zuora_api 1.6.20 → 1.6.21

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
  SHA1:
3
- metadata.gz: b66a64866c65694fb3c7943a3c6f25ee6c140c00
4
- data.tar.gz: 4ecb82d9f5f0b4436114faa52d64dfa51ac64792
3
+ metadata.gz: fcc7dc36e49132b3c42a3c42d68673011c858955
4
+ data.tar.gz: 64c770c204e53aa8c5b9a0ef65ec02dcca0daa27
5
5
  SHA512:
6
- metadata.gz: b4d62f26e1458614ab146fb2757ac07fdcec18389630082d73092ddbd21c5d1a78cc36cb7ad60d0d1a678f719a515e70b27ced3c01a004389f1009aa7cffcaef
7
- data.tar.gz: 2c95f895ca912ce1eaad5cc4c1d1b6087eb19e4b315f8c9fed91651b91afbc268f8834e47a9cccb1624894dd17d60973047aaea516a2c9a967de5520fe56cc38
6
+ metadata.gz: 8cb8539d713b55da67c8714e18318944b55de1fa610d03c54ec53c5ba271fdf80590f2869ae2c0ce87701a85e6ec02cf4ebe113b36f21df8be1146f2e14e74a9
7
+ data.tar.gz: c24463af0aa66d1595588c3172abdc71c8eecd3cb5daa655283325ed3cf882bfad99816f537ec904143121eb5b086318cff7e8efe07cc88fb4104b46ba941e77
@@ -7,7 +7,7 @@ module ZuoraAPI
7
7
  ENVIRONMENTS = [SANDBOX = 'Sandbox', PRODUCTION = 'Production', PREFORMANCE = 'Preformance', SERVICES = 'Services', UNKNOWN = 'Unknown', STAGING = 'Staging' ]
8
8
  REGIONS = [EU = 'EU', US = 'US', NA = 'NA' ]
9
9
  MIN_Endpoint = '91.0'
10
- XML_SAVE_OPTIONS = Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
10
+ XML_SAVE_OPTIONS = Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
11
11
  CONNECTION_EXCEPTIONS = [Net::OpenTimeout, OpenSSL::SSL::SSLError, Errno::ECONNREFUSED, SocketError]
12
12
  CONNECTION_READ_EXCEPTIONS = [Net::ReadTimeout, Errno::ECONNRESET, Errno::EPIPE]
13
13
 
@@ -327,7 +327,9 @@ module ZuoraAPI
327
327
  when 'NA'
328
328
  endpoint = "https://rest.na.zuora.com/v1/".concat(url)
329
329
  end
330
- when 'Services', 'Performance'
330
+ when 'Performance'
331
+ endpoint = "https://rest.pt1.zuora.com/v1/".concat(url)
332
+ when 'Services'
331
333
  https = /https:\/\/|http:\/\//.match(self.url)[0]
332
334
  host = self.hostname
333
335
  endpoint = "#{https}#{host}/apps/v1/#{url}"
@@ -347,15 +349,15 @@ module ZuoraAPI
347
349
  return self.wsdl_number > 68 ? '%Y-%m-%d' : '%Y-%m-%dT%H:%M:%S'
348
350
  end
349
351
 
350
- def new_session(auth_type: :basic, debug: false)
352
+ def new_session(auth_type: :basic, debug: false)
351
353
  end
352
354
 
353
355
  def get_session(prefix: false, auth_type: :basic)
354
- Rails.logger.debug("Get session for #{auth_type} - #{self.class.to_s}")
356
+ Rails.logger.debug("Get session for #{auth_type} - #{self.class.to_s}")
355
357
  case auth_type
356
358
  when :basic
357
359
  if self.current_session.blank?
358
- Rails.logger.debug("Create new session")
360
+ Rails.logger.debug("Create new session")
359
361
  case self.class.to_s
360
362
  when 'ZuoraAPI::Oauth'
361
363
  if self.bearer_token.blank? || self.oauth_expired?
@@ -506,12 +508,12 @@ module ZuoraAPI
506
508
  when "TEMPORARY_ERROR"
507
509
  raise ZuoraAPI::Exceptions::ZuoraAPITemporaryError.new("#{error}::#{message}", body, response.code)
508
510
  else
509
- raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{error}::#{message}", body, response.code) if error.present?
511
+ raise ZuoraAPI::Exceptions::ZuoraAPIError.new("#{error}::#{message}", body, response.code) if error.present?
510
512
  end
511
513
  elsif error.class == Array
512
514
  if error[0].include?("LOCK_COMPETITION") && error.count == 1
513
515
  raise ZuoraAPI::Exceptions::ZuoraAPILockCompetition.new(error.group_by {|v| v}.map {|k,v| "(#{v.size}x) - #{k == "::" ? 'UNKNOWN::No error provided' : k}"}.join(', '), body, response.code)
