Skip to content
Go library for http://www.brewerydb.com/ API
Go
Branch: master
Clone or download
naegelejd Merge pull request #15 from MovingtoMars/docs
adds reference links to the brewerydb API docs
Latest commit 37520b5 Jun 18, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test_data adding remaining tests. finished at 99.89% coverage May 22, 2015
.gitignore adding many test for List and Get endpoints May 22, 2015
.travis.yml adding Travis-CI configuration May 7, 2015
CONTRIBUTING.md adding "contributing" doc May 7, 2015
LICENSE adding documentation and a BSD-style license Apr 27, 2015
README.md change to Go Jun 18, 2015
adjunct.go api links for beer.go Jun 18, 2015
adjunct_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
beer.go api links for beer.go Jun 18, 2015
beer_test.go adding better examples and cleaning up existing ones Jun 11, 2015
brewery.go converting all "Y"/"N" fields to a boolean type (YesNo) Jun 2, 2015
brewery_test.go adding better examples and cleaning up existing ones Jun 11, 2015
brewerydb.go adding better examples and cleaning up existing ones Jun 11, 2015
brewerydb_test.go adding ListFermentables to Dragon's Milk example Jun 11, 2015
category.go
category_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
change.go api links for change.go Jun 18, 2015
change_test.go
convert_id.go api links for convert_id.go Jun 18, 2015
convert_id_test.go adding remaining tests. finished at 99.89% coverage May 22, 2015
event.go converting all "Y"/"N" fields to a boolean type (YesNo) Jun 2, 2015
event_test.go converting all "Y"/"N" fields to a boolean type (YesNo) Jun 2, 2015
example_ideas.md adding better examples and cleaning up existing ones Jun 11, 2015
feature.go api links for feature.go Jun 18, 2015
feature_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
fermentable.go
fermentable_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
fluidsize.go api links for fluidsize.go Jun 18, 2015
fluidsize_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
glass.go api links for glass.go Jun 18, 2015
glass_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
guild.go converting all "Y"/"N" fields to a boolean type (YesNo) Jun 2, 2015
guild_test.go adding many test for List and Get endpoints May 22, 2015
heartbeat.go api links for heartbear.go Jun 18, 2015
heartbeat_test.go adding remaining tests. finished at 99.89% coverage May 22, 2015
hop.go api links for hop.go Jun 18, 2015
hop_test.go adding better examples and cleaning up existing ones Jun 11, 2015
ingredient.go api links for ingredient.go Jun 18, 2015
ingredient_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
list.go fixing golint recommendations. May 1, 2015
location.go
location_test.go adding better examples and cleaning up existing ones Jun 11, 2015
menu.go adding tests for Menu and remaining Search endpoints. May 22, 2015
menu_test.go
search.go converting all "Y"/"N" fields to a boolean type (YesNo) Jun 2, 2015
search_test.go adding remaining tests. finished at 99.89% coverage May 22, 2015
socialsite.go api links for socialsite.go Jun 18, 2015
socialsite_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
style.go api links for style.go Jun 18, 2015
style_test.go adding "bad URL" test so each method is 100% tested May 21, 2015
yeast.go api links for yeast.go Jun 18, 2015
yeast_test.go adding "bad URL" test so each method is 100% tested May 21, 2015

README.md

brewerydb

brewerydb is a Go library for accessing the BreweryDB API

GoDoc Build StatusCoverage Status

usage

import "github.com/naegelejd/brewerydb"

Construct a new Client using your BreweryDB API key:

client := brewerydb.NewClient("<your API key>")

Then use the available services to access the API. For example:

// Get any random beer
beer, _ := client.Beer.Random(&brewerydb.RandomBeerRequest{ABV: "8"})
fmt.Println(beer.Name, beer.Style.Name)

or

// Get all breweries established in 1983
bs, err := client.Brewery.List(&brewerydb.BreweryListRequest{Established: "1983"})
if err != nil {
    panic(err)
}
for _, b := range bs {
    fmt.Println(b.Name, b.Website)
}

or

// "What is in Dragon's Milk?"
bl, _ := client.Search.Beer("Dragon's Milk", nil)

var beerID string
for _, beer := range bl.Beers {
    if beer.Name == "Dragon's Milk" {
        beerID = beer.ID
    }
}
if beerID == "" {
    panic("Dragon's Milk not found")
}

ingredients, _ := client.Beer.ListIngredients(beerID)
adjuncts, _ := client.Beer.ListAdjuncts(beerID)
fermentables, _ := client.Beer.ListFermentables(beerID)
hops, _ := client.Beer.ListHops(beerID)
yeasts, _ := client.Beer.ListYeasts(beerID)

fmt.Println("Dragon's Milk:")
fmt.Println("  Ingredients:")
for _, ingredient := range ingredients {
    fmt.Println("    " + ingredient.Name)
}
fmt.Println("\n  Adjuncts:")
for _, adjunct := range adjuncts {
    fmt.Println("    " + adjunct.Name)
}
fmt.Println("  Fermentables:")
for _, fermentable := range fermentables {
    fmt.Println("    " + fermentable.Name)
}
fmt.Println("  Hops:")
for _, hop := range hops {
    fmt.Println("    " + hop.Name)
}
fmt.Println("  Yeasts:")
for _, yeast := range yeasts {
    fmt.Println("    " + yeast.Name)
}

status

This library is under development. Please feel free to suggest design changes or report issues.

license

This library is distributed under the BSD-style license found in the LICENSE file.

viewsviews 24h

You can’t perform that action at this time.