Class: VerticalResponse::API::Message
- Defined in:
- lib/verticalresponse/api/message.rb
Instance Attribute Summary
Attributes inherited from Client
Class Method Summary collapse
-
.object_collection(response) ⇒ Object
Overwritting this method from the parent class since we want to return object instances depending on the message type.
-
.resource_uri_suffix ⇒ Object
Base URI for the Message resource.
Methods inherited from Resource
all, class_for_resource, class_name, create, #delete, exclude_methods, find, #id, id_attribute_name, id_regexp, 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, #initialize, resource_uri, resource_uri_with_prefix, resource_uri_with_token
Constructor Details
This class inherits a constructor from VerticalResponse::API::Client
Class Method Details
.object_collection(response) ⇒ Object
Overwritting this method from the parent class since we want to return object instances depending on the message type
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/verticalresponse/api/message.rb', line 23 def object_collection(response) response.handle_collection do |response_item| = self if response_item.attributes && response_item.attributes.has_key?('message_type') type = response_item.attributes['message_type'].downcase.gsub(' ', '_') if type == Email::MESSAGE_TYPE = Email elsif type == SocialPost::MESSAGE_TYPE = SocialPost end end .new(response_item, access_token) end end |
.resource_uri_suffix ⇒ Object
Base URI for the Message resource
17 18 19 |
# File 'lib/verticalresponse/api/message.rb', line 17 def resource_uri_suffix ['messages'] end |