514
- else
516
+ else
515
517
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new(error.group_by {|v| v}.map {|k,v| "(#{v.size}x) - #{k == "::" ? 'UNKNOWN::No error provided' : k}"}.join(', '), body, response.code, error, success)
516
518
  end
517
519
  end
@@ -728,7 +730,7 @@ module ZuoraAPI
728
730
  end
729
731
 
730
732
  raise "Method not supported, supported methods include: :get, :post, :put, :delete, :patch, :head, :options" if ![:get, :post, :put, :delete, :patch, :head, :options].include?(method)
731
-
733
+
732
734
  authentication_headers = z_session ? {"Authorization" => self.get_session(prefix: true, auth_type: session_type) } : {}
733
735
  headers = {'Content-Type' => "application/json; charset=utf-8"}.merge(headers).merge(authentication_headers)
734
736
 
@@ -745,7 +747,7 @@ module ZuoraAPI
745
747
  rescue ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError => ex
746
748
  if self.class.to_s == 'ZuoraAPI::Oauth'
747
749
  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)
748
- else
750
+ else
749
751
  Rails.logger.debug("Rest Call - Session Bad Auth type")
750
752
  raise ex
751
753
  end
@@ -868,7 +870,7 @@ module ZuoraAPI
868
870
  when Net::HTTPUnauthorized
869
871
  if count <= 0
870
872
  if z_session
871
- raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new(self.current_error)
873
+ raise ZuoraAPI::Exceptions::ZuoraAPISessionError.new(self.current_error)
872
874
  else
873
875
  raise
874
876
  end
@@ -906,14 +908,14 @@ module ZuoraAPI
906
908
  when /.*; filename=/
907
909
  full_filename ||= /.*; filename=(.*)/.match(response.header["Content-Disposition"])[1].strip
908
910
  else
909
- raise "Can't parse Content-Disposition header: #{response.header["Content-Disposition"]}"
911
+ raise "Can't parse Content-Disposition header: #{response.header["Content-Disposition"]}"
910
912
  end
911
913
  file_ending ||= full_filename.end_with?(".csv.zip") ? ".csv.zip" : File.extname(full_filename)
912
914
  filename ||= File.basename(full_filename, file_ending)
913
915
  end
914
916
 
915
917
  #If user supplied a filename use it, else default to content header filename, else default to uri pattern
916
- file_ending ||= uri.path.end_with?(".csv.zip") ? ".csv.zip" : File.extname(uri.path)
918
+ file_ending ||= uri.path.end_with?(".csv.zip") ? ".csv.zip" : File.extname(uri.path)
917
919
  filename ||= File.basename(uri.path, file_ending)
918
920
 
919
921
  if response.header["Content-Type"].present?
@@ -994,7 +996,7 @@ module ZuoraAPI
994
996
  end
995
997
 
996
998
  response_query = HTTParty.post(self.url, body: request.to_xml(:save_with => XML_SAVE_OPTIONS).strip, headers: {'Content-Type' => "application/json; charset=utf-8"}, :timeout => 120)
997
-
999
+
998
1000
  output_xml = Nokogiri::XML(response_query.body)
999
1001
  raise 'Export Creation Unsuccessful : ' + output_xml.xpath('//ns1:Message', 'ns1' =>'http://api.zuora.com/').text if output_xml.xpath('//ns1:Success', 'ns1' =>'http://api.zuora.com/').text != "true"
1000
1002
  id = output_xml.xpath('//ns1:Id', 'ns1' =>'http://api.zuora.com/').text
@@ -1018,7 +1020,7 @@ module ZuoraAPI
1018
1020
  while result != "Completed"
1019
1021
  sleep 3
1020
1022
  response_query = HTTParty.post(self.url, body: confirmRequest.to_xml(:save_with => XML_SAVE_OPTIONS).strip, headers: {'Content-Type' => "application/json; charset=utf-8"}, :timeout => 120)
1021
-
1023
+
1022
1024
  output_xml = Nokogiri::XML(response_query.body)
1023
1025
  result = output_xml.xpath('//ns2:Status', 'ns2' =>'http://object.api.zuora.com/').text
1024
1026
  status_code = response_query.code if response_query
@@ -1070,7 +1072,7 @@ module ZuoraAPI
1070
1072
  response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
1071
1073
  http.request req
1072
1074
  end
1073
-
1075
+
1074
1076
  Rails.logger.debug("Response #{response.code} #{response.message}: #{response.body}")
1075
1077
 
1076
1078
  result = JSON.parse(response.body)
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.6.20"
3
- end
2
+ VERSION = "1.6.21"
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.6.20
4
+ version: 1.6.21
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: 2018-12-31 00:00:00.000000000 Z
11
+ date: 2019-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler