zuora-ruby 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -1
- data/.rubocop_todo.yml +60 -0
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/bin/console +4 -3
- data/lib/utils/schema_model.rb +3 -1
- data/lib/zuora.rb +2 -2
- data/lib/zuora/calls/amend.rb +3 -1
- data/lib/zuora/calls/create.rb +2 -0
- data/lib/zuora/calls/delete.rb +3 -1
- data/lib/zuora/calls/generate.rb +3 -1
- data/lib/zuora/calls/login.rb +2 -0
- data/lib/zuora/calls/query.rb +10 -6
- data/lib/zuora/calls/query_more.rb +2 -0
- data/lib/zuora/calls/subscribe.rb +13 -7
- data/lib/zuora/calls/update.rb +2 -0
- data/lib/zuora/calls/upsert.rb +4 -2
- data/lib/zuora/client.rb +4 -2
- data/lib/zuora/dispatcher.rb +3 -1
- data/lib/zuora/errors.rb +2 -0
- data/lib/zuora/object.rb +2 -0
- data/lib/zuora/response.rb +3 -1
- data/lib/zuora/rest.rb +3 -2
- data/lib/zuora/rest/client.rb +7 -5
- data/lib/zuora/soap.rb +2 -0
- data/lib/zuora/soap/client.rb +9 -8
- data/lib/zuora/soap/z_object.rb +2 -0
- data/lib/zuora/utils/envelope.rb +3 -2
- data/lib/zuora/version.rb +2 -1
- data/zuora_ruby.gemspec +8 -6
- metadata +29 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 89856dc48d16fe98abd4bf05fdd34e9495e24177ce5fb9b59d48ecb0bb99cc5a
|
4
|
+
data.tar.gz: 9a896fbf1e8bd0f6a7a4353c7c3502bd8a67758ec5a49bc77723ddb7ba4e59df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ec746d67e9e27a1aeabe64cb68dc4bcd17c0c5188c432d46ec4aa3ea2c2a28701be51f4b52af883a893ffbf89e26a754ca5e4eb51d0a4412106cd40cbbd6a0e
|
7
|
+
data.tar.gz: ef5e5e1e1b775e8e7f81b307653e80bfecd53f80062b501510a8dad6e7dbf1e2781ab5cec47e315e0556089cf9e079a59dd828ba9a82a006c18882ab263a20d0
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
1
3
|
AllCops:
|
2
4
|
Exclude:
|
3
5
|
- 'db/**/*'
|
@@ -28,7 +30,7 @@ Style/AlignParameters:
|
|
28
30
|
- with_fixed_indentation
|
29
31
|
|
30
32
|
Style/CaseIndentation:
|
31
|
-
|
33
|
+
EnforcedStyle: end
|
32
34
|
SupportedStyles:
|
33
35
|
- case
|
34
36
|
- end
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2018-07-31 13:24:27 -0400 using RuboCop version 0.58.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
Lint/DuplicateMethods:
|
11
|
+
Exclude:
|
12
|
+
- 'lib/zuora/rest/client.rb'
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
Lint/EmptyWhen:
|
16
|
+
Exclude:
|
17
|
+
- 'lib/zuora/utils/envelope.rb'
|
18
|
+
|
19
|
+
# Offense count: 1
|
20
|
+
Lint/ReturnInVoidContext:
|
21
|
+
Exclude:
|
22
|
+
- 'lib/zuora/rest/client.rb'
|
23
|
+
|
24
|
+
# Offense count: 22
|
25
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
26
|
+
# ExcludedMethods: refine
|
27
|
+
Metrics/BlockLength:
|
28
|
+
Max: 107
|
29
|
+
|
30
|
+
# Offense count: 1
|
31
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
32
|
+
# AllowedNames: io, id, to, by, on, in, at, ip
|
33
|
+
Naming/UncommunicativeMethodParamName:
|
34
|
+
Exclude:
|
35
|
+
- 'lib/utils/schema_model.rb'
|
36
|
+
|
37
|
+
# Offense count: 5
|
38
|
+
# Configuration parameters: MinBodyLength.
|
39
|
+
Style/GuardClause:
|
40
|
+
Exclude:
|
41
|
+
- 'lib/zuora/calls/subscribe.rb'
|
42
|
+
- 'lib/zuora/rest/client.rb'
|
43
|
+
- 'lib/zuora/soap/client.rb'
|
44
|
+
- 'zuora_ruby.gemspec'
|
45
|
+
|
46
|
+
# Offense count: 1
|
47
|
+
Style/MethodMissingSuper:
|
48
|
+
Exclude:
|
49
|
+
- 'lib/zuora/dispatcher.rb'
|
50
|
+
|
51
|
+
# Offense count: 1
|
52
|
+
Style/MissingRespondToMissing:
|
53
|
+
Exclude:
|
54
|
+
- 'lib/zuora/dispatcher.rb'
|
55
|
+
|
56
|
+
# Offense count: 1
|
57
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
58
|
+
# URISchemes: http, https
|
59
|
+
Metrics/LineLength:
|
60
|
+
Max: 81
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
+
# frozen_string_literal: true
|
3
4
|
|
4
5
|
require 'bundler/setup'
|
5
6
|
require 'zuora'
|
@@ -12,10 +13,10 @@ require 'zuora'
|
|
12
13
|
# Pry.start
|
13
14
|
|
14
15
|
require 'factory_girl'
|
15
|
-
|
16
|
-
|
16
|
+
FactoryBot.definition_file_paths = ['spec/factories']
|
17
|
+
FactoryBot.find_definitions
|
17
18
|
# Short hand factory girl syntax
|
18
|
-
# include
|
19
|
+
# include FactoryBot::Syntax::Methods
|
19
20
|
|
20
21
|
require 'irb'
|
21
22
|
IRB.start
|
data/lib/utils/schema_model.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'byebug'
|
2
4
|
|
3
5
|
module SchemaModel
|
@@ -135,7 +137,7 @@ module SchemaModel
|
|
135
137
|
|
136
138
|
passes_validation = begin
|
137
139
|
valid.call(value)
|
138
|
-
rescue
|
140
|
+
rescue StandardError
|
139
141
|
false
|
140
142
|
end
|
141
143
|
passes_validation ? nil : 'is invalid'
|
data/lib/zuora.rb
CHANGED
@@ -9,8 +9,8 @@ require 'active_support/core_ext/string'
|
|
9
9
|
require 'hashie'
|
10
10
|
|
11
11
|
module Zuora
|
12
|
-
API_URL = 'https://api.zuora.com/rest/v1/'
|
13
|
-
SANDBOX_URL = 'https://apisandbox-api.zuora.com/rest/v1/'
|
12
|
+
API_URL = 'https://api.zuora.com/rest/v1/'
|
13
|
+
SANDBOX_URL = 'https://apisandbox-api.zuora.com/rest/v1/'
|
14
14
|
NAMESPACES = {
|
15
15
|
'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/',
|
16
16
|
'xmlns:api' => 'http://api.zuora.com/',
|
data/lib/zuora/calls/amend.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Zuora
|
2
4
|
module Calls
|
3
5
|
class Amend < Hashie::Dash
|
@@ -58,7 +60,7 @@ module Zuora
|
|
58
60
|
# @param [Symbol] child_ns - namespace of child node fields
|
59
61
|
# @return nil
|
60
62
|
def build_object(builder, property_name, object, child_ns)
|
61
|
-
|
63
|
+
raise 'Objects must respond to each' unless object.respond_to?(:each)
|
62
64
|
object_name = Zuora::Utils::Envelope.to_zuora_key property_name
|
63
65
|
builder[:api].send(object_name) do
|
64
66
|
build_nodes builder, object, child_ns
|
data/lib/zuora/calls/create.rb
CHANGED
data/lib/zuora/calls/delete.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Zuora
|
2
4
|
module Calls
|
3
5
|
class Delete < Hashie::Dash
|
@@ -5,7 +7,7 @@ module Zuora
|
|
5
7
|
property :ids, required: true
|
6
8
|
|
7
9
|
def xml_builder
|
8
|
-
|
10
|
+
raise 'Must be Enumerable' unless ids.respond_to? :each
|
9
11
|
lambda do |builder|
|
10
12
|
builder[:api].delete do
|
11
13
|
builder[:api].type type
|
data/lib/zuora/calls/generate.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Zuora
|
2
4
|
module Calls
|
3
5
|
class Generate < Hashie::Dash
|
@@ -9,7 +11,7 @@ module Zuora
|
|
9
11
|
# and updates object(s) of type.
|
10
12
|
# @return [Callable] - function of builder
|
11
13
|
def xml_builder
|
12
|
-
|
14
|
+
raise 'objects must respond to :each' unless objects.respond_to?(:each)
|
13
15
|
|
14
16
|
lambda do |builder|
|
15
17
|
builder[:api].generate do
|
data/lib/zuora/calls/login.rb
CHANGED
data/lib/zuora/calls/query.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Zuora
|
2
4
|
module Calls
|
3
5
|
class Query < Hashie::Dash
|
@@ -35,17 +37,19 @@ module Zuora
|
|
35
37
|
# @param [Symbol] table
|
36
38
|
# @param [Hash] conditions
|
37
39
|
def query_to_string(fields, table, conditions)
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
raise 'Fields must be an Array' unless fields.is_a?(Array)
|
41
|
+
raise 'Table must respond to :to_sym' unless table.respond_to?(:to_sym)
|
42
|
+
raise 'Conditions must be Array' if fields && !fields.is_a?(Array)
|
41
43
|
|
42
44
|
key_fn = ->(key) { Zuora::Utils::Envelope.to_zuora_key(key) }
|
43
45
|
|
44
46
|
select = fields.map { |field| key_fn[field] }.join(', ').to_s
|
45
47
|
from = table.to_s
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
if conditions
|
49
|
+
where = 'WHERE ' + conditions.map do |key, value|
|
50
|
+
"#{key_fn[key]} = '#{value}'"
|
51
|
+
end.join(' AND ')
|
52
|
+
end
|
49
53
|
|
50
54
|
"SELECT #{select} FROM #{from} #{where}".strip.squeeze(' ')
|
51
55
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Zuora
|
2
4
|
module Calls
|
3
5
|
class Subscribe < Hashie::Dash
|
@@ -10,7 +12,7 @@ module Zuora
|
|
10
12
|
property :rate_plan
|
11
13
|
property :rate_plan_charge
|
12
14
|
|
13
|
-
SIMPLE_OBJECTS = [
|
15
|
+
SIMPLE_OBJECTS = %i[account payment_method bill_to_contact].freeze
|
14
16
|
|
15
17
|
# Generates a function that adds login fields to a buidler
|
16
18
|
# @return [Callable] function of builder
|
@@ -43,9 +45,11 @@ module Zuora
|
|
43
45
|
# Builds the complex, nested part of the subscribe request
|
44
46
|
# @param [Nokogiri::XML::Builder] builder
|
45
47
|
def build_complex_objects(builder)
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
if subscribe_options
|
49
|
+
builder[:api].SubscribeOptions do
|
50
|
+
Zuora::Utils::Envelope.build_fields(builder, :api, subscribe_options)
|
51
|
+
end
|
52
|
+
end
|
49
53
|
|
50
54
|
builder[:api].SubscriptionData do
|
51
55
|
build_object(builder, :Subscription, subscription)
|
@@ -63,9 +67,11 @@ module Zuora
|
|
63
67
|
# [Symbol] type
|
64
68
|
# [Hash] data
|
65
69
|
def build_object(builder, type, data)
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
if data
|
71
|
+
builder[:api].send(type) do
|
72
|
+
build_fields builder, data
|
73
|
+
end
|
74
|
+
end
|
69
75
|
end
|
70
76
|
|
71
77
|
# [Nokogiri::XML::Builder] builder
|
data/lib/zuora/calls/update.rb
CHANGED
data/lib/zuora/calls/upsert.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Zuora
|
2
4
|
module Calls
|
3
5
|
class Upsert < Hashie::Dash
|
@@ -9,14 +11,14 @@ module Zuora
|
|
9
11
|
property :objects, required: true
|
10
12
|
|
11
13
|
def call_name
|
12
|
-
|
14
|
+
raise 'This class is abstract. Subclassers must def :call_name'
|
13
15
|
end
|
14
16
|
|
15
17
|
# Generates a function that takes a builder
|
16
18
|
# adds call of call_name and z-object(s) ogit rf type
|
17
19
|
# @return [Callable] - function of builder
|
18
20
|
def xml_builder
|
19
|
-
|
21
|
+
raise 'objects must respond to :each' unless objects.respond_to?(:each)
|
20
22
|
|
21
23
|
lambda do |builder|
|
22
24
|
builder[:api].send(call_name) do
|
data/lib/zuora/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'faraday_middleware'
|
3
5
|
require 'nokogiri'
|
@@ -6,7 +8,7 @@ module Zuora
|
|
6
8
|
class Client
|
7
9
|
attr_accessor :session_token
|
8
10
|
|
9
|
-
INSTANCE_VARIABLE_LOG_BLACKLIST = [
|
11
|
+
INSTANCE_VARIABLE_LOG_BLACKLIST = %i[@username @password].freeze
|
10
12
|
|
11
13
|
def initialize(username, password, sandbox = true)
|
12
14
|
@username = username
|
@@ -20,7 +22,7 @@ module Zuora
|
|
20
22
|
end
|
21
23
|
|
22
24
|
# Delegate REST methods to REST client
|
23
|
-
[
|
25
|
+
%i[post put get delete].each do |method|
|
24
26
|
define_method(method) do |*args|
|
25
27
|
rest_client.send(method, *args)
|
26
28
|
end
|
data/lib/zuora/dispatcher.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Zuora
|
2
4
|
module Dispatcher
|
3
5
|
# Maps a SOAP call name and args to its corresponding class.
|
@@ -40,7 +42,7 @@ module Zuora
|
|
40
42
|
end
|
41
43
|
|
42
44
|
def method_missing
|
43
|
-
|
45
|
+
raise "Unknown SOAP API call name: #{call_name}.
|
44
46
|
Must be one of :create, :update, :login,
|
45
47
|
subscribe, :amend, or :delete."
|
46
48
|
end
|
data/lib/zuora/errors.rb
CHANGED
data/lib/zuora/object.rb
CHANGED
data/lib/zuora/response.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support/core_ext/hash/conversions'
|
2
4
|
|
3
5
|
module Zuora
|
@@ -76,7 +78,7 @@ module Zuora
|
|
76
78
|
def raise_errors(errors)
|
77
79
|
error_string = errors.join(',')
|
78
80
|
error = Zuora::Errors::InvalidValue.new(error_string, to_h)
|
79
|
-
|
81
|
+
raise error
|
80
82
|
end
|
81
83
|
end
|
82
84
|
end
|
data/lib/zuora/rest.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Zuora
|
3
4
|
module Rest
|
4
|
-
API_URL = 'https://api.zuora.com/rest/v1/'
|
5
|
-
SANDBOX_URL = 'https://apisandbox-api.zuora.com/rest/v1/'
|
5
|
+
API_URL = 'https://api.zuora.com/rest/v1/'
|
6
|
+
SANDBOX_URL = 'https://apisandbox-api.zuora.com/rest/v1/'
|
6
7
|
|
7
8
|
# Unable to connect. Check username / password
|
8
9
|
ConnectionError = Class.new Errors::GenericError
|
data/lib/zuora/rest/client.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'faraday'
|
3
5
|
require 'faraday_middleware'
|
4
6
|
require 'json'
|
@@ -32,13 +34,13 @@ module Zuora
|
|
32
34
|
sleep(Zuora::RETRY_WAITING_PERIOD)
|
33
35
|
return initialize(username, password, sandbox)
|
34
36
|
else
|
35
|
-
|
37
|
+
raise Zuora::Rest::ConnectionError, response.body['reasons']
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
39
41
|
# @param [String] url - URL of request
|
40
42
|
# @return [Faraday::Response] A response, with .headers, .status & .body
|
41
|
-
[
|
43
|
+
%i[get delete].each do |method|
|
42
44
|
define_method(method) do |url|
|
43
45
|
response = @connection.send(method) do |req|
|
44
46
|
set_request_headers! req, url
|
@@ -54,7 +56,7 @@ module Zuora
|
|
54
56
|
# @param [String] url - URL for HTTP POST / PUT request
|
55
57
|
# @param [Params] params - Data to be sent in request body
|
56
58
|
# @return [Faraday::Response] A response, with .headers, .status & .body
|
57
|
-
[
|
59
|
+
%i[post put].each do |method|
|
58
60
|
define_method method do |url, params|
|
59
61
|
response = @connection.send(method) do |req|
|
60
62
|
set_request_headers! req, url
|
@@ -89,7 +91,7 @@ module Zuora
|
|
89
91
|
# @return [Faraday::Response]
|
90
92
|
def fail_or_response(response)
|
91
93
|
if response.status != 200
|
92
|
-
|
94
|
+
raise(ErrorResponse.new("HTTP Status #{response.status}", response))
|
93
95
|
elsif !response.body['success']
|
94
96
|
errors = 'Not successful.'
|
95
97
|
|
@@ -100,7 +102,7 @@ module Zuora
|
|
100
102
|
errors += ' ' + reasons.join(', ')
|
101
103
|
end
|
102
104
|
|
103
|
-
|
105
|
+
raise(ErrorResponse.new(errors, response))
|
104
106
|
end
|
105
107
|
response
|
106
108
|
end
|
data/lib/zuora/soap.rb
CHANGED
data/lib/zuora/soap/client.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Zuora
|
3
4
|
module Soap
|
4
5
|
class Client
|
5
6
|
attr_reader :session_token
|
6
7
|
|
7
|
-
SOAP_API_URI = '/apps/services/a/
|
8
|
+
SOAP_API_URI = '/apps/services/a/91.0'
|
8
9
|
SESSION_TOKEN_XPATH =
|
9
|
-
%w
|
10
|
-
api:result api:Session
|
10
|
+
%w[//soapenv:Envelope soapenv:Body api:loginResponse
|
11
|
+
api:result api:Session].join('/').freeze
|
11
12
|
|
12
13
|
# Creates a connection instance.
|
13
14
|
# Makes an initial SOAP request to fetch session token.
|
@@ -26,7 +27,7 @@ module Zuora
|
|
26
27
|
# @param [Xml] body - an object responding to .xml
|
27
28
|
# @return [Zuora::Response]
|
28
29
|
def request!(body)
|
29
|
-
|
30
|
+
raise 'body must support .to_xml' unless body.respond_to? :to_xml
|
30
31
|
|
31
32
|
raw_response = connection.post do |request|
|
32
33
|
request.url SOAP_API_URI
|
@@ -40,7 +41,7 @@ module Zuora
|
|
40
41
|
response = Zuora::Response.new(raw_response)
|
41
42
|
begin
|
42
43
|
response.handle_errors(response.to_h)
|
43
|
-
rescue => e
|
44
|
+
rescue StandardError => e
|
44
45
|
return handle_lock_competition(e, body)
|
45
46
|
end
|
46
47
|
response
|
@@ -71,7 +72,7 @@ module Zuora
|
|
71
72
|
if error.message =~ /(Operation failed due to a lock competition)/i
|
72
73
|
handle_rate_limiting(body)
|
73
74
|
else
|
74
|
-
|
75
|
+
raise error
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
@@ -112,7 +113,7 @@ module Zuora
|
|
112
113
|
@session_token = extract_session_token response
|
113
114
|
else
|
114
115
|
message = 'Unable to connect with provided credentials'
|
115
|
-
|
116
|
+
raise Zuora::Errors::InvalidCredentials, message
|
116
117
|
end
|
117
118
|
response
|
118
119
|
end
|
@@ -135,7 +136,7 @@ module Zuora
|
|
135
136
|
# @return [String] - SOAP url based on @sandbox
|
136
137
|
def api_url
|
137
138
|
host_prefix = @sandbox ? 'sandbox' : ''
|
138
|
-
"https://api#{host_prefix}.zuora.com/apps/services/a/
|
139
|
+
"https://api#{host_prefix}.zuora.com/apps/services/a/91.0"
|
139
140
|
end
|
140
141
|
end
|
141
142
|
end
|
data/lib/zuora/soap/z_object.rb
CHANGED
data/lib/zuora/utils/envelope.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Zuora
|
3
4
|
module Utils
|
4
5
|
module Envelope
|
5
|
-
CUSTOM_FIELD_STRING = '__c'
|
6
|
+
CUSTOM_FIELD_STRING = '__c'
|
6
7
|
|
7
8
|
# @param [Callable] header - optional function of builder, rtns builder
|
8
9
|
# @param [Callable] body - optional function of builder, rtns builder
|
@@ -20,7 +21,7 @@ module Zuora
|
|
20
21
|
# @return [Nokogiri::XML::Builder]
|
21
22
|
def self.authenticated_xml(token, &body)
|
22
23
|
failure_message = 'Session token not set. Did you call authenticate?'
|
23
|
-
|
24
|
+
raise failure_message unless token.present?
|
24
25
|
|
25
26
|
header = lambda do |builder|
|
26
27
|
builder[:api].SessionHeader { builder[:api].session(token) }
|
data/lib/zuora/version.rb
CHANGED
data/zuora_ruby.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'zuora/version'
|
4
6
|
|
@@ -18,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
18
20
|
if spec.respond_to?(:metadata)
|
19
21
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
20
22
|
else
|
21
|
-
|
23
|
+
raise 'RubyGems 2.0 or newer is required to prevent public gem pushes.'
|
22
24
|
end
|
23
25
|
|
24
26
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
@@ -33,20 +35,20 @@ Gem::Specification.new do |spec|
|
|
33
35
|
spec.add_runtime_dependency 'dotenv'
|
34
36
|
spec.add_runtime_dependency 'faraday'
|
35
37
|
spec.add_runtime_dependency 'faraday_middleware'
|
36
|
-
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
37
38
|
spec.add_runtime_dependency 'hashie', '~> 3.4'
|
39
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.6'
|
38
40
|
|
39
41
|
# Development
|
40
42
|
spec.add_development_dependency 'bundler'
|
41
43
|
spec.add_development_dependency 'byebug'
|
42
44
|
spec.add_development_dependency 'codeclimate-test-reporter'
|
43
|
-
spec.add_development_dependency '
|
45
|
+
spec.add_development_dependency 'factory_bot'
|
44
46
|
spec.add_development_dependency 'faker'
|
45
47
|
spec.add_development_dependency 'rake'
|
46
48
|
spec.add_development_dependency 'rspec'
|
47
49
|
spec.add_development_dependency 'rspec-its'
|
48
50
|
spec.add_development_dependency 'rspec_junit_formatter', '0.2.2'
|
49
|
-
spec.add_development_dependency 'rubocop', '0.36
|
50
|
-
spec.add_development_dependency 'webmock', '~> 1.22'
|
51
|
+
spec.add_development_dependency 'rubocop', '~> 0.36'
|
51
52
|
spec.add_development_dependency 'vcr'
|
53
|
+
spec.add_development_dependency 'webmock', '~> 1.22'
|
52
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contactually Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -67,33 +67,33 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: hashie
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.4'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: nokogiri
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.6'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.6'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,19 +137,19 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: factory_bot
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: faker
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,44 +224,44 @@ dependencies:
|
|
224
224
|
name: rubocop
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 0.36
|
229
|
+
version: '0.36'
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: 0.36
|
236
|
+
version: '0.36'
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
238
|
+
name: vcr
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
|
-
- - "
|
241
|
+
- - ">="
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: '
|
243
|
+
version: '0'
|
244
244
|
type: :development
|
245
245
|
prerelease: false
|
246
246
|
version_requirements: !ruby/object:Gem::Requirement
|
247
247
|
requirements:
|
248
|
-
- - "
|
248
|
+
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version: '
|
250
|
+
version: '0'
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
|
-
name:
|
252
|
+
name: webmock
|
253
253
|
requirement: !ruby/object:Gem::Requirement
|
254
254
|
requirements:
|
255
|
-
- - "
|
255
|
+
- - "~>"
|
256
256
|
- !ruby/object:Gem::Version
|
257
|
-
version: '
|
257
|
+
version: '1.22'
|
258
258
|
type: :development
|
259
259
|
prerelease: false
|
260
260
|
version_requirements: !ruby/object:Gem::Requirement
|
261
261
|
requirements:
|
262
|
-
- - "
|
262
|
+
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
|
-
version: '
|
264
|
+
version: '1.22'
|
265
265
|
description: A Ruby wrapper for Zuora API.
|
266
266
|
email:
|
267
267
|
- engineering@contactually.com
|
@@ -274,6 +274,7 @@ files:
|
|
274
274
|
- ".hound.yml"
|
275
275
|
- ".rspec"
|
276
276
|
- ".rubocop.yml"
|
277
|
+
- ".rubocop_todo.yml"
|
277
278
|
- ".ruby-gemset"
|
278
279
|
- ".ruby-version"
|
279
280
|
- ".travis.yml"
|
@@ -330,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
331
|
version: '0'
|
331
332
|
requirements: []
|
332
333
|
rubyforge_project:
|
333
|
-
rubygems_version: 2.
|
334
|
+
rubygems_version: 2.7.6
|
334
335
|
signing_key:
|
335
336
|
specification_version: 4
|
336
337
|
summary: A Ruby wrapper for Zuora API.
|