Module: Untappd::Client::Checkin

Included in:
Untappd::Client
Defined in:
lib/untappd-api/client/checkin.rb

Instance Method Summary collapse

Instance Method Details

#add_comment(checkin_id, comment) ⇒ Hashie::Mash

Add a comment to a checkin.

Examples:

Comment on checkin with ID 669114 and comment text of “Nice.”

Untappd.add_comment(669114, "Nice.")

Parameters:

  • checkin_id (String, Integer)

    The ID of the checkin you wish to comment on.

  • comment (String)

    The comment text you would like to add. Max 140 characters.

Returns:

  • (Hashie::Mash)

    The results of adding the comment. Includes user and comment details.



68
69
70
71
# File 'lib/untappd-api/client/checkin.rb', line 68

def add_comment(checkin_id, comment)
  options = { :checkin_id => checkin_id, :comment => comment }
  post('/add_comment', options)
end

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

Perform a checkin with the authenticated user.

Examples:

Checkin to beer with ID 6284 from Eastern time zone (GMT - 5 hours).

Untappd.checkin(-5, 6284)

Parameters:

  • gmt_offset (String, Integer)

    The numeric value of hours the user is from GMT (Greenwich Mean Time).

  • beer_id (String, Integer)

    The ID of the beer you wish to check into.

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

    a customizable set of options

Options Hash (options):

  • :foursquare_id (String)

    The MD5 hash ID of the Venue you want to attach the beer checkin to.

  • :shout (String)

    The text you would like included as a comment. Max of 140 characters.

  • :rating_value (String, Integer)

    The score you would like to add for the beer. Must be whole numbers from 1 to 5.

  • :user_lat (String, Integer)

    Latitude of the user. Required if you want to add a location to the checkin.

  • :user_lng (String, Integer)

    Longitude of the user. Required if you want to add a location to the checkin.

  • :facebook (String)

    Set to “on” to post checkin to Facebook. Defaults to “off”.

  • :twitter (String)

    Set to “on” to post checkin to Twitter. Defaults to “off”.

  • :foursquare (String)

    Set to “on” to pass checkin on to Foursquare. Defaults to “off”.

  • :gowalla (String)

    Set to “on” to pass checkin on to Gowalla. Defaults to “off”.

Returns:

  • (Hashie::Mash)

    The results of the checkin. Includes info for beer, venue, badges earned, and recommendations.



54
55
56
57
# File 'lib/untappd-api/client/checkin.rb', line 54

def checkin(beer_id, gmt_offset, options={})
  options.merge!(:gmt_offset => gmt_offset, :bid => beer_id)
  post('/checkin', options)
end

#checkin_details(id) ⇒ Hashie::Mash

Returns info for the specified checkin.

Examples:

Retrieve the checkin with ID 669114 .

Untappd.beer(3839)

Parameters:

  • id (String, Integer)

    The ID of the checkin.

Returns:

  • (Hashie::Mash)

    The requested checkin.



31
32
33
34
# File 'lib/untappd-api/client/checkin.rb', line 31

def checkin_details(id)
  options = { :id => id }
  get('/details', options)
end

#delete_comment(comment_id) ⇒ Hashie::Mash

Delete a comment made by the authenticated user.

Examples:

Delete comment with ID 669114.

Untappd.delete_comment(669114)

Parameters:

  • comment_id (String, Integer)

    The ID of the comment you wish to delete.

Returns:

  • (Hashie::Mash)

    The results of deleting the comment.



81
82
83
84
# File 'lib/untappd-api/client/checkin.rb', line 81

def delete_comment(comment_id)
  options = { :comment_id => comment_id }
  post('/delete_comment', options)
end

#public_feed(options = {}) ⇒ Array Also known as: the_pub

Returns all public checkins, otherwise known as “The Pub”.

Examples:

Retrieve the public feed.

Untappd.public_feed

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :since (String, Integer)

    The ID of the last recent check-in.

  • :offset (String, Integer)

    The offset you would like the dataset to begin with.

  • :geolat (String, Integer)

    Latitude to filter results by.

  • :geolng (String, Integer)

    Longitude to filter results by.

Returns:

  • (Array)

    The requested beer feed.



16
17
18
# File 'lib/untappd-api/client/checkin.rb', line 16

def public_feed(options={})
  get('/thepub', options)
end

#toast(checkin_id) ⇒ Hashie::Mash

Toast a checkin.

Examples:

Toast checkin with ID 669114.

Untappd.toast(669114)

Parameters:

  • checkin_id (String, Integer)

    The ID of the checkin you wish to toast.

Returns:

  • (Hashie::Mash)

    The results of the toast.



94
95
96
97
# File 'lib/untappd-api/client/checkin.rb', line 94

def toast(checkin_id)
  options = { :checkin_id => checkin_id }
  post('/toast', options)
end

#untoast(checkin_id) ⇒ Hashie::Mash

Remove a toast made by the authenticated user from a checkin.

Examples:

Remove toast from checkin with ID 669114.

Untappd.remove_toast(669114)

Parameters:

  • checkin_id (String, Integer)

    The ID of the checkin you wish to remove your toast from.

Returns:

  • (Hashie::Mash)

    The results of the toast removal.



107
108
109
110
# File 'lib/untappd-api/client/checkin.rb', line 107

def untoast(checkin_id)
  options = { :checkin_id => checkin_id }
  post('/delete_toast', options)
end