zuora_api 0.2.6.3 → 0.2.6.4

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: b951408f08d47564162bc87dfdce7f2d7cabc6db
4
- data.tar.gz: 0d049bf21fdbc43a867b882250b6f3efe5d8abc6
3
+ metadata.gz: 373ec490542a3dc52e573672a02c86afac305097
4
+ data.tar.gz: d3c3590ffc01986842faf9bed98384571c6d2f53
5
5
  SHA512:
6
- metadata.gz: 5a1b2c9d318bf82f4fc7609d0fbeaf3232c6873b8c877cbcad068e97bfba96d8b50ed8c0da0c81e270af39b318e848da6e358c84809c743813a749ad15cb4fd4
7
- data.tar.gz: 2d2e576bf7ce6c43bb71bb51316aa0230bd994a8f76348548025027dd6416707de077646c3e231748002fa6c91590e062e6d23237235d13e62791e10a2a82d13
6
+ metadata.gz: 2de0ead7dab62081da4c1648e669007b444749c462c9a4d3e6b25ec3049304ca404e06d5784abc4d5e197258303aa39954aaf44248cad263d6f532a73251cc03
7
+ data.tar.gz: 017e97a756cf0ea9506ec032ed1986557324af941cf0f789c512421ae68623100509d22063d1e89cbf910a5aa41dcaf18741d0de849e81ef2d16d25b84b90e21
@@ -193,10 +193,10 @@ module ZuoraAPI
193
193
 
194
194
  input_xml = Nokogiri::XML(xml.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip)
195
195
  input_xml.xpath('//ns1:session', 'ns1' =>'http://api.zuora.com/').children.remove
196
- Rails.logger.debug('Connect') {"Request SOAP XML: #{input_xml.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip}"}
196
+ Rails.logger.debug('Connect') {"Request SOAP XML: #{input_xml.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip}"} if debug
197
197
  response = HTTParty.post(self.url,:body => xml.doc.to_xml, :headers => {'Content-Type' => "text/xml; charset=utf-8"}, :timeout => 10)
198
198
  output_xml = Nokogiri::XML(response.body)
199
- Rails.logger.debug('Connect') {"Response SOAP XML: #{output_xml.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip}"}
199
+ Rails.logger.debug('Connect') {"Response SOAP XML: #{output_xml.to_xml(:save_with => Nokogiri::XML::Node::SaveOptions::AS_XML | Nokogiri::XML::Node::SaveOptions::NO_DECLARATION).strip}"} if debug
200
200
  raise "#{output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text}::#{output_xml.xpath('//fns:FaultMessage', 'fns' =>'http://fault.api.zuora.com/').text}" if !output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text.blank?
201
201
  raise "#{output_xml.xpath('//faultcode').text}::#{output_xml.xpath('//faultstring').text}" if !output_xml.xpath('//faultcode').text.blank?
202
202
  rescue => ex
@@ -254,17 +254,16 @@ module ZuoraAPI
254
254
  return des_hash
255
255
  end
256
256
 
257
- def rest_call(method: :get, body: {},headers: {}, url: rest_endpoint("catalog/products?pageSize=4") , debug:true, **keyword_args)
257
+ def rest_call(method: :get, body: {},headers: {}, url: rest_endpoint("catalog/products?pageSize=4") , debug: true, **keyword_args)
258
258
  tries ||= 2
259
259
  raise "Method not supported, supported methods include: :get, :post, :put, :delete, :patch, :head, :options" if ![:get, :post, :put, :delete, :patch, :head, :options].include?(method)
260
260
  response = HTTParty::Request.new("Net::HTTP::#{method.to_s.capitalize}".constantize, url, body: body, headers: {'Content-Type' => "application/json; charset=utf-8", "Authorization" => "ZSession #{self.get_session}"}.merge(headers)).perform
261
261
  raise "#{response.code}::#{response.return_code}" if !response.success?
262
- Rails.logger.debug('Connect') { response.code}
262
+ Rails.logger.debug('Connect') { response.code} if debug
263
263
  output_json = JSON.parse(response.body)
264
- Rails.logger.debug('Connect') {"Response JSON: #{output_json}"}
264
+ Rails.logger.debug('Connect') {"Response JSON: #{output_json}"} if debug
265
265
  raise "#{output_json["reasons"][0]["code"]}::#{output_json["reasons"][0]["message"]}" if !output_json["success"] || response.code != 200
266
266
  rescue => ex
267
- if debug
268
267
  if !(tries -= 1).zero
269
268
  case ex.to_s.split("::")[0]
270
269
  when "90000011"
@@ -272,13 +271,17 @@ module ZuoraAPI
272
271
  self.new_session
273
272
  retry
274
273
  else
275
- raise ex
274
+ if debug
275
+ raise ex
276
+ else
277
+ return output_json
278
+ end
276
279
  end
280
+ elsif debug
281
+ return output_json
277
282
  else
278
283
  raise ex
279
284
  end
280
- else
281
- return output_json
282
285
  end
283
286
  else
284
287
  return output_json
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "0.2.6.3"
2
+ VERSION = "0.2.6.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.3
4
+ version: 0.2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zuora Strategic Solutions Group