tankard 0.0.1 → 0.1.0
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/CHANGELOG.md +12 -0
- data/README.md +49 -2
- data/lib/tankard/api/beer.rb +77 -28
- data/lib/tankard/api/beers.rb +45 -31
- data/lib/tankard/api/search.rb +132 -0
- data/lib/tankard/api/style.rb +80 -0
- data/lib/tankard/api/styles.rb +48 -0
- data/lib/tankard/api/utils/find.rb +35 -0
- data/lib/tankard/api/utils/page_finders.rb +67 -0
- data/lib/tankard/client.rb +15 -0
- data/lib/tankard/configuration.rb +5 -6
- data/lib/tankard/error.rb +1 -1
- data/lib/tankard/version.rb +1 -1
- data/lib/tankard.rb +4 -0
- data/spec/shared_examples_for_find.rb +30 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/tankard/api/beer_spec.rb +81 -57
- data/spec/tankard/api/beers_spec.rb +24 -60
- data/spec/tankard/api/search_spec.rb +232 -0
- data/spec/tankard/api/style_spec.rb +61 -0
- data/spec/tankard/api/styles_spec.rb +18 -0
- data/spec/tankard/api/utils/find_spec.rb +27 -0
- data/spec/tankard/api/utils/page_finders_spec.rb +116 -0
- data/spec/tankard/client_spec.rb +59 -0
- data/tankard.gemspec +1 -1
- metadata +20 -3
@@ -0,0 +1,232 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tankard::Api::Search do
|
4
|
+
|
5
|
+
let(:search) { Tankard::Api::Search.new(@request) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
@request = mock("request")
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#query" do
|
12
|
+
|
13
|
+
it "sets options[:q] with the query the user wants to run" do
|
14
|
+
search.query("test")
|
15
|
+
search_options = search.instance_variable_get(:"@options")
|
16
|
+
expect(search_options[:q]).to eql("test")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "returns itself" do
|
20
|
+
expect(search.object_id).to eql(search.query("test").object_id)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#params" do
|
26
|
+
|
27
|
+
it "sets parameters" do
|
28
|
+
search.params(withSocialAccounts: "y", withGuilds: "n")
|
29
|
+
search_options = search.instance_variable_get(:"@options")
|
30
|
+
expect(search_options[:withSocialAccounts]).to eql("y")
|
31
|
+
expect(search_options[:withGuilds]).to eql("n")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "merges params when called multiple times" do
|
35
|
+
search.params(test: "n")
|
36
|
+
search.params(test: "y")
|
37
|
+
search_options = search.instance_variable_get(:"@options")
|
38
|
+
expect(search_options[:test]).to eql("y")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "returns itself" do
|
42
|
+
expect(search.object_id).to eql(search.params.object_id)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#type" do
|
47
|
+
|
48
|
+
it "sets options[:type] with the type to search for" do
|
49
|
+
search.type("beer")
|
50
|
+
search_options = search.instance_variable_get(:"@options")
|
51
|
+
expect(search_options[:type]).to eql("beer")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "returns itself" do
|
55
|
+
expect(search.object_id).to eql (search.type("test").object_id)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#page" do
|
60
|
+
|
61
|
+
it "sets options[:p] with the page number to load" do
|
62
|
+
search.page(1)
|
63
|
+
search_options = search.instance_variable_get(:"@options")
|
64
|
+
expect(search_options[:p]).to eql(1)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "returns itself" do
|
68
|
+
expect(search.object_id).to eql(search.page(1).object_id)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#upc" do
|
73
|
+
|
74
|
+
before do
|
75
|
+
search.upc("123")
|
76
|
+
@search_options = search.instance_variable_get(:"@options")
|
77
|
+
end
|
78
|
+
|
79
|
+
it "sets options[:endpoint] with the search endpoint to use" do
|
80
|
+
expect(@search_options[:endpoint]).to eql("upc")
|
81
|
+
end
|
82
|
+
|
83
|
+
it "sets options[:code] with the upc code" do
|
84
|
+
expect(@search_options[:code]).to eql("123")
|
85
|
+
end
|
86
|
+
|
87
|
+
it "returns itself" do
|
88
|
+
expect(search.object_id).to eql(search.upc("123").object_id)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "#geo_point" do
|
93
|
+
|
94
|
+
before do
|
95
|
+
search.geo_point(1.23, 4.56)
|
96
|
+
@search_options = search.instance_variable_get(:"@options")
|
97
|
+
end
|
98
|
+
|
99
|
+
it "sets options[:endpoint] with the correct search endpoint to use" do
|
100
|
+
expect(@search_options[:endpoint]).to eql("geo/point")
|
101
|
+
end
|
102
|
+
|
103
|
+
it "sets options[:lat] with the latitude" do
|
104
|
+
expect(@search_options[:lat]).to eql(1.23)
|
105
|
+
end
|
106
|
+
|
107
|
+
it "sets options[:lng] with the longitude" do
|
108
|
+
expect(@search_options[:lng]).to eql(4.56)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "returns itself" do
|
112
|
+
expect(search.object_id).to eql(search.geo_point(1.3, 4.5).object_id)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "#each" do
|
117
|
+
|
118
|
+
it "should call raise_if_required_options_not_set" do
|
119
|
+
search.stub(:find_on_single_or_all_pages).and_return(nil)
|
120
|
+
search.should_receive(:raise_if_required_options_not_set)
|
121
|
+
search.each
|
122
|
+
end
|
123
|
+
|
124
|
+
it "calls the super object with the block" do
|
125
|
+
block = -> x { x }
|
126
|
+
search.stub(:raise_if_required_options_not_set).and_return(nil)
|
127
|
+
search.should_receive(:find_on_single_or_all_pages)
|
128
|
+
search.each(&block)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "private methods" do
|
133
|
+
|
134
|
+
describe "#raise_if_required_options_not_set" do
|
135
|
+
|
136
|
+
context "the endpoint is not set" do
|
137
|
+
|
138
|
+
it "raises Tankard::Error::NoSearchQuery when the query is not set" do
|
139
|
+
expect { search.send(:raise_if_required_options_not_set) }.to raise_error(Tankard::Error::MissingParameter, "No search query set")
|
140
|
+
end
|
141
|
+
|
142
|
+
it "does not raise Tankard::Error::NoSearchQuery when the query is set" do
|
143
|
+
search.instance_variable_get(:"@options")[:q] = "findme"
|
144
|
+
expect { search.send(:raise_if_required_options_not_set) }.not_to raise_error(Tankard::Error::MissingParameter, "No search query set")
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context "the endpoint is set to upc" do
|
149
|
+
|
150
|
+
before do
|
151
|
+
search.instance_variable_get(:"@options")[:endpoint] = "upc"
|
152
|
+
end
|
153
|
+
|
154
|
+
it "raises Tankard::Error::MissingParameter when code is not set" do
|
155
|
+
expect { search.send(:raise_if_required_options_not_set) }.to raise_error(Tankard::Error::MissingParameter, "missing parameter: code")
|
156
|
+
end
|
157
|
+
|
158
|
+
it "does not raise Tankard::Error::MissingParameter when code is set" do
|
159
|
+
search.instance_variable_get(:"@options")[:code] = "1234"
|
160
|
+
expect { search.send(:raise_if_required_options_not_set) }.not_to raise_error(Tankard::Error::MissingParameter)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
context "the endpoint is set to geo/point" do
|
165
|
+
|
166
|
+
before do
|
167
|
+
search.instance_variable_get(:"@options")[:endpoint] = "geo/point"
|
168
|
+
end
|
169
|
+
|
170
|
+
it "raises Tankard::Error::MissingParameter when latitude is not set" do
|
171
|
+
search.instance_variable_get(:"@options")[:lng] = 123
|
172
|
+
expect { search.send(:raise_if_required_options_not_set) }.to raise_error(Tankard::Error::MissingParameter, "missing Parameters: lat, lng")
|
173
|
+
end
|
174
|
+
|
175
|
+
it "raises Tankard::Error::MissingParameter when longitude is not set" do
|
176
|
+
search.instance_variable_get(:"@options")[:lat] = 123
|
177
|
+
expect { search.send(:raise_if_required_options_not_set) }.to raise_error(Tankard::Error::MissingParameter, "missing Parameters: lat, lng")
|
178
|
+
end
|
179
|
+
|
180
|
+
it "raises Tankard::Error::MissingParameter when latitude and longitude are not set" do
|
181
|
+
expect { search.send(:raise_if_required_options_not_set) }.to raise_error(Tankard::Error::MissingParameter, "missing Parameters: lat, lng")
|
182
|
+
end
|
183
|
+
|
184
|
+
it "does not raise Tankard::Error::MissingParameter when latitude and longitude are set" do
|
185
|
+
search.instance_variable_get(:"@options")[:lat] = 123
|
186
|
+
search.instance_variable_get(:"@options")[:lng] = 123
|
187
|
+
expect { search.send(:raise_if_required_options_not_set) }.not_to raise_error(Tankard::Error::MissingParameter)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe "#http_request_uri" do
|
193
|
+
|
194
|
+
context "no endpoint is set" do
|
195
|
+
|
196
|
+
it "returns search" do
|
197
|
+
expect(search.send(:http_request_uri)).to eql("search")
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context "an endpoint is set" do
|
202
|
+
|
203
|
+
before do
|
204
|
+
search.instance_variable_get(:"@options")[:endpoint] = "upc"
|
205
|
+
end
|
206
|
+
|
207
|
+
it "adds the endpoint to the uri" do
|
208
|
+
expect(search.send(:http_request_uri)).to eql("search/upc")
|
209
|
+
end
|
210
|
+
|
211
|
+
it "removes the endpoint from options" do
|
212
|
+
search.send(:http_request_uri)
|
213
|
+
expect(search.instance_variable_get(:"@options")[:endpoint]).to eql(nil)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
describe "#http_client" do
|
219
|
+
|
220
|
+
it "returns the request variable that is passed when the class is created" do
|
221
|
+
expect(search.send(:http_client).object_id).to eql(@request.object_id)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
describe "#http_request_parameters" do
|
226
|
+
|
227
|
+
it "returns the options for the request" do
|
228
|
+
expect(search.send(:http_request_parameters).object_id).to eql(search.instance_variable_get(:"@options").object_id)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tankard::Api::Style do
|
4
|
+
let(:style) { Tankard::Api::Style.new(@request) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
@request = mock("request")
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#find" do
|
11
|
+
|
12
|
+
before do
|
13
|
+
@request.stub(:get).with("style/1", {}).and_return({ "data" => "valid1_found"})
|
14
|
+
@request.stub(:get).with("style/2", {}).and_return({ "data" => "valid2_found"})
|
15
|
+
@request.stub(:get).with("style/3", {}).and_raise(Tankard::Error::HttpError)
|
16
|
+
@request.stub(:get).with("style/4", {}).and_raise(Tankard::Error::HttpError)
|
17
|
+
end
|
18
|
+
|
19
|
+
it_should_behave_like "the find method" do
|
20
|
+
let(:context) { style }
|
21
|
+
let(:valid_items) { [1, 2] }
|
22
|
+
let(:valid_responses) { ["valid1_found", "valid2_found"] }
|
23
|
+
let(:invalid_items) { [3, 4] }
|
24
|
+
let(:valid_invalid_items) { valid_items + invalid_items }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "#id" do
|
29
|
+
|
30
|
+
it "sets the options[:id] for the style id passed in" do
|
31
|
+
style.id(1)
|
32
|
+
style_options = style.instance_variable_get(:"@options")
|
33
|
+
expect(style_options[:id]).to eql(1)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns itself" do
|
37
|
+
expect(style.object_id).to eql(style.id(1).object_id)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "when making a request" do
|
42
|
+
|
43
|
+
context "and the id for a style is not set" do
|
44
|
+
|
45
|
+
it "raises a Tankard::Error::NoStyleId" do
|
46
|
+
expect { style.each { |s| p s } }.to raise_error(Tankard::Error::MissingParameter, "No style id set")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "and the id for a style is set" do
|
51
|
+
|
52
|
+
before do
|
53
|
+
@request.stub(:get).with("style/1", {}).and_return({ "data" => ["style_valid"] })
|
54
|
+
end
|
55
|
+
|
56
|
+
it "uses the style id in the uri" do
|
57
|
+
expect(style.id(1).collect { |x| x}).to eql(["style_valid"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tankard::Api::Styles do
|
4
|
+
|
5
|
+
let(:styles) { Tankard::Api::Styles.new(@request) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
@request = mock("request")
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "when making a request" do
|
12
|
+
|
13
|
+
it "returns the data portion of the request" do
|
14
|
+
@request.stub(:get).with("styles", {}).and_return({"data" => ["test1", "test2"]})
|
15
|
+
expect(styles.collect { |x| x}).to eql(["test1", "test2"])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tankard::Api::Utils::Find do
|
4
|
+
|
5
|
+
let(:find) { Class.new { include Tankard::Api::Utils::Find }.new }
|
6
|
+
|
7
|
+
describe "#route" do
|
8
|
+
|
9
|
+
it "raises NoMethodError" do
|
10
|
+
expect { find.send(:route) }.to raise_error(NoMethodError, "Must implement and return the base route")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#http_client" do
|
15
|
+
|
16
|
+
it "raises NoMethodError" do
|
17
|
+
expect { find.send(:http_client) }.to raise_error(NoMethodError, "Must return the http object to make requests with")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#http_request_parameters" do
|
22
|
+
|
23
|
+
it "raises NoMethodError" do
|
24
|
+
expect { find.send(:http_request_parameters) }.to raise_error(NoMethodError, "Must return a hash like structure with request parameters")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tankard::Api::Utils::PageFinders do
|
4
|
+
|
5
|
+
let(:finders) { Class.new { include Tankard::Api::Utils::PageFinders }.new }
|
6
|
+
|
7
|
+
describe "private methods" do
|
8
|
+
|
9
|
+
before do
|
10
|
+
@request = mock("request")
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#http_request_uri" do
|
14
|
+
|
15
|
+
it "raises NoMethodError" do
|
16
|
+
expect { finders.send(:http_request_uri) }.to raise_error(NoMethodError)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#http_client" do
|
21
|
+
|
22
|
+
it "raises NoMethodError" do
|
23
|
+
expect { finders.send(:http_client) }.to raise_error(NoMethodError)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#http_request_parameters" do
|
28
|
+
|
29
|
+
it "raises NoMethodError" do
|
30
|
+
expect { finders.send(:http_request_parameters) }.to raise_error(NoMethodError)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#call_block_with_data" do
|
35
|
+
|
36
|
+
it "raises Tankard::Error::InvalidResponse when no data" do
|
37
|
+
expect { finders.send(:call_block_with_data, nil, nil) }.to raise_error(Tankard::Error::InvalidResponse)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "accepts a hash of data" do
|
41
|
+
result = []
|
42
|
+
block = -> n { result.push(n) }
|
43
|
+
finders.send(:call_block_with_data, {"test" => "something"}, block)
|
44
|
+
expect(result).to eql([{"test"=> "something"}])
|
45
|
+
end
|
46
|
+
|
47
|
+
it "loops through an array of data" do
|
48
|
+
result = []
|
49
|
+
block = -> n { result.push(n+1) }
|
50
|
+
finders.send(:call_block_with_data, [1,2,3], block)
|
51
|
+
expect(result).to eql([2,3,4])
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#find_on_single_page" do
|
56
|
+
|
57
|
+
it "sends response[data] to call_block_with_data" do
|
58
|
+
finders.stub!(:get_request).and_return({"data" => ["test"]})
|
59
|
+
finders.should_receive(:call_block_with_data).with(["test"], nil)
|
60
|
+
finders.send(:find_on_single_page, "test", @request, {}, nil)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "returns 0 when number of pages is not set" do
|
64
|
+
finders.stub!(:get_request).and_return({"data" => ["test"]})
|
65
|
+
finders.stub!(:call_block_with_data).with(["test"], nil)
|
66
|
+
expect(finders.send(:find_on_single_page, "test", @request, {}, nil)).to eql(0)
|
67
|
+
end
|
68
|
+
|
69
|
+
it "returns a value when number of pages is set" do
|
70
|
+
finders.stub!(:get_request).and_return({"data" => ["test"], "numberOfPages" => "3"})
|
71
|
+
finders.stub!(:call_block_with_data).with(["test"], nil)
|
72
|
+
expect(finders.send(:find_on_single_page, "test", @request, {}, nil)).to eql(3)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "#find_on_all_pages" do
|
78
|
+
|
79
|
+
it "only sets the page when the page is greater than 1" do
|
80
|
+
finders.should_receive(:find_on_single_page).with("test", @request, {}, nil).and_return(2)
|
81
|
+
finders.should_not_receive(:find_on_single_page).with("test", @request, {p:1}, nil)
|
82
|
+
finders.should_receive(:find_on_single_page).with("test", @request, {p:2}, nil).and_return(2)
|
83
|
+
|
84
|
+
finders.send(:find_on_all_pages, "test", @request, {}, nil)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#find_on_single_or_all_pages" do
|
89
|
+
|
90
|
+
it "calls find_with_options when a page is set in options" do
|
91
|
+
finders.should_receive(:find_on_single_page).with("test", nil, {p:2}, nil)
|
92
|
+
finders.send(:find_on_single_or_all_pages, "test", nil, {p:2}, nil)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "calls find_on_all_pages when a page is not set in options" do
|
96
|
+
finders.should_receive(:find_on_all_pages).with("test", nil, {}, nil)
|
97
|
+
finders.send(:find_on_single_or_all_pages, "test", nil, {}, nil)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "#each" do
|
102
|
+
|
103
|
+
before do
|
104
|
+
finders.stub!(:http_request_uri).and_return("test")
|
105
|
+
finders.stub!(:http_client).and_return(nil)
|
106
|
+
finders.stub!(:http_request_parameters).and_return({})
|
107
|
+
end
|
108
|
+
|
109
|
+
it "calls find_on_single_or_all_pages" do
|
110
|
+
finders.should_receive(:find_on_single_or_all_pages).with("test", nil, {}, nil)
|
111
|
+
finders.each
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
data/spec/tankard/client_spec.rb
CHANGED
@@ -51,4 +51,63 @@ describe Tankard::Client do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
describe "#search" do
|
56
|
+
|
57
|
+
context "when called" do
|
58
|
+
|
59
|
+
it "does not reuse an existing search object" do
|
60
|
+
search = client.search
|
61
|
+
expect(search.object_id).not_to eql(client.search.object_id)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "when passed a hash of options" do
|
66
|
+
|
67
|
+
before do
|
68
|
+
@request = mock("request")
|
69
|
+
Tankard::Request.stub!(:new).and_return(@request)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "passes the options to the search object" do
|
73
|
+
Tankard::Api::Search.should_receive(:new).with(@request, { test: 123 })
|
74
|
+
client.search({ test: 123 })
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#styles" do
|
80
|
+
|
81
|
+
context "when called" do
|
82
|
+
|
83
|
+
it "does not reuse an existing styles object" do
|
84
|
+
styles = client.styles
|
85
|
+
expect(styles.object_id != client.styles.object_id).to be_true
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe "#style" do
|
91
|
+
|
92
|
+
context "when called" do
|
93
|
+
|
94
|
+
it "does not reuse an existing style object" do
|
95
|
+
style = client.style
|
96
|
+
expect(style.object_id).not_to eql(client.style.object_id)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context "when passed a hash of options" do
|
101
|
+
|
102
|
+
before do
|
103
|
+
@request = mock("request")
|
104
|
+
Tankard::Request.stub!(:new).and_return(@request)
|
105
|
+
end
|
106
|
+
|
107
|
+
it "passes the options to the style object" do
|
108
|
+
Tankard::Api::Style.should_receive(:new).with(@request, { test: 123 })
|
109
|
+
client.style({ test: 123 })
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
54
113
|
end
|
data/tankard.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["matthewshafer@mac.com"]
|
11
11
|
spec.description = %q{Connector to the BreweryDB api}
|
12
12
|
spec.summary = %q{Allows easy quering to the breweryDB api}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/matthewshafer/tankard"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tankard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Shafer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -183,19 +183,30 @@ files:
|
|
183
183
|
- lib/tankard/api/beer.rb
|
184
184
|
- lib/tankard/api/beers.rb
|
185
185
|
- lib/tankard/api/request/get.rb
|
186
|
+
- lib/tankard/api/search.rb
|
187
|
+
- lib/tankard/api/style.rb
|
188
|
+
- lib/tankard/api/styles.rb
|
189
|
+
- lib/tankard/api/utils/find.rb
|
190
|
+
- lib/tankard/api/utils/page_finders.rb
|
186
191
|
- lib/tankard/client.rb
|
187
192
|
- lib/tankard/configuration.rb
|
188
193
|
- lib/tankard/error.rb
|
189
194
|
- lib/tankard/request.rb
|
190
195
|
- lib/tankard/version.rb
|
196
|
+
- spec/shared_examples_for_find.rb
|
191
197
|
- spec/spec_helper.rb
|
192
198
|
- spec/tankard/api/beer_spec.rb
|
193
199
|
- spec/tankard/api/beers_spec.rb
|
200
|
+
- spec/tankard/api/search_spec.rb
|
201
|
+
- spec/tankard/api/style_spec.rb
|
202
|
+
- spec/tankard/api/styles_spec.rb
|
203
|
+
- spec/tankard/api/utils/find_spec.rb
|
204
|
+
- spec/tankard/api/utils/page_finders_spec.rb
|
194
205
|
- spec/tankard/client_spec.rb
|
195
206
|
- spec/tankard/request_spec.rb
|
196
207
|
- spec/tankard_spec.rb
|
197
208
|
- tankard.gemspec
|
198
|
-
homepage:
|
209
|
+
homepage: https://github.com/matthewshafer/tankard
|
199
210
|
licenses:
|
200
211
|
- MIT
|
201
212
|
metadata: {}
|
@@ -220,9 +231,15 @@ signing_key:
|
|
220
231
|
specification_version: 4
|
221
232
|
summary: Allows easy quering to the breweryDB api
|
222
233
|
test_files:
|
234
|
+
- spec/shared_examples_for_find.rb
|
223
235
|
- spec/spec_helper.rb
|
224
236
|
- spec/tankard/api/beer_spec.rb
|
225
237
|
- spec/tankard/api/beers_spec.rb
|
238
|
+
- spec/tankard/api/search_spec.rb
|
239
|
+
- spec/tankard/api/style_spec.rb
|
240
|
+
- spec/tankard/api/styles_spec.rb
|
241
|
+
- spec/tankard/api/utils/find_spec.rb
|
242
|
+
- spec/tankard/api/utils/page_finders_spec.rb
|
226
243
|
- spec/tankard/client_spec.rb
|
227
244
|
- spec/tankard/request_spec.rb
|
228
245
|
- spec/tankard_spec.rb
|