Sha256: f7a410cfbd8d1af95f706d7fe3a45e836d5fc8810932af7c1e82e39c8aa36b7a

Contents?: true

Size: 1.2 KB

Versions: 29

Compression:

Stored size: 1.2 KB

Contents

module FbGraph
  class Checkin < Node
    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

29 entries across 29 versions & 1 rubygems

Version Path
fb_graph-2.1.11 lib/fb_graph/checkin.rb
fb_graph-2.1.10 lib/fb_graph/checkin.rb
fb_graph-2.1.9 lib/fb_graph/checkin.rb
fb_graph-2.1.8 lib/fb_graph/checkin.rb
fb_graph-2.1.7 lib/fb_graph/checkin.rb
fb_graph-2.1.6 lib/fb_graph/checkin.rb
fb_graph-2.1.5 lib/fb_graph/checkin.rb
fb_graph-2.1.4 lib/fb_graph/checkin.rb
fb_graph-2.1.3 lib/fb_graph/checkin.rb
fb_graph-2.1.2 lib/fb_graph/checkin.rb
fb_graph-2.1.1 lib/fb_graph/checkin.rb
fb_graph-2.1.0 lib/fb_graph/checkin.rb
fb_graph-2.1.0.alpha lib/fb_graph/checkin.rb
fb_graph-2.0.2 lib/fb_graph/checkin.rb
fb_graph-2.0.1 lib/fb_graph/checkin.rb
fb_graph-2.0.0 lib/fb_graph/checkin.rb
fb_graph-2.0.0.beta lib/fb_graph/checkin.rb
fb_graph-2.0.0.alpha lib/fb_graph/checkin.rb
fb_graph-1.9.5 lib/fb_graph/checkin.rb
fb_graph-1.9.4 lib/fb_graph/checkin.rb