Project

brewerydb

0.01
No commit activity in last 3 years
No release in over 3 years
Free Beer data. You'll need an api key.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 1.0.0
>= 0.7.3
 Project Readme

BreweryDB API¶ ↑

This is a simple wrapper around the BreweryDB API packaged as a ruby gem.

In Rails, you can configure it with initializer by creating a file named config/initializers/brewerydb.rb

BreweryDb.configure do |config|
  config.apikey = 'YOUR_API_KEY'
end

Remember: Good People Drink Good Beer!

Releases¶ ↑

0.0.4

  • properly documenting the hashie dependency

0.0.3

  • we return Hashie::Mash objects, so you can access the properties using .notation

  • search endpoint enabled

0.0.2

  • fully functional for all end points

0.0.1

  • initial release

Examples¶ ↑

You can fetch beers:

response = BreweryDb.beers

response.beer.each do |beer|
  puts "#{beer.id}: #{beer.name}"
end if response.beer

puts response.pages.page
puts response.pages.total

Get a list of beers on a specific page:

response = BreweryDb.beers(:page => 10, :metadata => true) 
response.beer.each do |beer|
  puts "#{beer.id}: #{beer.name}"
end if response.beer

Searching for Beers

results = BreweryDb.search(:q => 'stone')
results.result.each do |result|
  puts "#{result.id}: #{result.name} (#{result['type']})"
end if results.result #check if there is a result before looping

puts "Page: #{results.pages.page}"
puts "Total: #{results.pages.total}"

Get a specific beer or brewery by id:

response = BreweryDb.beer(1196)
puts response.name

response = BreweryDb.brewery(1000)
puts response.name

Get all the breweries around Washington DC:

response = BreweryDb.breweries(:geo => 1,
                               :lat => 38.875532,
                               :lng => -77.007294,
                               :radius => 30,
                               :units => 'm')
response.brewery.each do |brewery|
  puts brewery.name
end if response.brewery

puts response.pages.page
puts response.pages.total

Categories, Styles and Glassware work as well.

Additional working examples are in the examples directory