Sha256: 1f305a81cf22bb41b4073a4d0596bf16b6f17a23b80878381b6ba5d0ac27b010

Contents?: true

Size: 816 Bytes

Versions: 4

Compression:

Stored size: 816 Bytes

Contents

module ActsAsIcontact
  class Contact < Resource
    
    # Email is required
    def self.required_on_create
      super << 'email'
    end
    
    # Derived from clientFolder
    def self.base
      ActsAsIcontact.client
    end
    
    # Defaults to status=total to return contacts on or off lists
    def self.default_options
      super.merge(:status=>:total)
    end
   
    # Returns the lists to which this contact is subscribed (via the Subscription class).
    def lists
      @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id)
    end
    
    # Creates a new subscription for the contact to the specified list
    def subscribe(list)
      l = ActsAsIcontact::List.find(list)
      s = ActsAsIcontact::Subscription.new(:contactId => id, :listId => l.id)
      s.save
    end
    
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
SFEley-acts_as_icontact-0.2.4 lib/acts_as_icontact/resources/contact.rb
SFEley-acts_as_icontact-0.3.0 lib/acts_as_icontact/resources/contact.rb
acts_as_icontact-0.2.4 lib/acts_as_icontact/resources/contact.rb
acts_as_icontact-0.3.0 lib/acts_as_icontact/resources/contact.rb