zuora_api 1.3.999992 → 1.4.0
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/Gemfile.lock +16 -16
- data/lib/insights_api/login.rb +1 -1
- data/lib/zuora_api/login.rb +9 -6
- data/lib/zuora_api/version.rb +1 -1
- data/lib/zuora_api.rb +0 -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: 023d51f61b28c69e9371fc59b16880106fdc8782
|
4
|
+
data.tar.gz: 246af4a2749dcbdf9ef8285d385e8d97fb0a912d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bd2b25793d66dc74077e4454544b0a50850ffc22a92d6938b1d1ff83aa3d206dc31de15f19184eb99cab3751b35de89e6173354742793f166bbd3d5864c88dd
|
7
|
+
data.tar.gz: 9f81b7d43aabd6b2e9fabe87e86b5abd2185ea85ce5050f445021c719a5e8afe527b1a096017cda80305b044be71099d52a1b813a6e35e0e211b73adb62edcd0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zuora_api (1.
|
4
|
+
zuora_api (1.4.0)
|
5
5
|
httparty
|
6
6
|
nokogiri (~> 1.6.8)
|
7
7
|
railties (>= 4.1.0, < 5.1)
|
@@ -35,10 +35,10 @@ GEM
|
|
35
35
|
crack (0.4.3)
|
36
36
|
safe_yaml (~> 1.0.0)
|
37
37
|
crass (1.0.2)
|
38
|
-
diff-lcs (1.
|
38
|
+
diff-lcs (1.3)
|
39
39
|
docile (1.1.5)
|
40
40
|
erubis (2.7.0)
|
41
|
-
hashdiff (0.3.
|
41
|
+
hashdiff (0.3.7)
|
42
42
|
httparty (0.15.6)
|
43
43
|
multi_xml (>= 0.5.2)
|
44
44
|
i18n (0.9.1)
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
multi_xml (0.6.0)
|
54
54
|
nokogiri (1.6.8.1)
|
55
55
|
mini_portile2 (~> 2.1.0)
|
56
|
-
public_suffix (3.0.
|
56
|
+
public_suffix (3.0.1)
|
57
57
|
rack (2.0.3)
|
58
58
|
rack-test (0.6.3)
|
59
59
|
rack (>= 1.0)
|
@@ -69,19 +69,19 @@ GEM
|
|
69
69
|
rake (>= 0.8.7)
|
70
70
|
thor (>= 0.18.1, < 2.0)
|
71
71
|
rake (10.5.0)
|
72
|
-
rspec (3.
|
73
|
-
rspec-core (~> 3.
|
74
|
-
rspec-expectations (~> 3.
|
75
|
-
rspec-mocks (~> 3.
|
76
|
-
rspec-core (3.
|
77
|
-
rspec-support (~> 3.
|
78
|
-
rspec-expectations (3.
|
72
|
+
rspec (3.7.0)
|
73
|
+
rspec-core (~> 3.7.0)
|
74
|
+
rspec-expectations (~> 3.7.0)
|
75
|
+
rspec-mocks (~> 3.7.0)
|
76
|
+
rspec-core (3.7.0)
|
77
|
+
rspec-support (~> 3.7.0)
|
78
|
+
rspec-expectations (3.7.0)
|
79
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-mocks (3.
|
80
|
+
rspec-support (~> 3.7.0)
|
81
|
+
rspec-mocks (3.7.0)
|
82
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-support (3.
|
83
|
+
rspec-support (~> 3.7.0)
|
84
|
+
rspec-support (3.7.0)
|
85
85
|
rubyzip (1.2.1)
|
86
86
|
safe_yaml (1.0.4)
|
87
87
|
simplecov (0.15.1)
|
@@ -93,7 +93,7 @@ GEM
|
|
93
93
|
thread_safe (0.3.6)
|
94
94
|
tzinfo (1.2.4)
|
95
95
|
thread_safe (~> 0.1)
|
96
|
-
webmock (3.0
|
96
|
+
webmock (3.1.0)
|
97
97
|
addressable (>= 2.3.6)
|
98
98
|
crack (>= 0.3.2)
|
99
99
|
hashdiff
|
data/lib/insights_api/login.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "httparty"
|
2
|
-
require "zip"
|
3
2
|
module InsightsAPI
|
4
3
|
class Login
|
5
4
|
attr_accessor :api_token, :url
|
@@ -189,6 +188,7 @@ module InsightsAPI
|
|
189
188
|
end
|
190
189
|
|
191
190
|
def gzip_file(filePath)
|
191
|
+
require "zip"
|
192
192
|
Zlib::GzipWriter.open(filePath + ".gz") do |gzip|
|
193
193
|
open(filePath, "rb") do |f|
|
194
194
|
f.each_chunk() {|chunk| gzip.write chunk }
|
data/lib/zuora_api/login.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "httparty"
|
2
|
-
require "zip"
|
3
2
|
require "nokogiri"
|
4
3
|
module ZuoraAPI
|
5
4
|
class Login
|
@@ -554,7 +553,7 @@ module ZuoraAPI
|
|
554
553
|
return products, catalog_map
|
555
554
|
end
|
556
555
|
|
557
|
-
def get_file(url: nil, headers: {}, count: 3, z_session: true, tempfile: true, file_path: Rails.root.join('tmp'), timeout_retries: 2, timeout: 120, **execute_params)
|
556
|
+
def get_file(url: nil, headers: {}, count: 3, z_session: true, tempfile: true, file_path: defined?(Rails.root.join('tmp')) ? Rails.root.join('tmp') : Pathname.new(Dir.pwd), timeout_retries: 2, timeout: 120, **execute_params)
|
558
557
|
raise "file_path must be of class Pathname" if file_path.class != Pathname
|
559
558
|
|
560
559
|
#Make sure directory exists
|
@@ -634,7 +633,8 @@ module ZuoraAPI
|
|
634
633
|
file_handle = nil
|
635
634
|
timestamp = Time.now.to_i
|
636
635
|
if tempfile
|
637
|
-
|
636
|
+
require 'tempfile'
|
637
|
+
file_handle = ::Tempfile.new(["#{filename}_#{timestamp}", "#{file_ending}"], file_path)
|
638
638
|
file_handle.binmode
|
639
639
|
else
|
640
640
|
file_handle = File.new(file_path.join("#{filename}_#{timestamp}#{file_ending}"), "w+")
|
@@ -692,7 +692,7 @@ module ZuoraAPI
|
|
692
692
|
response_query = HTTParty.post(self.url, body: request.to_xml, headers: {'Content-Type' => "application/json; charset=utf-8"}, :timeout => 120)
|
693
693
|
output_xml = Nokogiri::XML(response_query.body)
|
694
694
|
|
695
|
-
|
695
|
+
raise 'Export Creation Unsuccessful : ' + output_xml.xpath('//ns1:Message', 'ns1' =>'http://api.zuora.com/').text if output_xml.xpath('//ns1:Success', 'ns1' =>'http://api.zuora.com/').text != "true"
|
696
696
|
id = output_xml.xpath('//ns1:Id', 'ns1' =>'http://api.zuora.com/').text
|
697
697
|
|
698
698
|
confirmRequest = Nokogiri::XML::Builder.new do |xml|
|
@@ -704,7 +704,7 @@ module ZuoraAPI
|
|
704
704
|
end
|
705
705
|
xml['SOAP-ENV'].Body do
|
706
706
|
xml['ns1'].query do
|
707
|
-
xml['ns1'].queryString "SELECT Id, CreatedById, CreatedDate, Encrypted, FileId, Format, Name, Query, Size, Status, StatusReason, UpdatedById, UpdatedDate, Zip From Export where
|
707
|
+
xml['ns1'].queryString "SELECT Id, CreatedById, CreatedDate, Encrypted, FileId, Format, Name, Query, Size, Status, StatusReason, UpdatedById, UpdatedDate, Zip From Export where Id = '#{id}"
|
708
708
|
end
|
709
709
|
end
|
710
710
|
end
|
@@ -714,9 +714,11 @@ module ZuoraAPI
|
|
714
714
|
sleep 3
|
715
715
|
response_query = HTTParty.post(self.url, body: confirmRequest.to_xml, headers: {'Content-Type' => "application/json; charset=utf-8"}, :timeout => 120)
|
716
716
|
output_xml = Nokogiri::XML(response_query.body)
|
717
|
+
|
717
718
|
result = output_xml.xpath('//ns2:Status', 'ns2' =>'http://object.api.zuora.com/').text
|
718
|
-
raise
|
719
|
+
raise "Export Creation Unsuccessful : #{output_xml.xpath('//ns1:Message', 'ns1' =>'http://api.zuora.com/').text}" if result.blank? || result == "Failed"
|
719
720
|
end
|
721
|
+
|
720
722
|
file_id = output_xml.xpath('//ns2:FileId', 'ns2' =>'http://object.api.zuora.com/').text
|
721
723
|
Rails.logger.info('Export') {'=====> Export finished'}
|
722
724
|
export_file = get_file(:url => self.fileURL(file_id))
|
@@ -724,6 +726,7 @@ module ZuoraAPI
|
|
724
726
|
Rails.logger.info('Export') {"=====> Export path #{export_file.path}"}
|
725
727
|
|
726
728
|
if extract && zip
|
729
|
+
require "zip"
|
727
730
|
new_path = export_file_path.partition('.zip').first
|
728
731
|
zipped = Zip::File.open(export_file_path)
|
729
732
|
file_handle = zipped.entries.first
|
data/lib/zuora_api/version.rb
CHANGED
data/lib/zuora_api.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.
|
4
|
+
version: 1.4.0
|
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-11-
|
11
|
+
date: 2017-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|