Subscriber.update not working?

Trying to do a subscriber updated as given by an example from the ruby gem
@subscriber.update new_email, "Subscriber", custom_fields, true

Every time I get an arguments error (4 for 1)

Then I tried
custom_fields = [ { :Key => 'url', :Value => 'http://site.com/' + self.url } ]
body = {:EmailAddress => self.email, :Name=> self.name, :CustomFields => custom_fields}
subscriber.update body

And that gives no error but the value is not updated. Any hints?

This in rails by the way.

jamesd jamesd, 5 years ago

I'm going to assume you're using the latest version of the createsend gem.

If you're looking at the subscriber tests, you will see that the @subscriber is created in the context block:

@subscriber = CreateSend::Subscriber.new "your list id", "subscriber@example.com"

So, you need to create your subscriber object with the existing email address (as a subscriber is identified by the list ID and email address combination), and then call update on that subscriber:

@subscriber.update "updated@example.com", "Subscriber", [], true

If the call above produced an arguments error, the tests would not be passing. And they are passing (run rake test to check).

Join 150,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098