zuora_api 1.11.0 → 1.11.2
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 +24 -22
- data/lib/zuora_api/logins/oauth.rb +1 -1
- 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: 1377cfe445b9ff82e0504e86ef89413c815b4250152769ec11bf6b7b8804cdd9
|
4
|
+
data.tar.gz: 9882ca98957ecf177985037124f9e77722fe9c1eeea430f8c5f632fc4327162c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5043d898c8ec80517f01bd65daf031880aa4ab91e14669eedece02be8dab5c7b895abeb8d48330c89a9159875f8a9418adb2db2b3017bfe5b698100bb3035183
|
7
|
+
data.tar.gz: 85ca8f78f0807ed8c7533e612a0816dcbdf52ec71131c1c122cc110e89898c0dfbe69d560e5130e50f438bced5235331ee4590af12912248319bddfae52cc376
|
data/lib/zuora_api/login.rb
CHANGED
@@ -7,7 +7,7 @@ module ZuoraAPI
|
|
7
7
|
class Login
|
8
8
|
ENVIRONMENTS = [TEST = 'Test', SANDBOX = 'Sandbox', PRODUCTION = 'Production', PREFORMANCE = 'Preformance', SERVICES = 'Services', UNKNOWN = 'Unknown', STAGING = 'Staging' ]
|
9
9
|
REGIONS = [EU = 'EU', US = 'US', NA = 'NA' ]
|
10
|
-
MIN_Endpoints = {'Test': '
|
10
|
+
MIN_Endpoints = {'Test': '126.0', 'Sandbox': '126.0', 'Production': '126.0', 'Performance': '126.0', 'Services': '96.0', 'Unknown': '96.0', 'Staging': '127.0'}.freeze
|
11
11
|
XML_SAVE_OPTIONS = Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
|
12
12
|
USER_AGENT = "Zuora#{ENV['Z_APPLICATION_NAME']&.capitalize}/#{ENV['Z_APPLICATION_VERSION']&.delete('v')}"
|
13
13
|
|
@@ -225,7 +225,8 @@ module ZuoraAPI
|
|
225
225
|
"NA" => {"Sandbox" => "https://sandbox.na.zuora.com/apps/services/a/",
|
226
226
|
"Production" => "https://na.zuora.com/apps/services/a/",
|
227
227
|
"Performance" => "https://pt1.na.zuora.com/apps/services/a/",
|
228
|
-
"Services" => "https://services347.na.zuora.com/apps/services/a/"
|
228
|
+
"Services" => "https://services347.na.zuora.com/apps/services/a/",
|
229
|
+
"Test" => "https://test.zuora.com/apps/services/a/"}
|
229
230
|
}
|
230
231
|
end
|
231
232
|
|
@@ -695,6 +696,7 @@ module ZuoraAPI
|
|
695
696
|
if body.dig('data', "errorCode") == "LINK_10000005"
|
696
697
|
raise ZuoraAPI::Exceptions::ZuoraAPITemporaryError.new(body.dig('data', "errorMessage"), response)
|
697
698
|
elsif (body.dig('data', "errorMessage").present? || body.dig('data', "queryStatus") == "failed")
|
699
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIUnkownError.new("Data query failed for unknown reasons. No error message.", response) if body.dig('data', "errorMessage").blank?
|
698
700
|
raise ZuoraAPI::Exceptions::ZuoraAPIError.new(body.dig('data', "errorMessage"), response)
|
699
701
|
end
|
700
702
|
when /^GET::404::\/query\/jobs\/([a-zA-Z0-9\-_]+)$/ #Get DQ job not found, capture of the id is present if needed in future error responses.
|
@@ -902,6 +904,8 @@ module ZuoraAPI
|
|
902
904
|
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(error_message, response)
|
903
905
|
when /414 Request-URI Too Large/
|
904
906
|
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("Request URL is too long", response)
|
907
|
+
when /Not Found/
|
908
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIError.new("The page you were looking for could not be found. If you believe you reached this page in error, please email support.", response)
|
905
909
|
else
|
906
910
|
raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(error_message, response)
|
907
911
|
end
|
@@ -1337,11 +1341,7 @@ module ZuoraAPI
|
|
1337
1341
|
status_code = response.code if response
|
1338
1342
|
case response
|
1339
1343
|
when Net::HTTPOK
|
1340
|
-
|
1341
|
-
response.each_header do |k,v|
|
1342
|
-
headers[k] = v
|
1343
|
-
end
|
1344
|
-
Rails.logger.debug("Headers: #{headers.to_s}")
|
1344
|
+
Rails.logger.warn("Headers: #{response.to_hash.to_s}")
|
1345
1345
|
if output_file_name.present?
|
1346
1346
|
file_ending ||= output_file_name.end_with?(".csv.zip") ? ".csv.zip" : File.extname(output_file_name)
|
1347
1347
|
filename ||= File.basename(output_file_name, file_ending)
|
@@ -1349,15 +1349,16 @@ module ZuoraAPI
|
|
1349
1349
|
|
1350
1350
|
size, export_progress = [0, 0]
|
1351
1351
|
encoding, type, full_filename = [nil, nil, nil]
|
1352
|
-
if response.
|
1353
|
-
|
1352
|
+
if response.get_fields("Content-Disposition").present?
|
1353
|
+
content_disposition = response.get_fields("Content-Disposition")[0]
|
1354
|
+
case content_disposition
|
1354
1355
|
when /.*; filename\*=.*/
|
1355
|
-
full_filename ||= /.*; filename\*=(.*)''(.*)/.match(
|
1356
|
-
encoding = /.*; filename\*=(.*)''(.*)/.match(
|
1356
|
+
full_filename ||= /.*; filename\*=(.*)''(.*)/.match(content_disposition)[2].strip
|
1357
|
+
encoding = /.*; filename\*=(.*)''(.*)/.match(content_disposition)[1].strip
|
1357
1358
|
when /.*; filename=/
|
1358
|
-
full_filename ||= /.*; filename=(.*)/.match(
|
1359
|
+
full_filename ||= /.*; filename=(.*)/.match(content_disposition)[1].strip
|
1359
1360
|
else
|
1360
|
-
raise "Can't parse Content-Disposition header: #{
|
1361
|
+
raise "Can't parse Content-Disposition header: #{content_disposition}"
|
1361
1362
|
end
|
1362
1363
|
file_ending ||= full_filename.end_with?(".csv.zip") ? ".csv.zip" : File.extname(full_filename)
|
1363
1364
|
filename ||= File.basename(full_filename, file_ending)
|
@@ -1367,21 +1368,22 @@ module ZuoraAPI
|
|
1367
1368
|
file_ending ||= uri.path.end_with?(".csv.zip") ? ".csv.zip" : File.extname(uri.path)
|
1368
1369
|
filename ||= File.basename(uri.path, file_ending)
|
1369
1370
|
|
1370
|
-
if response.
|
1371
|
-
|
1371
|
+
if response.get_fields("Content-Type").present?
|
1372
|
+
content_type = response.get_fields("Content-Type")[0]
|
1373
|
+
case content_type
|
1372
1374
|
when /.*;charset=.*/
|
1373
|
-
type = /(.*);charset=(.*)/.match(
|
1374
|
-
encoding = /(.*);charset=(.*)/.match(
|
1375
|
+
type = /(.*);charset=(.*)/.match(content_type)[1]
|
1376
|
+
encoding = /(.*);charset=(.*)/.match(content_type)[2]
|
1375
1377
|
else
|
1376
|
-
type =
|
1378
|
+
type = content_type
|
1377
1379
|
encoding ||= 'UTF-8'
|
1378
1380
|
end
|
1379
1381
|
end
|
1380
1382
|
|
1381
|
-
if response.
|
1382
|
-
export_size = response.
|
1383
|
-
elsif response.
|
1384
|
-
export_size = response.
|
1383
|
+
if response.get_fields("Content-Length").present?
|
1384
|
+
export_size = response.get_fields("Content-Length")[0].to_i
|
1385
|
+
elsif response.get_fields("ContentLength").present?
|
1386
|
+
export_size = response.get_fields("ContentLength")[0].to_i
|
1385
1387
|
end
|
1386
1388
|
|
1387
1389
|
Rails.logger.info("File: #{filename}#{file_ending} #{encoding} #{type} #{export_size}")
|
@@ -53,7 +53,7 @@ module ZuoraAPI
|
|
53
53
|
def get_bearer_token(zuora_track_id: nil)
|
54
54
|
raise ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError.new("Request Oauth Login but either 'Oauth Client Id' or 'Oauth Secret' were not passed") if self.oauth_client_id.blank? || self.oauth_secret.blank?
|
55
55
|
|
56
|
-
headers = {
|
56
|
+
headers = {"Content-Type" => "application/x-www-form-urlencoded" }
|
57
57
|
headers['Zuora-Track-Id'] = zuora_track_id if zuora_track_id.present?
|
58
58
|
headers['X-Amzn-Trace-Id'] = zuora_track_id if zuora_track_id.present?
|
59
59
|
|
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.11.
|
4
|
+
version: 1.11.2
|
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: 2022-
|
11
|
+
date: 2022-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|