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 +4 -4
- data/CHANGELOG.md +2 -9
- data/lib/zuora_api/login.rb +10 -6
- data/lib/zuora_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e6a8e9ae21ef49ef02ea0c4f68a568d5e0e8bb8
|
4
|
+
data.tar.gz: 29eb9ef8d16d22b41e0b446d89f86e416c03fb21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b80cc5f612a4b59fc80280fd1e9b8a694de301aa43f481ab5af4f33647ae65188e51399d9be59c161d8d7dfb7eeecbcc6667e5f0ab195cb56c3de91c2ced15
|
7
|
+
data.tar.gz: b955ba0161c862c0a7b96ab5b29e282548ace81f23b8df999710d1647c5e1e66ff5898781454df41b9f7cc6905c4ad95353c0c75c10cd7f1c6d6a8d582d72809
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
4
|
+
## [1.6.28] - 2018-3-12
|
5
5
|
### Added
|
6
|
-
-
|
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
|
data/lib/zuora_api/login.rb
CHANGED
@@ -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
|
-
|
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}")
|
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.6.
|
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-
|
11
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|