Sha256: 68e3dfdbd16255f9444b8c1564f677ccc0f5bb0ee86f60b84f154cf6c379e6da

Contents?: true

Size: 1.3 KB

Versions: 67

Compression:

Stored size: 1.3 KB

Contents

module FbGraph
  class Checkin < Node
    include Connections::Comments
    include Connections::Likes
    include Connections::Likes::Likable
    extend Searchable

    attr_accessor :from, :tags, :place, :message, :application, :created_time

    def initialize(identifier, attributes = {})
      super
      if (from = attributes[:from])
        @from = User.new(from[:id], from)
      end
      @tags = []
      if (tags = attributes[:tags])
        case tags
        when Hash
          Collection.new(tags).each do |user|
            @tags << User.new(user[:id], user)
          end
        when String, Array
          Array(tags).each do |user_id|
            @tags << User.new(user_id)
          end
        end
      end
      if (place = attributes[:place])
        @place = case place
        when Place
          place
        when String, Integer
          Place.new(place)
        when Hash
          Place.new(place[:id], place)
        end
      end
      @message = attributes[:message]
      if (application = attributes[:application])
        @application = Application.new(application[:id], application)
      end
      if (created_time = attributes[:created_time])
        @created_time = Time.parse(created_time).utc
      end
    end

    def self.search(options = {})
      super(nil, options)
    end
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

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