zuora_api 0.2.4.6 → 0.2.5.0

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: c126e3aca7524dba61eb8350dbeb41d8289505cd
4
- data.tar.gz: a33ecb7480c1a4e31a068d175c0124b2c7c2a102
3
+ metadata.gz: e01e3f51fbb499c9b26cfb6ae57b9cf7dc89eab2
4
+ data.tar.gz: d9d6aa6a9ff16802b9a74e549ceebda47ae751a3
5
5
  SHA512:
6
- metadata.gz: c5bd274bb979f7e91ed49620b071c670d68f9828c2c09d1d07807db6dd09f871136f9b5180144c45494671bf19095927340d0db419e7f84a672191d648cf6fc8
7
- data.tar.gz: 711d9d7ae4b52cdab75a875919f3ff6ce4c966c8bf8541d83e70be51bf71b5c442e9464caf9cc0a134a99a180dad3d0cc77dfd18dac920c8a0915f321de82f7b
6
+ metadata.gz: cf77c3ab0d4721ec880e062907c8fb6bb53bfaf29df90d483d7805ed48f3ba69536a203c8b8b6abbffa87839c801d56e26291543bf2e9dd365d0ed4bdc47f2a7
7
+ data.tar.gz: e8d1a461201d4c680fd960524edfe51ee92660dcb025e633148b4edc042f6243d05b8db6dcc46f8650e35c3ec14decc62dd0cad3045accf6779356ef78fccfbb
@@ -4,17 +4,20 @@ module ZuoraAPI
4
4
  class Login
5
5
  ENVIRONMENTS = [SANDBOX = 'Sandbox', PRODUCTION = 'Production', PREFORMANCE = 'Preformance', SERVICES = 'Services', UNKNOWN = 'Unknown' ]
6
6
 
7
- attr_accessor :username, :password, :url, :wsdl_number, :status, :current_session, :environment, :status, :errors, :current_error, :user_info, :tenant_id, :tenant_name
7
+ attr_accessor :username, :password, :url, :wsdl_number, :status, :current_session, :environment, :status, :errors, :current_error, :user_info, :tenant_id, :tenant_name, :entity_id
8
+
9
+ def initialize(username: nil, password: nil, url: nil, entity_id: nil, session: nil, **keyword_args)
10
+ @username = username
11
+ @password = password
12
+ @url = url
13
+ @entity_id = entity_id
14
+ @current_session = session
15
+ @errors = Hash.new
16
+ @status = "Active"
17
+ @user_info = Hash.new
18
+ self.update_environment
19
+ end
8
20
 
9
- def initialize(username,password,url)
10
- @username = username
11
- @password = password
12
- @errors = Hash.new
13
- @user_info = Hash.new
14
- @url = url
15
- self.new_session
16
- self.update_environment
17
- end
18
21
 
19
22
  def self.environments
20
23
  %w(Sandbox Production Services Performance)
@@ -244,12 +247,12 @@ module ZuoraAPI
244
247
 
245
248
  def rest_call(method: :get, body: {}, url: rest_endpoint("catalog/products?pageSize=4") , **keyword_args)
246
249
  tries ||= 2
247
- response = HTTParty.get(self.url, body: body, headers: {'Content-Type' => "application/json; charset=utf-8", "Authorization" => "ZSession #{self.get_session}"}) if method.to_s.downcase == "get"
248
- response = HTTParty.post(self.url, body: body, headers: {'Content-Type' => "application/json; charset=utf-8", "Authorization" => "ZSession #{self.get_session}"}) if method.to_s.downcase == "post"
250
+ 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
249
252
  raise "#{response.code}::#{response.return_code}" if !response.success?
250
253
  output_json = JSON.parse(response.body)
251
254
  Rails.logger.debug('Connect') {"Response JSON: #{output_json}"}
252
- raise "#{output_json["reasons"][0]["code"]}::#{output_json["reasons"][0]["message"]}" if !output_json["success"].to_bool
255
+ raise "#{output_json["reasons"][0]["code"]}::#{output_json["reasons"][0]["message"]}" if !output_json["success"]
253
256
  rescue => ex
254
257
  if !(tries -= 1).zero?
255
258
  case ex.to_s.split("::")[0]
@@ -1,3 +1,3 @@
1
1
  module ZuoraAPI
2
- VERSION = "0.2.4.6"
2
+ VERSION = "0.2.5.0"
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.4.6
4
+ version: 0.2.5.0
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-09-19 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler