zuora_api 1.6.38 → 1.6.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/zuora_api/login.rb +17 -11
- data/lib/zuora_api/logins/basic.rb +2 -2
- data/lib/zuora_api/logins/oauth.rb +5 -3
- 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: 327020361fd779fff57aad1eae6b019cb0d89117e5e6a2f43bcb6b73577287ab
|
4
|
+
data.tar.gz: 14b99e36c696d2b8627fce73ad56ae24e6e49e3805a480f532d9a42837638405
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cbb02c248d3cf410fdb16b4dfaabe11b7cb5328c8c0ed665aa7bc878221a23b1db8cd1733f8c0f71a171deee979452c36885c783262e9c9c07fca3bc8e831ce
|
7
|
+
data.tar.gz: 13262076080a1aadfaa9bc40921c8287cf6c921e7dcd93d481b57d83d1878cc6b639f19f985f8814dbd90d113c8212cbe5b4519114e0c725dfad28224ae98545
|
data/Gemfile.lock
CHANGED
data/lib/zuora_api/login.rb
CHANGED
@@ -13,18 +13,24 @@ module ZuoraAPI
|
|
13
13
|
CONNECTION_READ_EXCEPTIONS = [Net::ReadTimeout, Errno::ECONNRESET, Errno::EPIPE]
|
14
14
|
ZUORA_API_ERRORS = [ZuoraAPI::Exceptions::ZuoraAPIError, ZuoraAPI::Exceptions::ZuoraAPIRequestLimit, ZuoraAPI::Exceptions::ZuoraAPILockCompetition, ZuoraAPI::Exceptions::ZuoraAPITemporaryError, ZuoraAPI::Exceptions::ZuoraDataIntegrity]
|
15
15
|
|
16
|
-
attr_accessor :region, :url, :wsdl_number, :current_session, :environment, :status, :errors, :current_error, :user_info, :tenant_id, :tenant_name, :entity_id, :timeout_sleep, :hostname, :zconnect_provider
|
16
|
+
attr_accessor :region, :url, :wsdl_number, :current_session, :bearer_token, :oauth_session_expires_at, :environment, :status, :errors, :current_error, :user_info, :tenant_id, :tenant_name, :entity_id, :timeout_sleep, :hostname, :zconnect_provider
|
17
17
|
|
18
|
-
def initialize(url: nil, entity_id: nil, session: nil, status: nil, **keyword_args)
|
18
|
+
def initialize(url: nil, entity_id: nil, session: nil, status: nil, bearer_token: nil, oauth_session_expires_at: nil, **keyword_args)
|
19
19
|
raise "URL is nil or empty, but URL is required" if url.nil? || url.empty?
|
20
20
|
# raise "URL is improper. URL must contain zuora.com, zuora.eu, or zuora.na" if /zuora.com|zuora.eu|zuora.na/ === url
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
self.hostname = /(?<=https:\/\/|http:\/\/)(.*?)(?=\/|$)/.match(url)[0] if !/(?<=https:\/\/|http:\/\/)(.*?)(?=\/|$)/.match(url).nil?
|
22
|
+
if !/apps\/services\/a\/\d{2}\.\d$/.match(url.strip)
|
23
|
+
self.url = "https://#{hostname}/apps/services/#{MIN_Endpoint}"
|
24
|
+
elsif MIN_Endpoint.to_f > url.scan(/(\d{2}\.\d)$/).dig(0,0).to_f
|
25
|
+
self.url = url.gsub(/(\d{2}\.\d)$/, MIN_Endpoint)
|
26
|
+
end
|
27
|
+
self.entity_id = get_entity_id(entity_id: entity_id)
|
28
|
+
self.errors = Hash.new
|
29
|
+
self.current_session = session
|
30
|
+
self.bearer_token = bearer_token
|
31
|
+
self.oauth_session_expires_at = oauth_session_expires_at
|
32
|
+
self.status = status.blank? ? "Active" : status
|
33
|
+
self.user_info = Hash.new
|
28
34
|
self.update_region
|
29
35
|
self.update_environment
|
30
36
|
self.update_zconnect_provider
|
@@ -634,7 +640,7 @@ module ZuoraAPI
|
|
634
640
|
end
|
635
641
|
|
636
642
|
#All other errors
|
637
|
-
if response.code
|
643
|
+
if ![200,201].include?(response.code)
|
638
644
|
if response.code == 429
|
639
645
|
raise ZuoraAPI::Exceptions::ZuoraAPIRequestLimit.new("The total number of concurrent requests has exceeded the limit allowed by the system. Please resubmit your request later.", response)
|
640
646
|
else
|
@@ -768,7 +774,7 @@ module ZuoraAPI
|
|
768
774
|
raise_errors(type: :JSON, body: output_json, response: response)
|
769
775
|
rescue ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError => ex
|
770
776
|
if self.class.to_s == 'ZuoraAPI::Oauth'
|
771
|
-
self.rest_call(method: method.to_sym, url: url, debug: debug, errors: errors, z_session: z_session, session_type: :bearer, timeout_retry: timeout_retry, timeout: timeout)
|
777
|
+
self.rest_call(method: method.to_sym, url: url, body: body, debug: debug, errors: errors, z_session: z_session, session_type: :bearer, timeout_retry: timeout_retry, timeout: timeout)
|
772
778
|
else
|
773
779
|
Rails.logger.debug("Rest Call - Session Bad Auth type")
|
774
780
|
raise ex
|
@@ -5,9 +5,9 @@ module ZuoraAPI
|
|
5
5
|
def initialize(oauth_client_id: nil, oauth_secret: nil, bearer_token: nil, oauth_session_expires_at: nil, **keyword_args)
|
6
6
|
self.oauth_client_id = oauth_client_id
|
7
7
|
self.oauth_secret = oauth_secret
|
8
|
-
self.bearer_token = bearer_token
|
9
|
-
self.oauth_session_expires_at = oauth_session_expires_at
|
10
|
-
raise ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError.new("Request Oauth Login but either 'Oauth Client Id' or 'Oauth Secret' were not passed") if
|
8
|
+
self.bearer_token = bearer_token
|
9
|
+
self.oauth_session_expires_at = oauth_session_expires_at
|
10
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError.new("Request Oauth Login but either 'Oauth Client Id' or 'Oauth Secret' were not passed") if self.bearer_token.blank? && (self.oauth_client_id.blank? || self.oauth_secret.blank?)
|
11
11
|
super
|
12
12
|
end
|
13
13
|
|
@@ -66,6 +66,8 @@ module ZuoraAPI
|
|
66
66
|
|
67
67
|
def get_bearer_token
|
68
68
|
tries ||= 2
|
69
|
+
raise ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError.new("Request Oauth Login but either 'Oauth Client Id' or 'Oauth Secret' were not passed") if self.oauth_client_id.blank? || self.oauth_secret.blank?
|
70
|
+
|
69
71
|
output_json, response = self.rest_call(:method => :post,
|
70
72
|
:url => self.rest_endpoint.chomp('v1/').concat("oauth/token"),
|
71
73
|
:z_session => false,
|
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.39
|
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-05-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|