Module: Foursquare2::Checkins

Included in:
Client
Defined in:
lib/foursquare2/checkins.rb

Instance Method Summary collapse

Instance Method Details

#add_checkin(options = {}) ⇒ Object

Checkin on behalf of the user.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • String (Object)

    :venueId - Venue for the checkin.

  • String (Object)

    :venue - For venueless checkins (name or other identifier)

  • String (Object)

    :shout - Message to be included with the checkin.

  • String (Object)

    :broadcast - Required, one or more of private,public,facebook,twitter. Comma-separated.

  • String (Object)

    :ll - Latitude and longitude in format LAT,LON

  • Integer (Object)

    :llAcc - Accuracy of the lat/lon in meters.

  • Integer (Object)

    :alt - Altitude in meters

  • Integer (Object)

    :altAcc - Accuracy of the altitude in meters



43
44
45
46
47
48
# File 'lib/foursquare2/checkins.rb', line 43

def add_checkin(options={})
  response = connection.post do |req|
    req.url "checkins/add", options
  end
  return_error_or_body(response, response.body.response.checkin)
end

#add_checkin_comment(checkin_id, options = {}) ⇒ Object

Add a comment to a checkin.

Parameters:

  • checkin_id (String)

    the ID of the checkin.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • String (Object)

    :text - Text of the comment to add, 200 character max.



56
57
58
59
60
61
# File 'lib/foursquare2/checkins.rb', line 56

def add_checkin_comment(checkin_id, options={})
  response = connection.post do |req|
    req.url "checkins/#{checkin_id}/addcomment", options
  end
  return_error_or_body(response, response.body.response)  
end

#add_checkin_post(checkin_id, options = {}) ⇒ Object

Add a post to a checkin.

Parameters:

  • checkin_id (String)

    the ID of the checkin.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • String (Object)

    :text - The text of the post, up to 200 characters.

  • String (Object)

    :url - Link for more details. This page will be opened in an embedded web view in the foursquare application, unless contentId is specified and a native link handler is registered and present. We support the following URL schemes: http, https, foursquare, mailto, tel, and sms.

  • String (Object)

    :contentId - Identifier for the post to be used in a native link, up to 50 characters. A url must also be specified in the request.



84
85
86
87
88
89
# File 'lib/foursquare2/checkins.rb', line 84

def add_checkin_post(checkin_id, options={})
  response = connection.post do |req|
    req.url "checkins/#{checkin_id}/addpost", options
  end
  return_error_or_body(response, response.body.response.post)  
end

#add_checkin_reply(checkin_id, options = {}) ⇒ Object

Add a reply to a checkin.

Parameters:

  • checkin_id (String)

    the ID of the checkin.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • String (Object)

    :text - The text of the post, up to 200 characters.

  • String (Object)

    :url - Link for more details. This page will be opened in an embedded web view in the foursquare application, unless contentId is specified and a native link handler is registered and present. We support the following URL schemes: http, https, foursquare, mailto, tel, and sms.

  • String (Object)

    :contentId - Identifier for the post to be used in a native link, up to 50 characters. A url must also be specified in the request.



99
100
101
102
103
104
# File 'lib/foursquare2/checkins.rb', line 99

def add_checkin_reply(checkin_id, options={})
  response = connection.post do |req|
    req.url "checkins/#{checkin_id}/reply", options
  end
  return_error_or_body(response, response.body.response.reply)  
end

#checkin(checkin_id, options = {}) ⇒ Object

Retrive information about a single checkin.

Parameters:

  • checkin_id (String)

    the ID of the checkin.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • String (Object)

    :signature - Signature allowing users to bypass the friends-only access check on checkins



10
11
12
13
14
15
# File 'lib/foursquare2/checkins.rb', line 10

def checkin(checkin_id, options={})
  response = connection.get do |req|
    req.url "checkins/#{checkin_id}", options
  end
  return_error_or_body(response, response.body.response.checkin)
end

#delete_checkin_comment(checkin_id, options = {}) ⇒ Object

Delete a checkin’s comment

Parameters:

  • checkin_id (String)
    • The ID of the checkin

  • options (Hash) (defaults to: {})

Options Hash (options):

  • String (Object)

    :commentId - ID of the comment to be deleted.



69
70
71
72
73
74
# File 'lib/foursquare2/checkins.rb', line 69

def delete_checkin_comment(checkin_id, options={})
  response = connection.post do |req|
    req.url "checkins/#{checkin_id}/deletecomment", options
  end
  return_error_or_body(response, response.body.response)  
end

#recent_checkins(options = {}) ⇒ Object

Retrive a list of recent checkins from friends.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • String (Object)

    :ll - Latitude and longitude in format LAT,LON

  • String (Object)

    :limit - Maximum results to return (max 100)

  • Integer (Object)

    :afterTimestamp - Seconds after which to look for checkins



24
25
26
27
28
29
# File 'lib/foursquare2/checkins.rb', line 24

def recent_checkins(options={})
  response = connection.get do |req|
    req.url "checkins/recent", options
  end
  return_error_or_body(response, response.body.response.recent)
end