Class: FbGraph::Thread::BeforeTransition
- Defined in:
- lib/fb_graph/thread.rb
Overview
NOTE:
Facebook is under transision of their message platform.
This is current thread model in Graph API.
In near future, this will be replaced with FbGraph::Thread model.
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#message ⇒ Object
Returns the value of attribute message.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
-
#unread ⇒ Object
Returns the value of attribute unread.
-
#unseen ⇒ Object
Returns the value of attribute unseen.
-
#updated_time ⇒ Object
Returns the value of attribute updated_time.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary collapse
-
#initialize(identifier, attributes = {}) ⇒ BeforeTransition
constructor
A new instance of BeforeTransition.
-
#messages(options = {}) ⇒ Object
(also: #comments)
NOTE: This is a connection named “comments” but returns “messages” and different from normal “comments” connection.
Methods inherited from Node
#connection, #destroy, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
#initialize(identifier, attributes = {}) ⇒ BeforeTransition
Returns a new instance of BeforeTransition.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fb_graph/thread.rb', line 31 def initialize(identifier, attributes = {}) super @subject = attributes[:subject] @message = attributes[:message] if (from = attributes[:from]) @from = if from[:start_time] Event.new(from[:id], from) else User.new(from[:id], from) end end @to = [] Collection.new(attributes[:to]).each do |to| @to << User.new(to[:id], to) end if attributes[:updated_time] @created_time = Time.parse(attributes[:updated_time]).utc end @unread = attributes[:unread] == 1 @unseen = attributes[:unseen] == 1 # cached connection cache_collection attributes, :comments end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def from @from end |
#message ⇒ Object
Returns the value of attribute message.
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def @message end |
#subject ⇒ Object
Returns the value of attribute subject.
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def to @to end |
#unread ⇒ Object
Returns the value of attribute unread.
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def unread @unread end |
#unseen ⇒ Object
Returns the value of attribute unseen.
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def unseen @unseen end |
#updated_time ⇒ Object
Returns the value of attribute updated_time.
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def updated_time @updated_time end |
Instance Method Details
#messages(options = {}) ⇒ Object Also known as: comments
NOTE:
This is a connection named "comments" but returns "messages" and different from normal "comments" connection.
Therefore I put this connection here not under FbGraph::Connections.
59 60 61 62 63 64 65 66 |
# File 'lib/fb_graph/thread.rb', line 59 def ( = {}) = self.connection(:comments, ) .map! do || Message.new([:id], .merge( :access_token => [:access_token] || self.access_token )) end end |