zuora_api 1.8.21 → 1.8.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44a650019155981d2075062e2d4de0d8feff5c5e89b7d3ba9e4540f81de803dc
4
- data.tar.gz: 6db8be3cfaa2905300c7b3d91b7b7d4f8b5aa5eb8306d24116dac7f1035dd3b0
3
+ metadata.gz: 5546a62ebcd1e41ab71c6e8555c49a9c8de4e627b69c2d6c3ee658e32a773a81
4
+ data.tar.gz: 75c008dec5f8652cfcdcd86d3e0503ddab0d6fe26789bd17a8b87551fdce7b3f
5
5
  SHA512:
6
- metadata.gz: 704fd52ba264db7e1937f6307d0c761d72f615495d15097b1e5ceb14bc31b3b07b8b71ef99b87d74c95706399a822008bf654e06e6e4f8e4e6637187ab993446
7
- data.tar.gz: 0be344718465df6d0bbb69d7fca93263c9bcc299a20ad9a70498f9d56e09eb5b708d9d474984c42f183220eff62ba145b486fbae5be73202e7c7a210b740c9a5
6
+ metadata.gz: e8ee6cc80db3980eff77b60f94d8ce97a08fdabc5ed013a927c1ae8e8f40bc76fbaabcd95fae270dba1e7c813127aa526791e146d4838a610c29c4b56bc4e154
7
+ data.tar.gz: dc8cfcca12a83c6c0103e908c77b9f6838f9cb426a7762cd34998015e8f94d35ae756691b42527780204a65a22cea47502f057df48028551a5395271e7300c7a
@@ -1,4 +1,4 @@
1
- # Changelog
1
+ # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
4
  ## [1.7.07] - 2018-9-10
@@ -1395,68 +1395,35 @@ module ZuoraAPI
1395
1395
 
1396
1396
  def getDataSourceExport(query, extract: true, encrypted: false, zip: true, z_track_id: "")
1397
1397
  tries ||= 3
