Class: GetResponse::Message
- Inherits:
-
Object
- Object
- GetResponse::Message
- Defined in:
- lib/get_response/message.rb
Overview
Class representa a message in GetResponse
Direct Known Subclasses
Instance Attribute Summary collapse
-
#created_on ⇒ Object
readonly
Returns the value of attribute created_on.
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#contents ⇒ Object
Content of message.
-
#initialize(params, connection) ⇒ Message
constructor
A new instance of Message.
-
#links ⇒ Array
Fetch links embedded in this message.
-
#stats ⇒ Object
Stats of message.
Constructor Details
#initialize(params, connection) ⇒ Message
Returns a new instance of Message.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/get_response/message.rb', line 7 def initialize(params, connection) @id = params["id"] @type = params["type"] @subject = params["subject"] @day_of_cycle = params["day_of_cycle"] @flags = params["flags"] || [] @created_on = params["created_on"] @connection = connection @campaign_id = params["campaign_id"] @contents = params["contents"] end |
Instance Attribute Details
#created_on ⇒ Object (readonly)
Returns the value of attribute created_on.
5 6 7 |
# File 'lib/get_response/message.rb', line 5 def created_on @created_on end |
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
5 6 7 |
# File 'lib/get_response/message.rb', line 5 def flags @flags end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/get_response/message.rb', line 5 def id @id end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
5 6 7 |
# File 'lib/get_response/message.rb', line 5 def subject @subject end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/get_response/message.rb', line 5 def type @type end |
Instance Method Details
#contents ⇒ Object
Content of message. Every message has two kinds of content: plain and html. Method returns Hash
instance with keys "plain"
and "html"
.
- returns
-
Hash
24 25 26 27 |
# File 'lib/get_response/message.rb', line 24 def contents resp = @connection.send_request("get_message_contents", :message => @id) resp["result"] end |
#links ⇒ Array
Fetch links embedded in this message
43 44 45 |
# File 'lib/get_response/message.rb', line 43 def links @connection.links.all("messages" => [@id]) end |
#stats ⇒ Object
Stats of message. Method returns Hash
instance where hey is a date and value is set of data.
- returns
-
Hash
34 35 36 37 |
# File 'lib/get_response/message.rb', line 34 def stats resp = @connection.send_request("get_message_stats", :message => @id) resp["result"] end |