Class: Foursquare::CheckinProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/foursquare/checkin_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(foursquare) ⇒ CheckinProxy

Returns a new instance of CheckinProxy.



3
4
5
# File 'lib/foursquare/checkin_proxy.rb', line 3

def initialize(foursquare)
  @foursquare = foursquare
end

Instance Method Details

#all(options = {}) ⇒ Object



17
18
19
20
21
# File 'lib/foursquare/checkin_proxy.rb', line 17

def all(options={})
  @foursquare.get("users/self/checkins", options)["checkins"]["items"].map do |json|
    Foursquare::Checkin.new(@foursquare, json)
  end
end

#create(options = {}) ⇒ Object Also known as: add



23
24
25
26
27
28
29
# File 'lib/foursquare/checkin_proxy.rb', line 23

def create(options={})
  if json = @foursquare.post("checkins/add", options)
    Foursquare::Checkin.new(@foursquare, json["checkin"])
  else
    nil
  end
end

#find(id) ⇒ Object



7
8
9
# File 'lib/foursquare/checkin_proxy.rb', line 7

def find(id)
  Foursquare::Checkin.new(@foursquare, @foursquare.get("checkins/#{id}")["checkin"])
end

#recent(options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/foursquare/checkin_proxy.rb', line 11

def recent(options={})
  @foursquare.get("checkins/recent", options)["recent"].map do |json|
    Foursquare::Checkin.new(@foursquare, json)
  end
end