spark_api 1.4.18 → 1.4.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTQxYzNmMDgyMGU3NTNlMGJhMDA4ZWUwMDNmMDk0ZjFmOTdkZjQwMg==
4
+ NjBhNTg3Y2Q0ZWY3NzUzZDI3ZjViNjNkZjY3NGQ2YmU1ZTIwODE4Mw==
5
5
  data.tar.gz: !binary |-
6
- ZjNkYjFiYTAwOTRmNjA5M2I5MzA5MjJkNTFiZWYwMDg0ODZiNjFkZQ==
6
+ ZjkwOTRhZGVhYjkzZmFjYjkwOGYzMDkzYzI2M2VkYWQwNzJjY2VhZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWE3ZTg0M2JiNmU0NTdlNzYwNDU4NDFiMjNmNTZiNTA4YzVlMzJiMTUyZjQ2
10
- MjBlNzc4NWEzOTQ2ZDQ0MjQzNGVkYjI1M2E5NmE4OGUzYmI1OWM0ZTE5MmZk
11
- YzAwZjk1YWE0OGRmYTlkODJmNTFhOGQwZWYyNjNhZjliMDY1YzA=
9
+ MWIzZTkzZGJmZDcwNzg1YmY4ZTY4NTcyZDViOWZjNTgzYzZhNjNlZmFiZmQw
10
+ NWZhZGUwZTc1YTA5NDljOTc3NzVkM2UwZTcwMjQ1Y2MyMThmN2E4ZTU4NjVh
11
+ ZTc1YTMyZTNlZTUzNzRiNmJiY2Q0YTA4YjRhZmNlNWE0NDA2MzM=
12
12
  data.tar.gz: !binary |-
13
- NjAwMGMxOGZhNDE2YTc0NDUwZTk4ZjRmOTQ0MzVjOTRjYTMwZWY0MWI3ZjNl
14
- YjhiMzkzNGI4YzdmYzkxNDRlMzc2MmE4YjFhNTMxYjcwOTEyOWE4NDljNmQy
15
- OWIxMjJiOGM5ZDM4YjJhMTc3N2U5OGM0ZmMzYWViYmU1ZWE5ZGY=
13
+ ZDI2YzIxZTU1NjlhMDBmN2U2NTgwYWEwNDFhZGI5NWE2MjI0NzYxZjJhODJj
14
+ YjQzOWExZjFiMDU2ODE5YWU1NWQ3OGZjY2RlZjM0MmM3OTc4ZjAzNmQ3NTRi
15
+ YzYxYzI2OTAwZmY2YTk0YzM0NjM1MTZkYTMzOTE4OWFlOGRhMTY=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.18
1
+ 1.4.19
@@ -92,7 +92,12 @@ module SparkApi
92
92
  SparkApi.logger.error { "Authentication failed or server is sending us expired tokens, nothing we can do here." }
93
93
  raise
94
94
  end
95
- response.body
95
+
96
+ if options[:full_response]
97
+ return response
98
+ else
99
+ return response.body
100
+ end
96
101
  rescue Faraday::Error::ConnectionFailed => e
97
102
  if self.ssl_verify && e.message =~ /certificate verify failed/
98
103
  SparkApi.logger.error { SparkApi::Errors.ssl_verification_error }
@@ -1,7 +1,7 @@
1
1
  module SparkApi
2
2
  # API Response interface
3
3
  module Response
4
- ATTRIBUTES = [:code, :message, :results, :success, :pagination, :details, :d]
4
+ ATTRIBUTES = [:code, :message, :results, :success, :pagination, :details, :d, :errors, :sparkql_errors]
5
5
  attr_accessor *ATTRIBUTES
6
6
  def success?
7
7
  @success
@@ -23,6 +23,8 @@ module SparkApi
23
23
  self.success = self.d["Success"]
24
24
  self.pagination = self.d["Pagination"]
25
25
  self.details = self.d["Details"] || []
26
+ self.errors = self.d["Errors"]
27
+ self.sparkql_errors = self.d['SparkQLErrors']
26
28
  super(results)
27
29
  rescue Exception => e
28
30
  SparkApi.logger.error "Unable to understand the response! #{d}"
@@ -57,6 +57,20 @@ describe SparkApi do
57
57
  r.success?.should be(false)
58
58
  r.message.should be == "I am a failure."
59
59
  end
60
+ it "should have SparkQLErrors when present" do
61
+ err = {"Token" => "ExpirationDate", "Status" => "Dropped"}
62
+ r = SparkApi::ApiResponse.new({"D"=>{"Success" => false, "Message" => "I am a failure from .",
63
+ "SparkQLErrors" => [err]
64
+ }})
65
+ r.sparkql_errors.first.should eq(err)
66
+ end
67
+ it "should have Errors when present" do
68
+ err = {"Type" => "InvalidAttribute", "Attribute" => "DisplayName", "Message" => "DisplayName is wrong."}
69
+ r = SparkApi::ApiResponse.new({"D"=>{"Success" => false, "Message" => "I am a failure from .",
70
+ "Errors" => [err]
71
+ }})
72
+ r.errors.first.should eq(err)
73
+ end
60
74
  end
61
75
 
62
76
  describe SparkApi::Request do
@@ -197,6 +211,13 @@ describe SparkApi do
197
211
  subject.post('/stringdata', 'I am a lonely String!').success?.should == true
198
212
  end
199
213
 
214
+ it "should allow response object to be returned instead of body" do
215
+ r = subject.get('/system', { full_response: true })
216
+
217
+ r.is_a?(Faraday::Response).should be(true)
218
+ r.status.should eq(200)
219
+ end
220
+
200
221
  it "should give me BigDecimal results for large floating point numbers" do
201
222
  MultiJson.default_adapter.should eq(:yajl) unless jruby?
202
223
  result = subject.get('/listings/1000')[0]
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.18
4
+ version: 1.4.19
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: 2018-01-19 00:00:00.000000000 Z
12
+ date: 2018-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday