Class: ActsAsIcontact::Contact
- Defined in:
- lib/acts_as_icontact/resources/contact.rb
Class Method Summary collapse
-
.base ⇒ Object
Derived from clientFolder.
-
.default_options ⇒ Object
Defaults to status=total to return contacts on or off lists.
-
.required_on_create ⇒ Object
Email is required.
Instance Method Summary collapse
-
#lists ⇒ Object
Returns the lists to which this contact is subscribed (via the Subscription class).
-
#subscribe(list) ⇒ Object
Creates a new subscription for the contact to the specified list.
Methods inherited from Resource
#==, all, #connection, #error, #errors, find, find_by_id, first, #id, #initialize, #method_missing, #new_record?, #save, #save!
Constructor Details
This class inherits a constructor from ActsAsIcontact::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActsAsIcontact::Resource
Class Method Details
.base ⇒ Object
Derived from clientFolder
10 11 12 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 10 def self.base ActsAsIcontact.client end |
.default_options ⇒ Object
Defaults to status=total to return contacts on or off lists
15 16 17 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 15 def self. super.merge(:status=>:total) end |
.required_on_create ⇒ Object
Email is required
5 6 7 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 5 def self.required_on_create super << 'email' end |
Instance Method Details
#lists ⇒ Object
Returns the lists to which this contact is subscribed (via the Subscription class).
20 21 22 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 20 def lists @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id) end |
#subscribe(list) ⇒ Object
Creates a new subscription for the contact to the specified list
25 26 27 28 29 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 25 def subscribe(list) l = ActsAsIcontact::List.find(list) s = ActsAsIcontact::Subscription.new(:contactId => id, :listId => l.id) s.save end |