Using the Constant Contact Ruby gem to add a contact

Highlighted
Visitor

Using the Constant Contact Ruby gem to add a contact

Hello,

 

I'm attempting to use the Constant Contact gem (here https://github.com/constantcontact/ruby-sdk ) to add a contact. However, I can't find anything that tells me how to go about doing this. I've tried looking through the gem itself, and attempting various methods to no avail. I have the gem setup in my app, I have an API key, and I can successfully get a list of contacts, but that functionality is completely useless to me. When I try to use the same object with the add_contact method (i.e. cc.add_contact(token, @contact, true)), I get a 400 Bad Request error. Is there anything posted anywhere that details simply how to add a contact? Such information would be greatly appreciated!

 

Thanks

2 REPLIES 2
Highlighted
Regular Advisor

Re: Using the Constant Contact Ruby gem to add a contact

Hello,

 

Thanks for posting.  Have you had a look at the example?  Inside the SDK is a small ruby app that makes a PUT or POST of a contact to a selected list.  It's located here:

 

https://github.com/constantcontact/ruby-sdk/tree/master/ContactFunctionalExample

 

The methods I'm referring to are in myapp.rb on lines 145 and 147.  I'm not sure if the gem had a method with three arguments for the add, the one in the example has only two.  I hope this helps.

 

Regards,

 

Andrew B.

Constant Contact

API Support

Highlighted
Visitor

Re: Using the Constant Contact Ruby gem to add a contact

Hi Andrew,

 

Thanks for the reply. I've been trying to use the same method as the one in the code posted. When I was looking at the code in the gem, the third parameter in the method is optional. It's for initiated by user, but in any case, I get the same result with and without the third parameter. This is what I'm trying: https://gist.github.com/willc0de4food/cdf0668e78c8777a3787

 

Thanks

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured