Class: ActsAsIcontact::Contact
- Defined in:
- lib/acts_as_icontact/resources/contact.rb
Class Method Summary collapse
-
.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
-
#history(options = {}) ⇒ Object
Returns a collection of ContactHistory resources for this contact.
-
#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, #inspect, #method_missing, #new_record?, #property_names, #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
.default_options ⇒ Object
Defaults to status=total to return contacts on or off lists
10 11 12 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 10 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
#history(options = {}) ⇒ Object
Returns a collection of ContactHistory resources for this contact. The usual iContact search options (limit, offset, search terms, etc.) can be passed.
27 28 29 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 27 def history(={}) @history ||= ActsAsIcontact::ContactHistory.scoped_find(self, ) end |
#lists ⇒ Object
Returns the lists to which this contact is subscribed (via the Subscription class).
15 16 17 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 15 def lists @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id) end |
#subscribe(list) ⇒ Object
Creates a new subscription for the contact to the specified list
20 21 22 23 24 |
# File 'lib/acts_as_icontact/resources/contact.rb', line 20 def subscribe(list) l = ActsAsIcontact::List.find(list) s = ActsAsIcontact::Subscription.new(:contactId => id, :listId => l.id) s.save end |