Brewry 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +46 -0
- data/README.rdoc +7 -2
- data/Rakefile +10 -0
- data/brewry.gemspec +5 -1
- data/lib/brewry.rb +12 -5
- data/lib/brewry/exceptions.rb +7 -0
- data/lib/brewry/version.rb +1 -1
- data/lib/utils/{brewry_string_utils.rb → string_utils.rb} +1 -1
- data/spec/brewry_spec.rb +45 -0
- data/spec/fixtures/Brewry/api_endpoints/should_return_brewery.yml +48 -0
- data/spec/fixtures/Brewry/api_endpoints/should_search_styles.yml +1964 -0
- data/spec/fixtures/Brewry/return_types/should_be_an_array.yml +64 -0
- data/spec/fixtures/Brewry/return_types/should_return_nil_when_no_results_found.yml +38 -0
- data/spec/spec_helper.rb +21 -0
- metadata +64 -5
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: http://api.brewerydb.com/v2/beers?key=xxx&name=Lone%20Star
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers: {}
|
|
10
|
+
response:
|
|
11
|
+
status:
|
|
12
|
+
code: 200
|
|
13
|
+
message: OK
|
|
14
|
+
headers:
|
|
15
|
+
Content-Type:
|
|
16
|
+
- application/json
|
|
17
|
+
Date:
|
|
18
|
+
- Fri, 15 Aug 2014 00:53:44 GMT
|
|
19
|
+
Server:
|
|
20
|
+
- Apache/2.2.27 (Amazon)
|
|
21
|
+
Vary:
|
|
22
|
+
- Accept-Encoding
|
|
23
|
+
X-Powered-By:
|
|
24
|
+
- PHP/5.3.28
|
|
25
|
+
X-Ratelimit-Limit:
|
|
26
|
+
- '400'
|
|
27
|
+
X-Ratelimit-Remaining:
|
|
28
|
+
- '392'
|
|
29
|
+
Content-Length:
|
|
30
|
+
- '2514'
|
|
31
|
+
Connection:
|
|
32
|
+
- keep-alive
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: "{\"currentPage\":1,\"numberOfPages\":1,\"totalResults\":2,\"data\":[{\"id\":\"sEq2iH\",\"name\":\"Lone
|
|
36
|
+
Star\",\"styleId\":97,\"isOrganic\":\"N\",\"status\":\"verified\",\"statusDisplay\":\"Verified\",\"createDate\":\"2012-01-03
|
|
37
|
+
02:43:38\",\"updateDate\":\"2012-03-22 13:04:53\",\"style\":{\"id\":97,\"categoryId\":8,\"category\":{\"id\":8,\"name\":\"North
|
|
38
|
+
American Lager\",\"createDate\":\"2012-03-21 20:06:46\"},\"name\":\"American-Style
|
|
39
|
+
Premium Lager\",\"description\":\"This style has low malt (and adjunct) sweetness,
|
|
40
|
+
is medium bodied, and should contain no or a low percentage (less than 25%)
|
|
41
|
+
of adjuncts. Color may be light straw to golden. Alcohol content and bitterness
|
|
42
|
+
may also be greater. Hop aroma and flavor is low or negligible. Light fruity
|
|
43
|
+
esters are acceptable. Chill haze and diacetyl should be absent. Note: Some
|
|
44
|
+
beers marketed as \\\"premium\\\" (based on price) may not fit this definition.\",\"ibuMin\":\"6\",\"ibuMax\":\"15\",\"abvMin\":\"4.3\",\"abvMax\":\"5\",\"srmMin\":\"2\",\"srmMax\":\"6\",\"ogMin\":\"1.044\",\"fgMin\":\"1.01\",\"fgMax\":\"1.014\",\"createDate\":\"2012-03-21
|
|
45
|
+
20:06:46\"}},{\"id\":\"HPC9eo\",\"name\":\"Lone Star\",\"description\":\"The
|
|
46
|
+
National Beer of Texas\\n\\\\Lone Star beer uses the finest hops from the
|
|
47
|
+
Pacific Northwest with hearty grains from the Central and Northern Plains.
|
|
48
|
+
The GABF recognized Lone Star as a high quality American Cream Lager by awarding
|
|
49
|
+
it with a silver medal. Malted barley and corn extract combine to provide
|
|
50
|
+
Lone Star with nature's finest ingredients for brewing. Lone Star's ingredients
|
|
51
|
+
give this beer its full natural flavor. The choicest hops lend complexity
|
|
52
|
+
and aroma to this beer body and character.\\\"\",\"abv\":\"4.65\",\"styleId\":97,\"isOrganic\":\"N\",\"status\":\"verified\",\"statusDisplay\":\"Verified\",\"createDate\":\"2012-01-03
|
|
53
|
+
02:43:38\",\"updateDate\":\"2012-03-22 13:04:59\",\"style\":{\"id\":97,\"categoryId\":8,\"category\":{\"id\":8,\"name\":\"North
|
|
54
|
+
American Lager\",\"createDate\":\"2012-03-21 20:06:46\"},\"name\":\"American-Style
|
|
55
|
+
Premium Lager\",\"description\":\"This style has low malt (and adjunct) sweetness,
|
|
56
|
+
is medium bodied, and should contain no or a low percentage (less than 25%)
|
|
57
|
+
of adjuncts. Color may be light straw to golden. Alcohol content and bitterness
|
|
58
|
+
may also be greater. Hop aroma and flavor is low or negligible. Light fruity
|
|
59
|
+
esters are acceptable. Chill haze and diacetyl should be absent. Note: Some
|
|
60
|
+
beers marketed as \\\"premium\\\" (based on price) may not fit this definition.\",\"ibuMin\":\"6\",\"ibuMax\":\"15\",\"abvMin\":\"4.3\",\"abvMax\":\"5\",\"srmMin\":\"2\",\"srmMax\":\"6\",\"ogMin\":\"1.044\",\"fgMin\":\"1.01\",\"fgMax\":\"1.014\",\"createDate\":\"2012-03-21
|
|
61
|
+
20:06:46\"}}],\"status\":\"success\"}"
|
|
62
|
+
http_version:
|
|
63
|
+
recorded_at: Fri, 15 Aug 2014 00:53:44 GMT
|
|
64
|
+
recorded_with: VCR 2.9.2
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: http://api.brewerydb.com/v2/beers?key=xxx&name=Corona
|
|
6
|
+
body:
|
|
7
|
+
encoding: US-ASCII
|
|
8
|
+
string: ''
|
|
9
|
+
headers: {}
|
|
10
|
+
response:
|
|
11
|
+
status:
|
|
12
|
+
code: 200
|
|
13
|
+
message: OK
|
|
14
|
+
headers:
|
|
15
|
+
Content-Type:
|
|
16
|
+
- application/json
|
|
17
|
+
Date:
|
|
18
|
+
- Fri, 15 Aug 2014 00:53:45 GMT
|
|
19
|
+
Server:
|
|
20
|
+
- Apache/2.2.27 (Amazon)
|
|
21
|
+
Vary:
|
|
22
|
+
- Accept-Encoding
|
|
23
|
+
X-Powered-By:
|
|
24
|
+
- PHP/5.3.28
|
|
25
|
+
X-Ratelimit-Limit:
|
|
26
|
+
- '400'
|
|
27
|
+
X-Ratelimit-Remaining:
|
|
28
|
+
- '391'
|
|
29
|
+
Content-Length:
|
|
30
|
+
- '36'
|
|
31
|
+
Connection:
|
|
32
|
+
- keep-alive
|
|
33
|
+
body:
|
|
34
|
+
encoding: UTF-8
|
|
35
|
+
string: "{\"currentPage\":1,\"status\":\"success\"}"
|
|
36
|
+
http_version:
|
|
37
|
+
recorded_at: Fri, 15 Aug 2014 00:53:44 GMT
|
|
38
|
+
recorded_with: VCR 2.9.2
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'brewry'
|
|
2
|
+
require 'vcr'
|
|
3
|
+
require 'webmock'
|
|
4
|
+
|
|
5
|
+
# with VCR, there is no need to set up an api key to run tests
|
|
6
|
+
|
|
7
|
+
VCR.configure do |c|
|
|
8
|
+
c.cassette_library_dir = 'spec/fixtures'
|
|
9
|
+
c.hook_into :webmock
|
|
10
|
+
c.configure_rspec_metadata!
|
|
11
|
+
c.ignore_localhost = true
|
|
12
|
+
# remove to start creating cassettes
|
|
13
|
+
c.allow_http_connections_when_no_cassette = true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
RSpec.configure do |c|
|
|
17
|
+
c.around(:each, :vcr) do |example|
|
|
18
|
+
name = example.metadata[:full_description].split(/\s+/, 2).join('/').gsub(/[^\w\/]+/, '_')
|
|
19
|
+
VCR.use_cassette(name) { example.call }
|
|
20
|
+
end
|
|
21
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: Brewry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Ochoa
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|
|
@@ -24,6 +24,48 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0.13'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rspec
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: vcr
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '2.9'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '2.9'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: webmock
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '1.18'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '1.18'
|
|
27
69
|
description: Brewry provides an interface to the BreweryDB API. Instead of returning
|
|
28
70
|
a struct or some other Brewry instance, it returns a hash that can quickly be inserted
|
|
29
71
|
into ActiveRecord. It also allows you to replace the keys for certain results such
|
|
@@ -35,11 +77,22 @@ extensions: []
|
|
|
35
77
|
extra_rdoc_files: []
|
|
36
78
|
files:
|
|
37
79
|
- ".gitignore"
|
|
80
|
+
- ".travis.yml"
|
|
81
|
+
- Gemfile
|
|
82
|
+
- Gemfile.lock
|
|
38
83
|
- README.rdoc
|
|
84
|
+
- Rakefile
|
|
39
85
|
- brewry.gemspec
|
|
40
86
|
- lib/brewry.rb
|
|
87
|
+
- lib/brewry/exceptions.rb
|
|
41
88
|
- lib/brewry/version.rb
|
|
42
|
-
- lib/utils/
|
|
89
|
+
- lib/utils/string_utils.rb
|
|
90
|
+
- spec/brewry_spec.rb
|
|
91
|
+
- spec/fixtures/Brewry/api_endpoints/should_return_brewery.yml
|
|
92
|
+
- spec/fixtures/Brewry/api_endpoints/should_search_styles.yml
|
|
93
|
+
- spec/fixtures/Brewry/return_types/should_be_an_array.yml
|
|
94
|
+
- spec/fixtures/Brewry/return_types/should_return_nil_when_no_results_found.yml
|
|
95
|
+
- spec/spec_helper.rb
|
|
43
96
|
homepage: https://github.com/DanyHunter/brewry
|
|
44
97
|
licenses:
|
|
45
98
|
- MIT
|
|
@@ -52,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
52
105
|
requirements:
|
|
53
106
|
- - ">="
|
|
54
107
|
- !ruby/object:Gem::Version
|
|
55
|
-
version:
|
|
108
|
+
version: 2.1.0
|
|
56
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
110
|
requirements:
|
|
58
111
|
- - ">="
|
|
@@ -64,4 +117,10 @@ rubygems_version: 2.2.1
|
|
|
64
117
|
signing_key:
|
|
65
118
|
specification_version: 4
|
|
66
119
|
summary: Brewry provides an interface to the BreweryDB API.
|
|
67
|
-
test_files:
|
|
120
|
+
test_files:
|
|
121
|
+
- spec/brewry_spec.rb
|
|
122
|
+
- spec/fixtures/Brewry/api_endpoints/should_return_brewery.yml
|
|
123
|
+
- spec/fixtures/Brewry/api_endpoints/should_search_styles.yml
|
|
124
|
+
- spec/fixtures/Brewry/return_types/should_be_an_array.yml
|
|
125
|
+
- spec/fixtures/Brewry/return_types/should_return_nil_when_no_results_found.yml
|
|
126
|
+
- spec/spec_helper.rb
|