zuora_api 1.7.04 → 1.7.05
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/exceptions.rb +32 -0
- data/lib/zuora_api/login.rb +33 -5
- data/lib/zuora_api/logins/basic.rb +1 -1
- data/lib/zuora_api/logins/oauth.rb +2 -2
- data/lib/zuora_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9054b92f61410eb657f7649d1781b3ee3d0c29d4d58929baf02c275a3f39bb4b
|
4
|
+
data.tar.gz: 8f42f159769fe1230d100c0f1004e75926101b5248555b0f34990b43cb3ffd45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34293864341beaf686e853925c5336ab0b67fa91034e533b4c1cfdb602d77514c52e376bba07fdef9a381812bc3073301db88cf12a2d1b411cac69cd4298876a
|
7
|
+
data.tar.gz: b00e9a2f3949a9e1ce1fca71076015dc4531e2185c53d3626b360b3dbcb12b2761b7a9856ae44f09cc3aa2049147c44b515625d109769971a2e69360384eb890
|
data/Gemfile.lock
CHANGED
data/lib/zuora_api/exceptions.rb
CHANGED
@@ -133,5 +133,37 @@ module ZuoraAPI
|
|
133
133
|
@message || @default_message
|
134
134
|
end
|
135
135
|
end
|
136
|
+
|
137
|
+
class ZuoraAPIConnectionTimeout < Net::OpenTimeout
|
138
|
+
attr_reader :code, :response
|
139
|
+
attr_writer :default_message
|
140
|
+
|
141
|
+
def initialize(message = nil,response=nil, *args)
|
142
|
+
@code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil
|
143
|
+
@message = message
|
144
|
+
@response = response
|
145
|
+
@default_message = "Authentication type is not supported by this Login"
|
146
|
+
end
|
147
|
+
|
148
|
+
def to_s
|
149
|
+
@message || @default_message
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
class ZuoraAPIReadTimeout < Net::ReadTimeout
|
154
|
+
attr_reader :code, :response
|
155
|
+
attr_writer :default_message
|
156
|
+
|
157
|
+
def initialize(message = nil,response=nil, *args)
|
158
|
+
@code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil
|
159
|
+
@message = message
|
160
|
+
@response = response
|
161
|
+
@default_message = "Authentication type is not supported by this Login"
|
162
|
+
end
|
163
|
+
|
164
|
+
def to_s
|
165
|
+
@message || @default_message
|
166
|
+
end
|
167
|
+
end
|
136
168
|
end
|
137
169
|
end
|
data/lib/zuora_api/login.rb
CHANGED
@@ -9,9 +9,29 @@ module ZuoraAPI
|
|
9
9
|
REGIONS = [EU = 'EU', US = 'US', NA = 'NA' ]
|
10
10
|
MIN_Endpoint = '96.0'
|
11
11
|
XML_SAVE_OPTIONS = Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
CONNECTION_EXCEPTIONS = [
|
14
|
+
Net::OpenTimeout,
|
15
|
+
OpenSSL::SSL::SSLError,
|
16
|
+
Errno::ECONNREFUSED,
|
17
|
+
SocketError,
|
18
|
+
Errno::EHOSTUNREACH,
|
19
|
+
Errno::EADDRNOTAVAIL
|
20
|
+
].freeze
|
21
|
+
|
22
|
+
CONNECTION_READ_EXCEPTIONS = [
|
23
|
+
Net::ReadTimeout,
|
24
|
+
Errno::ECONNRESET,
|
25
|
+
Errno::EPIPE
|
26
|
+
].freeze
|
27
|
+
|
28
|
+
ZUORA_API_ERRORS = [
|
29
|
+
ZuoraAPI::Exceptions::ZuoraAPIError,
|
30
|
+
ZuoraAPI::Exceptions::ZuoraAPIRequestLimit,
|
31
|
+
ZuoraAPI::Exceptions::ZuoraAPILockCompetition,
|
32
|
+
ZuoraAPI::Exceptions::ZuoraAPITemporaryError,
|
33
|
+
ZuoraAPI::Exceptions::ZuoraDataIntegrity
|
34
|
+
].freeze
|
15
35
|
|
16
36
|
attr_accessor :region, :url, :wsdl_number, :current_session, :bearer_token, :oauth_session_expires_at, :environment, :status, :errors, :current_error, :user_info, :tenant_id, :tenant_name, :entity_id, :timeout_sleep, :hostname, :zconnect_provider
|
17
37
|
|
@@ -565,6 +585,14 @@ module ZuoraAPI
|
|
565
585
|
raise ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError.new("Authentication type is not supported by this Login", response)
|
566
586
|
end
|
567
587
|
|
588
|
+
if response.code ==502
|
589
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIConnectionTimeout.new("Received 502 from downstream host", response)
|
590
|
+
end
|
591
|
+
|
592
|
+
if response.code ==504
|
593
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIReadTimeout.new("Received 504 from downstream host", response)
|
594
|
+
end
|
595
|
+
|
568
596
|
if body['errorMessage']
|
569
597
|
raise ZuoraAPI::Exceptions::ZuoraAPIError.new(body['errorMessage'], response)
|
570
598
|
end
|
@@ -574,7 +602,7 @@ module ZuoraAPI
|
|
574
602
|
end
|
575
603
|
|
576
604
|
#Oauth Tokens - User deactivated
|
577
|
-
if body['
|
605
|
+
if body['reason'] == 'Forbidden' && body['status'] == 403 && response.code == 403
|
578
606
|
raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new("Forbidden", response)
|
579
607
|
end
|
580
608
|
|
@@ -742,7 +770,7 @@ module ZuoraAPI
|
|
742
770
|
end
|
743
771
|
des_hash[:related_objects] = output_xml.xpath(".//related-objects").xpath(".//object").map{ |x| [x.xpath(".//name").text.to_sym, [ [:url, x.attributes["href"].value], [:label, x.xpath(".//name").text ] ].to_h] }.to_h
|
744
772
|
end
|
745
|
-
rescue *(CONNECTION_EXCEPTIONS
|
773
|
+
rescue *(CONNECTION_EXCEPTIONS + CONNECTION_READ_EXCEPTIONS) => ex
|
746
774
|
if !(tries -= 1).zero?
|
747
775
|
Rails.logger.info("Describe - #{ex.class} Timed out will retry after 5 seconds")
|
748
776
|
sleep(self.timeout_sleep)
|
@@ -94,7 +94,7 @@ module ZuoraAPI
|
|
94
94
|
self.current_session = retrieved_session
|
95
95
|
end
|
96
96
|
return self.status
|
97
|
-
rescue *(CONNECTION_EXCEPTIONS
|
97
|
+
rescue *(CONNECTION_EXCEPTIONS + CONNECTION_READ_EXCEPTIONS) => ex
|
98
98
|
if !(tries -= 1).zero?
|
99
99
|
Rails.logger.info {"#{ex.class} Timed out will retry after 5 seconds"}
|
100
100
|
sleep(self.timeout_sleep)
|
@@ -52,7 +52,7 @@ module ZuoraAPI
|
|
52
52
|
else
|
53
53
|
return [output_json, response]
|
54
54
|
end
|
55
|
-
rescue *(CONNECTION_EXCEPTIONS
|
55
|
+
rescue *(CONNECTION_EXCEPTIONS + CONNECTION_READ_EXCEPTIONS) => ex
|
56
56
|
if !(tries -= 1).zero?
|
57
57
|
Rails.logger.info {"#{ex.class} Timed out will retry after 5 seconds"}
|
58
58
|
sleep(self.timeout_sleep)
|
@@ -98,7 +98,7 @@ module ZuoraAPI
|
|
98
98
|
return self.status
|
99
99
|
rescue ZuoraAPI::Exceptions::ZuoraAPIError, ZuoraAPI::Exceptions::ZuoraAPIRequestLimit, ZuoraAPI::Exceptions::ZuoraAPILockCompetition => ex
|
100
100
|
raise ex
|
101
|
-
rescue *(CONNECTION_EXCEPTIONS
|
101
|
+
rescue *(CONNECTION_EXCEPTIONS + CONNECTION_READ_EXCEPTIONS) => ex
|
102
102
|
if !(tries -= 1).zero?
|
103
103
|
Rails.logger.info {"#{ex.class} Timed out will retry after 5 seconds"}
|
104
104
|
sleep(self.timeout_sleep)
|
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: 1.7.
|
4
|
+
version: 1.7.05
|
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: 2019-08-
|
11
|
+
date: 2019-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|