Sha256: acb0ad1ed1e56acdd1fae55a9317ac8e3bc44c77e9307020ce3148cae1159271

Contents?: true

Size: 1009 Bytes

Versions: 5

Compression:

Stored size: 1009 Bytes

Contents

module FbGraph
  class Link < Node
    include Connections::Comments

    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]
          FbGraph::Page.new(from.delete(:id), from)
        else
          FbGraph::User.new(from.delete(: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_ = 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/link.rb
fb_graph-1.2.0 lib/fb_graph/link.rb
fb_graph-1.1.7 lib/fb_graph/link.rb
fb_graph-1.1.6 lib/fb_graph/link.rb
fb_graph-1.1.5 lib/fb_graph/link.rb