Sha256: 003d3fe821943848b2a7050dac1e15a5dddfbf36e45e8f3e80f47e5a614381d1

Contents?: true

Size: 1.3 KB

Versions: 15

Compression:

Stored size: 1.3 KB

Contents

module FbGraph
  class Album < Node
    include Connections::Photos
    include Connections::Comments
    include Connections::Likes

    attr_accessor :from, :name, :description, :location, :link, :privacy, :count, :created_time, :updated_time, :type

    def initialize(identifier, attributes = {})
      super
      @from = if (from = attributes[:from])
        if from[:category]
          Page.new(from.delete(:id), from)
        else
          User.new(from.delete(:id), from)
        end
      end
      @name = attributes[:name]
      # NOTE:
      # for some reason, facebook uses different parameter names.
      # "description" in GET & "message" in POST
      # TODO:
      # check whether this issue is solved or not
      @description = attributes[:description] || attributes[:message]
      @location    = attributes[:location]
      @link        = attributes[:link]
      @privacy     = attributes[:privacy]
      @count       = attributes[:count]
      @type        = attributes[:type]
      
      @created_time = if attributes[:created_time]
        Time.parse(attributes[:created_time]).utc
      end
      @updated_time = if attributes[:updated_time]
        Time.parse(attributes[:updated_time]).utc
      end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fb_graph-1.8.0.alpha lib/fb_graph/album.rb
fb_graph-1.7.4 lib/fb_graph/album.rb
fb_graph-1.7.3 lib/fb_graph/album.rb
fb_graph-1.7.2 lib/fb_graph/album.rb
fb_graph-1.7.1 lib/fb_graph/album.rb
fb_graph-1.7.0 lib/fb_graph/album.rb
fb_graph-1.7.0.alpha2 lib/fb_graph/album.rb
fb_graph-1.6.9 lib/fb_graph/album.rb
fb_graph-1.7.0.alpha lib/fb_graph/album.rb
fb_graph-1.6.8 lib/fb_graph/album.rb
fb_graph-1.6.7 lib/fb_graph/album.rb
fb_graph-1.6.5 lib/fb_graph/album.rb
fb_graph-1.6.4 lib/fb_graph/album.rb
fb_graph-1.6.3 lib/fb_graph/album.rb
fb_graph-1.6.2 lib/fb_graph/album.rb