Skip to content

Commit

Permalink
Merge pull request #10 from Oni-zerone/feature/Instructions
Browse files Browse the repository at this point in the history
Chore: update readme with basic documentation
  • Loading branch information
Oni-zerone committed Mar 3, 2019
2 parents 5693170 + 54a5a25 commit bd2c5ce
Showing 1 changed file with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,81 @@ _The Punk API takes Brewdog's DIY Dog and turns it into a searchable, filterable

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements
## Usage
```
let punkApi = PunkAPI(configuration: .default)
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
punkApi.get(BeerRequest(id: 1), queue: .main) { beersResult in }
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
punkApi.get(BeersRequest(filter: [
.abv(condition: .more, value: 3),
.beerName(value: "Punk")]), queue: .main) { beersResult in }
```

## API
#### `RandomBeerRequest()`
Get a random beer request
```
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
```

#### `BeerRequest(id: 1)`
Get a beer from given id
```
punkApi.get(BeerRequest(id: 1), queue: .main) { beersResult in }
```

#### `BeersRequest(filter: [])`
Get beers that match the passed in options, if no options are passed in it will return all beers in ascending order of `id`.
```
punkApi.get(RandomBeerRequest(), queue: .main) { beersResult in }
```
**Options**

##### `BeersRequest.Parameter.abv(condition: .more, value: 3)`
Condition: `Condition`
Value: `Float`
Will return beers with an abv greater or lower than the passed in value.

##### `BeersRequest.Parameter.ibu(condition: .more, value: 3)`
Condition: `Condition`
Value: `Float`
Will return beers with an ibu greater or lower than the passed in value.

##### `BeersRequest.Parameter.ebc(condition: .more, value: 3)`
Condition: `Condition`
Value: `Float`
Will return beers with an ebc greater or lower than the passed in value.

##### `BeersRequest.Parameter.beerName(value: "Punk")`
Value: `String`
Will return beers matching the string passed in (we use fuzzy matching to find the names).

##### `BeersRequest.Parameter.yeast(value: "American Ale")`
Value: `String`
Will return beers which match the name of the yeast of the string passed in (we use fuzzy matching to find the yeast names).

##### `BeersRequest.Parameter.brewed(condition: .more, value: 3)`
Condition: `Condition`
Value: `Date`
Will return beers brewed before or after the passed in date.

##### `BeersRequest.Parameter.hops(value: "Ahtanum")`
Value: `String`
Will return beers which match the name of the hops of the string passed in (we use fuzzy matching to find the hop names).

##### `BeersRequest.Parameter.malt(value: "American Ale")`
Value: `String`
Will return beers which match the name of the yeast of the string passed in (we use fuzzy matching to find the yeast names).

##### `BeersRequest.Parameter.food(value: "Cheesecake")`
Value: `String`
Will return beers which match food pairings of the string passed in (we use fuzzy matching to find the foods).

##### `BeersRequest.Parameter.ids(value: [1, 2, 4, 6])`
Value: `Array<Int>`
Will return beers which match the given ids.

## Installation

Expand Down

0 comments on commit bd2c5ce

Please sign in to comment.