zuora_api 1.7.50 → 1.7.51

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
  SHA256:
3
- metadata.gz: e75a6b0ad3f4bc32fb9219d2dc532ae7398c25f86196aee3be552056c16e53d3
4
- data.tar.gz: 2db1a25001b11c3700d5c359de840bce013a278c9c9a060498525ecf533e9ddc
3
+ metadata.gz: 5cd2aa521463a9f52d88dc5a6ccc895b87e18fdc03994f73a2d9a015d83faa3e
4
+ data.tar.gz: 5645ed96e0f8e29f56bff92f07b026cddb4a3157740044dd34715803ca8f38e7
5
5
  SHA512:
6
- metadata.gz: ac0dcc310f4f701908cb28f898045634290103e4b2cf65299ea6e25bf4e45999ee2577360e6e91a1f0210717f252a493b15ae4497f906c4140d7c9855853b600
7
- data.tar.gz: 953b7b1332b0ec5c2f735b9a9b5d6bb247a9784aa28a75a98ef620de1dd2f73c1cec684908d2e3e8bf0707525fae8f8f2642fffea03b1ea96c5e0659cfeca564
6
+ metadata.gz: 5a362242619d917e955f2133d986e8367d04924d1f3bae69d9c924a34c8e53ad395fa0f2c0aee1239ba9a096d473004757a197f0a71f3874b2599b759d31110c
7
+ data.tar.gz: b2829f5a1decf1f840916ce986589142b1e0bd0ddf69f8795af1d3f715cdf21afa56067e053ad6379ca790a6ba2094a430d97e8e71ea6c9fe7ebedf1077f834b
@@ -571,6 +571,9 @@ module ZuoraAPI
571
571
  end
572
572
 
573
573
  def raise_errors(type: :SOAP, body: nil, response: nil)
574
+ request = response.request
575
+ match_string = "#{request.http_method.to_s.split("Net::HTTP::").last.upcase}::#{response.code}::#{request.path.path}"
576
+
574
577
  if [502,503].include?(response.code)
575
578
  raise ZuoraAPI::Exceptions::ZuoraAPIConnectionTimeout.new("Received #{response.code} from #{response.request.uri}", response)
576
579
  end
@@ -581,6 +584,18 @@ module ZuoraAPI
581
584
  raise ZuoraAPI::Exceptions::ZuoraAPIReadTimeout.new("Received 504 from #{response.request.uri}", response)
582
585
  when 429
583
586
  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)
587
+ when 401
588
+
589
+ else
590
+ if body.class == Hash
591
+ case response.request.path.path
592
+ when /^\/v1\/connections$/
593
+ response_headers = response.headers.to_h
594
+ raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new("Missing cookies for authentication call", response) if response_headers['set-cookie'].blank?
595
+ z_session_cookie = response_headers.fetch('set-cookie', []).select{|x| x.match(/^ZSession=.*/) }.first
596
+ raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new("Missing ZSession cookie for authentication call", response) if z_session_cookie.blank?
597
+ end
598
+ end
584
599
  end
585
600
 
586
601
  case type
@@ -619,15 +634,24 @@ module ZuoraAPI
619
634
  end
620
635
  end
621
636
 
622
- if response.code == 500 || (response.code == 400 && response.headers.fetch('content-type', []).include?('text/html'))
637
+ if (response.code == 400 && response.headers.fetch('content-type', []).include?('text/html'))
623
638
  raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(response.body, response)
639
+ elsif response.code == 500
640
+ if response.headers.fetch('content-type', []).include?('application/json')
641
+ begin
642
+ output_json = JSON.parse(response.body)
643
+ self.raise_errors(type: :JSON, body: output_json, response: response)
644
+ rescue JSON::ParserError => ex
645
+ raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(response.body, response)
646
+ end
647
+ else
648
+ raise ZuoraAPI::Exceptions::ZuoraAPIInternalServerError.new(response.body, response)
649
+ end
624
650
  end
625
651
 
626
652
  when :JSON
627
653
  if body.class == Hash
628
- request = response.request
629
- match_string = "#{request.http_method.to_s.split("Net::HTTP::").last.upcase}::#{response.code}::#{request.path.path}"
630
- case response.request.path.path
654
+ case request.path.path
631
655
  when /^\/query\/jobs.*/ #DataQuery Paths
632
656
  case match_string
633
657
  when /^GET::200::\/query\/jobs\/([a-zA-Z0-9\-_]*)$/ #Get DQ job
@@ -843,7 +867,7 @@ module ZuoraAPI
843
867
  raise ZuoraAPI::Exceptions::ZuoraAPIUnkownError.new(message, response, errors, success)
844
868
  end
845
869
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new(message, response, errors, success)
846
- when /invalid/, /INVALID_ID/, /MAX_RECORDS_EXCEEDED/, /INVALID_FIELD/, /MALFORMED_QUERY/, /NO_PERMISSION/, /PDF_QUERY_ERROR/, /MISSING_REQUIRED_VALUE/, /INVALID_TYPE/, /TRANSACTION_FAILED/, /API_DISABLED/, /CANNOT_DELETE/, /ACCOUNTING_PERIOD_CLOSED/
870
+ when /invalid/, /REQUEST_REJECTED/, /INVALID_ID/, /MAX_RECORDS_EXCEEDED/, /INVALID_FIELD/, /MALFORMED_QUERY/, /NO_PERMISSION/, /PDF_QUERY_ERROR/, /MISSING_REQUIRED_VALUE/, /INVALID_TYPE/, /TRANSACTION_FAILED/, /API_DISABLED/, /CANNOT_DELETE/, /ACCOUNTING_PERIOD_CLOSED/
847
871
  raise ZuoraAPI::Exceptions::ZuoraAPIError.new(message, response, errors, success)
848
872
  when /.*UNEXPECTED_ERROR/
849
873
  raise ZuoraAPI::Exceptions::ZuoraUnexpectedError.new(message, response, errors, success)
@@ -11,7 +11,7 @@ module ZuoraAPI
11
11
  super
12
12
  end
13
13
 
14
- def new_session(raise_errors: false, auth_type: nil, zuora_track_id: nil)
14
+ def new_session(auth_type: nil, zuora_track_id: nil)
15
15
  if auth_type == :bearer
16
16
  get_bearer_token(zuora_track_id: zuora_track_id)
17
17
  elsif auth_type == :basic
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.7.50"
2
+ VERSION = "1.7.51"
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.7.50
4
+ version: 1.7.51
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-02-25 00:00:00.000000000 Z
11
+ date: 2020-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler