attune 1.0.16 → 1.0.17
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/lib/attune/api/anonymous.rb +5 -5
- data/lib/attune/mocks.rb +1 -1
- data/lib/attune/version.rb +1 -1
- data/spec/attune/client_spec.rb +35 -34
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8230dee1fb1dfdd00d7ecafdac74c1d2b201b6fb
|
4
|
+
data.tar.gz: 206ce4cbc055a9840de86b9b81bddcb7c0908609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bef816aabbdbc5452d9d11f07fe6610203fa333f40ffdc70145ce995c749a94f5a2f20204e87b580270ac12d5b018bd199962d9e4cffd0cf1fd1499d0868d70
|
7
|
+
data.tar.gz: 1db4fda86189b962b830e8575a022768dcc70a549a1fb57e7eb29ba7cff3c145972379042bd2313775a0f1e7d6c18daaa2f017420a3435c733b4e7d61a66724e
|
data/lib/attune/api/anonymous.rb
CHANGED
@@ -33,10 +33,10 @@ module Attune
|
|
33
33
|
|
34
34
|
headers = nil
|
35
35
|
post_body = nil
|
36
|
-
response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
37
|
-
if response
|
38
|
-
|
39
|
-
else
|
36
|
+
#response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
37
|
+
#if response
|
38
|
+
# Attune::Model::AnonymousResult.new(JSON.parse(response.body))
|
39
|
+
#else
|
40
40
|
mockProc = MOCKS['Anonymous.create']
|
41
41
|
if mockProc
|
42
42
|
mockResponse = mockProc.call()
|
@@ -44,7 +44,7 @@ module Attune
|
|
44
44
|
else
|
45
45
|
nil
|
46
46
|
end
|
47
|
-
end
|
47
|
+
# end
|
48
48
|
|
49
49
|
end
|
50
50
|
|
data/lib/attune/mocks.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Attune
|
2
2
|
MOCKS = {
|
3
|
-
'Anonymous.create' => Proc.new{ {:id => SecureRandom.uuid } },
|
3
|
+
'Anonymous.create' => Proc.new{ |body| {:id => SecureRandom.uuid } },
|
4
4
|
'Entities.get_rankings' => Proc.new{ |body| { :ranking => body.ids.map(&:to_s) } },
|
5
5
|
'Entities.batch_get_rankings' => Proc.new{ |body|
|
6
6
|
{ :results => body.requests.map {
|
data/lib/attune/version.rb
CHANGED
data/spec/attune/client_spec.rb
CHANGED
@@ -24,26 +24,26 @@ describe Attune::Client do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "API errors" do
|
27
|
-
it "will raise timeout" do
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
it "will raise ConnectionFailed" do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
it "will raise ConnectionFailed on Errno::ENOENT" do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
27
|
+
# it "will raise timeout" do
|
28
|
+
# stubs.post("anonymous", nil){ raise Faraday::Error::TimeoutError.new("test") }
|
29
|
+
# expect {
|
30
|
+
# client.anonymous.create
|
31
|
+
# }.to raise_exception(Faraday::Error::TimeoutError)
|
32
|
+
# stubs.verify_stubbed_calls
|
33
|
+
# end
|
34
|
+
# it "will raise ConnectionFailed" do
|
35
|
+
# stubs.post("anonymous", nil){ raise Faraday::Error::ConnectionFailed.new("test") }
|
36
|
+
# expect {
|
37
|
+
# client.anonymous.create
|
38
|
+
# }.to raise_exception(Faraday::Error::ConnectionFailed)
|
39
|
+
# stubs.verify_stubbed_calls
|
40
|
+
# end
|
41
|
+
# it "will raise ConnectionFailed on Errno::ENOENT" do
|
42
|
+
# stubs.post("anonymous", nil){ raise Errno::ENOENT.new("test") }
|
43
|
+
# expect {
|
44
|
+
# client.anonymous.create
|
45
|
+
# }.to raise_exception(Faraday::Error::ConnectionFailed)
|
46
|
+
# end
|
47
47
|
it "will raise AuthenticationException" do
|
48
48
|
stubs.post("oauth/token",
|
49
49
|
{:client_id=>"id", :client_secret=>"secret", grant_type: :client_credentials}
|
@@ -56,14 +56,14 @@ describe Attune::Client do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "disabled" do
|
59
|
-
context "with raise" do
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
59
|
+
# context "with raise" do
|
60
|
+
# let(:options){ {disabled: true, exception_handler: :raise} }
|
61
|
+
# it "will raise DisalbedException" do
|
62
|
+
# expect {
|
63
|
+
# client.anonymous.create
|
64
|
+
# }.to raise_exception(Attune::DisabledException)
|
65
|
+
# end
|
66
|
+
# end
|
67
67
|
context "with mock" do
|
68
68
|
let(:options){ {disabled: true, exception_handler: :mock} }
|
69
69
|
|
@@ -148,13 +148,14 @@ describe Attune::Client do
|
|
148
148
|
expect(token).to eq('secret-token')
|
149
149
|
end
|
150
150
|
|
151
|
-
it "can create_anonymous generating an id" do
|
152
|
-
stubs.post("anonymous", nil){ [200,
|
153
|
-
result = client.anonymous.create
|
154
|
-
stubs.verify_stubbed_calls
|
151
|
+
# it "can create_anonymous generating an id" do
|
152
|
+
# stubs.post("anonymous", nil){ [200, %[{"id": "abcd123"}]] }
|
153
|
+
# result = client.anonymous.create
|
154
|
+
# stubs.verify_stubbed_calls
|
155
155
|
|
156
|
-
expect(result.id).to eq('abcd123')
|
157
|
-
|
156
|
+
# expect(result.id).to eq('abcd123')
|
157
|
+
# expect(result.id).to match(/^[a-z0-9\-]+$/)
|
158
|
+
# end
|
158
159
|
|
159
160
|
it "can bind" do
|
160
161
|
stubs.put("anonymous/abcd123", %[{"customer":"foobar"}]){ [200, {}, nil] }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attune
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|