zuora_api 0.2.5.3 → 0.2.5.4

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: 0409dff31b8141c742abcbae06dcfaf4870bcaf4
4
- data.tar.gz: aee31e9d143a81b6b88444e74f34bb1494321f1e
3
+ metadata.gz: 169f2f90fba53110b85acf5f0503e10e109fedd6
4
+ data.tar.gz: 5aa69c3fd166a6ef685ba969830bd6ad7d3ffa41
5
5
  SHA512:
6
- metadata.gz: 45334f881630ef4b16488f875d2c7c3ca952f5bdc5f885869ce0e00b5aa30a02f0ed1df07b7b5c651f75b3354d573baec25168907ee9db0d4d2d828d3538aca2
7
- data.tar.gz: 99ca1f118a690bfa9c32c36310c3e884b6d43715775a25368fbefa1276d69c78db69057cbc0186493b85f89b17aa1578186fc20441a65f1507829cf651b8d93b
6
+ metadata.gz: 411afcba59e39519b7742812c7e5847969ce77ce717f36c1b630358f096b706cdf8d1d9b72b9f4493845866f90a57ef484882db622d33431f4e8ba1a59e21d0e
7
+ data.tar.gz: 9abd148c972ac5fa24f31f3ed431e0ba212a55b56fce6e77a331d0350970242e2c576ceaf108d11813ff8a633f158b5fd1cb32988285178e61511cc3ec0b3ebf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zuora_api (0.2.5.3)
4
+ zuora_api (0.2.5.4)
5
5
  httparty
6
6
  nokogiri (~> 1.6.8)
7
7
  railties (>= 4.1.0, < 5.1)
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Zuora_api
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/zuora_api.svg)](https://badge.fury.io/rb/zuora_api)
4
+
3
5
  This gem provides an easy integration with Zuora
4
6
 
5
7
  ## Installation
@@ -20,7 +22,7 @@ Or install it yourself as:
20
22
 
21
23
  In order to make API calls a Zuora Login object must be created by running
22
24
 
23
- zuora_client = Zuora::Login.new("username", "password", "endpoint")
25
+ zuora_client = Zuora:API:Login.new(:username =>"username", :password => "password", :url => "endpoint")
24
26
 
25
27
  ### Available Fields
26
28
  - username
@@ -39,11 +41,11 @@ In order to make API calls a Zuora Login object must be created by running
39
41
 
40
42
  ### Rest Call
41
43
 
42
- zuora_client.rest_call(method: :get, body: {}, url: rest_endpoint("catalog/products?pageSize=4") , **keyword_args)
44
+ zuora_client.rest_call(method: :get, body: {}, url: rest_endpoint("catalog/products?pageSize=4"),headers: {}, **keyword_args)
43
45
 
44
46
  ### SOAP Call
45
47
 
46
- soap_call(ns1: 'ns1', ns2: 'ns2', batch_size: nil, single_transaction: false, **keyword_args)
48
+ soap_call(ns1: 'ns1', ns2: 'ns2', batch_size: nil, single_transaction: false, debug: false , **keyword_args)
47
49
  Example:
48
50
 
49
51
  output_xml, input_xml = zuora_client.soap_call() do |xml, args|
@@ -13,7 +13,7 @@ module ZuoraAPI
13
13
  @entity_id = entity_id
14
14
  @current_session = session
15
15
  @errors = Hash.new
16
- @status = "Active"
16
+ @status = "Inactive"
17
17
  @user_info = Hash.new
18
18
  self.update_environment
19
19
  end
@@ -162,7 +162,7 @@ module ZuoraAPI
162
162
  return self.current_session
163
163
  end
164
164
 
165
- def soap_call(ns1: 'ns1', ns2: 'ns2', batch_size: nil, single_transaction: false, **keyword_args)
165
+ def soap_call(ns1: 'ns1', ns2: 'ns2', batch_size: nil, single_transaction: false,debug: false, **keyword_args)
166
166
  tries ||= 2
167
167
  xml = Nokogiri::XML::Builder.new do |xml|
168
168
  xml['SOAP-ENV'].Envelope('xmlns:SOAP-ENV' => "http://schemas.xmlsoap.org/soap/envelope/",
@@ -197,9 +197,10 @@ module ZuoraAPI
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
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}"}
200
-
201
- 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?
202
- raise "#{output_xml.xpath('//faultcode').text}::#{output_xml.xpath('//faultstring').text}" if !output_xml.xpath('//faultcode').text.blank?
200
+ if !debug
201
+ 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?
202
+ raise "#{output_xml.xpath('//faultcode').text}::#{output_xml.xpath('//faultstring').text}" if !output_xml.xpath('//faultcode').text.blank?
203
+ end
203
204
  rescue => ex
204
205
  if !(tries -= 1).zero?
205
206
  case ex.to_s.split("::")[0]
@@ -245,10 +246,10 @@ module ZuoraAPI
245
246
  return des_hash
246
247
  end
247
248
 
248
- def rest_call(method: :get, body: {}, url: rest_endpoint("catalog/products?pageSize=4") , **keyword_args)
249
+ def rest_call(method: :get, body: {},headers: {}, url: rest_endpoint("catalog/products?pageSize=4") , **keyword_args)
249
250
  tries ||= 2
250
251
  raise "Method not supported, supported methods include: :get, :post, :put, :delete, :patch, :head, :options" if ![:get, :post, :put, :delete, :patch, :head, :options].include?(method)
251
- 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}"}).perform
252
+ 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
252
253
  raise "#{response.code}::#{response.return_code}" if !response.success?
253
254
  Rails.logger.debug('Connect') { response.code}
254
255
  output_json = JSON.parse(response.body)
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "0.2.5.3"
2
+ VERSION = "0.2.5.4"
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: 0.2.5.3
4
+ version: 0.2.5.4
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: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler