Sha256: a1da42ae3737255b67da8c9281156a82f4a314d64fc1a8acfdaad30ffb16fa7d

Contents?: true

Size: 987 Bytes

Versions: 4

Compression:

Stored size: 987 Bytes

Contents

module FbGraph
  class Link < Node
    include Connections::Comments
    include Connections::Likes
    include Connections::Likes::Likable

    attr_accessor :from, :link, :name, :description, :icon, :picture, :message, :created_time

    def initialize(identifier, attributes = {})
      super
      if (from = attributes[:from])
        @from = if from[:category]
          Page.new(from[:id], from)
        else
          User.new(from[:id], from)
        end
      end
      @name        = attributes[:name]
      @link        = attributes[:link]
      @description = attributes[:description]
      @icon        = attributes[:icon]
      @picture     = attributes[:picture] # NOTE: this is external image, so isn't connection.
      @message     = attributes[:message]
      if attributes[:created_time]
        @created_time = Time.parse(attributes[:created_time]).utc
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fb_graph-2.2.2 lib/fb_graph/link.rb
fb_graph-2.2.1 lib/fb_graph/link.rb
fb_graph-2.2.0 lib/fb_graph/link.rb
fb_graph-2.2.0.beta lib/fb_graph/link.rb