zuora_api 1.6.254 → 1.6.255

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: 6128f5dcd59c8e19f685147b06d6868a4dc8c1f1
4
- data.tar.gz: 40d87abab8c18aacadbfacdff0881ecc067a01e3
3
+ metadata.gz: 5e6a8e9ae21ef49ef02ea0c4f68a568d5e0e8bb8
4
+ data.tar.gz: 29eb9ef8d16d22b41e0b446d89f86e416c03fb21
5
5
  SHA512:
6
- metadata.gz: 26edd6cdeaf34cb552b9b158f86f3108cc6396ff949e8e0246dcfea79f22b5bf6f1ff1a1e2d7d1f109ef2a34e624e03268fb5b6494c693f9ede2afe54c496083
7
- data.tar.gz: eb82465f57e28ea368c03ff47be3d82fd5211375b7253f06890241ff05d4638151b1e3ac817477b83f0252a66ab28ca9552230516e78b9e4c9980a615dfbc262
6
+ metadata.gz: 53b80cc5f612a4b59fc80280fd1e9b8a694de301aa43f481ab5af4f33647ae65188e51399d9be59c161d8d7dfb7eeecbcc6667e5f0ab195cb56c3de91c2ced15
7
+ data.tar.gz: b955ba0161c862c0a7b96ab5b29e282548ace81f23b8df999710d1647c5e1e66ff5898781454df41b9f7cc6905c4ad95353c0c75c10cd7f1c6d6a8d582d72809
@@ -1,18 +1,11 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [1.6.16] - 2018-12-09
4
+ ## [1.6.28] - 2018-3-12
5
5
  ### Added
6
- - Example
7
-
8
- ### Changed
9
- - Example
10
-
11
- ### Removed
12
- - Example
6
+ - Way to avoid force encoding for filedownload
13
7
 
14
8
  ## [1.6.22] - 2019-01-03
15
-
16
9
  ### Changed
17
10
  - get_identity method - supports ZSession auth now
18
11
  - updated rspecs accordingly
@@ -845,7 +845,7 @@ module ZuoraAPI
845
845
  return products, catalog_map
846
846
  end
847
847
 
848
- def get_file(url: nil, headers: {}, count: 3, z_session: true, tempfile: true, output_file_name: nil, add_timestamp: true, file_path: defined?(Rails.root.join('tmp')) ? Rails.root.join('tmp') : Pathname.new(Dir.pwd), timeout_retries: 2, timeout: 120, session_type: :basic, **execute_params)
848
+ def get_file(url: nil, headers: {}, count: 3, z_session: true, tempfile: true, output_file_name: nil, add_timestamp: true, file_path: defined?(Rails.root.join('tmp')) ? Rails.root.join('tmp') : Pathname.new(Dir.pwd), timeout_retries: 2, timeout: 120, session_type: :basic, force_encoding: true, **execute_params)
849
849
  raise "file_path must be of class Pathname" if file_path.class != Pathname
850
850
 
851
851
  #Make sure directory exists
@@ -884,7 +884,7 @@ module ZuoraAPI
884
884
  end
885
885
  Rails.logger.fatal("Unauthorized: Retry")
886
886
  self.new_session if z_session
887
- return get_file(:url => url, :headers => headers, :count => count - 1, :z_session => z_session, :tempfile => tempfile, :file_path => file_path, :timeout_retries => timeout_retries, :timeout => timeout)
887
+ return get_file(:url => url, :headers => headers, :count => count - 1, :z_session => z_session, :tempfile => tempfile, :file_path => file_path, :timeout_retries => timeout_retries, :timeout => timeout, :force_encoding => force_encoding)
888
888
 
889
889
  when Net::HTTPClientError
890
890
  raise
@@ -895,7 +895,6 @@ module ZuoraAPI
895
895
  headers[k] = v
896
896
  end
897
897
  Rails.logger.debug("Headers: #{headers.to_s}")
898
-
899
898
  if output_file_name.present?
900
899
  file_ending ||= output_file_name.end_with?(".csv.zip") ? ".csv.zip" : File.extname(output_file_name)
901
900
  filename ||= File.basename(output_file_name, file_ending)
@@ -931,7 +930,6 @@ module ZuoraAPI
931
930
  encoding ||= 'UTF-8'
932
931
  end
933
932
  end
934
- Rails.logger.info("File: #{filename}#{file_ending} #{encoding} #{type}")
935
933
 
936
934
  if response.header["Content-Length"].present?
937
935
  export_size = response.header["Content-Length"].to_i
@@ -939,6 +937,8 @@ module ZuoraAPI
939
937
  export_size = response.header["ContentLength"].to_i
940
938
  end
941
939
 
940
+ Rails.logger.info("File: #{filename}#{file_ending} #{encoding} #{type} #{export_size}")
941
+
942
942
  file_prefix = add_timestamp ? "#{filename}_#{Time.now.to_i}" : filename
943
943
  if tempfile
944
944
  require 'tempfile'
@@ -949,7 +949,11 @@ module ZuoraAPI
949
949
  file_handle.binmode
950
950
 
951
951
  response.read_body do |chunk|
952
- file_handle << chunk.force_encoding(encoding)
952
+ if force_encoding
953
+ file_handle << chunk.force_encoding(encoding)
954
+ else
955
+ file_handle << chunk
956
+ end
953
957
 
954
958
  if defined?(export_size) && export_size != 0 && export_size.class == Integer
955
959
  size += chunk.size
@@ -967,7 +971,7 @@ module ZuoraAPI
967
971
  return file_handle
968
972
  end
969
973
  end
970
- rescue *(CONNECTION_EXCEPTIONS).concat(CONNECTION_READ_EXCEPTIONS) => e
974
+ rescue *(CONNECTION_EXCEPTIONS).concat(CONNECTION_READ_EXCEPTIONS).concat([Net::HTTPBadResponse]) => e
971
975
  sleep(5)
972
976
  if (timeout_retries -= 1) >= 0
973
977
  Rails.logger.warn("Download Failed: #{e.class} : #{e.message}")
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.6.254"
2
+ VERSION = "1.6.255"
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.6.254
4
+ version: 1.6.255
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-02-17 00:00:00.000000000 Z
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler