Sha256: 140f6e281583bc724aa189d2129740e86a8b5e7eaaff599931f7c1b233d686fe
Contents?: true
Size: 1.24 KB
Versions: 4
Compression:
Stored size: 1.24 KB
Contents
module ActsAsIcontact class List < Resource # Derives from clientFolder. def self.base ActsAsIcontact.client end # Searches on list name. def self.find_by_string(value) first(:name => value) end # Requires name, emailOwnerOnChange, welcomeOnManualAdd, welcomeOnSignupAdd, and welcomeMessageId. def self.required_on_create super << "name" << "emailOwnerOnChange" << "welcomeOnManualAdd" << "welcomeOnSignupAdd" << "welcomeMessageId" end def self.boolean_fields super << "emailOwnerOnChange" << "welcomeOnManualAdd" << "welcomeOnSignupAdd" end # The welcome message pointed to by the welcomeMessageId. def welcomeMessage return nil unless welcomeMessageId ActsAsIcontact::Message.find(welcomeMessageId) end # Returns the contacts subscribed to this list (via the Subscription class). def subscribers @subscribers ||= ActsAsIcontact::Subscription.contacts(:listId => id) end # Creates a new subscription for the specified list by the contact def subscribe(contact) c = ActsAsIcontact::Contact.find(contact) s = ActsAsIcontact::Subscription.new(:contactId => c.id, :listId => id) s.save end end end
Version data entries
4 entries across 4 versions & 2 rubygems