Module: Skittles::Client::Checkin

Included in:
Skittles::Client
Defined in:
lib/skittles/client/checkin.rb

Overview

Define methods related to checkins.

Instance Method Summary collapse

Instance Method Details

#add_checkin(broadcast = 'private', options = {}) ⇒ Hashie::Mash

Allows a user to checkin to a place.

Parameters:

  • broadcast (String) (defaults to: 'private')

    How much to broadcast this check-in, ranging from private (off-the-grid) to public,faceboook,twitter.

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

    A customizable set of options.

Options Hash (options):

  • venueId (String)

    The venue where the user is checking in.

  • venue (String)

    Name of the venue.

  • shout (String)

    A message about a check-in. (140 character max.)

  • ll (String)

    Latitude and longitude of the user's location.

  • llAcc (Decimal)

    Accuracy of the user's latitude and longitude, in meters.

  • alt (Decimal)

    Altitude of the user's location, in meters.

  • altAcc (Decimal)

    Vertical accuracy of the user's location, in meters.

Returns:

  • (Hashie::Mash)

    A checkin object.

See Also:

Requires Acting User:

  • Yes


20
21
22
# File 'lib/skittles/client/checkin.rb', line 20

def add_checkin(broadcast = 'private', options = {})
  post("checkins/add", { :broadcast => broadcast }.merge(options)).checkin
end

#checkin(id, options = {}) ⇒ Hashie::Mash

Get details of a checkin.

Parameters:

  • id (String)

    The id of the checkin to retrieve additional information for.

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

    A customizable set of options.

Options Hash (options):

  • signature (String)

    When checkins are sent to public feeds such as Twitter, foursquare appends a signature (s=XXXXXX) allowing users to bypass the friends-only access check on checkins. The same value can be used here for programmatic access to otherwise inaccessible checkins.

Returns:

  • (Hashie::Mash)

    A complete checkin object.

See Also:

Requires Acting User:

  • Yes


47
48
49
# File 'lib/skittles/client/checkin.rb', line 47

def checkin(id, options = {})
  get("checkins/#{id}", options).checkin
end

#checkin_addcomment(id, text) ⇒ Hashie::Mash

Comment on a check-in.

Parameters:

  • id (String)

    The id of the checkin to add a comment to.

  • text (String)

    The text of the comment, up to 200 characters.

Returns:

  • (Hashie::Mash)

    The newly-created comment.

See Also:

Requires Acting User:

  • Yes


58
59
60
# File 'lib/skittles/client/checkin.rb', line 58

def checkin_addcomment(id, text)
  post("checkins/#{id}/addcomment", { :text => text }).comment
end

#checkin_addpost(id, options = {}) ⇒ Hashie::Mash

Note:

This endpoint is part of foursquare's new Apps Platform, currently in developer preview.

Post user generated content from an external app to a check-in.

Parameters:

  • id (String)

    The id of the checkin to add a post to.

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

    A customizable set of options.

Options Hash (options):

  • text (String)

    The text of the post, up to 200 characters.

  • url (String)

    Link for more details.

  • contentId (String)

    Identifier for the post to be used in a native link, up to 50 characters.

Returns:

  • (Hashie::Mash)

    The newly-created post.

See Also:

Requires Acting User:

  • Yes


35
36
37
# File 'lib/skittles/client/checkin.rb', line 35

def checkin_addpost(id, options = {})
  post("checkins/#{id}/addpost", options).post
end

#checkin_deletecomment(checkin_id, comment_id) ⇒ Hashie::Mash

Remove a comment from a checkin, if the acting user is the author or the owner of the checkin.

Parameters:

  • checkin_id (String)

    The id of the checkin to remove a comment from.

  • comment_id (String)

    The id of the comment to remove.

Returns:

  • (Hashie::Mash)

    The checkin, minus this comment.

See Also:

Requires Acting User:

  • Yes


70
71
72
# File 'lib/skittles/client/checkin.rb', line 70

def checkin_deletecomment(checkin_id, comment_id)
  post("checkins/#{checkin_id}/deletecomment", { :commentId => comment_id }).checkin
end

#checkin_likes(id) ⇒ Hashie::Mash

Returns friends and a total count of users who have liked this checkin.

Parameters:

  • id (String)

    The id of the checkin to return likes from.

Returns:

  • (Hashie::Mash)

    A count and groups of users who like this checkin.

See Also:

Requires Acting User:

  • No


80
81
82
# File 'lib/skittles/client/checkin.rb', line 80

def checkin_likes(id)
  get("checkins/#{id}/likes").likes
end

#checkin_reply(id, options = {}) ⇒ Object

Reply to a user about their check-in.

Parameters:

  • id (String)

    The id of the checkin to reply to.

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

    A customizable set of options.

Options Hash (options):

  • text (String)

    The text of th reply, up to 200 characters.

  • url (String)

    Link for more details.

  • contentId (String)

    Identifier for the reply to be used in a native link, up to 50 characters.

Returns:

  • The newly-created reply.

See Also:

Requires Acting User:

  • Yes


94
95
96
# File 'lib/skittles/client/checkin.rb', line 94

def checkin_reply(id, options = {})
  post("checkins/#{id}/reply", options).reply
end

#like_checkin(id, set = 1) ⇒ Hashie::Mash

Allows the acting user to like or unlike a checkin.

Parameters:

  • id (String)

    The id of the checkin to like or unlike.

  • set (Integer) (defaults to: 1)

    If 1, like this checkin. If 0 unlike it. Default is 1.

Returns:

  • (Hashie::Mash)

    Updated count and groups of users who like this checkin.

See Also:

Requires Acting User:

  • Yes


105
106
107
# File 'lib/skittles/client/checkin.rb', line 105

def like_checkin(id, set = 1)
  post("checkins/#{id}/like", { :set => set }).likes
end

#recent_checkins(ll, options = {}) ⇒ Hashie::Mash

Returns a list of recent checkins from friends.

Parameters:

  • ll (String)

    Latitude and longitude of the user's location, so response can include distance.

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

    A customizable set of options.

Options Hash (options):

  • Number (Integer)

    of results to return, up to 100.

  • Seconds (Integer)

    after which to look for checkins.

Returns:

  • (Hashie::Mash)

    An array of checkin objects with user details present.

See Also:

Requires Acting User:

  • Yes


118
119
120
# File 'lib/skittles/client/checkin.rb', line 118

def recent_checkins(ll, options = {})
  get("checkins/recent", { :ll => ll }.merge(options)).recent
end