Last active
August 29, 2015 14:00
-
-
Save itstommymorgan/db8573adee6fb3ae81de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def on_unsubscribe(incoming) | |
@payload = incoming.payload | |
# puts fired_at | |
# puts action | |
# puts reason | |
# puts id | |
# puts list_id | |
# puts email | |
# puts email_type | |
# puts payload_with_email | |
# puts payload_with_fname | |
# puts payload_with_lname | |
# puts payload_with_interests | |
# puts ip_opt | |
# puts campaign_id | |
puts reason | |
user = User.find_by_email(email) | |
binding.pry | |
if user and user.notification_preferences | |
user.notification_preferences.update_attributes(newsletter: false) | |
end | |
end | |
def fired_at | |
@payload.fired_at | |
end | |
def action | |
@payload.data.action | |
end | |
# etc... | |
def payload_with_interests | |
@payload.data.merges.INTERESTS | |
end | |
def payload_with_LNAME | |
@payload.data.merges.LNAME | |
end | |
# etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment