Class: GSGraph::Message
- Includes:
- Connections::Tags
- Defined in:
- lib/gs_graph/message.rb
Instance Attribute Summary collapse
-
#created_time ⇒ Object
Returns the value of attribute created_time.
-
#from ⇒ Object
Returns the value of attribute from.
-
#message ⇒ Object
Returns the value of attribute message.
-
#to ⇒ Object
Returns the value of attribute to.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary collapse
-
#initialize(identifier, attributes = {}) ⇒ Message
constructor
A new instance of Message.
Methods included from Connections::Tags
Methods inherited from Node
#connection, #destroy, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ Message
Returns a new instance of Message.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gs_graph/message.rb', line 10 def initialize(identifier, attributes = {}) super @message = attributes[:message] if (from = attributes[:from]) @from = User.new(from[:id], from) end @to = [] if attributes[:to] Collection.new(attributes[:to]).each do |to| @to << User.new(to[:id], to) end end if attributes[:created_time] @created_time = Time.parse(attributes[:created_time]).utc end # cached connection cache_collection attributes, :tags end |
Instance Attribute Details
#created_time ⇒ Object
Returns the value of attribute created_time.
8 9 10 |
# File 'lib/gs_graph/message.rb', line 8 def created_time @created_time end |
#from ⇒ Object
Returns the value of attribute from.
8 9 10 |
# File 'lib/gs_graph/message.rb', line 8 def from @from end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/gs_graph/message.rb', line 8 def @message end |
#to ⇒ Object
Returns the value of attribute to.
8 9 10 |
# File 'lib/gs_graph/message.rb', line 8 def to @to end |