Module: Untappd::Client::Beer

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

Instance Method Summary collapse

Instance Method Details

#beer(id) ⇒ Hashie::Mash

Returns info for the specified beer.

Examples:

Retrieve the beer with ID 3839.

Untappd.beer(3839)

Parameters:

  • id (String, Integer)

    The ID of the beer.

Returns:

  • (Hashie::Mash)

    The requested beer.



28
29
30
31
# File 'lib/untappd-api/client/beer.rb', line 28

def beer(id)
  options = { :bid => id }
  get('/beer_info', options)
end

#beer_feed(id, options = {}) ⇒ Array

Returns the feed for the specified beer.

Examples:

Retrieve the feed for beer with ID 3839.

Untappd.beer_feed(399)

Parameters:

  • id (String, Integer)

    The ID of the beer.

  • 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.

Returns:

  • (Array)

    The requested beer feed.



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

def beer_feed(id, options={})
  options.merge!(:bid => id)
  get('/beer_checkins', options)
end

#beer_search(query, options = {}) ⇒ Array

Search beers with the specified query.

Examples:

Search beers for “Pale ale”.

Untappd.beer_search("Pale ale")

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :offset (String, Integer)

    The offset you would like the dataset to begin with.

  • :sort (String, Integer)

    Alphabetical order (“name”) or checkin count order (“count”).

Returns:

  • (Array)

    The search results.



42
43
44
45
# File 'lib/untappd-api/client/beer.rb', line 42

def beer_search(query, options={})
  options.merge!(:q => query)
  get('/beer_search', options)
end

Returns the currently trending beers.

Examples:

Return all trending beers.

Untappd.trending_beers

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :type (String)

    “all”, “macro”, “micro”, “local”. “all” is set as default.

  • :limit (String, Integer)

    The number of records to return. (max 10)

  • :age (String, Integer)

    “daily”, “weekly”, “monthly”.

  • :geolat (String, Integer)

    Latitude to filter results by. Required when :type => “local”.

  • :geolng (String, Integer)

    Longitude to filter results by. Required when :type => “local”.

Returns:

  • (Array)

    The search results.



59
60
61
# File 'lib/untappd-api/client/beer.rb', line 59

def trending_beers(options={})
  get('/trending', options)
end