zuora_api 1.3.7 → 1.3.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b029ed6d9f7ead429f7bb42665cc0b27feb1a9a
4
- data.tar.gz: 8336ab06ebd36be6ca08c91df27582f82a03eb60
3
+ metadata.gz: 6f8e6bf0f062ce8204b1ee21e04028d8fad4619c
4
+ data.tar.gz: 4ff63a9575ba4974b254620cecc94925294c635e
5
5
  SHA512:
6
- metadata.gz: 2273c4ebd710a119d61894080cf6f6aecfc59fd073b3bcf8cc0213c49f13c89890f0169f518a13a99c1595ecee840f5fd55ecb61b70ce8644cc1a5b6d608f526
7
- data.tar.gz: 1f4c13ffeb78e0cac396f79e5c863df5478051aea14e21f0603ce24b7e0a53be340e1c84dac9d74592e9f98f8052f17bb99d1ee40a26ae310f8e6b07b47eaed3
6
+ metadata.gz: 357c54ae68bd2abc34a09644653f94bdb665b334cb32c92b4f89f74eece529df4001f57ab7b3c31a2df364800b1d5b9acf3829059ae14c9506507eedc73325a3
7
+ data.tar.gz: a44f093a5ddd337f5fbc236502bc2ac561eedfd5650ff0d5ac6c47de1e69fc2b5058c299016abc5c4e523805bef83938f3609513a41aa799ae42cb748f6c7e9f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zuora_api (1.3.7)
4
+ zuora_api (1.3.8)
5
5
  httparty
6
6
  nokogiri (~> 1.6.8)
7
7
  railties (>= 4.1.0, < 5.1)
@@ -34,7 +34,7 @@ GEM
34
34
  erubis (2.7.0)
35
35
  httparty (0.15.5)
36
36
  multi_xml (>= 0.5.2)
37
- i18n (0.8.4)
37
+ i18n (0.8.6)
38
38
  loofah (2.0.3)
39
39
  nokogiri (>= 1.5.9)
40
40
  method_source (0.8.2)
@@ -4,8 +4,8 @@ require "nokogiri"
4
4
  module ZuoraAPI
5
5
  class Login
6
6
  ENVIRONMENTS = [SANDBOX = 'Sandbox', PRODUCTION = 'Production', PREFORMANCE = 'Preformance', SERVICES = 'Services', UNKNOWN = 'Unknown' ]
7
-
8
- attr_accessor :username, :password, :url, :wsdl_number, :status, :current_session, :environment, :status, :errors, :current_error, :user_info, :tenant_id, :tenant_name, :entity_id
7
+ REGIONS = [EU = 'EU', US = 'US' ]
8
+ attr_accessor :username, :password, :region,:url, :wsdl_number, :status, :current_session, :environment, :status, :errors, :current_error, :user_info, :tenant_id, :tenant_name, :entity_id
9
9
 
10
10
  def initialize(username: nil, password: nil, url: nil, entity_id: nil, session: nil, **keyword_args)
11
11
  @username = username
@@ -24,23 +24,32 @@ module ZuoraAPI
24
24
  %w(Sandbox Production Services Performance)
25
25
  end
26
26
 
27
+ def self.regions
28
+ %w(US EU)
29
+ end
30
+
27
31
  def self.endpoints
28
- return {"Sandbox" => "https://apisandbox.zuora.com/apps/services/a/",
29
- "Production" => "https://www.zuora.com/apps/services/a/",
30
- "Performance" => "https://pt1.zuora.com/apps/services/a/",
31
- "Services" => "https://services347.zuora.com/apps/services/a/",
32
- "Staging" => "https://app-0.stg.zuora.eu/apps/services/a/"}
32
+ return {"US" => {"Sandbox" => "https://apisandbox.zuora.com/apps/services/a/",
33
+ "Production" => "https://www.zuora.com/apps/services/a/",
34
+ "Performance" => "https://pt1.zuora.com/apps/services/a/",
35
+ "Services" => "https://services347.zuora.com/apps/services/a/"},
36
+ "EU" => {"Sandbox" => "https://sandbox.eu.zuora.com/apps/services/a/",
37
+ "Production" => "https://eu.zuora.com/apps/services/a/",
38
+ "Performance" => "https://pt1.eu.zuora.com/apps/services/a/",
39
+ "Services" => "https://services347.eu.zuora.com/apps/services/a/"}
40
+ }
33
41
  end
34
42
 
43
+
35
44
  def update_environment
36
45
  if !self.url.blank?
37
- env_path = self.url.split('https://').last.split('.zuora.com').first if self.url.include?(".zuora.com")
38
- env_path = self.url.split('https://').last.split('.zuora.eu').first if self.url.include?(".zuora.eu")
39
- if env_path == 'apisandbox' || self.url.include?('tls10.apisandbox.zuora.com')
46
+ env_path = self.url.split('https://').last.split('.zuora.com').first
47
+ self.region = self.url.include?("eu.") ? "EU" : "US"
48
+ if env_path == 'apisandbox' || self.url.include?('sandbox')
40
49
  self.environment = 'Sandbox'
41
- elsif env_path == 'www' || env_path == 'api' || self.url.include?('tls10.zuora.com')
50
+ elsif env_path == 'www' || env_path == 'api' || self.url.include?('tls10.zuora.com') || self.url.include?('origin-www.zuora.com') || self.url.include?('zforsf.zuora.com') || self.url.include?('https://zuora.com') || self.url.include?('eu.zuora.com')
42
51
  self.environment = 'Production'
43
- elsif env_path.include?('service')
52
+ elsif env_path.include?('service') || env_path.include?('ep-edge')
44
53
  self.environment = 'Services'
45
54
  elsif env_path.include?('pt')
46
55
  self.environment = 'Performance'
@@ -53,25 +62,17 @@ module ZuoraAPI
53
62
  end
54
63
 
55
64
  def aqua_endpoint(url="")
56
- if self.environment == 'Sandbox'
57
- return "https://apisandbox.zuora.com/apps/api/".concat(url)
58
- elsif self.environment == 'Production'
59
- return "https://zuora.com/apps/api/".concat(url)
60
- else self.environment == 'Unknown'
61
- return url
62
- end
65
+ return "#{self.url.split(".com").first}/apps/api/".concat(url)
63
66
  end
64
67
 
65
68
  def rest_endpoint(url="")
66
69
  if self.environment == 'Sandbox'
67
- return "https://rest.apisandbox.zuora.com/v1/".concat(url)
70
+ return self.region == "US" ? "https://apisandbox-api.zuora.com/rest/v1/".concat(url) : "https://rest.sandbox.eu.zuora.com/v1/".concat(url)
68
71
  elsif self.environment == 'Production'
69
- return "https://rest.zuora.com/v1/".concat(url)
72
+ return self.region == "US" ? "https://api.zuora.com/rest/v1/".concat(url) : "https://rest.eu.zuora.com/v1/".concat(url)
70
73
  elsif self.environment == 'Services'
71
74
  return self.url.split('/')[0..2].join('/').concat('/apps/v1/').concat(url)
72
75
  elsif self.environment == 'Performance'
73
- return "https://rest.pt1.zuora.com/v1/".concat(url)
74
- elsif self.environment == "Staging"
75
76
  return self.url.split('/')[0..2].join('/').concat('/apps/v1/').concat(url)
76
77
  else self.environment == 'Unknown'
77
78
  return url
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.3.7"
2
+ VERSION = "1.3.8"
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.3.7
4
+ version: 1.3.8
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-06-29 00:00:00.000000000 Z
11
+ date: 2017-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler