brewerydb2 0.1.0 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/brewerydb2.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "brewerydb2"
7
7
  s.version = Brewerydb2::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Ben Woodall"]
9
+ s.authors = ["Ben Woodall","Chris Mar"]
10
10
  s.email = ["mail@benwoodall.com"]
11
11
  s.homepage = "https://github.com/benwoody/brewerydb2"
12
12
  s.summary = %q{Simple Wrapper around the BreweryDB API v2}
data/lib/brewerydb2.rb CHANGED
@@ -2,110 +2,265 @@ require 'rubygems'
2
2
  require 'httparty'
3
3
  require 'hashie'
4
4
 
5
+ #
6
+ # BreweryDb.configure do |config|
7
+ # config.apikey = ''
8
+ # end
9
+
5
10
  class BreweryDb2
6
11
  include HTTParty
7
- base_uri 'http://www.brewerydb.com/api'
12
+ base_uri 'http://api.brewerydb.com/v2'
8
13
  format :json
9
14
  default_params :format => 'JSON'
10
15
  @@apikey = nil
11
16
 
17
+ def self.heartbeat(options={})
18
+ options.merge!({
19
+ :key => apikey
20
+ })
21
+
22
+ response = get("/heartbeat", :query => options)
23
+ Hashie::Mash.new(response)['data'] if response.code == 200
24
+ end
25
+
12
26
  def self.search(options={})
13
27
  options.merge!({
14
- :apikey => apikey
28
+ :key => apikey
15
29
  })
16
30
 
17
31
  response = get("/search", :query => options)
18
- Hashie::Mash.new(response['results']) if response.code == 200
32
+ Hashie::Mash.new(response)['data'] if response.code == 200
19
33
  end
20
34
 
21
35
  def self.breweries(options={})
22
36
  options.merge!({
23
- :apikey => apikey
37
+ :key => apikey
24
38
  })
25
39
 
26
40
  response = get("/breweries", :query => options)
27
- Hashie::Mash.new(response['breweries']) if response.code == 200
41
+ Hashie::Mash.new(response)['data'] if response.code == 200
28
42
  end
29
43
 
30
44
  def self.brewery(id, options={})
31
45
  options.merge!({
32
- :apikey => apikey
46
+ :key => apikey
33
47
  })
34
48
 
35
- response = get("/breweries/#{id}", :query => options)
36
- Hashie::Mash.new(response['breweries']['brewery']) if response.code == 200
49
+ response = get("/brewery/#{id}", :query => options)
50
+ Hashie::Mash.new(response)['data'] if response.code == 200
37
51
  end
38
52
 
39
53
  def self.beers(options={})
40
54
  options.merge!({
41
- :apikey => apikey
55
+ :key => apikey
42
56
  })
43
57
 
44
58
  response = get("/beers", :query => options)
45
- Hashie::Mash.new(response['beers']) if response.code == 200
59
+ Hashie::Mash.new(response)['data'] if response.code == 200
46
60
  end
47
61
 
48
62
  def self.beer(id, options={})
49
63
  options.merge!({
50
- :apikey => apikey
64
+ :key => apikey
51
65
  })
52
66
 
53
- response = get("/beers/#{id}", :query => options)
54
- Hashie::Mash.new(response['beers']['beer']) if response.code == 200
67
+ response = get("/beer/#{id}", :query => options)
68
+ Hashie::Mash.new(response)['data'] if response.code == 200
55
69
  end
56
70
 
57
71
  def self.styles(options={})
58
72
  options.merge!({
59
- :apikey => apikey
73
+ :key => apikey
60
74
  })
61
75
 
62
76
  response = get("/styles", :query => options)
63
- Hashie::Mash.new(response['styles']) if response.code == 200
77
+ Hashie::Mash.new(response)['data'] if response.code == 200
64
78
  end
65
79
 
66
80
  def self.style(id, options={})
67
81
  options.merge!({
68
- :apikey => apikey
82
+ :key => apikey
69
83
  })
70
84
 
