Class: VerticalResponse::API::List
- Defined in:
- lib/list.rb
Instance Attribute Summary
Attributes inherited from Client
Class Method Summary collapse
-
.base_uri(*args) ⇒ Object
Base URI for the List resource.
Instance Method Summary collapse
-
#contacts(options = {}) ⇒ Object
Returns all the contacts that belong to the list.
-
#create_contact(params) ⇒ Object
Creates a contact for the list with the parameters provided.
-
#create_contacts(params) ⇒ Object
Creates contacts in batch for the list with the parameters provided.
-
#delete_contact(contact) ⇒ Object
Deletes a contact from the list.
-
#delete_contacts(contact_emails) ⇒ Object
Deletes contacts in batch from the list.
- #find_contact(contact_id, options = {}) ⇒ Object
-
#initialize(*args) ⇒ List
constructor
A new instance of List.
-
#messages(options = {}) ⇒ Object
Returns all the messages targetted to the current list.
Methods inherited from Resource
all, class_for_resource, class_name, create, #delete, exclude_methods, find, #id, id_attribute_name, id_regexp, object_collection, resource_id_from_url, resource_name, #stats, #update, #url, validate_supported_method!
Methods inherited from Client
add_default_query_param, assign_headers, build_params, build_query_params, config, default_query_params, embed_resource, resource_uri
Constructor Details
Class Method Details
.base_uri(*args) ⇒ Object
Base URI for the List resource
16 17 18 |
# File 'lib/list.rb', line 16 def base_uri(*args) @base_uri ||= File.join(super.to_s, 'lists') end |
Instance Method Details
#contacts(options = {}) ⇒ Object
Returns all the contacts that belong to the list
33 34 35 |
# File 'lib/list.rb', line 33 def contacts( = {}) @contact_class.all() end |
#create_contact(params) ⇒ Object
Creates a contact for the list with the parameters provided
42 43 44 |
# File 'lib/list.rb', line 42 def create_contact(params) @contact_class.create(params) end |
#create_contacts(params) ⇒ Object
Creates contacts in batch for the list with the parameters provided
47 48 49 50 |
# File 'lib/list.rb', line 47 def create_contacts(params) params = { :contacts => params } if params.is_a?(Array) @contact_class.create(params) end |
#delete_contact(contact) ⇒ Object
Deletes a contact from the list
53 54 55 56 57 58 |
# File 'lib/list.rb', line 53 def delete_contact(contact) # Make a copy of the original contact but embedding the request # within the list resource contact_to_delete = @contact_class.new(contact.response) contact_to_delete.delete end |
#delete_contacts(contact_emails) ⇒ Object
Deletes contacts in batch from the list
61 62 63 64 65 66 |
# File 'lib/list.rb', line 61 def delete_contacts(contact_emails) Response.new @contact_class.delete( @contact_class.resource_uri, self.class.build_params({ :contacts => contact_emails }) ) end |
#find_contact(contact_id, options = {}) ⇒ Object
37 38 39 |
# File 'lib/list.rb', line 37 def find_contact(contact_id, = {}) @contact_class.find(contact_id, ) end |
#messages(options = {}) ⇒ Object
Returns all the messages targetted to the current list
28 29 30 |
# File 'lib/list.rb', line 28 def ( = {}) @message_class.all() end |