spark_api 1.4.17 → 1.4.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/lib/spark_api/errors.rb +2 -1
- data/lib/spark_api/faraday_middleware.rb +2 -1
- data/spec/unit/spark_api/faraday_middleware_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTQxYzNmMDgyMGU3NTNlMGJhMDA4ZWUwMDNmMDk0ZjFmOTdkZjQwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjNkYjFiYTAwOTRmNjA5M2I5MzA5MjJkNTFiZWYwMDg0ODZiNjFkZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWE3ZTg0M2JiNmU0NTdlNzYwNDU4NDFiMjNmNTZiNTA4YzVlMzJiMTUyZjQ2
|
10
|
+
MjBlNzc4NWEzOTQ2ZDQ0MjQzNGVkYjI1M2E5NmE4OGUzYmI1OWM0ZTE5MmZk
|
11
|
+
YzAwZjk1YWE0OGRmYTlkODJmNTFhOGQwZWYyNjNhZjliMDY1YzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjAwMGMxOGZhNDE2YTc0NDUwZTk4ZjRmOTQ0MzVjOTRjYTMwZWY0MWI3ZjNl
|
14
|
+
YjhiMzkzNGI4YzdmYzkxNDRlMzc2MmE4YjFhNTMxYjcwOTEyOWE4NDljNmQy
|
15
|
+
OWIxMjJiOGM5ZDM4YjJhMTc3N2U5OGM0ZmMzYWViYmU1ZWE5ZGY=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.18
|
data/lib/spark_api/errors.rb
CHANGED
@@ -21,7 +21,7 @@ module SparkApi
|
|
21
21
|
# Errors built from API responses
|
22
22
|
class InvalidResponse < StandardError; end
|
23
23
|
class ClientError < StandardError
|
24
|
-
attr_reader :code, :status, :details, :request_path
|
24
|
+
attr_reader :code, :status, :details, :request_path, :errors
|
25
25
|
def initialize (options = {})
|
26
26
|
# Support the standard initializer for errors
|
27
27
|
opts = options.is_a?(Hash) ? options : {:message => options.to_s}
|
@@ -29,6 +29,7 @@ module SparkApi
|
|
29
29
|
@status = opts[:status]
|
30
30
|
@details = opts[:details]
|
31
31
|
@request_path = opts[:request_path]
|
32
|
+
@errors = opts[:errors]
|
32
33
|
super(opts[:message])
|
33
34
|
end
|
34
35
|
|
@@ -48,6 +48,13 @@ describe SparkApi do
|
|
48
48
|
"Code": "0000"
|
49
49
|
}}']
|
50
50
|
}
|
51
|
+
stub.get('/badresourcerequest') { [409, {}, '{"D": {
|
52
|
+
"Message": "FlexmlsApiResponse::Errors::Errors",
|
53
|
+
"Code": 1053,
|
54
|
+
"Success": false,
|
55
|
+
"Errors": "Some errors and stuff."
|
56
|
+
}}']
|
57
|
+
}
|
51
58
|
stub.get('/invalidjson') { [200, {}, '{"OMG": "THIS IS NOT THE API JSON THAT I KNOW AND <3!!!"}'] }
|
52
59
|
stub.get('/garbage') { [200, {}, 'THIS IS TOTAL GARBAGE!'] }
|
53
60
|
end
|
@@ -85,6 +92,12 @@ describe SparkApi do
|
|
85
92
|
response.results.length.should be > 0
|
86
93
|
end
|
87
94
|
|
95
|
+
it "should include the errors in the response" do
|
96
|
+
expect { @connection.get('/badresourcerequest')}.to raise_error(SparkApi::BadResourceRequest){ |e|
|
97
|
+
e.errors.should == "Some errors and stuff."
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
88
101
|
end
|
89
102
|
|
90
103
|
describe "#decompress_body" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spark_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Hornseth
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|