Class: Tankard::Api::Beer
- Inherits:
-
Object
- Object
- Tankard::Api::Beer
- Includes:
- Enumerable, Utils::Find, Utils::PageFinders
- Defined in:
- lib/tankard/api/beer.rb
Overview
Access for the /beer route on brewerydb
Instance Method Summary collapse
-
#breweries ⇒ self
Sets the request to beer/:id/breweries.
-
#each {|hash| ... } ⇒ Object
Calls the given block once for each beer.
-
#events ⇒ self
Sets the request to beer/:id/events.
-
#find(id_or_array, options = {}) ⇒ Hash, Array
Find a single or multiple beers by their id.
-
#id(beer_id) ⇒ self
BeerID to query.
-
#ingredients ⇒ self
Sets the request to beer/:id/ingredients.
-
#initialize(request, options = {}) ⇒ Tankard::Api::Beer
constructor
Initialize a new object.
-
#params(options = {}) ⇒ self
Additional parameters to send with the request.
-
#social_accounts ⇒ self
Sets the request to beer/:id/socialaccounts.
-
#variations ⇒ self
Sets the request to beer/:id/variations.
Constructor Details
#initialize(request, options = {}) ⇒ Tankard::Api::Beer
Initialize a new object
21 22 23 24 |
# File 'lib/tankard/api/beer.rb', line 21 def initialize(request, = {}) @http_client = request @http_request_parameters = Hashie::Mash.new() end |
Instance Method Details
#breweries ⇒ self
Sets the request to beer/:id/breweries
57 58 59 60 |
# File 'lib/tankard/api/beer.rb', line 57 def breweries @http_request_parameters.endpoint = 'breweries' self end |
#each {|hash| ... } ⇒ Object
Calls the given block once for each beer
|
# File 'lib/tankard/api/beer.rb', line 35
|
#events ⇒ self
Sets the request to beer/:id/events
65 66 67 68 |
# File 'lib/tankard/api/beer.rb', line 65 def events @http_request_parameters.endpoint = 'events' self end |
#find(id_or_array, options = {}) ⇒ Hash, Array
Find a single or multiple beers by their id
|
# File 'lib/tankard/api/beer.rb', line 26
|
#id(beer_id) ⇒ self
BeerID to query
49 50 51 52 |
# File 'lib/tankard/api/beer.rb', line 49 def id(beer_id) @http_request_parameters.id = beer_id self end |
#ingredients ⇒ self
Sets the request to beer/:id/ingredients
73 74 75 76 |
# File 'lib/tankard/api/beer.rb', line 73 def ingredients @http_request_parameters.endpoint = 'ingredients' self end |
#params(options = {}) ⇒ self
Additional parameters to send with the request
98 99 100 101 102 103 |
# File 'lib/tankard/api/beer.rb', line 98 def params( = {}) .each_pair do |key, value| @http_request_parameters[key] = value end self end |
#social_accounts ⇒ self
Sets the request to beer/:id/socialaccounts
81 82 83 84 |
# File 'lib/tankard/api/beer.rb', line 81 def @http_request_parameters.endpoint = 'socialaccounts' self end |
#variations ⇒ self
Sets the request to beer/:id/variations
89 90 91 92 |
# File 'lib/tankard/api/beer.rb', line 89 def variations @http_request_parameters.endpoint = 'variations' self end |