Sha256: 58a750910abd206dc84f63d2b8a0a9fc73f393f8ae28d188c1fdfd18510e8198

Contents?: true

Size: 1.32 KB

Versions: 19

Compression:

Stored size: 1.32 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.delete(:id), from)
      end
      @tags = []
      if (tags = attributes[:tags])
        Collection.new(tags).each do |user|
          @tags << User.new(user.delete(:id), user)
        end
      end
      if (place = attributes[:place])
        @place = case place
        when Place
          place
        when String, Integer
          Place.new(place)
        when Hash
          Place.new(place.delete(:id), place)
        end
      end
      @message = attributes[:message]
      if (application = attributes[:application])
        @application = Application.new(application.delete(:id), application)
      end
      if (created_time = attributes.delete(:created_time))
        @created_time = Time.parse(created_time).utc
      end
    end

    # == Search for recent check-ins for an authorized user and his or her friends:
    # 
    #   FbGraph::Checkin.search(:access_token => ACCESS_TOKEN)
    #   # => Array of FbGraph::Checkin
    def self.search(options = {})
      # NOTE:
      # checkin search doesn't support "q=***" parameter
      super(nil, options)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
fb_graph-1.6.1 lib/fb_graph/checkin.rb
fb_graph-1.6.0 lib/fb_graph/checkin.rb
fb_graph-1.5.5 lib/fb_graph/checkin.rb
fb_graph-1.5.4 lib/fb_graph/checkin.rb
fb_graph-1.5.3 lib/fb_graph/checkin.rb
fb_graph-1.5.2 lib/fb_graph/checkin.rb
fb_graph-1.5.1 lib/fb_graph/checkin.rb
fb_graph-1.5.0 lib/fb_graph/checkin.rb
fb_graph-1.4.1 lib/fb_graph/checkin.rb
fb_graph-1.4.0 lib/fb_graph/checkin.rb
fb_graph-1.3.9 lib/fb_graph/checkin.rb
fb_graph-1.3.8 lib/fb_graph/checkin.rb
fb_graph-1.3.7 lib/fb_graph/checkin.rb
fb_graph-1.3.6 lib/fb_graph/checkin.rb
fb_graph-1.3.5 lib/fb_graph/checkin.rb
fb_graph-1.3.4 lib/fb_graph/checkin.rb
fb_graph-1.3.3 lib/fb_graph/checkin.rb
fb_graph-1.3.2 lib/fb_graph/checkin.rb
fb_graph-1.3.1 lib/fb_graph/checkin.rb