Sha256: 83011bb9e8e98f79acc40cc065cab25c5b49f03760e788588bcde7470a9af65a

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

module FbGraph
  class Message < Node
    # TODO:
    # include Connections::Attachments
    # include Connections::Shares

    attr_accessor :subject, :message, :from, :to, :tags, :created_time

    def initialize(identifier, attributes = {})
      super
      @subject = attributes[:subject]
      @message = attributes[:message]
      if (from = attributes[:from])
        @from = User.new(from[:id], from)
      end
      @to = []
      if attributes[:to]
        Collection.new(attributes[:to]).each do |to|
          @to << User.new(to[:id], to)
        end
      end
      @tags = []
      if attributes[:tags]
        Collection.new(attributes[:tags]).each do |tag|
          @tags << Tag.new(tag)
        end
      end
      if attributes[:created_time]
        @created_time = Time.parse(attributes[:created_time]).utc
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fb_graph-1.8.2 lib/fb_graph/message.rb
fb_graph-1.8.1 lib/fb_graph/message.rb