zuora_api 1.3.996 → 1.3.997

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
  SHA1:
3
- metadata.gz: 7ab9b53d9882b003663bc5deaebac6d5e8116c25
4
- data.tar.gz: 51214067943da97e6147c650d786a6e2cded3157
3
+ metadata.gz: 244b6ef47daa9d5f30620630e70e9b2917670213
4
+ data.tar.gz: 4591349f6ac4f7ffaca7fdf9d9f1399655b167d4
5
5
  SHA512:
6
- metadata.gz: b985373ecb91daa6c62b3d7439a4bdcd3cf0ed4063d6435904dcebf8151b4300bc2dac33416919a086577b87811e6c923696dc8c11d2d7235da0b0ce2cd069dd
7
- data.tar.gz: 91e7c7e2f11766bc94ef6890797212178ccd3ab8c7739970842cf1cf0aa19a783e76e928601bf9af49b20f01e6ff9552b3c0b9e7f69f1576fa78bd7f0205c1ec
6
+ metadata.gz: 457dfca43748e6817c814dcec4d7dac354a4a8f041f770a902a1c275c9cf85bfbcc87f934fa5f84bce8194495dcb0e491c0f9fffe19ab6373affecfb610c6482
7
+ data.tar.gz: 0a4cfe45d894b0abad532d6858e52ec8428c4db8690b45afea76661cb2ea2f595c1adc217afb2effb7ae473aeba434aeb68de6db667887755c5a8e04a83aad25
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zuora_api (1.3.996)
4
+ zuora_api (1.3.997)
5
5
  httparty
6
6
  nokogiri (~> 1.6.8)
7
7
  railties (>= 4.1.0, < 5.1)
@@ -421,7 +421,7 @@ module ZuoraAPI
421
421
  return products, catalog_map
422
422
  end
423
423
 
424
- def get_file(file_name: nil, file_type: nil, url: nil, headers: {}, count: 3, z_session: true, tempfile: true, file_path: Rails.root.join('tmp'))
424
+ def get_file(file_name: nil, file_type: nil, url: nil, headers: {}, count: 3, z_session: true, tempfile: true, file_path: Rails.root.join('tmp'), **execute_params)
425
425
  raise "file_path must be of class Pathname" if file_path.class != Pathname
426
426
 
427
427
  #Make sure directory exists
@@ -455,26 +455,30 @@ module ZuoraAPI
455
455
  raise response
456
456
 
457
457
  when Net::HTTPOK
458
- Rails.logger.debug("Headers: #{response}")
458
+ headers = {}
459
+ response.each_header do |k,v|
460
+ headers[k] = v
461
+ end
462
+ Rails.logger.debug("Headers: #{headers.to_s}")
459
463
 
460
464
  size, export_progress = [0, 0]
461
465
  encoding, type, full_filename = [nil, nil, nil]
462
466
  if response.header["Content-Disposition"].present?
463
467
  case response.header["Content-Disposition"]
464
- when /attachment; filename\*=.*/
465
- full_filename = /attachment; filename\*=(.*)''(.*)/.match(response.header["Content-Disposition"])[2].strip
466
- encoding = /attachment; filename\*=(.*)''(.*)/.match(response.header["Content-Disposition"])[1].strip
467
- when /attachment; filename=/
468
- full_filename = /attachment; filename=(.*)/.match(response.header["Content-Disposition"])[1].strip
468
+ when /.*; filename\*=.*/
469
+ full_filename = /.*; filename\*=(.*)''(.*)/.match(response.header["Content-Disposition"])[2].strip
470
+ encoding = /.*; filename\*=(.*)''(.*)/.match(response.header["Content-Disposition"])[1].strip
471
+ when /.*; filename=/
472
+ full_filename = /.*; filename=(.*)/.match(response.header["Content-Disposition"])[1].strip
469
473
  end
470
- file_ending = file_type.present? ? ".#{file_type}" : /.*(\..*)$/.match(full_filename)[-1]
474
+ file_ending = file_type.present? ? ".#{file_type}" : ".#{full_filename.partition(".").last}"
471
475
  end
472
476
  #If user supplied a filename use it, else default to content header filename, else default to uri pattern
473
477
  filename = file_name.present? ? file_name : full_filename.present? ? full_filename.split(file_ending).first : File.basename(uri.path).rpartition('.').first
474
478
 
475
479
  if response.header["Content-Type"].present?
476
480
  case response.header["Content-Type"]
477
- when /.*;charset=.*/.match("application/zip")
481
+ when /.*;charset=.*/
478
482
  type = /(.*);charset=(.*)/.match(response.header["Content-Type"])[1]
479
483
  encoding = /(.*);charset=(.*)/.match(response.header["Content-Type"])[2]
480
484
  else
@@ -519,6 +523,7 @@ module ZuoraAPI
519
523
  end
520
524
  rescue Exception => e
521
525
  Rails.logger.fatal('GetFile') {"Download Failed: #{response_save} - #{e.message}"}
526
+ Rails.logger.fatal('GetFile') {"Download Failed: #{e.backtrace.join("\n")}"}
522
527
  raise
523
528
  end
524
529
  end
@@ -578,13 +583,13 @@ module ZuoraAPI
578
583
  end
579
584
  file_id = output_xml.xpath('//ns2:FileId', 'ns2' =>'http://object.api.zuora.com/').text
580
585
  Rails.logger.info('Export') {'=====> Export finished'}
581
- zip_file = get_file(:file_name => "#{file_id}.zip" ,:url => "#{self.fileURL}#{file_id}?file-id=#{file_id}")
586
+ zip_file = get_file(:url => "#{self.fileURL}#{file_id}?file-id=#{file_id}")
582
587
  if extract && zip
583
588
  location = extract_zip(zip_file.path, "#{file_id}")
584
589
  File.delete(zip_file.path)
585
590
  return location
586
591
  elsif !zip
587
- file = get_file(:file_name => "#{file_id}.gpg" ,:url => "#{self.fileURL}#{file_id}?file-id=#{file_id}", headers: {"Authorization" => "ZSession " + self.current_session})
592
+ file = get_file(:url => "#{self.fileURL}#{file_id}?file-id=#{file_id}", headers: {"Authorization" => "ZSession " + self.current_session})
588
593
  puts file.path
589
594
  return file.path
590
595
  else
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.3.996"
2
+ VERSION = "1.3.997"
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.3.996
4
+ version: 1.3.997
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: 2017-09-14 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler