zuora_api 1.9.05 → 1.9.09

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
  SHA256:
3
- metadata.gz: 5452aee1cc74ec9a6780ddbf5a63c2b0916e483c69ca44ef401316fe64fe8785
4
- data.tar.gz: fe7189452d77301133c1703b74699a56d8ac05f31b886387b28abb1d659dcc71
3
+ metadata.gz: a6da8c9fbf54221b62336d0221ada0f53e9d22690b7a6a52cd83f214314b5ba5
4
+ data.tar.gz: be31b09eef19df8b8d1fcbd70b9a11980f125c4eb4d5f96c3259ed516ab88934
5
5
  SHA512:
6
- metadata.gz: 057de8a5dfe3faf340cd993314b2eba4e2bec90dc5adccb803e611748531fc5f7ca1b6fc468f24d60694a23041a07883b30972ea38935c7f07d92c3f32ab5682
7
- data.tar.gz: b1331df530a20c776ca934f50f370504f844723595b2c24d31923edadde33bb87975a32633dac8d7815da067ad4b47f8c2ffe01a688480b1c1ce767de3650e70
6
+ metadata.gz: d6382ae611e80b38e574357baa771b432c4e554662293e98e4a73ca446c9445264d902f0b604ee071fe9dac6cf6bee4fde8319f0f782975955fdd562cf921b6c
7
+ data.tar.gz: 1008b0e7e533e01b6636cc82e3e79b21c825d095d789d83c73c96142d9de78556c0caa38775aedb97a3b27e43a93f16281680f10a7d988fb005951084a36f75e
@@ -7,8 +7,9 @@ module ZuoraAPI
7
7
  class Login
8
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
- MIN_Endpoints = {'Test': '107.0', 'Sandbox': '107.0', 'Production': '107.0', 'Performance': '107.0', 'Services': '96.0', 'Unknown': '96.0', 'Staging': '107.0'}.freeze
10
+ MIN_Endpoints = {'Test': '108.0', 'Sandbox': '108.0', 'Production': '108.0', 'Performance': '108.0', 'Services': '96.0', 'Unknown': '96.0', 'Staging': '108.0'}.freeze
11
11
  XML_SAVE_OPTIONS = Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
12
+ USER_AGENT = "Zuora#{ENV['Z_APPLICATION_NAME']&.capitalize}/#{ENV['Z_APPLICATION_VERSION']&.delete('v')}"
12
13
 
