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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd4263c2eb83157c69a7e2602d6cf2581d16a8a9b221758f68d1812143c8b065
4
- data.tar.gz: fee95cc2bb990cd82e54d788fbb45165a5c1ef1ec5d7a024a7486bb9a64ef3b2
3
+ metadata.gz: 9054b92f61410eb657f7649d1781b3ee3d0c29d4d58929baf02c275a3f39bb4b
4
+ data.tar.gz: 8f42f159769fe1230d100c0f1004e75926101b5248555b0f34990b43cb3ffd45
5
5
  SHA512:
6
- metadata.gz: 3a21cd1b2f25b43289e2c6977e244a2e34d02fe2c4f0491498a48857354e1ba0af1e178a677a6a6b6725acfad6dbb3e569b167cb56a69cfc838ab3854ed90253
7
- data.tar.gz: b50365fa6fec945684dcf1a22b2e5824ed192d6cbd3bc8a1e502874cec7167f417732be8df3c694ed51f17ff5fdcda205a2b3d8138d9caa3a2af2c598c996a86
6
+ metadata.gz: 34293864341beaf686e853925c5336ab0b67fa91034e533b4c1cfdb602d77514c52e376bba07fdef9a381812bc3073301db88cf12a2d1b411cac69cd4298876a
7
+ data.tar.gz: b00e9a2f3949a9e1ce1fca71076015dc4531e2185c53d3626b360b3dbcb12b2761b7a9856ae44f09cc3aa2049147c44b515625d109769971a2e69360384eb890
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zuora_api (1.7.04)
4
+ zuora_api (1.7.05)
5
5
  httparty
6
6
  nokogiri
7
7
  railties (>= 4.1.0, < 6)
@@ -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
@@ -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
- CONNECTION_EXCEPTIONS = [Net::OpenTimeout, OpenSSL::SSL::SSLError, Errno::ECONNREFUSED, SocketError, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL]
13
- CONNECTION_READ_EXCEPTIONS = [Net::ReadTimeout, Errno::ECONNRESET, Errno::EPIPE]
14
- ZUORA_API_ERRORS = [ZuoraAPI::Exceptions::ZuoraAPIError, ZuoraAPI::Exceptions::ZuoraAPIRequestLimit, ZuoraAPI::Exceptions::ZuoraAPILockCompetition, ZuoraAPI::Exceptions::ZuoraAPITemporaryError, ZuoraAPI::Exceptions::ZuoraDataIntegrity]
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['message'] == 'Forbidden' && body['status'] == 403 && response.code == 403
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).concat(CONNECTION_READ_EXCEPTIONS) => ex
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).concat(CONNECTION_READ_EXCEPTIONS) => ex
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).concat(CONNECTION_READ_EXCEPTIONS) => ex
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).concat(CONNECTION_READ_EXCEPTIONS) => ex
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)
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.7.04"
2
+ VERSION = "1.7.05"
3
3
  end
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.04
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-23 00:00:00.000000000 Z
11
+ date: 2019-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler