Class: FBScrape::Message
- Inherits:
-
Object
- Object
- FBScrape::Message
- Defined in:
- lib/fb_scrape/message.rb
Instance Attribute Summary collapse
-
#conversation_id ⇒ Object
Returns the value of attribute conversation_id.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#from_id ⇒ Object
Returns the value of attribute from_id.
-
#from_name ⇒ Object
Returns the value of attribute from_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#reply_id ⇒ Object
Returns the value of attribute reply_id.
-
#text ⇒ Object
Returns the value of attribute text.
-
#to_id ⇒ Object
Returns the value of attribute to_id.
-
#to_name ⇒ Object
Returns the value of attribute to_name.
Instance Method Summary collapse
-
#initialize(payload, conversation_id, page_id = nil) ⇒ Message
constructor
A new instance of Message.
- #is_incoming? ⇒ Boolean
- #is_reply? ⇒ Boolean
Constructor Details
#initialize(payload, conversation_id, page_id = nil) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/fb_scrape/message.rb', line 5 def initialize(payload, conversation_id, page_id=nil) @page_id = page_id @conversation_id = conversation_id @id = payload['id'] @text = payload['message'] @created_at = DateTime.strptime payload['created_time'] if payload['created_time'] @from_id = payload['from']['id'] @from_name = payload['from']['name'] @to_id = payload['to']['data'].first['id'] @to_name = payload['to']['data'].first['name'] end |
Instance Attribute Details
#conversation_id ⇒ Object
Returns the value of attribute conversation_id.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def conversation_id @conversation_id end |
#created_at ⇒ Object
Returns the value of attribute created_at.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def created_at @created_at end |
#from_id ⇒ Object
Returns the value of attribute from_id.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def from_id @from_id end |
#from_name ⇒ Object
Returns the value of attribute from_name.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def from_name @from_name end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def id @id end |
#reply_id ⇒ Object
Returns the value of attribute reply_id.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def reply_id @reply_id end |
#text ⇒ Object
Returns the value of attribute text.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def text @text end |
#to_id ⇒ Object
Returns the value of attribute to_id.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def to_id @to_id end |
#to_name ⇒ Object
Returns the value of attribute to_name.
2 3 4 |
# File 'lib/fb_scrape/message.rb', line 2 def to_name @to_name end |
Instance Method Details
#is_incoming? ⇒ Boolean
19 20 21 |
# File 'lib/fb_scrape/message.rb', line 19 def is_incoming? @to_id == @page_id end |
#is_reply? ⇒ Boolean
23 24 25 |
# File 'lib/fb_scrape/message.rb', line 23 def is_reply? !is_incoming? end |