zuora_api 1.3.99996 → 1.3.99997

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: 7299b303142d685cde62c0fc727a99e83b7b4fbd
4
- data.tar.gz: 35c2a6d5870567fe60e6e0454c987b34aa20ecf4
3
+ metadata.gz: b8cdfd5fc02c92eeb6ec0550ebb787514b3e7e1c
4
+ data.tar.gz: 76351375800d7ab572906c388c4576d8244b376e
5
5
  SHA512:
6
- metadata.gz: a5dc79bbdb75f6adb5cad23eb60202abc141baa88b5f261970a2fc1fd1d1c0d44228d62658b1e1f95d7dfbecf2c6df9c7c4383ce15eb06e5d66fea51c1fe2de8
7
- data.tar.gz: ac5b82a3c1f39528abecbd57329815fdf7c324eb96ed25dad5c7d708108d4f1d04365a836ca6d8ef90d37ca712f26cdfcee713401babc73f84c939bf772a4b8d
6
+ metadata.gz: f0d3ca62771ecfdd0022dd1e9b90653623a5e950f6f242a78e75b7e2728c23fe6e8a468ed0be838a9c6457e9690535fe3a7c36aae05763067a836188d990d997
7
+ data.tar.gz: f60275ea6eb2ab36390edb1b0b06b4909ed179045c756413402b5a26f9b58053f92ad5071555153e58d48b60587a28e34eb638db87ab1ba23a71e30c7666b52b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zuora_api (1.3.99996)
4
+ zuora_api (1.3.99997)
5
5
  httparty
6
6
  nokogiri (~> 1.6.8)
7
7
  railties (>= 4.1.0, < 5.1)
@@ -652,7 +652,7 @@ module ZuoraAPI
652
652
 
653
653
  def getDataSourceExport(query, extract: true, encrypted: false, zip: true)
654
654
  Rails.logger.info('Export') {"Build export"}
655
- Rails.logger.info('Export query') {"#{query}"}
655
+ Rails.logger.debug('Export query') {"#{query}"}
656
656
  request = Nokogiri::XML::Builder.new do |xml|
657
657
  xml['SOAP-ENV'].Envelope('xmlns:SOAP-ENV' => "http://schemas.xmlsoap.org/soap/envelope/", 'xmlns:ns2' => "http://object.api.zuora.com/", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns:ns1' => "http://api.zuora.com/") do
658
658
  xml['SOAP-ENV'].Header do
@@ -719,26 +719,20 @@ module ZuoraAPI
719
719
  end
720
720
  end
721
721
 
722
- def query(query)
723
- Rails.logger.info('query') {"Querying Zuora for #{query}"}
724
- confirmRequest = Nokogiri::XML::Builder.new do |xml|
725
- xml['SOAP-ENV'].Envelope('xmlns:SOAP-ENV' => "http://schemas.xmlsoap.org/soap/envelope/", 'xmlns:ns2' => "http://object.api.zuora.com/", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns:ns1' => "http://api.zuora.com/") do
726
- xml['SOAP-ENV'].Header do
727
- xml['ns1'].SessionHeader do
728
- xml['ns1'].session self.current_session
729
- end
730
- end
731
- xml['SOAP-ENV'].Body do
732
- xml['ns1'].query do
733
- xml['ns1'].queryString query
734
- end
735
- end
722
+ def query(query, parse = false)
723
+ Rails.logger.debug('query') {"Querying Zuora for #{query}"}
724
+ output_xml, input_xml = self.soap_call({:debug => false, :timeout_retry => true}) do |xml|
725
+ xml['ns1'].query do
726
+ xml['ns1'].queryString query
736
727
  end
737
728
  end
738
- response_query = HTTParty.post(self.url, body: confirmRequest.to_xml, :headers => {'Content-Type' => "text/xml; charset=utf-8"}, :timeout => 120)
739
- output_xml = Nokogiri::XML(response_query.body)
740
- Rails.logger.info('query') {"#{output_xml}"}
741
- return output_xml
729
+ if parse
730
+ return [] if output_xml.xpath('//ns1:size', 'ns1' =>'http://api.zuora.com/').text == '0'
731
+ data = output_xml.xpath('//ns1:records', 'ns1' =>'http://api.zuora.com/').map {|record| record.children.map {|element| [element.name, element.text]}.to_h}
732
+ return data
733
+ else
734
+ return output_xml
735
+ end
742
736
  end
743
737
 
744
738
  def createJournalRun(call)
@@ -750,7 +744,7 @@ module ZuoraAPI
750
744
  response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
751
745
  http.request req
752
746
  end
753
- Rails.logger.info('Journal Run') {"Response #{response.code} #{response.message}:
747
+ Rails.logger.debug('Journal Run') {"Response #{response.code} #{response.message}:
754
748
  #{response.body}"}
755
749
 
756
750
  result = JSON.parse(response.body)
@@ -759,7 +753,7 @@ module ZuoraAPI
759
753
  return jrNumber
760
754
  else
761
755
  message = result["reasons"][0]["message"]
762
- Rails.logger.info('Journal Run') {"Journal Run failed with message #{message}"}
756
+ Rails.logger.debug('Journal Run') {"Journal Run failed with message #{message}"}
763
757
  return result
764
758
  end
765
759
  end
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "1.3.99996"
2
+ VERSION = "1.3.99997"
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: 1.3.99996
4
+ version: 1.3.99997
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zuora Strategic Solutions Group