Sha256: 285c30c20f993f19bd673032c1483647ad772ac444ecfb8364b02149c2464120
Contents?: true
Size: 841 Bytes
Versions: 15
Compression:
Stored size: 841 Bytes
Contents
class UserObserver < ActiveRecord::Observer def after_create(user) return unless gibbon = mailchimp(user) gibbon.list_subscribe({:id=>Preference.get_cached(user.system_id, "mailchimp_all_user_list"), :email_address=>user.email, :double_optin=>false}) Activity.add(user.system_id, "Subscribed '#{user.email}'", 0, "Mailchimp") end def before_delete(user) return unless gibbon = mailchimp(user) gibbon.list_unsubscribe({:id=>Preference.get_cached(user.system_id, "mailchimp_all_user_list"), :email_address=>user.email, :delete_member=>true}) Activity.add(user.system_id, "Deleted '#{user.email}'", 0, "Mailchimp") end def before_save(user) end def mailchimp(user) key = Preference.get_cached(user.system_id, "mailchimp_api_key") return nil unless key return Gibbon.new(key) end end
Version data entries
15 entries across 15 versions & 1 rubygems