spark_api 1.4.17 → 1.4.18

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjRjMWMwOTI0Y2RiNGI2ZGM0NWE5YzUyNjdkOTMxOTIwY2FmNWE1YQ==
4
+ OTQxYzNmMDgyMGU3NTNlMGJhMDA4ZWUwMDNmMDk0ZjFmOTdkZjQwMg==
5
5
  data.tar.gz: !binary |-
6
- ZWI5Y2FjZjY0MTkxZmZhMGI3ZGRhNDJmZjY0YTE4ZjAyYTdiMjViOA==
6
+ ZjNkYjFiYTAwOTRmNjA5M2I5MzA5MjJkNTFiZWYwMDg0ODZiNjFkZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDhjZmYwZjlmZDZjN2E2Y2UyMWIxNjQyNzNlMmU4MmY1NWYzNmQ4NWU2YWEx
10
- YTUyYmYwNjNiOTgxNTU1N2I1MjYzYTI4MGFmMDYxZWNiNDZkODEzZjJhNmIz
11
- MmQ3M2ZkODNmNTQyYWU4MWIzOTIxNTQ0MDk3ZDQxYmY5NDQxYmE=
9
+ OWE3ZTg0M2JiNmU0NTdlNzYwNDU4NDFiMjNmNTZiNTA4YzVlMzJiMTUyZjQ2
10
+ MjBlNzc4NWEzOTQ2ZDQ0MjQzNGVkYjI1M2E5NmE4OGUzYmI1OWM0ZTE5MmZk
11
+ YzAwZjk1YWE0OGRmYTlkODJmNTFhOGQwZWYyNjNhZjliMDY1YzA=
12
12
  data.tar.gz: !binary |-
13
- ZTVmOTU3Mjk3MzUxYzVjMDIzZTk4MGIyMWE4Yzg4MzFiMWRiM2M5Yzg2ZDJi
14
- OWQ1ZDA2MzlhNmY2MDEwYTA3NDJjYmNiMTdiZjU3YzY0NzA2MTAxODZlNmFm
15
- Y2RlYzUzNzU4MDEwYjE1NmFhMjVlOTZmNjQ2NTM3YzZlYTdmNTk=
13
+ NjAwMGMxOGZhNDE2YTc0NDUwZTk4ZjRmOTQ0MzVjOTRjYTMwZWY0MWI3ZjNl
14
+ YjhiMzkzNGI4YzdmYzkxNDRlMzc2MmE4YjFhNTMxYjcwOTEyOWE4NDljNmQy
15
+ OWIxMjJiOGM5ZDM4YjJhMTc3N2U5OGM0ZmMzYWViYmU1ZWE5ZGY=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.17
1
+ 1.4.18
@@ -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
 
@@ -40,7 +40,8 @@ module SparkApi
40
40
  :request_path => env[:url],
41
41
  :message => response.message,
42
42
  :code => response.code,
43
- :status => env[:status]
43
+ :status => env[:status],
44
+ :errors => body['D']['Errors']
44
45
  }
45
46
 
46
47
  case env[:status]
@@ -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.17
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: 2017-11-13 00:00:00.000000000 Z
12
+ date: 2018-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday