class FBScrape::Message

Attributes

conversation_id[RW]
created_at[RW]
from_id[RW]
from_name[RW]
id[RW]
reply_id[RW]
text[RW]
to_id[RW]
to_name[RW]

Public Class Methods

new(payload, conversation_id, page_id=nil) click to toggle source
# 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

Public Instance Methods

is_incoming?() click to toggle source
# File lib/fb_scrape/message.rb, line 19
def is_incoming?
  @to_id == @page_id
end
is_reply?() click to toggle source
# File lib/fb_scrape/message.rb, line 23
def is_reply?
  !is_incoming?
end