Sha256: 4f560c1f56670914b706d53a46c9b4313639ab61c4fbba2e1c24b185ceec0d0f

Contents?: true

Size: 1.41 KB

Versions: 17

Compression:

Stored size: 1.41 KB

Contents

module FbGraph
  class Checkin < Node
    extend Searchable

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

    def initialize(identifier, attributes = {})
      super
      if (from = attributes[:from])
        @from = FbGraph::User.new(from.delete(:id), from)
      end
      @tags = []
      if (tags = attributes[:tags])
        FbGraph::Collection.new(tags).each do |user|
          @tags << FbGraph::User.new(user.delete(:id), user)
        end
      end
      if (place = attributes[:place])
        @place = FbGraph::Page.new(place.delete(:id), place)
      end
      @message = attributes[:message]
      if (coordinates = attributes[:coordinates])
        # NOTE: it seems this attributes isn't used now
        @coordinates = FbGraph::Venue.new(location)
      end
      if (application = attributes[:application])
        @application = FbGraph::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

17 entries across 17 versions & 2 rubygems

Version Path
fb_graph-1.2.1 lib/fb_graph/checkin.rb
fb_graph-1.2.0 lib/fb_graph/checkin.rb
fb_graph-1.1.7 lib/fb_graph/checkin.rb
fb_graph-1.1.6 lib/fb_graph/checkin.rb
fb_graph-1.1.5 lib/fb_graph/checkin.rb
fb_graph-1.1.4 lib/fb_graph/checkin.rb
fb_graph-1.1.3 lib/fb_graph/checkin.rb
fb_graph-1.1.2 lib/fb_graph/checkin.rb
fb_graph-1.1.1 lib/fb_graph/checkin.rb
fb_graph-1.1.0 lib/fb_graph/checkin.rb
fb_graph-1.0.7 lib/fb_graph/checkin.rb
fb_graph-1.0.6 lib/fb_graph/checkin.rb
fb_graph-1.0.5 lib/fb_graph/checkin.rb
palidanx-fb_graph-1.0.4 lib/fb_graph/checkin.rb
fb_graph-1.0.4 lib/fb_graph/checkin.rb
fb_graph-1.0.3 lib/fb_graph/checkin.rb
fb_graph-1.0.2 lib/fb_graph/checkin.rb