zuora_api 1.1.4 → 1.1.5

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
  SHA1:
3
- metadata.gz: 38fc1647c028388104b7a6ba6578a22e2cb9dc85
4
- data.tar.gz: aef15a183f55d343b8931d39de1facb82500ad00
3
+ metadata.gz: 910019d7db9a10c5d3c8a02ec90db16b39513996
4
+ data.tar.gz: 2f763fe720affc3a9f04aad5920ba4ce14b111ba
5
5
  SHA512:
6
- metadata.gz: 35ddaaaee823cffaeb21faa7e9e17cb4ba067ab5c7e1b2ef15708e5a039b46a6179f765dae26715d62a7b0a6bead58fa459dd42aa3d90a28b5ac3f5ac238fa98
7
- data.tar.gz: 5af9ea10e679470306b9d14161be39cdaa910865883719d18a266ab3ee1f0ea0b37aaa1a25f4899e0267655f9df25956e1e2a7c89b06dece0fae6bceee178cb7
6
+ metadata.gz: 529349e471734a14f4cabd97d3ff568b7db4f1a5551a957185523030fecc0afd83237e907c7f822a2fa8234c789459e1462122e4c31a3b347d731974dd7200a8
7
+ data.tar.gz: d912191c076382472bd1ab9446e38e7f11b1ebb14f74cc4893a49759a18e375aabc753ac885249f5d3b274518f8cda4495dac48bcea7f4e9a947f278522b1dee
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zuora_api (1.1.4)
4
+ zuora_api (1.1.5)
5
5
  httparty
6
6
  nokogiri (~> 1.6.8)
7
7
  railties (>= 4.1.0, < 5.1)
@@ -10,50 +10,50 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- actionpack (5.0.0.1)
14
- actionview (= 5.0.0.1)
15
- activesupport (= 5.0.0.1)
13
+ actionpack (5.0.1)
14
+ actionview (= 5.0.1)
15
+ activesupport (= 5.0.1)
16
16
  rack (~> 2.0)
17
17
  rack-test (~> 0.6.3)
18
18
  rails-dom-testing (~> 2.0)
19
19
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
20
- actionview (5.0.0.1)
21
- activesupport (= 5.0.0.1)
20
+ actionview (5.0.1)
21
+ activesupport (= 5.0.1)
22
22
  builder (~> 3.1)
23
23
  erubis (~> 2.7.0)
24
24
  rails-dom-testing (~> 2.0)
25
25
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
26
- activesupport (5.0.0.1)
26
+ activesupport (5.0.1)
27
27
  concurrent-ruby (~> 1.0, >= 1.0.2)
28
28
  i18n (~> 0.7)
29
29
  minitest (~> 5.1)
30
30
  tzinfo (~> 1.1)
31
- builder (3.2.2)
32
- concurrent-ruby (1.0.2)
31
+ builder (3.2.3)
32
+ concurrent-ruby (1.0.4)
33
33
  diff-lcs (1.2.5)
34
34
  erubis (2.7.0)
35
35
  httparty (0.14.0)
36
36
  multi_xml (>= 0.5.2)
37
- i18n (0.7.0)
37
+ i18n (0.8.1)
38
38
  loofah (2.0.3)
39
39
  nokogiri (>= 1.5.9)
40
40
  method_source (0.8.2)
41
41
  mini_portile2 (2.1.0)
42
- minitest (5.9.1)
43
- multi_xml (0.5.5)
42
+ minitest (5.10.1)
43
+ multi_xml (0.6.0)
44
44
  nokogiri (1.6.8.1)
45
45
  mini_portile2 (~> 2.1.0)
46
46
  rack (2.0.1)
47
47
  rack-test (0.6.3)
48
48
  rack (>= 1.0)
49
- rails-dom-testing (2.0.1)
49
+ rails-dom-testing (2.0.2)
50
50
  activesupport (>= 4.2.0, < 6.0)
51
- nokogiri (~> 1.6.0)
51
+ nokogiri (~> 1.6)
52
52
  rails-html-sanitizer (1.0.3)
53
53
  loofah (~> 2.0)
54
- railties (5.0.0.1)
55
- actionpack (= 5.0.0.1)
56
- activesupport (= 5.0.0.1)
54
+ railties (5.0.1)
55
+ actionpack (= 5.0.1)
56
+ activesupport (= 5.0.1)
57
57
  method_source
58
58
  rake (>= 0.8.7)
59
59
  thor (>= 0.18.1, < 2.0)
@@ -71,9 +71,9 @@ GEM
71
71
  diff-lcs (>= 1.2.0, < 2.0)
72
72
  rspec-support (~> 3.5.0)
73
73
  rspec-support (3.5.0)
74
- rubyzip (1.2.0)
75
- thor (0.19.1)
76
- thread_safe (0.3.5)
74
+ rubyzip (1.2.1)
75
+ thor (0.19.4)
76
+ thread_safe (0.3.6)
77
77
  tzinfo (1.2.2)
78
78
  thread_safe (~> 0.1)
79
79
 
@@ -236,6 +236,45 @@ module ZuoraAPI
236
236
  return [output_xml, input_xml]
237
237
  end
238
238
 
239
+ def aqua_query(queryName: '', query: '', version: '1.2', jobName: 'Aqua',partner: '', project: '')
240
+ params = {
241
+ "format" => 'csv',
242
+ "version" => version,
243
+ "name" => jobName,
244
+ "encrypted" => 'none',
245
+ "useQueryLabels" => 'true',
246
+ "partner" => partner,
247
+ "project" => project,
248
+ "queries" => [{
249
+ "name" => queryName,
250
+ "query" => query,
251
+ "type" => 'zoqlexport'
252
+ }]
253
+ }
254
+ response = @zuora_client.rest_call(method: :post, body: params.to_json, url: self.aqua_endpoint("batch-query/"))
255
+ if(response[0]["id"].nil?)
256
+ Rails.logger.debug {"Error in AQuA Process. ID was not found."}
257
+ raise "Error in AQuA Process. ID was not found."
258
+ end
259
+ return getFileById(id: response[0]["id"])
260
+ end
261
+
262
+ def getFileById(id: "")
263
+ response = nil
264
+ loop do
265
+ sleep(2)#sleep 2 seconds
266
+ response, fullResponse = self.rest_call(method: :get, body: {}, url: self.aqua_endpoint("batch-query/jobs/#{id}"), debug: false)
267
+ break unless !(response["batches"][0]["localizedStatus"].eql? "completed")
268
+ if response["batches"][0]["localizedStatus"].eql? "error"
269
+ raise "Aqua Error: #{response}"
270
+ break
271
+ end
272
+ end
273
+ fileId = response["batches"][0]["fileId"]
274
+ return self.get_file(file_name: "#{id}.csv", url: self.aqua_endpoint("file/#{fileId}"), headers: {"Authorization" => "ZSession " + self.current_session, 'Content-Type' => "application/json; charset=utf-8"})
275
+ end
276
+
277
+
239
278
  def describe_call(object = nil)
240
279
  self.get_session
241
280
  base = self.url.include?(".com") ? self.url.split(".com")[0] : self.url.split(".eu")[0]
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
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.1.4
4
+ version: 1.1.5
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-02-22 00:00:00.000000000 Z
11
+ date: 2017-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler