harpy 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +37 -33
- data/harpy.gemspec +8 -10
- data/lib/harpy/client.rb +2 -2
- data/spec/harpy/client_spec.rb +13 -13
- data/spec/harpy/entry_point_spec.rb +3 -3
- data/spec/harpy/resource_spec.rb +40 -40
- data/spec/harpy_spec.rb +4 -4
- data/spec/spec_helper.rb +2 -5
- metadata +16 -27
- data/lib/harpy/version.rb +0 -3
data/Gemfile.lock
CHANGED
@@ -1,46 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
harpy (0.
|
4
|
+
harpy (0.5.0)
|
5
5
|
activemodel (>= 3.1.0)
|
6
6
|
activesupport (>= 3.1.0)
|
7
7
|
hash-deep-merge (~> 0.1.1)
|
8
|
-
typhoeus (
|
8
|
+
typhoeus (= 0.6.5)
|
9
9
|
yajl-ruby (~> 1.1.0)
|
10
10
|
|
11
11
|
GEM
|
12
12
|
remote: http://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activemodel (
|
15
|
-
activesupport (=
|
16
|
-
builder (~> 3.
|
17
|
-
activesupport (
|
18
|
-
i18n (~> 0.6)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
rake (0.9.2.2)
|
29
|
-
redcarpet (2.1.0)
|
30
|
-
rocco (0.8.2)
|
31
|
-
mustache
|
32
|
-
redcarpet
|
33
|
-
rspec (2.6.0)
|
34
|
-
rspec-core (~> 2.6.0)
|
35
|
-
rspec-expectations (~> 2.6.0)
|
36
|
-
rspec-mocks (~> 2.6.0)
|
37
|
-
rspec-core (2.6.4)
|
38
|
-
rspec-expectations (2.6.0)
|
39
|
-
diff-lcs (~> 1.1.2)
|
40
|
-
rspec-mocks (2.6.0)
|
41
|
-
typhoeus (0.4.2)
|
42
|
-
ffi (~> 1.0)
|
14
|
+
activemodel (4.0.0)
|
15
|
+
activesupport (= 4.0.0)
|
16
|
+
builder (~> 3.1.0)
|
17
|
+
activesupport (4.0.0)
|
18
|
+
i18n (~> 0.6, >= 0.6.4)
|
19
|
+
minitest (~> 4.2)
|
20
|
+
multi_json (~> 1.3)
|
21
|
+
thread_safe (~> 0.1)
|
22
|
+
tzinfo (~> 0.3.37)
|
23
|
+
atomic (1.1.13)
|
24
|
+
builder (3.1.4)
|
25
|
+
diff-lcs (1.2.4)
|
26
|
+
ethon (0.6.1)
|
27
|
+
ffi (>= 1.3.0)
|
43
28
|
mime-types (~> 1.18)
|
29
|
+
ffi (1.9.0)
|
30
|
+
hash-deep-merge (0.1.1)
|
31
|
+
i18n (0.6.5)
|
32
|
+
mime-types (1.24)
|
33
|
+
minitest (4.7.5)
|
34
|
+
multi_json (1.7.9)
|
35
|
+
rake (10.1.0)
|
36
|
+
rspec (2.14.1)
|
37
|
+
rspec-core (~> 2.14.0)
|
38
|
+
rspec-expectations (~> 2.14.0)
|
39
|
+
rspec-mocks (~> 2.14.0)
|
40
|
+
rspec-core (2.14.5)
|
41
|
+
rspec-expectations (2.14.2)
|
42
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
43
|
+
rspec-mocks (2.14.3)
|
44
|
+
thread_safe (0.1.2)
|
45
|
+
atomic
|
46
|
+
typhoeus (0.6.5)
|
47
|
+
ethon (~> 0.6.1)
|
48
|
+
tzinfo (0.3.37)
|
44
49
|
yajl-ruby (1.1.0)
|
45
50
|
|
46
51
|
PLATFORMS
|
@@ -49,5 +54,4 @@ PLATFORMS
|
|
49
54
|
DEPENDENCIES
|
50
55
|
harpy!
|
51
56
|
rake (>= 0.8.7)
|
52
|
-
|
53
|
-
rspec (~> 2.6.0)
|
57
|
+
rspec
|
data/harpy.gemspec
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "harpy/version"
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "harpy"
|
7
|
-
s.version =
|
6
|
+
s.version = "0.5.0"
|
8
7
|
s.platform = Gem::Platform::RUBY
|
9
8
|
s.authors = ["Joseph HALTER", "Jonathan TRON"]
|
10
9
|
s.email = ["joseph.halter@thetalentbox.com", "jonathan.tron@thetalentbox.com"]
|
@@ -18,13 +17,12 @@ Gem::Specification.new do |s|
|
|
18
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
18
|
s.require_paths = ["lib"]
|
20
19
|
|
21
|
-
s.add_runtime_dependency
|
22
|
-
s.add_runtime_dependency
|
23
|
-
s.add_runtime_dependency
|
24
|
-
s.add_runtime_dependency
|
25
|
-
s.add_runtime_dependency
|
20
|
+
s.add_runtime_dependency "typhoeus", ["0.6.5"]
|
21
|
+
s.add_runtime_dependency "activesupport", [">= 3.1.0"]
|
22
|
+
s.add_runtime_dependency "activemodel", [">= 3.1.0"]
|
23
|
+
s.add_runtime_dependency "hash-deep-merge", ["~> 0.1.1"]
|
24
|
+
s.add_runtime_dependency "yajl-ruby", ["~> 1.1.0"]
|
26
25
|
|
27
|
-
s.add_development_dependency
|
28
|
-
s.add_development_dependency
|
29
|
-
s.add_development_dependency("rocco", ["~> 0.7"])
|
26
|
+
s.add_development_dependency "rake", [">= 0.8.7"]
|
27
|
+
s.add_development_dependency "rspec"
|
30
28
|
end
|
data/lib/harpy/client.rb
CHANGED
data/spec/harpy/client_spec.rb
CHANGED
@@ -19,35 +19,35 @@ describe Harpy::Client do
|
|
19
19
|
context "with one url" do
|
20
20
|
before do
|
21
21
|
@expected = Typhoeus::Response.new :code => 200
|
22
|
-
Typhoeus
|
22
|
+
Typhoeus.stub(entry_url, method: method){@expected}
|
23
23
|
end
|
24
24
|
it "sends a #{method.to_s.upcase} to the url" do
|
25
25
|
subject.send(method, entry_url).should == @expected
|
26
26
|
end
|
27
27
|
it "merges options" do
|
28
28
|
client = Harpy::Client.new :headers => {"Authorization" => "spec"}
|
29
|
-
Typhoeus
|
29
|
+
Typhoeus.stub(entry_url, method: method){Typhoeus::Response.new :code => 200}
|
30
30
|
response = client.send method, entry_url, :headers => {"X-Files" => "Harpy"}
|
31
|
-
response.request.headers.should include({"X-Files" => "Harpy", "Authorization" => "spec"})
|
31
|
+
response.request.options[:headers].should include({"X-Files" => "Harpy", "Authorization" => "spec"})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
context "with multiple urls" do
|
35
35
|
it "does not execute requests" do
|
36
36
|
lambda {
|
37
37
|
subject.send method, [entry_url, users_url]
|
38
|
-
}.should_not raise_error
|
38
|
+
}.should_not raise_error
|
39
39
|
end
|
40
40
|
it "returns one requests per url" do
|
41
41
|
requests = subject.send method, [entry_url, users_url]
|
42
42
|
requests.size.should == 2
|
43
|
-
requests.collect
|
43
|
+
requests.collect{|r| r.options[:method]}.should =~ [method, method]
|
44
44
|
requests.collect(&:url).should =~ [entry_url, users_url]
|
45
45
|
end
|
46
46
|
it "merges options" do
|
47
47
|
client = Harpy::Client.new :headers => {"Authorization" => "spec"}
|
48
48
|
requests = client.send method, [entry_url, users_url], :headers => {"X-Files" => "Harpy"}
|
49
49
|
requests.each do |request|
|
50
|
-
request.headers.should include({"X-Files" => "Harpy", "Authorization" => "spec"})
|
50
|
+
request.options[:headers].should include({"X-Files" => "Harpy", "Authorization" => "spec"})
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -57,9 +57,9 @@ describe Harpy::Client do
|
|
57
57
|
before do
|
58
58
|
@entry_response = Typhoeus::Response.new :code => 200, :body => "entry"
|
59
59
|
@users_response = Typhoeus::Response.new :code => 200, :body => "users"
|
60
|
-
|
61
|
-
Typhoeus
|
62
|
-
Typhoeus
|
60
|
+
|
61
|
+
Typhoeus.stub(entry_url, method: :get){ @entry_response }
|
62
|
+
Typhoeus.stub(users_url, method: :get){ @users_response }
|
63
63
|
end
|
64
64
|
it "executes requests in parallel" do
|
65
65
|
Typhoeus::Hydra.hydra.should_receive(:run).once
|
@@ -79,18 +79,18 @@ describe Harpy::Client do
|
|
79
79
|
describe "#invalid_code(response)" do
|
80
80
|
it "raises Harpy::ClientTimeout on request timeout" do
|
81
81
|
lambda {
|
82
|
-
subject.invalid_code
|
82
|
+
subject.invalid_code double("Response", :timed_out? => true)
|
83
83
|
}.should raise_error Harpy::ClientTimeout
|
84
84
|
end
|
85
85
|
it "raises Harpy::ClientError on code 0" do
|
86
86
|
lambda {
|
87
|
-
subject.invalid_code
|
87
|
+
subject.invalid_code double("Response", :timed_out? => false, :code => 0, :curl_error_message => "Could not connect to server")
|
88
88
|
}.should raise_error Harpy::ClientError, "Could not connect to server"
|
89
89
|
end
|
90
90
|
it "raises Harpy::InvalidResponseCode with code otherwise" do
|
91
91
|
lambda {
|
92
|
-
subject.invalid_code
|
92
|
+
subject.invalid_code double("Response", :timed_out? => false, :code => 404)
|
93
93
|
}.should raise_error Harpy::InvalidResponseCode, "404"
|
94
94
|
end
|
95
95
|
end
|
96
|
-
end
|
96
|
+
end
|
@@ -31,7 +31,7 @@ describe Harpy::EntryPoint do
|
|
31
31
|
subject.resource_url("company_url")
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
describe "#urn(urn)" do
|
36
36
|
let(:urn) { "urn:harpy:company:1" }
|
37
37
|
let(:company_url) { "#{url}/company/1"}
|
@@ -52,5 +52,5 @@ describe Harpy::EntryPoint do
|
|
52
52
|
subject.urn(urn)
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
56
|
-
end
|
55
|
+
|
56
|
+
end
|
data/spec/harpy/resource_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Harpy::Resource do
|
|
6
6
|
let(:json_response) { %Q|{"name": "Harpy ltd", "link": [{"rel": "self", "href": "#{company_url}"}]}| }
|
7
7
|
let(:success_response) { Typhoeus::Response.new :code => 200, :body => json_response}
|
8
8
|
it "queries multiple resources in parallel and return instances" do
|
9
|
-
Typhoeus
|
9
|
+
Typhoeus.stub(company_url, method: :get){ success_response }
|
10
10
|
responses = Harpy::Resource.from_url({ Harpy::Spec::Company => [company_url] })
|
11
11
|
responses.should have(1).keys
|
12
12
|
responses[Harpy::Spec::Company].should have(1).item
|
@@ -105,8 +105,8 @@ describe "class including Harpy::Resource" do
|
|
105
105
|
]
|
106
106
|
}
|
107
107
|
eos
|
108
|
-
Typhoeus
|
109
|
-
Typhoeus
|
108
|
+
Typhoeus.stub(url1, method: :get){ response1 }
|
109
|
+
Typhoeus.stub(url2, method: :get){ response2 }
|
110
110
|
results = Harpy::Spec::Company.from_url [url1, url2]
|
111
111
|
results.should have(2).items
|
112
112
|
results[0].should be_kind_of Harpy::Spec::Company
|
@@ -131,18 +131,18 @@ describe "class including Harpy::Resource" do
|
|
131
131
|
let(:url) { "http://localhost/company/1" }
|
132
132
|
it "asks Harpy.entry_point to convert urn to url then call .from_url" do
|
133
133
|
# urn:harpy:company:1 -> http://localhost/company/1
|
134
|
-
Harpy.entry_point =
|
134
|
+
Harpy.entry_point = double
|
135
135
|
Harpy.entry_point.should_receive(:urn).with(urn).and_return url
|
136
136
|
|
137
137
|
# http://localhost/company/1 -> Harpy::Spec::Company instance
|
138
|
-
Harpy::Spec::Company.should_receive(:from_url).with(url).and_return(expected =
|
138
|
+
Harpy::Spec::Company.should_receive(:from_url).with(url).and_return(expected = double)
|
139
139
|
Harpy::Spec::Company.from_urn(urn).should be expected
|
140
140
|
end
|
141
141
|
it "is nil if urn is not found" do
|
142
142
|
# urn:harpy:company:1 -> nil
|
143
|
-
Harpy.entry_point =
|
143
|
+
Harpy.entry_point = double
|
144
144
|
Harpy.entry_point.should_receive(:urn).with(urn)
|
145
|
-
|
145
|
+
|
146
146
|
Harpy::Spec::Company.from_urn(urn).should be_nil
|
147
147
|
end
|
148
148
|
end
|
@@ -160,7 +160,7 @@ describe "class including Harpy::Resource" do
|
|
160
160
|
it "raises Harpy::EntryPointRequired" do
|
161
161
|
# 1 -> urn:harpy:company:1
|
162
162
|
Harpy::Spec::Company.should_receive(:urn).with(1).and_return urn
|
163
|
-
|
163
|
+
|
164
164
|
lambda{
|
165
165
|
Harpy::Spec::Company.from_id(1)
|
166
166
|
}.should raise_error Harpy::EntryPointRequired
|
@@ -172,27 +172,27 @@ describe "class including Harpy::Resource" do
|
|
172
172
|
it "asks Harpy.entry_point to convert urn to url then call .from_url" do
|
173
173
|
# 1 -> urn:harpy:company:1
|
174
174
|
Harpy::Spec::Company.should_receive(:urn).with(1).and_return urn
|
175
|
-
|
175
|
+
|
176
176
|
# urn:harpy:company:1 -> http://localhost/company/1
|
177
|
-
Harpy.entry_point =
|
177
|
+
Harpy.entry_point = double
|
178
178
|
Harpy.entry_point.should_receive(:urn).with(urn).and_return url
|
179
|
-
|
179
|
+
|
180
180
|
# http://localhost/company/1 -> Harpy::Spec::Company instance
|
181
|
-
Harpy::Spec::Company.should_receive(:from_url).with(url).and_return(expected =
|
181
|
+
Harpy::Spec::Company.should_receive(:from_url).with(url).and_return(expected = double)
|
182
182
|
Harpy::Spec::Company.from_id(1).should be expected
|
183
183
|
end
|
184
184
|
it "is nil if urn is not found" do
|
185
185
|
# 1 -> urn:harpy:company:1
|
186
186
|
Harpy::Spec::Company.should_receive(:urn).with(1).and_return urn
|
187
|
-
|
187
|
+
|
188
188
|
# urn:harpy:company:1 -> nil
|
189
|
-
Harpy.entry_point =
|
189
|
+
Harpy.entry_point = double
|
190
190
|
Harpy.entry_point.should_receive(:urn).with(urn)
|
191
|
-
|
191
|
+
|
192
192
|
Harpy::Spec::Company.from_id(1).should be_nil
|
193
193
|
end
|
194
194
|
end
|
195
|
-
end
|
195
|
+
end
|
196
196
|
describe ".delete_from_url(url)" do
|
197
197
|
context "called with only one url" do
|
198
198
|
let(:url){ "http://localhost/company/1" }
|
@@ -228,16 +228,16 @@ describe "class including Harpy::Resource" do
|
|
228
228
|
let(:url) { "http://localhost/company/1" }
|
229
229
|
it "asks Harpy.entry_point to convert urn to url then call .from_url" do
|
230
230
|
# urn:harpy:company:1 -> http://localhost/company/1
|
231
|
-
Harpy.entry_point =
|
231
|
+
Harpy.entry_point = double
|
232
232
|
Harpy.entry_point.should_receive(:urn).with(urn).and_return url
|
233
233
|
|
234
234
|
# http://localhost/company/1 -> Harpy::Spec::Company instance
|
235
|
-
Harpy::Spec::Company.should_receive(:delete_from_url).with(url).and_return(expected =
|
235
|
+
Harpy::Spec::Company.should_receive(:delete_from_url).with(url).and_return(expected = double)
|
236
236
|
Harpy::Spec::Company.delete_from_urn(urn).should be expected
|
237
237
|
end
|
238
238
|
it "is nil if urn is not found" do
|
239
239
|
# urn:harpy:company:1 -> nil
|
240
|
-
Harpy.entry_point =
|
240
|
+
Harpy.entry_point = double
|
241
241
|
Harpy.entry_point.should_receive(:urn).with(urn)
|
242
242
|
|
243
243
|
Harpy::Spec::Company.delete_from_urn(urn).should be_false
|
@@ -257,7 +257,7 @@ describe "class including Harpy::Resource" do
|
|
257
257
|
it "raises Harpy::EntryPointRequired" do
|
258
258
|
# 1 -> urn:harpy:company:1
|
259
259
|
Harpy::Spec::Company.should_receive(:urn).with(1).and_return urn
|
260
|
-
|
260
|
+
|
261
261
|
lambda{
|
262
262
|
Harpy::Spec::Company.delete_from_id(1)
|
263
263
|
}.should raise_error Harpy::EntryPointRequired
|
@@ -269,23 +269,23 @@ describe "class including Harpy::Resource" do
|
|
269
269
|
it "asks Harpy.entry_point to convert urn to url then call .from_url" do
|
270
270
|
# 1 -> urn:harpy:company:1
|
271
271
|
Harpy::Spec::Company.should_receive(:urn).with(1).and_return urn
|
272
|
-
|
272
|
+
|
273
273
|
# urn:harpy:company:1 -> http://localhost/company/1
|
274
|
-
Harpy.entry_point =
|
274
|
+
Harpy.entry_point = double
|
275
275
|
Harpy.entry_point.should_receive(:urn).with(urn).and_return url
|
276
|
-
|
276
|
+
|
277
277
|
# http://localhost/company/1 -> Harpy::Spec::Company instance
|
278
|
-
Harpy::Spec::Company.should_receive(:delete_from_url).with(url).and_return(expected =
|
278
|
+
Harpy::Spec::Company.should_receive(:delete_from_url).with(url).and_return(expected = double)
|
279
279
|
Harpy::Spec::Company.delete_from_id(1).should be expected
|
280
280
|
end
|
281
281
|
it "is nil if urn is not found" do
|
282
282
|
# 1 -> urn:harpy:company:1
|
283
283
|
Harpy::Spec::Company.should_receive(:urn).with(1).and_return urn
|
284
|
-
|
284
|
+
|
285
285
|
# urn:harpy:company:1 -> nil
|
286
|
-
Harpy.entry_point =
|
286
|
+
Harpy.entry_point = double
|
287
287
|
Harpy.entry_point.should_receive(:urn).with(urn)
|
288
|
-
|
288
|
+
|
289
289
|
Harpy::Spec::Company.delete_from_id(1).should be_false
|
290
290
|
end
|
291
291
|
end
|
@@ -305,7 +305,7 @@ describe "class including Harpy::Resource" do
|
|
305
305
|
describe ".search(conditions)" do
|
306
306
|
let(:url){ "http://localhost/company" }
|
307
307
|
before do
|
308
|
-
Harpy.entry_point =
|
308
|
+
Harpy.entry_point = double
|
309
309
|
Harpy.entry_point.should_receive(:resource_url).with("harpy/spec/company").and_return url
|
310
310
|
end
|
311
311
|
it "return properly filled instances on 200" do
|
@@ -435,7 +435,7 @@ describe "class including Harpy::Resource" do
|
|
435
435
|
end
|
436
436
|
describe "#url" do
|
437
437
|
it "searches url to self inside links" do
|
438
|
-
subject.should_receive(:link).with("self").and_return (expected =
|
438
|
+
subject.should_receive(:link).with("self").and_return (expected = double)
|
439
439
|
subject.url.should be expected
|
440
440
|
end
|
441
441
|
it "is nil when no link to self can be found" do
|
@@ -445,8 +445,8 @@ describe "class including Harpy::Resource" do
|
|
445
445
|
end
|
446
446
|
describe "#url_collection" do
|
447
447
|
it "defaults to entry_point link which rel matches resource name" do
|
448
|
-
Harpy.entry_point =
|
449
|
-
Harpy.entry_point.should_receive(:resource_url).with("harpy/spec/company").and_return (expected =
|
448
|
+
Harpy.entry_point = double
|
449
|
+
Harpy.entry_point.should_receive(:resource_url).with("harpy/spec/company").and_return (expected = double)
|
450
450
|
subject.url_collection.should be expected
|
451
451
|
end
|
452
452
|
end
|
@@ -533,14 +533,14 @@ describe "class including Harpy::Resource" do
|
|
533
533
|
end
|
534
534
|
describe "#as_json" do
|
535
535
|
let(:url) { "http://localhost/user/1" }
|
536
|
-
subject do
|
536
|
+
subject do
|
537
537
|
Harpy::Spec::User.new({
|
538
|
-
"urn" => "urn:harpy:user:1",
|
539
|
-
"company_name" => "Stark Enterprises",
|
538
|
+
"urn" => "urn:harpy:user:1",
|
539
|
+
"company_name" => "Stark Enterprises",
|
540
540
|
"link" => [{"rel" => "self", "href" => url}],
|
541
541
|
})
|
542
542
|
end
|
543
|
-
|
543
|
+
|
544
544
|
it "exclude link and urn from attributes" do
|
545
545
|
subject.as_json.should == {"company_name" => "Stark Enterprises"}
|
546
546
|
end
|
@@ -633,8 +633,8 @@ describe "class including Harpy::Resource" do
|
|
633
633
|
let(:body) { '{"company_name":"Stark Enterprises"}' }
|
634
634
|
subject do
|
635
635
|
Harpy::Spec::User.new({
|
636
|
-
"urn" => "urn:harpy:user:1",
|
637
|
-
"company_name" => "Stark Enterprises",
|
636
|
+
"urn" => "urn:harpy:user:1",
|
637
|
+
"company_name" => "Stark Enterprises",
|
638
638
|
"link" => [{"rel" => "self", "href" => url}],
|
639
639
|
})
|
640
640
|
end
|
@@ -710,8 +710,8 @@ describe "class including Harpy::Resource" do
|
|
710
710
|
let(:url) { "http://localhost/user/1" }
|
711
711
|
subject do
|
712
712
|
Harpy::Spec::User.new({
|
713
|
-
"urn" => "urn:harpy:user:1",
|
714
|
-
"company_name" => "Stark Enterprises",
|
713
|
+
"urn" => "urn:harpy:user:1",
|
714
|
+
"company_name" => "Stark Enterprises",
|
715
715
|
"link" => [{"rel" => "self", "href" => url}],
|
716
716
|
})
|
717
717
|
end
|
@@ -794,4 +794,4 @@ describe "class including Harpy::Resource" do
|
|
794
794
|
company1.should_not == company2
|
795
795
|
end
|
796
796
|
end
|
797
|
-
end
|
797
|
+
end
|
data/spec/harpy_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Harpy do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "does allow using another client" do
|
11
|
-
custom_client =
|
11
|
+
custom_client = double
|
12
12
|
Harpy.client = custom_client
|
13
13
|
Harpy.client.should be custom_client
|
14
14
|
end
|
@@ -33,7 +33,7 @@ describe Harpy do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "does allow setting entry_point manually" do
|
36
|
-
Harpy.entry_point = (entry_point =
|
36
|
+
Harpy.entry_point = (entry_point = double)
|
37
37
|
Harpy.entry_point.should be entry_point
|
38
38
|
entry_point.should_receive(:url).and_return "http://localhost"
|
39
39
|
Harpy.entry_point_url.should == "http://localhost"
|
@@ -41,7 +41,7 @@ describe Harpy do
|
|
41
41
|
|
42
42
|
it "Harpy.reset clears both client and entry_point" do
|
43
43
|
Harpy.entry_point_url = "http://localhost"
|
44
|
-
Harpy.client = (custom_client =
|
44
|
+
Harpy.client = (custom_client = double)
|
45
45
|
Harpy.reset
|
46
46
|
Harpy.entry_point_url.should be_nil
|
47
47
|
Harpy.client.should_not be custom_client
|
@@ -94,4 +94,4 @@ describe Harpy::InvalidResponseCode do
|
|
94
94
|
it "is an Harpy::Exception" do
|
95
95
|
Harpy::InvalidResponseCode.ancestors.should include Harpy::Exception
|
96
96
|
end
|
97
|
-
end
|
97
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,11 +3,8 @@ require "typhoeus"
|
|
3
3
|
|
4
4
|
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each{|f| require f}
|
5
5
|
|
6
|
-
# Do not allow external connections
|
7
|
-
Typhoeus::Hydra.allow_net_connect = false
|
8
|
-
|
9
6
|
RSpec.configure do |config|
|
10
7
|
config.after(:each) do
|
11
|
-
Typhoeus::
|
8
|
+
Typhoeus::Expectation.clear
|
12
9
|
end
|
13
|
-
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: harpy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,24 +10,24 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: typhoeus
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.6.5
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - '='
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 0.
|
30
|
+
version: 0.6.5
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: activesupport
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,33 +113,17 @@ dependencies:
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|
116
|
-
- -
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: 2.6.0
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
|
-
requirements:
|
124
|
-
- - ~>
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: 2.6.0
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: rocco
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
|
-
requirements:
|
132
|
-
- - ~>
|
116
|
+
- - ! '>='
|
133
117
|
- !ruby/object:Gem::Version
|
134
|
-
version: '0
|
118
|
+
version: '0'
|
135
119
|
type: :development
|
136
120
|
prerelease: false
|
137
121
|
version_requirements: !ruby/object:Gem::Requirement
|
138
122
|
none: false
|
139
123
|
requirements:
|
140
|
-
- -
|
124
|
+
- - ! '>='
|
141
125
|
- !ruby/object:Gem::Version
|
142
|
-
version: '0
|
126
|
+
version: '0'
|
143
127
|
description: Client for REST API with HATEOAS
|
144
128
|
email:
|
145
129
|
- joseph.halter@thetalentbox.com
|
@@ -162,7 +146,6 @@ files:
|
|
162
146
|
- lib/harpy/collection.rb
|
163
147
|
- lib/harpy/entry_point.rb
|
164
148
|
- lib/harpy/resource.rb
|
165
|
-
- lib/harpy/version.rb
|
166
149
|
- spec/harpy/client_spec.rb
|
167
150
|
- spec/harpy/entry_point_spec.rb
|
168
151
|
- spec/harpy/resource_spec.rb
|
@@ -181,12 +164,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
164
|
- - ! '>='
|
182
165
|
- !ruby/object:Gem::Version
|
183
166
|
version: '0'
|
167
|
+
segments:
|
168
|
+
- 0
|
169
|
+
hash: 3317959473737263468
|
184
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
171
|
none: false
|
186
172
|
requirements:
|
187
173
|
- - ! '>='
|
188
174
|
- !ruby/object:Gem::Version
|
189
175
|
version: '0'
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
hash: 3317959473737263468
|
190
179
|
requirements: []
|
191
180
|
rubyforge_project:
|
192
181
|
rubygems_version: 1.8.23
|
data/lib/harpy/version.rb
DELETED