Class: VerticalResponse::API::Contact
- Defined in:
- lib/verticalresponse/api/contact.rb
Instance Attribute Summary
Attributes inherited from Client
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Contact
constructor
A new instance of Contact.
-
#lists(options = {}) ⇒ Object
Returns all the lists this contact belongs to.
-
#messages(options = {}) ⇒ Object
Returns all the messages targetted to the current contact.
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, base_service_uri, base_uri, base_uri_with_prefix, build_params, build_query_params, config, default_query_params, embed_resource, resource_uri, resource_uri_with_prefix, resource_uri_with_token
Constructor Details
#initialize(*args) ⇒ Contact
32 33 34 35 36 |
# File 'lib/verticalresponse/api/contact.rb', line 32 def initialize(*args) super @list_class = self.class.class_for_resource(List, id) = self.class.class_for_resource(Message, id) end |
Class Method Details
.fields(options = {}) ⇒ Object
20 21 22 |
# File 'lib/verticalresponse/api/contact.rb', line 20 def fields( = {}) Response.new get(resource_uri('fields'), build_query_params(), [:access_token]) end |
.find_by_email(options = {}) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/verticalresponse/api/contact.rb', line 24 def find_by_email( = {}) validate_supported_method!(:find) response = Response.new(get(resource_uri,build_query_params()), [:access_token]) object_collection(response, [:access_token]) end |
.resource_uri_suffix ⇒ Object
16 17 18 |
# File 'lib/verticalresponse/api/contact.rb', line 16 def resource_uri_suffix ['contacts'] end |
Instance Method Details
#lists(options = {}) ⇒ Object
Returns all the lists this contact belongs to
39 40 41 42 |
# File 'lib/verticalresponse/api/contact.rb', line 39 def lists( = {}) .merge!(access_token: @access_token) @list_class.all() end |
#messages(options = {}) ⇒ Object
Returns all the messages targetted to the current contact
45 46 47 48 |
# File 'lib/verticalresponse/api/contact.rb', line 45 def ( = {}) .merge!(access_token: @access_token) .all() end |