1398
- request = Nokogiri::XML::Builder.new do |xml|
1399
- xml['SOAP-ENV'].Envelope('xmlns:SOAP-ENV' => "http://schemas.xmlsoap.org/soap/envelope/", 'xmlns:ns2' => "http://object.api.zuora.com/", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns:ns1' => "http://api.zuora.com/") do
1400
- xml['SOAP-ENV'].Header do
1401
- xml['ns1'].SessionHeader do
1402
- xml['ns1'].session self.get_session(prefix: false, auth_type: :basic, zuora_track_id: z_track_id)
1403
- end
1404
- end
1405
- xml['SOAP-ENV'].Body do
1406
- xml['ns1'].create do
1407
- xml['ns1'].zObjects('xsi:type' => "ns2:Export") do
1408
- xml['ns2'].Format 'csv'
1409
- xml['ns2'].Zip zip
1410
- xml['ns2'].Name 'googman'
1411
- xml['ns2'].Query query
1412
- xml['ns2'].Encrypted encrypted
1413
- end
1414
- end
1398
+
1399
+ output_xml, input_xml = self.soap_call(debug: false, timeout_retry: true, zuora_track_id: z_track_id) do |xml|
1400
+ xml['ns1'].create do
1401
+ xml['ns1'].zObjects('xsi:type' => "ns2:Export") do
1402
+ xml['ns2'].Format 'csv'
1403
+ xml['ns2'].Zip zip
1404
+ xml['ns2'].Name 'googman'
1405
+ xml['ns2'].Query query
1406
+ xml['ns2'].Encrypted encrypted
1415
1407
  end
1416
1408
  end
1417
1409
  end
1418
-
1419
- response_query = HTTParty.post(self.url, body: request.to_xml(:save_with => XML_SAVE_OPTIONS).strip, headers: {'Content-Type' => "application/json; charset=utf-8", "Z-Track-Id" => z_track_id}, :timeout => 130)
1420
-
1421
- output_xml = Nokogiri::XML(response_query.body)
1422
- raise_errors(type: :SOAP, body: output_xml, response: response_query) if output_xml.xpath('//ns1:Success', 'ns1' =>'http://api.zuora.com/').text != "true"
1423
-
1424
- # raise "Export Creation Unsuccessful : #{response_query.code}: #{response_query.parsed_response}" if output_xml.xpath('//ns1:Success', 'ns1' =>'http://api.zuora.com/').text != "true"
1425
1410
 
1426
1411
  id = output_xml.xpath('//ns1:Id', 'ns1' =>'http://api.zuora.com/').text
1427
1412
 
1428
- confirmRequest = Nokogiri::XML::Builder.new do |xml|
1429
- xml['SOAP-ENV'].Envelope('xmlns:SOAP-ENV' => "http://schemas.xmlsoap.org/soap/envelope/", 'xmlns:ns2' => "http://object.api.zuora.com/", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns:ns1' => "http://api.zuora.com/") do
1430
- xml['SOAP-ENV'].Header do
1431
- xml['ns1'].SessionHeader do
1432
- xml['ns1'].session self.get_session(prefix: false, auth_type: :basic, zuora_track_id: z_track_id)
1433
- end
1434
- end
1435
- xml['SOAP-ENV'].Body do
1436
- xml['ns1'].query do
1437
- xml['ns1'].queryString "SELECT Id, CreatedById, CreatedDate, Encrypted, FileId, Format, Name, Query, Size, Status, StatusReason, UpdatedById, UpdatedDate, Zip From Export where Id = '#{id}'"
1438
- end
1439
- end
1440
- end
1441
- end
1442
1413
  result = 'Waiting'
1443
-
1444
1414
  while result != "Completed"
1445
1415
  sleep 3
1446
- response_query = HTTParty.post(self.url, body: confirmRequest.to_xml(:save_with => XML_SAVE_OPTIONS).strip, headers: {'Content-Type' => "application/json; charset=utf-8", "Z-Track-Id" => z_track_id}, :timeout => 130)
1447
-
1448
- output_xml = Nokogiri::XML(response_query.body)
1416
+ output_xml, input_xml = self.soap_call(debug: false, timeout_retry: true, zuora_track_id: z_track_id) do |xml|
1417
+ xml['ns1'].query do
1418
+ xml['ns1'].queryString "SELECT Id, CreatedById, CreatedDate, Encrypted, FileId, Format, Name, Query, Size, Status, StatusReason, UpdatedById, UpdatedDate, Zip From Export where Id = '#{id}'"
1419
+ end
1420
+ end
1449
1421
  result = output_xml.xpath('//ns2:Status', 'ns2' =>'http://object.api.zuora.com/').text
1450
- status_code = response_query.code if response_query
1451
-
1452
- raise_errors(type: :SOAP, body: output_xml, response: response_query) if result.blank? || result == "Failed"
1453
- # raise "Export Creation Unsuccessful : #{response_query.code}: #{response_query.parsed_response}" if result.blank? || result == "Failed"
1454
1422
  end
1455
1423
 
1456
1424
  file_id = output_xml.xpath('//ns2:FileId', 'ns2' =>'http://object.api.zuora.com/').text
1457
1425
  export_file = get_file(:url => self.fileURL(file_id))
1458
1426
  export_file_path = export_file.path
1459
- Rails.logger.debug("=====> Export path #{export_file.path}")
1460
1427
 
1461
1428
  if extract && zip
1462
1429
  require "zip"
@@ -1480,24 +1447,18 @@ module ZuoraAPI
1480
1447
  rescue ZuoraAPI::Exceptions::ZuoraUnexpectedError => ex
1481
1448
  if !(tries -= 1).zero?
1482
1449
  Rails.logger.info("Trace ID: #{z_track_id} UnexpectedError, will retry after 10 seconds")
1483
- sleep 10
1450
+ sleep(self.timeout_sleep)
1484
1451
  retry
1485
1452
  end
1486
1453
  raise ex
1487
-
1488
- rescue *ZUORA_API_ERRORS => ex
1489
- raise ex
1490
-
1454
+
1491
1455
  rescue *(CONNECTION_EXCEPTIONS + CONNECTION_READ_EXCEPTIONS) => ex
1492
1456
  if !(tries -= 1).zero?
1493
1457
  Rails.logger.info("Trace ID: #{z_track_id} Timed out will retry after 5 seconds")
1494
- sleep 5
1458
+ sleep(self.timeout_sleep)
1495
1459
  retry
1496
1460
  end
1497
1461
  raise ex
1498
-
1499
- rescue ZuoraAPI::Exceptions::BadEntityError => ex
1500
- raise ex
1501
1462
  end
1502
1463
 
1503
1464
  def query(query, parse = false)
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.8.21"
2
+ VERSION = "1.8.22"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.21
4
+ version: 1.8.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zuora Strategic Solutions Group