Class: FbGraph::Thread::BeforeTransition
- Inherits:
-
Node
- Object
- Node
- 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)
-
- (Object) from
Returns the value of attribute from.
-
- (Object) message
Returns the value of attribute message.
-
- (Object) subject
Returns the value of attribute subject.
-
- (Object) to
Returns the value of attribute to.
-
- (Object) unread
Returns the value of attribute unread.
-
- (Object) unseen
Returns the value of attribute unseen.
-
- (Object) updated_time
Returns the value of attribute updated_time.
Attributes inherited from Node
#access_token, #endpoint, #identifier, #raw_attributes
Instance Method Summary (collapse)
-
- (BeforeTransition) initialize(identifier, attributes = {})
constructor
A new instance of BeforeTransition.
-
- (Object) messages(options = {})
(also: #comments)
NOTE:.
Methods inherited from Node
#connection, #destroy, fetch, #fetch, #update
Methods included from Comparison
Constructor Details
- (BeforeTransition) initialize(identifier, attributes = {})
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
- (Object) from
Returns the value of attribute from
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def from @from end |
- (Object) message
Returns the value of attribute message
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def @message end |
- (Object) subject
Returns the value of attribute subject
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def subject @subject end |
- (Object) to
Returns the value of attribute to
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def to @to end |
- (Object) unread
Returns the value of attribute unread
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def unread @unread end |
- (Object) unseen
Returns the value of attribute unseen
29 30 31 |
# File 'lib/fb_graph/thread.rb', line 29 def unseen @unseen end |
- (Object) updated_time
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
- (Object) messages(options = {}) 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 |