zuora_api 1.7.65g → 1.7.65i
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/login.rb +62 -38
- 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: 2d3a5ce233d3d4b441e52a9d4342db32d616d2bcd23e650ad0e5c09208b5904e
|
4
|
+
data.tar.gz: 5c1acb4964d32582cb84a05b0b120bde86d3d572fbeb663dff5ad2a58e228448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f208500da4b73e03a91fd9381fb5408f2007d62f698b97c74a46c5e71616e5b312fd0beaf00a19b977aab868850b83c03e4f8910fa1f2292666e13204e8598
|
7
|
+
data.tar.gz: '06791a0a95a2031edb03efa889d35f7721f129d3e8318565e7b6a86fef6a2539b361f1ca1fe27e8470b7a43e5d6d29c463de1b0710451f539353b51e599b5903'
|
data/lib/zuora_api/login.rb
CHANGED
@@ -629,21 +629,8 @@ module ZuoraAPI
|
|
629
629
|
end
|
630
630
|
end
|
631
631
|
|
632
|
-
|
633
|
-
|
634
|
-
elsif response.code == 500
|
635
|
-
if response.headers.fetch('content-type', []).include?('application/json')
|
636
|
-
begin
|
637
|
-
output_json = JSON.parse(response.body)
|
638
|
-
self.raise_errors(type: :JSON, body: output_json, response: response)
|
639
|
-
rescue JSON::ParserError => ex
|
640
|
-
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(response.body, response)
|
641
|
-
end
|
642
|
-
else
|
643
|
-
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(response.body, response)
|
644
|
-
end
|
645
|
-
end
|
646
|
-
|
632
|
+
self.errors_via_content_type(response: response, type: :xml)
|
633
|
+
|
647
634
|
when :JSON
|
648
635
|
case request_path
|
649
636
|
when /^\/query\/jobs.*/ #DataQuery Paths
|
@@ -731,7 +718,6 @@ module ZuoraAPI
|
|
731
718
|
if codes_array.map{|code| code.to_s.slice(6,7).to_i}.include?(50)
|
732
719
|
raise ZuoraAPI::Exceptions::ZuoraAPILockCompetition.new("#{messages_array.join(', ')}", response)
|
733
720
|
end
|
734
|
-
|
735
721
|
#Internal Server Error
|
736
722
|
if codes_array.map{|code| code.to_s.slice(6,7).to_i}.include?(60)
|
737
723
|
if messages_array.uniq.size == 1
|
@@ -742,6 +728,11 @@ module ZuoraAPI
|
|
742
728
|
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new("#{messages_array.join(', ')}", response)
|
743
729
|
end
|
744
730
|
|
731
|
+
#Retryiable Service Error
|
732
|
+
if codes_array.map{|code| code.to_s.slice(6,7).to_i}.include?(61)
|
733
|
+
raise ZuoraAPI::Exceptions::ZuoraAPITemporaryError.new("#{messages_array.join(', ')}", response)
|
734
|
+
end
|
735
|
+
|
745
736
|
#Request exceeded limit
|
746
737
|
if codes_array.map{|code| code.to_s.slice(6,7).to_i}.include?(70)
|
747
738
|
raise ZuoraAPI::Exceptions::ZuoraAPIRequestLimit.new("#{messages_array.join(', ')}", response)
|
@@ -794,32 +785,56 @@ module ZuoraAPI
|
|
794
785
|
end
|
795
786
|
end
|
796
787
|
|
788
|
+
if body.class == Hash && body['message'].present?
|
789
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(body['message'], response) if response.code == 500
|
790
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIError.new(body['message'], response) if ![200,201].include?(response.code)
|
791
|
+
end
|
792
|
+
|
793
|
+
self.errors_via_content_type(response: response, type: :json)
|
794
|
+
|
797
795
|
#All other errors
|
798
|
-
if response.code
|
799
|
-
|
800
|
-
|
801
|
-
else
|
802
|
-
response_content_types = response.headers.transform_keys(&:downcase).fetch('content-type', []).first || ''
|
796
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIError.new(response.body, response) if ![200,201].include?(response.code)
|
797
|
+
end
|
798
|
+
end
|
803
799
|
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
800
|
+
def errors_via_content_type(response: nil, type: :xml)
|
801
|
+
response_content_types = response.headers.transform_keys(&:downcase).fetch('content-type', []).first || ""
|
802
|
+
|
803
|
+
if response_content_types.include?('application/json') && type != :json
|
804
|
+
output_json = JSON.parse(response.body)
|
805
|
+
self.raise_errors(type: :JSON, body: output_json, response: response)
|
806
|
+
|
807
|
+
elsif (response_content_types.include?('application/xml') || response_content_types.include?('text/xml')) and type != :xml
|
808
|
+
output_xml = Nokogiri::XML(response.body)
|
809
|
+
self.raise_errors(type: :SOAP, body: output_xml, response: response)
|
810
|
+
|
811
|
+
elsif response_content_types.include?('text/html')
|
812
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new("Akamai Error", response) if response.headers.fetch('server', '') == 'AkamaiGHost'
|
813
|
+
|
814
|
+
parse_body = Nokogiri::HTML(response.body)
|
815
|
+
error_title = parse_body.xpath('//h2').text
|
816
|
+
error_title = parse_body.xpath('//h1').text if error_title.blank?
|
817
|
+
error_message = parse_body.xpath('//p').text
|
818
|
+
|
819
|
+
error_message = error_title if error_message.blank?
|
820
|
+
|
821
|
+
if error_title.present?
|
822
|
+
case error_title
|
823
|
+
when /Service Unavailable/
|
824
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIConnectionTimeout.new(error_message, response)
|
825
|
+
when /Client sent a bad request./, /Bad Request/, /403 Forbidden/
|
826
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(error_message, response)
|
827
|
+
else
|
828
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(error_message, response)
|
819
829
|
end
|
820
830
|
end
|
831
|
+
|
832
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new("Http response body is missing", response) if response.body.blank?
|
821
833
|
end
|
834
|
+
|
835
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(response.body, response) if response.code == 500
|
822
836
|
end
|
837
|
+
|
823
838
|
|
824
839
|
def get_soap_error_and_message(body)
|
825
840
|
error = body.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text
|
@@ -885,7 +900,7 @@ module ZuoraAPI
|
|
885
900
|
when /.*soapenv:Server.*/
|
886
901
|
if /^Invalid value.*for type.*|^Id is invalid|^date string can not be less than 19 charactors$/.match(message).present?
|
887
902
|
raise ZuoraAPI::Exceptions::ZuoraAPIError.new(message, response, errors, success)
|
888
|
-
elsif /^Invalid white space character \(.*\) in text to output$/.match(message).present?
|
903
|
+
elsif /^Invalid white space character \(.*\) in text to output$|^Invalid null character in text to output$/.match(message).present?
|
889
904
|
raise ZuoraAPI::Exceptions::ZuoraAPIUnkownError.new(message, response, errors, success)
|
890
905
|
end
|
891
906
|
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(message, response, errors, success)
|
@@ -1313,7 +1328,7 @@ module ZuoraAPI
|
|
1313
1328
|
end
|
1314
1329
|
end
|
1315
1330
|
|
1316
|
-
def getDataSourceExport(query, extract: true, encrypted: false, zip: true, z_track_id:
|
1331
|
+
def getDataSourceExport(query, extract: true, encrypted: false, zip: true, z_track_id: "")
|
1317
1332
|
begin
|
1318
1333
|
tries ||= 3
|
1319
1334
|
request = Nokogiri::XML::Builder.new do |xml|
|
@@ -1399,6 +1414,15 @@ module ZuoraAPI
|
|
1399
1414
|
raise ex
|
1400
1415
|
end
|
1401
1416
|
|
1417
|
+
rescue ZuoraAPI::Exceptions::ZuoraUnexpectedError => ex
|
1418
|
+
if !(tries -= 1).zero?
|
1419
|
+
Rails.logger.info("Trace ID: #{z_track_id} UnexpectedError, will retry after 10 seconds")
|
1420
|
+
sleep 10
|
1421
|
+
retry
|
1422
|
+
else
|
1423
|
+
raise ex
|
1424
|
+
end
|
1425
|
+
|
1402
1426
|
rescue *ZUORA_API_ERRORS => ex
|
1403
1427
|
raise ex
|
1404
1428
|
|
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.65i
|
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: 2020-05-
|
11
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|