<commit_before># Tankard
[![Build Status](https://travis-ci.org/matthewshafer/tankard.png?branch=master)](https://travis-ci.org/matthewshafer/tankard)
[![Dependency Status](https://gemnasium.com/matthewshafer/tankard.png)](https://gemnasium.com/matthewshafer/tankard)
[![Code Climate](https://codeclimate.com/github/matthewshafer/tankard.png)](https://codeclimate.com/github/matthewshafer/tankard)
[![Coverage Status](https://coveralls.io/repos/matthewshafer/tankard/badge.png?branch=master)](https://coveralls.io/r/matthewshafer/tankard)
[![Gem Version](https://badge.fury.io/rb/tankard.png)](http://rubygems.org/gems/tankard)

Allows easy quering of the BreweryDB Api

## About

I decided to make Tankard for a personal project and then figured why not put it on github as I am working on it.
Tankard is very immature at the moment.  I plan on adding support for all of the get routes to the BreweryDB Api.
I've also been pretty interested in Jruby as of late and wanted to make Tankard thread safe.

## Installation

```ruby
gem install "tankard"
```

or add it to your gemfile

## Documentation

Everytime a commit is pushed to github the documentation regenerates.
You can find this at http://rubydoc.info/github/matthewshafer/tankard/frames

If you visit rubygems you can find the documentation for a specific gem release.

## Usage

If you happen to be using Rails you can do the configuration in an initializer, something like:

```ruby
require 'tankard'

Tankard.configure do |config|
  config.api_key = "YOUR_API_KEY"
end
```

After being configured this is a sample of ways to use Tankard:

### Beer

```ruby
Tankard.beer.id("some_id").breweries.each { |x| p x}

beer = Tankard.beer.find(["first_id", "second_id"])
```

Alternatively you can send parameters to the request in two ways.  Here are examples:

```ruby
Tankard.beer(id: "some_id", endpoint: "breweries", anotherParam: "something").each { |x| p x }

Tankard.beer.id("some_id").breweries.params(anotherParam: "something").each { |x| p x }
```

### Beers

This would return an array with all beers greater than 5% (to_a comes from enumerable in this case)

```ruby
Tankard.beers.abv("+5").to_a
```
### Search

Here is how we could search for everything that matches "stone".
We would get results that contain more than just beer (EX I would probably get a result for Stone Brewing)
<commit_msg>fix readme<commit_after># Tankard
[![Build Status](https://travis-ci.org/matthewshafer/tankard.png?branch=master)](https://travis-ci.org/matthewshafer/tankard)
[![Dependency Status](https://gemnasium.com/matthewshafer/tankard.png)](https://gemnasium.com/matthewshafer/tankard)
[![Code Climate](https://codeclimate.com/github/matthewshafer/tankard.png)](https://codeclimate.com/github/matthewshafer/tankard)
[![Coverage Status](https://coveralls.io/repos/matthewshafer/tankard/badge.png?branch=master)](https://coveralls.io/r/matthewshafer/tankard)
[![Gem Version](https://badge.fury.io/rb/tankard.png)](http://rubygems.org/gems/tankard)

Allows easy quering of the BreweryDB Api

## About

I decided to make Tankard for a personal project and then figured why not put it on github as I am working on it.
Tankard is very immature at the moment.  I plan on adding support for all of the get routes to the BreweryDB Api.
I've also been pretty interested in Jruby as of late and wanted to make Tankard thread safe.

## Installation

```ruby
gem install "tankard"
```

or add it to your gemfile

## Documentation

Everytime a commit is pushed to github the documentation regenerates.
You can find this at http://rubydoc.info/github/matthewshafer/tankard/frames

If you visit rubygems you can find the documentation for a specific gem release.

## Usage

If you happen to be using Rails you can do the configuration in an initializer, something like:

```ruby
require 'tankard'

Tankard.configure do |config|
  config.api_key = "YOUR_API_KEY"
end
```

After being configured this is a sample of ways to use Tankard:

### Beer

```ruby
Tankard.beer.id("some_id").breweries.each { |x| p x}

beer = Tankard.beer.find(["first_id", "second_id"])
```

Alternatively you can send parameters to the request in two ways.  Here are examples:

```ruby
Tankard.beer(id: "some_id", endpoint: "breweries", anotherParam: "something").each { |x| p x }

Tankard.beer.id("some_id").breweries.params(anotherParam: "something").each { |x| p x }
```

### Beers

This would return an array with all beers greater than 10% (to_a comes from enumerable in this case)

```ruby
Tankard.beers.params(abv: "+10").to_a
```
### Search

Here is how we could search for everything that matches "stone".
We would get results that contain more than just beer (EX I would probably get a result for Stone Brewing)

{'fraction_non_alphanumeric': 0.11890179514255544, 'fraction_numerical': 0.0012671594508975714, 'mean_word_length': 4.927409261576972, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3151618', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1554, 'n_words': 512}