zuora_api 1.7.57 → 1.7.58
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +2 -2
- data/lib/zuora_api/exceptions.rb +2 -0
- data/lib/zuora_api/login.rb +26 -39
- data/lib/zuora_api/logins/basic.rb +2 -2
- data/lib/zuora_api/logins/oauth.rb +2 -2
- data/lib/zuora_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb9e45899e7ed9dc05d9c9d18df9d279e296bcc7d6b5f7882df09982c3e6a15c
|
4
|
+
data.tar.gz: 3f4a4ec2eb0f56177364fd4107d785e2b8209105709642da97a9d421937b90a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b0a07c385a8435988cfb41417e602a57143705e11a5c9a13b7a72a4f0852b0b6a4e15fc6a5960bfed109c0d3643ced57f6425448921649c2b36e479afa78a66
|
7
|
+
data.tar.gz: e4b81e99bbac7512893e9aa617437a529f49ed0cff325c997d1cd90315b054c172254a3eb113deb0d2b47d2d5b8035a2dbc079db9fbff5cc201d1db79cea29a7
|
data/.gitlab-ci.yml
CHANGED
@@ -45,8 +45,8 @@ rubygems-deploy:
|
|
45
45
|
- apt-get install -y git
|
46
46
|
- apt-get clean all
|
47
47
|
- gem install dpl
|
48
|
-
- if [[ "staging"
|
49
|
-
- if [[ "master"
|
48
|
+
- if [[ "staging" == $CI_BUILD_REF_SLUG ]];then export VERSION=`git describe --match "[0-9]*\.[0-9]*\.[0-9]*[a-z]" --abbrev=0 --tags HEAD`; fi
|
49
|
+
- if [[ "master" == $CI_BUILD_REF_SLUG ]];then export VERSION=`git describe --exclude "[0-9]*\.[0-9]*\.[0-9]*[a-z]" --abbrev=0 --tags HEAD`; fi
|
50
50
|
- echo $VERSION
|
51
51
|
- sed -i "s/0.0.1/$VERSION/" lib/zuora_api/version.rb
|
52
52
|
- git add lib/zuora_api/version.rb
|
data/lib/zuora_api/exceptions.rb
CHANGED
@@ -17,6 +17,8 @@ module ZuoraAPI
|
|
17
17
|
@message = "Query failed: #{$1}"
|
18
18
|
when /^Could not find [\w\d]{32}.$/
|
19
19
|
@message = "Could not find object."
|
20
|
+
when /^Subscription [\w\d]{32} is in expired status. It is not supported to generate billing documents for expired subscriptions./
|
21
|
+
@message = "Subscription is in expired status. It is not supported to generate billing documents for expired subscriptions."
|
20
22
|
else
|
21
23
|
@message = message
|
22
24
|
end
|
data/lib/zuora_api/login.rb
CHANGED
@@ -5,7 +5,7 @@ require 'zuora_api/exceptions'
|
|
5
5
|
|
6
6
|
module ZuoraAPI
|
7
7
|
class Login
|
8
|
-
ENVIRONMENTS = [SANDBOX = 'Sandbox', PRODUCTION = 'Production', PREFORMANCE = 'Preformance', SERVICES = 'Services', UNKNOWN = 'Unknown', STAGING = 'Staging' ]
|
8
|
+
ENVIRONMENTS = [TEST = 'Test', SANDBOX = 'Sandbox', PRODUCTION = 'Production', PREFORMANCE = 'Preformance', SERVICES = 'Services', UNKNOWN = 'Unknown', STAGING = 'Staging' ]
|
9
9
|
REGIONS = [EU = 'EU', US = 'US', NA = 'NA' ]
|
10
10
|
MIN_Endpoint = '96.0'
|
11
11
|
XML_SAVE_OPTIONS = Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
|
@@ -190,10 +190,13 @@ module ZuoraAPI
|
|
190
190
|
def reporting_url(path)
|
191
191
|
map = {"US" => {"Sandbox" => "https://zconnectsandbox.zuora.com/api/rest/v1/",
|
192
192
|
"Production" => "https://zconnect.zuora.com/api/rest/v1/",
|
193
|
-
"
|
193
|
+
"Test" => "https://reporting-sbx.zan.0001.sbx.auw2.zuora.com/api/rest/v1/",
|
194
|
+
"Staging" => "https://reporting-stg11.zan.svc.auw2.zuora.com/api/rest/v1/",
|
195
|
+
"Performance" => "https://zconnectpt1.zuora.com/api/rest/v1/",
|
196
|
+
"Services" => "https://reporting-svc08.svc.auw2.zuora.com/api/rest/v1/"},
|
194
197
|
"EU" => {"Sandbox" => "https://zconnect.sandbox.eu.zuora.com/api/rest/v1/",
|
195
198
|
"Production" => "https://zconnect.eu.zuora.com/api/rest/v1/",
|
196
|
-
"Services"=> ""},
|
199
|
+
"Services"=> "https://reporting-sbx0000.sbx.aec1.zuora.com/api/rest/v1/"},
|
197
200
|
"NA" => {"Sandbox" => "https://zconnect.sandbox.na.zuora.com/api/rest/v1/",
|
198
201
|
"Production" => "https://zconnect.na.zuora.com/api/rest/v1/",
|
199
202
|
"Services"=> ""}
|
@@ -248,7 +251,7 @@ module ZuoraAPI
|
|
248
251
|
end
|
249
252
|
|
250
253
|
def self.environments
|
251
|
-
%w(Sandbox Production Services Performance Staging)
|
254
|
+
%w(Sandbox Production Services Performance Staging Test)
|
252
255
|
end
|
253
256
|
|
254
257
|
def self.regions
|
@@ -260,7 +263,8 @@ module ZuoraAPI
|
|
260
263
|
"Production" => "https://www.zuora.com/apps/services/a/",
|
261
264
|
"Performance" => "https://pt1.zuora.com/apps/services/a/",
|
262
265
|
"Services" => "https://services347.zuora.com/apps/services/a/",
|
263
|
-
"Staging" => "https://staging2.zuora.com/apps/services/a/"
|
266
|
+
"Staging" => "https://staging2.zuora.com/apps/services/a/",
|
267
|
+
"Test" => "https://test.zuora.com/apps/services/a/"},
|
264
268
|
"EU" => {"Sandbox" => "https://sandbox.eu.zuora.com/apps/services/a/",
|
265
269
|
"Production" => "https://eu.zuora.com/apps/services/a/",
|
266
270
|
"Performance" => "https://pt1.eu.zuora.com/apps/services/a/",
|
@@ -301,15 +305,18 @@ module ZuoraAPI
|
|
301
305
|
|
302
306
|
def update_environment
|
303
307
|
if !self.url.blank?
|
304
|
-
|
308
|
+
case self.hostname
|
309
|
+
when /(?<=\.|\/|-|^)(apisandbox|sandbox)(?=\.|\/|-|$)/
|
305
310
|
self.environment = 'Sandbox'
|
306
|
-
|
311
|
+
when /(?<=\.|\/|^)(service[\d]*|services[\d]*|ep-edge)(?=\.|\/|$)/
|
307
312
|
self.environment = 'Services'
|
308
|
-
|
313
|
+
when /(?<=\.|\/|-|^)(pt[\d]*)(?=\.|\/|-|$)/
|
309
314
|
self.environment = 'Performance'
|
310
|
-
|
315
|
+
when /(?<=\.|\/|^)(staging1|staging2|stg)(?=\.|\/|$)/
|
311
316
|
self.environment = 'Staging'
|
312
|
-
|
317
|
+
when /(?<=\.|\/|^)(test)(?=\.|\/|$)/
|
318
|
+
self.environment = 'Test'
|
319
|
+
when /(?<=\.|\/|^)(www|api)(?=\.|\/|$)/, /(^|tls10\.|origin-www\.|zforsf\.|eu\.|na\.)(zuora\.com)/
|
313
320
|
self.environment = 'Production'
|
314
321
|
else
|
315
322
|
self.environment = 'Unknown'
|
@@ -319,20 +326,10 @@ module ZuoraAPI
|
|
319
326
|
end
|
320
327
|
end
|
321
328
|
|
322
|
-
def is_prod_env
|
323
|
-
is_prod = false
|
324
|
-
www_or_api = /(?<=\.|\/|^)(www|api)(?=\.|\/|$)/ === self.hostname
|
325
|
-
host_prefix_match = /(^|tls10\.|origin-www\.|zforsf\.|eu\.|na\.)(zuora\.com)/ === self.hostname
|
326
|
-
if www_or_api || host_prefix_match
|
327
|
-
is_prod = true
|
328
|
-
end
|
329
|
-
return is_prod
|
330
|
-
end
|
331
|
-
|
332
329
|
def update_zconnect_provider
|
333
330
|
region = update_region
|
334
331
|
environment = update_environment
|
335
|
-
mappings = {"US" => {"Sandbox" => "ZConnectSbx",
|
332
|
+
mappings = {"US" => {"Sandbox" => "ZConnectSbx", "Services" => "ZConnectSvcUS", "Production" => "ZConnectProd", "Performance" => "ZConnectPT1", "Test" => "ZConnectTest", "Staging" => "ZConnectQA", "KubeSTG" => "ZConnectDev", "KubeDEV" => "ZConnectDev", "KubePROD" => "ZConnectDev"},
|
336
333
|
"NA" => {"Sandbox" => "ZConnectSbxNA", "Services" => "ZConnectSvcNA", "Production" => "ZConnectProdNA", "Performance" => "ZConnectPT1NA"},
|
337
334
|
"EU" => {"Sandbox" => "ZConnectSbxEU", "Services" => "ZConnectSvcEU", "Production" => "ZConnectProdEU", "Performance" => "ZConnectPT1EU"},
|
338
335
|
"Unknown" => {"Unknown" => "Unknown"}}
|
@@ -352,26 +349,16 @@ module ZuoraAPI
|
|
352
349
|
def rest_endpoint(url="", domain=true, prefix='/v1/')
|
353
350
|
update_environment
|
354
351
|
endpoint = url
|
355
|
-
|
352
|
+
url_postfix = {"US" => ".", "EU" => ".eu.", "NA" => ".na."}[self.region]
|
353
|
+
|
356
354
|
case self.environment
|
355
|
+
when 'Test'
|
356
|
+
endpoint = "https://rest.test#{url_postfix}zuora.com"
|
357
357
|
when 'Sandbox'
|
358
|
-
|
359
|
-
|
360
|
-
endpoint = "https://rest.apisandbox.zuora.com"
|
361
|
-
when 'EU'
|
362
|
-
endpoint = "https://rest.sandbox.eu.zuora.com"
|
363
|
-
when 'NA'
|
364
|
-
endpoint = "https://rest.sandbox.na.zuora.com"
|
365
|
-
end
|
358
|
+
endpoint = "https://rest.sandbox#{url_postfix}zuora.com"
|
359
|
+
endpoint = "https://rest.apisandbox.zuora.com" if self.region == "US"
|
366
360
|
when 'Production'
|
367
|
-
|
368
|
-
when 'US'
|
369
|
-
endpoint = "https://rest.zuora.com"
|
370
|
-
when 'EU'
|
371
|
-
endpoint = "https://rest.eu.zuora.com"
|
372
|
-
when 'NA'
|
373
|
-
endpoint = "https://rest.na.zuora.com"
|
374
|
-
end
|
361
|
+
endpoint = "https://rest#{url_postfix}zuora.com"
|
375
362
|
when 'Performance'
|
376
363
|
endpoint = "https://rest.pt1.zuora.com"
|
377
364
|
when 'Services'
|
@@ -613,7 +600,7 @@ module ZuoraAPI
|
|
613
600
|
reason = body.xpath('//ns2:StatusReason', 'ns2' => 'http://object.api.zuora.com/').text
|
614
601
|
if reason.present?
|
615
602
|
message = body.xpath('//ns2:StatusReason', 'ns2' => 'http://object.api.zuora.com/').text
|
616
|
-
error = message.
|
603
|
+
error = message.match(/^[\w\d]{16}\: (Unexpected error.|No HTTP Response)/).present? ? 'UNEXPECTED_ERROR' : 'FATAL_ERROR'
|
617
604
|
else
|
618
605
|
error = 'FATAL_ERROR'
|
619
606
|
message = 'Export failed due to unknown reason. Consult api logs.'
|
@@ -104,9 +104,9 @@ module ZuoraAPI
|
|
104
104
|
retry
|
105
105
|
else
|
106
106
|
if Rails.logger.class.to_s == "Ougai::Logger"
|
107
|
-
Rails.logger.error("BasicLogin - Timed out
|
107
|
+
Rails.logger.error("BasicLogin - Timed out", ex)
|
108
108
|
else
|
109
|
-
Rails.logger.error("BasicLogin - #{ex.class} Timed out
|
109
|
+
Rails.logger.error("BasicLogin - #{ex.class} Timed out")
|
110
110
|
end
|
111
111
|
|
112
112
|
self.current_error = "Request timed out. Try again"
|
@@ -66,9 +66,9 @@ module ZuoraAPI
|
|
66
66
|
retry
|
67
67
|
else
|
68
68
|
if Rails.logger.class.to_s == "Ougai::Logger"
|
69
|
-
Rails.logger.error("OAuthLogin - Timed out
|
69
|
+
Rails.logger.error("OAuthLogin - Timed out", ex)
|
70
70
|
else
|
71
|
-
Rails.logger.error("OAuthLogin - #{ex.class} Timed out
|
71
|
+
Rails.logger.error("OAuthLogin - #{ex.class} Timed out")
|
72
72
|
end
|
73
73
|
self.current_error = "Request timed out. Try again"
|
74
74
|
self.status = 'Timeout'
|
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.7.
|
4
|
+
version: 1.7.58
|
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: 2020-03-
|
11
|
+
date: 2020-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|