zuora_api 0.2.7.6.2 → 0.2.7.6.5
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/Gemfile.lock +1 -1
- data/lib/zuora_api/login.rb +11 -3
- data/lib/zuora_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c71e0318ded88fd9ccf75579553100d7aca9776
|
4
|
+
data.tar.gz: 9a6ca73fa57b27c775c4eada2338ea9e14c94d4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2bab74f3712de8f6bd9add33bc3e99aaf158cc68f90a5fd7a24348edc10f7f31619b318ab2d4cae7e8a4b091b5a0e8bfdbd5296e7c43047b60c59dbfde1c59a
|
7
|
+
data.tar.gz: 92e8d1a36ff9e6ecfd6e78c6513a005a4aed1fb92f37274ec577f3ce711d70ce0fc1221ef69482f4a9b5eadf00931945163fb92cb270885b0a0e7d584586ac6b
|
data/Gemfile.lock
CHANGED
data/lib/zuora_api/login.rb
CHANGED
@@ -264,12 +264,20 @@ module ZuoraAPI
|
|
264
264
|
tries ||= 2
|
265
265
|
raise "Method not supported, supported methods include: :get, :post, :put, :delete, :patch, :head, :options" if ![:get, :post, :put, :delete, :patch, :head, :options].include?(method)
|
266
266
|
response = HTTParty::Request.new("Net::HTTP::#{method.to_s.capitalize}".constantize, url, body: body, headers: {'Content-Type' => "application/json; charset=utf-8", "Authorization" => "ZSession #{self.get_session}"}.merge(headers)).perform
|
267
|
-
raise "#{response.code}::#{response.message}" if !response.success?
|
268
267
|
Rails.logger.debug('Connect') { response.code} if debug
|
269
268
|
output_json = JSON.parse(response.body)
|
270
269
|
Rails.logger.debug('Connect') {"Response JSON: #{output_json}"} if debug
|
271
|
-
|
272
|
-
|
270
|
+
|
271
|
+
#Zuora Regular REST API Unauthorized
|
272
|
+
raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new("#{output_json["reasons"][0]["message"]}") if (!output_json["success"] && !output_json["reasons"].blank? && output_json["reasons"] == Array && output_json["reasons"][0]["code"] == 90000011 && response.code == 401)
|
273
|
+
#Zuora AQuA Unauthorized
|
274
|
+
raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new("Unauthorized") if response.code == 401
|
275
|
+
#Zuora REST Query Errors
|
276
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{output_json["faultcode"]}::#{output_json["faultstring"]}") if !output_json["faultcode"].blank?
|
277
|
+
#Zuora REST actions error
|
278
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{output_json["Errors"][0]["Code"]}::#{output_json["Errors"][0]["Message"]}") if output_json.class != Array && !output_json["Success"] && output_json["Errors"]
|
279
|
+
#Zuora All Other API Errors
|
280
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{response.message}") if response.code != 200
|
273
281
|
rescue ZuoraAPI::Exceptions::ZuoraAPISessionError => ex
|
274
282
|
if !(tries -= 1).zero?
|
275
283
|
Rails.logger.debug {"Session Invalid"}
|
data/lib/zuora_api/version.rb
CHANGED