Sha256: bcf3ed22a9169368586870a7365e53b5530b099283fe0ce9b2555e268b129bba

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

class FBScrape::Message
  attr_accessor :id, :created_at, :from_name, :from_id, :text, :reply_id, :to_id, :to_name


  def initialize(payload, page_id=nil)
    @page_id = page_id
    
    @id = payload['id']
    @text = payload['message']
    @created_at = 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

  def is_incoming?
    @to_id == @page_id
  end

  def is_reply?
    !is_incoming?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fb_scrape-0.0.7 lib/fb_scrape/message.rb