71
- response = get("/styles/#{id}", :query => options)
72
- Hashie::Mash.new(response['styles']['style']) if response.code == 200
85
+ response = get("/style/#{id}", :query => options)
86
+ Hashie::Mash.new(response)['data'] if response.code == 200
73
87
  end
74
88
 
75
89
  def self.categories(options={})
76
90
  options.merge!({
77
- :apikey => apikey
91
+ :key => apikey
78
92
  })
79
93
 
80
94
  response = get("/categories", :query => options)
81
- Hashie::Mash.new(response['categories']) if response.code == 200
95
+ Hashie::Mash.new(response)['data'] if response.code == 200
82
96
  end
83
97
 
84
98
  def self.category(id, options={})
85
99
  options.merge!({
86
- :apikey => apikey
100
+ :key => apikey
87
101
  })
88
102
 
89
- response = get("/categories/#{id}", :query => options)
90
- Hashie::Mash.new(response['categories']['category']) if response.code == 200
103
+ response = get("/category/#{id}", :query => options)
104
+ Hashie::Mash.new(response)['data'] if response.code == 200
91
105
  end
92
106
 
93
107
  def self.glassware(options={})
94
108
  options.merge!({
95
- :apikey => apikey
109
+ :key => apikey
96
110
  })
97
111
 
98
112
  response = get("/glassware", :query => options)
99
- Hashie::Mash.new(response['glassware']) if response.code == 200
113
+ Hashie::Mash.new(response)['data'] if response.code == 200
100
114
  end
101
115
 
102
116
  def self.glass(id, options={})
103
117
  options.merge!({
104
- :apikey => apikey
118
+ :key => apikey
119
+ })
120
+
121
+ response = get("/glass/#{id}", :query => options)
122
+ Hashie::Mash.new(response)['data'] if response.code == 200
123
+ end
124
+
125
+ def self.events(options={})
126
+ options.merge!({
127
+ :key => apikey
128
+ })
129
+
130
+ response = get("/events", :query => options)
131
+ Hashie::Mash.new(response)['data'] if response.code == 200
132
+ end
133
+
134
+ def self.event(id, options={})
135
+ options.merge!({
136
+ :key => apikey
137
+ })
138
+
139
+ response = get("/event/#{id}", :query => options)
140
+ Hashie::Mash.new(response)['data'] if response.code == 200
141
+ end
142
+
143
+ def self.featured(options={})
144
+ options.merge!({
145
+ :key => apikey
146
+ })
147
+
148
+ response = get("/featured", :query => options)
149
+ Hashie::Mash.new(response)['data'] if response.code == 200
150
+ end
151
+
152
+ def self.features(options={})
153
+ options.merge!({
154
+ :key => apikey
155
+ })
156
+
157
+ response = get("/features", :query => options)
158
+ Hashie::Mash.new(response)['data'] if response.code == 200
159
+ end
160
+
161
+
162
+ def self.feature(id, options={})
163
+ options.merge!({
164
+ :key => apikey
165
+ })
166
+
167
+ response = get("/feature/#{id}", :query => options)
168
+ Hashie::Mash.new(response)['data'] if response.code == 200
169
+ end
170
+
171
+ def self.fluidsizes(options={})
172
+ options.merge!({
173
+ :key => apikey
105
174
  })
106
175
 
