zuora_api 0.2.7.6.5 → 0.2.7.6.6
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/zuora_api/exceptions.rb +31 -0
- data/lib/zuora_api/login.rb +7 -0
- data/lib/zuora_api/version.rb +1 -1
- 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: 73c08a3b5848237f66744bd547da19c3077a1123
|
4
|
+
data.tar.gz: f9e06eb21f5ac7122ffb111705c2a9d312571947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7897292cda5ed5d3d26ec0c620beb8c13dadc3034cf0a79b3d81f4ef004c70bcc3edc7d9906b188acc1e79875bf66bb7db18410d3181b564138b033d4d8145e
|
7
|
+
data.tar.gz: eb0a3cba93cfcda3eb8495739b9bad1aa20f878d9a242eb8907fc552334811ac2ce182fac9fdb6d2e379f5b2dd8780739c210cfd0f1944224b9c571c9612615f
|
data/lib/zuora_api/exceptions.rb
CHANGED
@@ -33,5 +33,36 @@ module ZuoraAPI
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
class ZuoraAPIRequestLimit < Error
|
37
|
+
attr_reader :code, :response
|
38
|
+
attr_writer :default_message
|
39
|
+
|
40
|
+
def initialize(message = nil,response=nil, code =nil)
|
41
|
+
@code = code
|
42
|
+
@message = message
|
43
|
+
@response = response
|
44
|
+
@default_message = "Your request limit has been exceeded for zuora."
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_s
|
48
|
+
@message || @default_message
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class ZuoraAPILockCompetition < Error
|
53
|
+
attr_reader :code, :response
|
54
|
+
attr_writer :default_message
|
55
|
+
|
56
|
+
def initialize(message = nil,response=nil, code =nil)
|
57
|
+
@code = code
|
58
|
+
@message = message
|
59
|
+
@response = response
|
60
|
+
@default_message = "Operation failed due to lock competition. Please retry"
|
61
|
+
end
|
62
|
+
|
63
|
+
def to_s
|
64
|
+
@message || @default_message
|
65
|
+
end
|
66
|
+
end
|
36
67
|
end
|
37
68
|
end
|
data/lib/zuora_api/login.rb
CHANGED
@@ -208,6 +208,11 @@ module ZuoraAPI
|
|
208
208
|
response = HTTParty.post(self.url,:body => xml.doc.to_xml, :headers => {'Content-Type' => "text/xml; charset=utf-8"}, :timeout => 10)
|
209
209
|
output_xml = Nokogiri::XML(response.body)
|
210
210
|
Rails.logger.debug('Connect') {"Response SOAP XML: #{output_xml.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip}"} if debug
|
211
|
+
|
212
|
+
raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new("#{output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text}::#{output_xml.xpath('//fns:FaultMessage', 'fns' =>'http://fault.api.zuora.com/').text}") if (!output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text.blank? && output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text == "INVALID_SESSION")
|
213
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIRequestLimit.new("#{output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text}::#{output_xml.xpath('//fns:FaultMessage', 'fns' =>'http://fault.api.zuora.com/').text}") if (!output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text.blank? && output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text == "REQUEST_EXCEEDED_LIMIT")
|
214
|
+
raise ZuoraAPI::Exceptions::ZuoraAPILockCompetition.new("#{output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text}::#{output_xml.xpath('//fns:FaultMessage', 'fns' =>'http://fault.api.zuora.com/').text}") if (!output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text.blank? && output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text == "LOCK_COMPETITION")
|
215
|
+
|
211
216
|
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text}::#{output_xml.xpath('//fns:FaultMessage', 'fns' =>'http://fault.api.zuora.com/').text}") if !output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text.blank?
|
212
217
|
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{output_xml.xpath('//faultcode').text}::#{output_xml.xpath('//faultstring').text}") if !output_xml.xpath('//faultcode').text.blank?
|
213
218
|
rescue ZuoraAPI::Exceptions::ZuoraAPISessionError => ex
|
@@ -272,6 +277,8 @@ module ZuoraAPI
|
|
272
277
|
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
278
|
#Zuora AQuA Unauthorized
|
274
279
|
raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new("Unauthorized") if response.code == 401
|
280
|
+
#Zuora REST API Limit Errors
|
281
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIRequestLimit.new("#{output_json["reasons"][0]["message"]}") if (!output_json["success"] && !output_json["reasons"].blank? && output_json["reasons"] == Array && output_json["reasons"][0]["code"] == 50000070 && response.code == 429)
|
275
282
|
#Zuora REST Query Errors
|
276
283
|
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{output_json["faultcode"]}::#{output_json["faultstring"]}") if !output_json["faultcode"].blank?
|
277
284
|
#Zuora REST actions error
|
data/lib/zuora_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.7.6.
|
4
|
+
version: 0.2.7.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zuora Strategic Solutions Group
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|