Sha256: 0cfaa5511f98e376b90f2e9f177a57b5fffd0ba4386ed2e4110988d73674e33c

Contents?: true

Size: 894 Bytes

Versions: 5

Compression:

Stored size: 894 Bytes

Contents

module FbGraph
  class Note < Node
    include Connections::Comments
    include Connections::Likes

    attr_accessor :from, :subject, :message, :created_time, :updated_time, :icon

    def initialize(identifier, attributes = {})
      super
      if (from = attributes[:from])
        @from = if from[:category]
          FbGraph::Page.new(from.delete(:id), from)
        else
          FbGraph::User.new(from.delete(:id), from)
        end
      end
      @subject = attributes[:subject]
      @message = attributes[:message]
      if attributes[:created_time]
        @created_time = Time.parse(attributes[:created_time]).utc
      end
      if attributes[:updated_time]
        @updated_time = Time.parse(attributes[:updated_time]).utc
      end
      @icon = attributes[:icon]

      # cached connection
      @_comments_ = FbGraph::Collection.new(attributes[:comments])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fb_graph-1.2.1 lib/fb_graph/note.rb
fb_graph-1.2.0 lib/fb_graph/note.rb
fb_graph-1.1.7 lib/fb_graph/note.rb
fb_graph-1.1.6 lib/fb_graph/note.rb
fb_graph-1.1.5 lib/fb_graph/note.rb