zuora_api 0.2.7.0 → 0.2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zuora_api/login.rb +35 -0
- 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: 4e861be8997030565b43cf09a909a0daf0e54fb3
|
4
|
+
data.tar.gz: e26feda4866af5ed05a6ea487b027c99b9558c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd903fb7babf044e18581ea1c8b6449bad68bb60af1cb2b2e6324c32f0884fb3b12eae5f64ea974a3a45df7bacfe068fbcacb76c73a01ebacc3e1011a3e68f3d
|
7
|
+
data.tar.gz: ff98abec36239a83a5769bd2afbf1b51857327824fcb8608eaa7538cd3bf26fa75277fc6dc57127b32d6db05fd821ea092868096db48569242d3c26805257ae7
|
data/lib/zuora_api/login.rb
CHANGED
@@ -48,6 +48,16 @@ module ZuoraAPI
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def aqua_endpoint(url="")
|
52
|
+
if self.environment == 'Sandbox'
|
53
|
+
return "https://apisandbox.zuora.com/apps/api/".concat(url)
|
54
|
+
elsif self.environment == 'Production'
|
55
|
+
return "https://zuora.com/apps/api/".concat(url)
|
56
|
+
else self.environment == 'Unknown'
|
57
|
+
return url
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
51
61
|
def rest_endpoint(url="")
|
52
62
|
if self.environment == 'Sandbox'
|
53
63
|
return "https://rest.apisandbox.zuora.com/v1/".concat(url)
|
@@ -255,6 +265,31 @@ module ZuoraAPI
|
|
255
265
|
return des_hash
|
256
266
|
end
|
257
267
|
|
268
|
+
def rest_call_full(method: :get, body: {}, url: rest_endpoint("catalog/products?pageSize=4") , **keyword_args)
|
269
|
+
begin
|
270
|
+
tries ||= 2
|
271
|
+
raise "Method not supported, supported methods include: :get, :post, :put, :delete, :patch, :head, :options" if ![:get, :post, :put, :delete, :patch, :head, :options].include?(method)
|
272
|
+
response = HTTParty::Request.new("Net::HTTP::#{method.to_s.capitalize}".constantize, url, body: body, headers: {'Content-Type' => "application/json; charset=utf-8", "Authorization" => "ZSession #{self.get_session}"}).perform
|
273
|
+
raise "#{response.code}::#{response.return_code}" if !response.success?
|
274
|
+
output_json = JSON.parse(response.body)
|
275
|
+
Rails.logger.debug('Connect') {"Response JSON: #{output_json}"}
|
276
|
+
rescue => ex
|
277
|
+
if !(tries -= 1).zero?
|
278
|
+
case ex.to_s.split("::")[0]
|
279
|
+
when "90000011"
|
280
|
+
Rails.logger.debug {"Session Invalid"}
|
281
|
+
self.new_session
|
282
|
+
retry
|
283
|
+
else
|
284
|
+
raise ex
|
285
|
+
end
|
286
|
+
else
|
287
|
+
raise ex
|
288
|
+
end
|
289
|
+
end
|
290
|
+
return output_json
|
291
|
+
end
|
292
|
+
|
258
293
|
def rest_call(method: :get, body: {},headers: {}, url: rest_endpoint("catalog/products?pageSize=4") , debug: true, **keyword_args)
|
259
294
|
tries ||= 2
|
260
295
|
raise "Method not supported, supported methods include: :get, :post, :put, :delete, :patch, :head, :options" if ![:get, :post, :put, :delete, :patch, :head, :options].include?(method)
|
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: 0.2.7.
|
4
|
+
version: 0.2.7.1
|
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: 2016-11-
|
11
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|