Wednesday, 11 September 2013

Translate code snippet to RUBY

Translate code snippet to RUBY

I received the following code from a development team:
curl -u EMAILADDRESS:PASSWORD -d "sender=NAME
<EMAILADDRESS>&message=[Invite Link]&collector=COLLECTOR&subject=Test
Invite&footer=My Custom Text [Unsubscription Link]"
I have been told that the above works fine. This is what I translated it
to in Ruby 1.9.3, using the httparty gem:
call= "/api/v2/emails/?survey=#{i}"
puts collector_final_id
url= HTTParty.post("https://www.fluidsurveys.com#{call}",
:basic_auth => auth,
:headers => { 'Content-Type' =>
'application/x-www-form-urlencoded','Accept' =>
'application/x-www-form-urlencoded' },
:collector => collector,
:body => {
"subject" => "Test Invite",
"sender" => "NAME <EMAILADDRESS>",
"message" => "[Invite Link]"
}
:footer => "My Custom Text [Unsubscription Link]"
)
Everything within this works fine except for the :footer and :collector
parameters. It doesn't seem to recognize them at all. There are no errors
thrown, they just aren't included in the actual email I am sending. What
am I doing wrong when passing in those two parameters?

No comments:

Post a Comment