Sha256: fb1f2ae4139730f8d79e31ec4817ab927512a8ce47ff5a7e15c4c12b5e38a3bb

Contents?: true

Size: 974 Bytes

Versions: 63

Compression:

Stored size: 974 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
      cache_collection attributes, :comments
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
fb_graph-2.7.17 lib/fb_graph/link.rb
fb_graph-2.7.16 lib/fb_graph/link.rb
fb_graph-2.7.15 lib/fb_graph/link.rb
fb_graph-2.7.14 lib/fb_graph/link.rb
fb_graph-2.7.13 lib/fb_graph/link.rb
fb_graph-2.7.12 lib/fb_graph/link.rb
fb_graph-2.7.11 lib/fb_graph/link.rb
fb_graph-2.7.10 lib/fb_graph/link.rb
fb_graph-2.7.9 lib/fb_graph/link.rb
fb_graph-2.7.8 lib/fb_graph/link.rb
fb_graph-2.7.7 lib/fb_graph/link.rb
fb_graph-2.7.6 lib/fb_graph/link.rb
fb_graph-2.7.5 lib/fb_graph/link.rb
fb_graph-2.7.4 lib/fb_graph/link.rb
fb_graph-2.7.3 lib/fb_graph/link.rb
fb_graph-2.7.2 lib/fb_graph/link.rb
fb_graph-2.7.1 lib/fb_graph/link.rb
fb_graph-2.7.0 lib/fb_graph/link.rb
fb_graph-2.6.7 lib/fb_graph/link.rb
fb_graph-2.6.6 lib/fb_graph/link.rb