Sha256: 79ff0cf3a7b323a948cad781512e5a7a0d56fe9ad93ce58207eba2f12d1cc560

Contents?: true

Size: 999 Bytes

Versions: 6

Compression:

Stored size: 999 Bytes

Contents

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

    attr_accessor :from, :link, :name, :caption, :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]
      @caption     = attributes[:caption]
      @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

6 entries across 6 versions & 1 rubygems

Version Path
fb_graph-1.8.6 lib/fb_graph/link.rb
fb_graph-1.8.5 lib/fb_graph/link.rb
fb_graph-1.8.4 lib/fb_graph/link.rb
fb_graph-1.8.3 lib/fb_graph/link.rb
fb_graph-1.8.2 lib/fb_graph/link.rb
fb_graph-1.8.1 lib/fb_graph/link.rb