107
- response = get("/glassware/#{id}", :query => options)
108
- Hashie::Mash.new(response['glassware']['glass']) if response.code == 200
176
+ response = get("/fluidsizes", :query => options)
177
+ Hashie::Mash.new(response)['data'] if response.code == 200
178
+ end
179
+
180
+
181
+ def self.fluidsize(id, options={})
182
+ options.merge!({
183
+ :key => apikey
184
+ })
185
+
186
+ response = get("/fluidsize/#{id}", :query => options)
187
+ Hashie::Mash.new(response)['data'] if response.code == 200
188
+ end
189
+
190
+ def self.guilds(options={})
191
+ options.merge!({
192
+ :key => apikey
193
+ })
194
+
195
+ response = get("/guilds", :query => options)
196
+ Hashie::Mash.new(response)['data'] if response.code == 200
197
+ end
198
+
199
+
200
+ def self.guild(id, options={})
201
+ options.merge!({
202
+ :key => apikey
203
+ })
204
+
205
+ response = get("/guild/#{id}", :query => options)
206
+ Hashie::Mash.new(response)['data'] if response.code == 200
207
+ end
208
+
209
+ def self.ingredients(options={})
210
+ options.merge!({
211
+ :key => apikey
212
+ })
213
+
214
+ response = get("/ingredients", :query => options)
215
+ Hashie::Mash.new(response)['data'] if response.code == 200
216
+ end
217
+
218
+
219
+ def self.ingredient(id, options={})
220
+ options.merge!({
221
+ :key => apikey
222
+ })
223
+
224
+ response = get("/ingredient/#{id}", :query => options)
225
+ Hashie::Mash.new(response)['data'] if response.code == 200
226
+ end
227
+
228
+ def self.locations(options={})
229
+ options.merge!({
230
+ :key => apikey
231
+ })
232
+
233
+ response = get("/locations", :query => options)
234
+ Hashie::Mash.new(response)['data'] if response.code == 200
235
+ end
236
+
237
+
238
+ def self.location(id, options={})
239
+ options.merge!({
240
+ :key => apikey
241
+ })
242
+
243
+ response = get("/location/#{id}", :query => options)
244
+ Hashie::Mash.new(response)['data'] if response.code == 200
245
+ end
246
+
247
+ def self.socialsites(options={})
248
+ options.merge!({
249
+ :key => apikey
250
+ })
251
+
252
+ response = get("/socialsites", :query => options)
253
+ Hashie::Mash.new(response)['data'] if response.code == 200
254
+ end
255
+
256
+
257
+ def self.socialsite(id, options={})
258
+ options.merge!({
259
+ :key => apikey
260
+ })
261
+
262
+ response = get("/socialsite/#{id}", :query => options)
263
+ Hashie::Mash.new(response)['data'] if response.code == 200
109
264
  end
110
265
 
111
266
  def self.apikey
@@ -121,4 +276,3 @@ class BreweryDb2
121
276
  end
122
277
 
123
278
  end
124
-
@@ -1,3 +1,3 @@
1
1
  module Brewerydb2
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brewerydb2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ben Woodall
9
+ - Chris Mar
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -13,7 +14,7 @@ date: 2012-07-09 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: httparty
16
- requirement: &77952460 !ruby/object:Gem::Requirement
17
+ requirement: &71910910 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ! '>='
@@ -21,10 +22,10 @@ dependencies:
21
22
  version: 0.7.3
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *77952460
25
+ version_requirements: *71910910
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: hashie
27
- requirement: &77951570 !ruby/object:Gem::Requirement
28
+ requirement: &71910080 !ruby/object:Gem::Requirement
28
29
  none: false
29
30
  requirements:
30
31
  - - ! '>='
@@ -32,10 +33,10 @@ dependencies:
32
33
  version: 1.0.0
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *77951570
36
+ version_requirements: *71910080
36
37
  - !ruby/object:Gem::Dependency
37
38
  name: rspec
38
- requirement: &77950460 !ruby/object:Gem::Requirement
39
+ requirement: &71909670 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
42
  - - ! '>='
@@ -43,7 +44,7 @@ dependencies:
43
44
  version: '0'
44
45
  type: :development
45
46
  prerelease: false
46
- version_requirements: *77950460
47
+ version_requirements: *71909670
47
48
  description: An API wrapper for PintLabs BreweryDB
48
49
  email:
49
50
  - mail@benwoodall.com
@@ -51,7 +52,6 @@ executables: []
51
52
  extensions: []
52
53
  extra_rdoc_files: []
53
54
  files:
54
- - .gitignore
55
55
  - Gemfile
56
56
  - README.rdoc
57
57
  - Rakefile
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- pkg/*
2
- *.gem
3
- .bundle