Sha256: 4e3ae5c5e0392d1e3112629f381f1b96842996addd94489c21764d27f3390170

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

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

    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

      # cached connection
      @_tags_ = Collection.new(attributes[:tags])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fb_graph-1.8.6 lib/fb_graph/message.rb
fb_graph-1.8.5 lib/fb_graph/message.rb
fb_graph-1.8.4 lib/fb_graph/message.rb
fb_graph-1.8.3 lib/fb_graph/message.rb