Sha256: 3a668ae2fe653733d8fd95afa41993b390b2c846d98e170884d59113fb579b0a

Contents?: true

Size: 1023 Bytes

Versions: 2

Compression:

Stored size: 1023 Bytes

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
    
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
SFEley-acts_as_icontact-0.2.3 lib/acts_as_icontact/resources/list.rb
acts_as_icontact-0.2.3 lib/acts_as_icontact/resources/list.rb