13
14
  CONNECTION_EXCEPTIONS = [
14
15
  Net::OpenTimeout,
@@ -75,7 +76,7 @@ module ZuoraAPI
75
76
  zsession = cookies["ZSession"]
76
77
  begin
77
78
  if !zsession.blank?
78
- response = HTTParty.get("https://#{self.hostname}/apps/v1/identity", :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json'})
79
+ response = HTTParty.get("https://#{self.hostname}/apps/v1/identity", :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json', "User-Agent" => USER_AGENT})
79
80
  output_json = JSON.parse(response.body)
80
81
  else
81
82
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new("No ZSession cookie present")
@@ -91,7 +92,7 @@ module ZuoraAPI
91
92
  zsession = cookies["ZSession"]
92
93
  begin
93
94
  if zsession.present?
94
- response = HTTParty.get("https://#{self.hostname}/apps/v1/navigation", :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json'})
95
+ response = HTTParty.get("https://#{self.hostname}/apps/v1/navigation", :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json', "User-Agent" => USER_AGENT})
95
96
  output_json = JSON.parse(response.body)
96
97
  else
97
98
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new("No ZSession cookie present")
@@ -107,7 +108,7 @@ module ZuoraAPI
107
108
  zsession = cookies["ZSession"]
108
109
  begin
109
110
  if !zsession.blank?
110
- response = HTTParty.put("https://#{self.hostname}/apps/v1/preference/navigation", :body => state.to_json, :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json'})
111
+ response = HTTParty.put("https://#{self.hostname}/apps/v1/preference/navigation", :body => state.to_json, :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json', "User-Agent" => USER_AGENT})
111
112
  output_json = JSON.parse(response.body)
112
113
  else
113
114
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new("No ZSession cookie present")
@@ -123,7 +124,7 @@ module ZuoraAPI
123
124
  zsession = cookies["ZSession"]
124
125
  begin
125
126
  if !zsession.blank?
126
- response = HTTParty.post("https://#{self.hostname}/apps/v1/navigation/fetch", :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json'})
127
+ response = HTTParty.post("https://#{self.hostname}/apps/v1/navigation/fetch", :headers => {'Cookie' => "ZSession=#{zsession}", 'Content-Type' => 'application/json', "User-Agent" => USER_AGENT})
127
128
  output_json = JSON.parse(response.body)
128
129
  else
129
130
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new("No ZSession cookie present")
@@ -138,7 +139,7 @@ module ZuoraAPI
138
139
  def reporting_url(path)
139
140
  map = {"US" => {"Sandbox" => "https://zconnectsandbox.zuora.com/api/rest/v1/",
140
141
  "Production" => "https://zconnect.zuora.com/api/rest/v1/",
141
- "Test" => "https://reporting-sbx.zan.0001.sbx.auw2.zuora.com/api/rest/v1/",
142
+ "Test" => "https://zconnect-services0001.test.zuora.com/api/rest/v1/",
142
143
  "Staging" => "https://reporting-stg11.zan.svc.auw2.zuora.com/api/rest/v1/",
143
144
  "Performance" => "https://zconnectpt1.zuora.com/api/rest/v1/",
144
145
  "Services" => "https://reporting-svc08.svc.auw2.zuora.com/api/rest/v1/"},
@@ -176,7 +177,7 @@ module ZuoraAPI
176
177
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new("Zuora User ID not provided")
177
178
  end
178
179
  elsif !client_id.nil? && !client_secret.nil?
179
- bearer_response = HTTParty.post("https://#{self.hostname}/oauth/token", :headers => {'Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'application/json'}, :body => {'client_id' => client_id, 'client_secret' => URI::encode(client_secret), 'grant_type' => 'client_credentials'})
180
+ bearer_response = HTTParty.post("https://#{self.hostname}/oauth/token", :headers => {'Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'application/json', "User-Agent" => USER_AGENT}, :body => {'client_id' => client_id, 'client_secret' => URI::encode(client_secret), 'grant_type' => 'client_credentials'})
180
181
  bearer_hash = JSON.parse(bearer_response.body)
181
182
  bearer_token = bearer_hash["access_token"]
182
183
  authorization = "Bearer #{bearer_token}"
@@ -184,7 +185,7 @@ module ZuoraAPI
184
185
 
185
186
  if !authorization.blank? && !user_id.blank? && !entity_ids.blank?
186
187
  endpoint = chomp_v1_from_genesis_endpoint ? self.rest_endpoint.chomp("v1/").concat("genesis/clients") : self.rest_endpoint("genesis/clients")
187
- oauth_response = HTTParty.post(endpoint, :headers => {'authorization' => authorization, 'Content-Type' => 'application/json'}, :body => {'clientId' => new_client_id, 'clientSecret' => new_client_secret, 'userId' => user_id, 'entityIds' => entity_ids, 'customAuthorities' => custom_authorities, 'additionalInformation' => {'description' => info_desc, 'name' => info_name}}.to_json)
188
+ oauth_response = HTTParty.post(endpoint, :headers => {'authorization' => authorization, 'Content-Type' => 'application/json', "User-Agent" => USER_AGENT}, :body => {'clientId' => new_client_id, 'clientSecret' => new_client_secret, 'userId' => user_id, 'entityIds' => entity_ids, 'customAuthorities' => custom_authorities, 'additionalInformation' => {'description' => info_desc, 'name' => info_name}}.to_json)
188
189
  output_json = JSON.parse(oauth_response.body)
189
190
  if oauth_response.code == 201
190
191
  output_json["clientSecret"] = new_client_secret if !use_api_generated_client_secret
@@ -433,12 +434,12 @@ module ZuoraAPI
433
434
  end
434
435
  if single_transaction
435
436
  xml["#{ns1}"].CallOptions do
436
- xml.useSingleTransaction single_transaction
437
+ xml["#{ns1}"].useSingleTransaction single_transaction
437
438
  end
438
439
  end
439
440
  if batch_size
440
441
  xml["#{ns1}"].QueryOptions do
441
- xml.batchSize batch_size
442
+ xml["#{ns1}"].batchSize batch_size
442
443
  end
443
444
  end
444
445
  end
@@ -453,6 +454,7 @@ module ZuoraAPI
453
454
 
454
455
  headers.merge!({ 'Content-Type' => "text/xml; charset=utf-8", 'Accept' => 'text/xml'})
455
456
  headers['Zuora-Track-Id'] = zuora_track_id if zuora_track_id.present?
457
+ headers["User-Agent"] = USER_AGENT
456
458
 
457
459
  request = HTTParty::Request.new(
458
460
  Net::HTTP::Post,
@@ -1026,7 +1028,7 @@ module ZuoraAPI
1026
1028
  base = self.url.include?(".com") ? self.url.split(".com")[0].concat(".com") : self.url.split(".eu")[0].concat(".eu")
1027
1029
  url = object ? "#{base}/apps/api/describe/#{object}" : "#{base}/apps/api/describe/"
1028
1030
  headers = self.entity_id.present? ? {"Zuora-Entity-Ids" => self.entity_id, 'Content-Type' => "text/xml; charset=utf-8"} : {'Content-Type' => "text/xml; charset=utf-8"}
1029
- response = HTTParty.get(url, headers: {"Authorization" => self.get_session(prefix: true, auth_type: :basic)}.merge(headers), :timeout => 130)
1031
+ response = HTTParty.get(url, headers: {"Authorization" => self.get_session(prefix: true, auth_type: :basic), "User-Agent" => USER_AGENT}.merge(headers), :timeout => 130)
1030
1032
 
1031
1033
  raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new(self.current_error.present? ? self.current_error : 'Describe call 401', response) if response.code == 401
1032
1034
 
@@ -1118,6 +1120,7 @@ module ZuoraAPI
1118
1120
  end
1119
1121
  end
1120
1122
  headers['Zuora-Track-Id'] = zuora_track_id if zuora_track_id.present?
1123
+ headers['User-Agent'] = USER_AGENT
1121
1124
 
1122
1125
  modified_headers = {'Content-Type' => "application/json; charset=utf-8"}.merge(authentication_headers).merge(headers)
1123
1126
 
@@ -1283,6 +1286,7 @@ module ZuoraAPI
1283
1286
  end
1284
1287
 
1285
1288
  headers['Zuora-Track-Id'] = zuora_track_id if zuora_track_id.present?
1289
+ headers["User-Agent"] = USER_AGENT
1286
1290
 
1287
1291
  response_save = nil
1288
1292
  http.request_get(uri.request_uri, headers) do |response|
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.9.05"
2
+ VERSION = "1.9.09"
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.9.05
4
+ version: 1.9.09
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: 2021-05-18 00:00:00.000000000 Z
11
+ date: 2021-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  - !ruby/object:Gem::Version
220
220
  version: '0'
221
221
  requirements: []
222
- rubygems_version: 3.2.15
222
+ rubygems_version: 3.2.22
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: Gem that provides easy integration to Zuora