Class: Hashblue::API::Contact

Inherits:
Model
  • Object
show all
Defined in:
lib/hashblue/api/contact.rb

Overview

A Contact represents another number with which the Subscriber has sent or received Messages. It should not be instantiated directly; instead, use Subscriber#contacts to retrieve the set for a Subscriber.

Instance Method Summary collapse

Methods inherited from Model

from_json, #get, #id, #method_missing, model_name, #post, #to_param

Constructor Details

#initialize(attributes) ⇒ Contact

:nodoc:



7
8
9
10
# File 'lib/hashblue/api/contact.rb', line 7

def initialize(attributes)
  super
  @attributes["latest_message"] = Hashblue::API::Message.new(@attributes["latest_message"]) if @attributes["latest_message"]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hashblue::API::Model

Instance Method Details

#messages(options = {}) ⇒ Object

Returns an Array of Message objects corresponding to the conversation between the Subscriber and this Contact.

The options available to this message correspond to those available for the collections on Subscriber.



17
18
19
# File 'lib/hashblue/api/contact.rb', line 17

def messages(options={})
  Hashblue::API::Message.from_json(get("#{_path}/messages.json", options))
end