cancel
Showing results for 
Search instead for 
Did you mean: 
Some customers are unable to login to their accounts. We are aware of this issue and working to resolve it as quickly as possible. Thank you for your patience.

CC ruby gem for Rails 3.1?

Developer

CC ruby gem for Rails 3.1?

I've been using the CC gem for a while, and recently upgraded from rails 2.3 to 3.1 The CC gem no longer works, giving:

 

undefined method `collect!' for #<Net::HTTPOK 200 OK readbody=true> undefined method `collect!' for #<Net::HTTPOK 200 OK readbody=true> /usr/lib/ruby/gems/1.8/gems/activeresource-3.1.0/lib/active_resource/base.rb:922:in `instantiate_collection'/usr/lib/ruby/gems/1.8/gems/constant_contact-1.1.4/lib/constant_contact/base.rb

 

but I cannot get a newer CC 'cos when I try it complains about Rails 3.1 needing a newer "builder" than CC allows.

 

Does anybody have this working?

 

     

8 REPLIES 8
CTCT Employee

Re: CC ruby gem for Rails 3.1?

Hey,

 

There are two different gems right now on rubyforge for Constant Contact.  I have yet to use them as they are 3rd party source.  I believe the one you are looking for would be listed under

 

$ gem search --remote constant

 Should return 2 different constant contact gems.  One will give you the error that you are explaining and the other will install fine.  If you have any issues let me know and I will try to implement it as well.

Ryan Davis
Quality Engineer
Developer

Re: CC ruby gem for Rails 3.1?

Thanks for that.

 

Looking into that, the two gems seem to have completely different interfaces, so I'd have to re-write what I've done to benefit from the installable one. From what I read in the github forks I am not confident it'll work robustly.

 

FWIIW: I've been on the fence w.r.t CC integration anyway (ever since a spammer pumped accounts into my system and my integration ran up my CC costs) so I might just remove this integration from my system.

 

Thanks for your time.

Occasional Contributor

Re: CC ruby gem for Rails 3.1?

Not sure if you're still wondering/thinking about this, but the problem was a change in the ActiveResource gem introduced in the upgrade to Rails 3.1. My organization maintains a fork of the gem used in a Rails 3.1 production environment at https://github.com/wishery/constant_contact, feel free to use that if you want. 

Occasional Participant

Re: CC ruby gem for Rails 3.1?

Hi CooperM,

 

I took a look at your repo for your fork. It doesn't appear to work in my Rails 3.2.1 project. I see you mentioned it worked in 3.1 - have you guys looked into upgrading to Rails 3.2 yet?

 

Thanks,

Kev

Highlighted
Occasional Contributor

Re: CC ruby gem for Rails 3.1?

We haven't, but likely will in the near future. Any idea why it doesn't work? Was there a breaking change in ActiveResource (again) ;) ?

Occasional Participant

Re: CC ruby gem for Rails 3.1?

Hey Cooper,

 

After a bit more research, I realized the master branch at https://github.com/wishery/constant_contact wasn't what I needed. Instead, I grabbed the oauth branch since it looked like several updates have been made there recently.

 

using bundler...

gem "constant_contact", :git => 'git://github.com/wishery/constant_contact.git', :branch => 'oauth'

 

Appears to be working great now. Thanks!

 

Kev

Frequent Visitor

Re: CC ruby gem for Rails 3.1?

Did you get it working with OAuth or are you using basic authentication?  I can get the OAuth integration to work.  I get outh_access_token_key not defined.  The code doesn't seem to get the access_token before making a call to create a connection.  I'm assuming you don't hard code those values because all you get is an api key and secret, which is to be used for the consumer.

 

Anyone know how to get OAuth working in Rails 3.2?

 

Occasional Participant

Re: CC ruby gem for Rails 3.1?

Hey Derek,

 

I got it working using just basic auth. Specifically just setting these fields:

 

ConstantContact::Base.user
ConstantContact::Base.api_key
ConstantContact::Base.password 

 

I haven't tried using Oauth, unfortunately!

 

Kev