Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsubscribe example #61

Closed
eriktrautman opened this issue Oct 4, 2013 · 2 comments
Closed

Unsubscribe example #61

eriktrautman opened this issue Oct 4, 2013 · 2 comments

Comments

@eriktrautman
Copy link
Contributor

Minor, but it'd be useful to see an example in the readme of unsubscribing a single user with the gem. I couldn't find that listed anywhere but dug into the mailchimp API and took a flier and it worked. Let the people know it can be done! :)

(this is from within the User.rb model in a before_destroy callback, hence the "self")

def unsubscribe
mailchimp = Gibbon::API.new
result = mailchimp.lists.unsubscribe({
:id => ENV["MAILCHIMP_LIST_ID"],
:email => {:email => self.email},
:delete_member => true, # this is NOT the default value
:send_notify => true,
:send_goodbye => true
})
Rails.logger.info("Unsubscribed #{self.email} from MailChimp") if result
end

@amro
Copy link
Owner

amro commented Oct 4, 2013

Would you mind sending a PR with a simple example added to the readme? If not I'll do it when I can. Thanks!

@eriktrautman
Copy link
Contributor Author

PR sent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants