iron_bank 1.0.4 → 2.0.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 +5 -5
- data/.reek.yml +101 -0
- data/.rubocop.yml +4 -0
- data/.travis.yml +3 -4
- data/README.md +1 -1
- data/iron_bank.gemspec +3 -1
- data/lib/iron_bank/action.rb +3 -8
- data/lib/iron_bank/actions/amend.rb +11 -1
- data/lib/iron_bank/actions/create.rb +10 -2
- data/lib/iron_bank/actions/delete.rb +5 -1
- data/lib/iron_bank/actions/execute.rb +5 -1
- data/lib/iron_bank/actions/generate.rb +10 -2
- data/lib/iron_bank/actions/query.rb +1 -1
- data/lib/iron_bank/actions/query_more.rb +1 -1
- data/lib/iron_bank/actions/subscribe.rb +3 -14
- data/lib/iron_bank/actions/update.rb +10 -2
- data/lib/iron_bank/associations.rb +4 -6
- data/lib/iron_bank/endpoint.rb +3 -3
- data/lib/iron_bank/object.rb +35 -55
- data/lib/iron_bank/resources/account.rb +1 -1
- data/lib/iron_bank/resources/invoice.rb +2 -2
- data/lib/iron_bank/resources/product.rb +1 -1
- data/lib/iron_bank/resources/product_rate_plan.rb +1 -1
- data/lib/iron_bank/resources/product_rate_plan_charge.rb +2 -2
- data/lib/iron_bank/resources/product_rate_plan_charge_tier.rb +1 -1
- data/lib/iron_bank/resources/rate_plan.rb +2 -2
- data/lib/iron_bank/resources/rate_plan_charge.rb +3 -3
- data/lib/iron_bank/resources/rate_plan_charge_tier.rb +1 -1
- data/lib/iron_bank/resources/subscription.rb +2 -2
- data/lib/iron_bank/version.rb +1 -1
- metadata +7 -7
- data/.reek +0 -100
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7b44c23ef147468febcaa424fc386905e956383b
|
|
4
|
+
data.tar.gz: c75b2d1b28b9b46ade61e3b3a2500c9908fefab3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a79828f6152c630e86f4e56b25d95cb533d4e66ce348ac623c486c962944165b8d0b0d388beea9a116b04997a02d0b4692c7ce7ac7c9c36b5be82abcb3eaab41
|
|
7
|
+
data.tar.gz: d323fbda75c7d13afe62b8a2f02ef363bd7268cea1427b5016442fb077e08de23feb27366d6dab0b11a7f4a12f7039b2333e8958d7823dd250b868319ba6033b
|
data/.reek.yml
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
# Exclude vendor/bundle directory for Travis
|
|
4
|
+
exclude_paths:
|
|
5
|
+
- vendor/bundle
|
|
6
|
+
|
|
7
|
+
detectors:
|
|
8
|
+
Attribute:
|
|
9
|
+
exclude:
|
|
10
|
+
- IronBank#client
|
|
11
|
+
- IronBank#configuration
|
|
12
|
+
- IronBank::Configuration#auth_type
|
|
13
|
+
- IronBank::Configuration#cache
|
|
14
|
+
- IronBank::Configuration#client_id
|
|
15
|
+
- IronBank::Configuration#client_secret
|
|
16
|
+
- IronBank::Configuration#domain
|
|
17
|
+
- IronBank::Configuration#export_directory
|
|
18
|
+
- IronBank::Configuration#instrumenter
|
|
19
|
+
- IronBank::Configuration#instrumenter_options
|
|
20
|
+
- IronBank::Configuration#logger
|
|
21
|
+
- IronBank::Configuration#open_tracing_enabled
|
|
22
|
+
- IronBank::Configuration#open_tracing_service_name
|
|
23
|
+
- IronBank::Configuration#schema_directory
|
|
24
|
+
|
|
25
|
+
BooleanParameter:
|
|
26
|
+
exclude:
|
|
27
|
+
- IronBank::Cacheable::ClassMethods#find
|
|
28
|
+
|
|
29
|
+
DuplicateMethodCall:
|
|
30
|
+
exclude:
|
|
31
|
+
- IronBank::Utils#camelize
|
|
32
|
+
- IronBank::Local#all
|
|
33
|
+
|
|
34
|
+
FeatureEnvy:
|
|
35
|
+
exclude:
|
|
36
|
+
- IronBank::Client#connection
|
|
37
|
+
- IronBank::Authentications::Cookie#connection
|
|
38
|
+
- IronBank::Authentications::Token#connection
|
|
39
|
+
- IronBank::Configuration#schema_directory=
|
|
40
|
+
- IronBank::Resource#==
|
|
41
|
+
- IronBank::Object#camelize
|
|
42
|
+
- IronBank::Object#underscore
|
|
43
|
+
- IronBank::Actions::Subscribe#hash_args
|
|
44
|
+
- IronBank::Utils#camelize
|
|
45
|
+
|
|
46
|
+
InstanceVariableAssumption:
|
|
47
|
+
exclude:
|
|
48
|
+
- IronBank::FaradayMiddleware::RetriableAuth
|
|
49
|
+
|
|
50
|
+
IrresponsibleModule:
|
|
51
|
+
exclude:
|
|
52
|
+
- Sample
|
|
53
|
+
|
|
54
|
+
ManualDispatch:
|
|
55
|
+
exclude:
|
|
56
|
+
- IronBank::Resource#inspect
|
|
57
|
+
|
|
58
|
+
NestedIterators:
|
|
59
|
+
exclude:
|
|
60
|
+
- IronBank::Schema#self.import
|
|
61
|
+
- IronBank::Local#where
|
|
62
|
+
- IronBank::Local#load_records
|
|
63
|
+
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
|
64
|
+
|
|
65
|
+
NilCheck:
|
|
66
|
+
exclude:
|
|
67
|
+
- IronBank::Local#load_records
|
|
68
|
+
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
|
69
|
+
|
|
70
|
+
TooManyInstanceVariables:
|
|
71
|
+
max_instance_variables: 6
|
|
72
|
+
|
|
73
|
+
TooManyStatements:
|
|
74
|
+
exclude:
|
|
75
|
+
- IronBank::Associations::ClassMethods#with_many
|
|
76
|
+
- IronBank::Associations::ClassMethods#with_one
|
|
77
|
+
- IronBank::Authentications::Cookie#connection
|
|
78
|
+
- IronBank::Authentications::Token#connection
|
|
79
|
+
- IronBank::Client#connection
|
|
80
|
+
- IronBank::Configuration#schema_directory=
|
|
81
|
+
- IronBank::Configuration#initialize
|
|
82
|
+
- IronBank::Queryable#find_each
|
|
83
|
+
- IronBank::Queryable#where
|
|
84
|
+
- IronBank::Utils#camelize
|
|
85
|
+
- IronBank::Utils#underscore
|
|
86
|
+
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
|
87
|
+
- IronBank::Error#self.from_response
|
|
88
|
+
|
|
89
|
+
UtilityFunction:
|
|
90
|
+
exclude:
|
|
91
|
+
- IronBank::Cacheable::ClassMethods#cache
|
|
92
|
+
- IronBank::Object#convert
|
|
93
|
+
- IronBank::Object#camelize_array
|
|
94
|
+
- IronBank::Object#underscore_array
|
|
95
|
+
- IronBank::OpenTracing#open_tracing_enabled?
|
|
96
|
+
- IronBank::OpenTracing#open_tracing_options
|
|
97
|
+
- IronBank::QueryBuilder#range_query_builder
|
|
98
|
+
- IronBank::Utils#lower_camelize
|
|
99
|
+
- IronBank::Utils#upper_camelize
|
|
100
|
+
- IronBank::Instrumentation#instrumenter
|
|
101
|
+
- IronBank::Instrumentation#instrumenter_options
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -13,7 +13,7 @@ This gem provides opinionated resources to interact with the Zuora API through
|
|
|
13
13
|
their REST interface. It defines **associations** between them, as well as a
|
|
14
14
|
simple **declaration API** (`with_one`, `with_many`) to extend them.
|
|
15
15
|
|
|
16
|
-
This gem is tested against Ruby `>= 2.
|
|
16
|
+
This gem is tested against Ruby `>= 2.3.8`.
|
|
17
17
|
|
|
18
18
|
Please use [GitHub Issues][issues] to report bugs.
|
|
19
19
|
|
data/iron_bank.gemspec
CHANGED
|
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
'mturan@zendesk.com'
|
|
20
20
|
]
|
|
21
21
|
|
|
22
|
+
spec.required_ruby_version = '>= 2.3'
|
|
23
|
+
|
|
22
24
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
23
25
|
f.match(%r{^(test|spec|features)/})
|
|
24
26
|
end
|
|
@@ -33,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
|
33
35
|
spec.add_development_dependency 'factory_bot', '~> 4.10'
|
|
34
36
|
spec.add_development_dependency 'pry-byebug', '~> 3.4'
|
|
35
37
|
spec.add_development_dependency 'rake', '~> 12.0'
|
|
36
|
-
spec.add_development_dependency 'reek', '~>
|
|
38
|
+
spec.add_development_dependency 'reek', '~> 5.0'
|
|
37
39
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
38
40
|
spec.add_development_dependency 'rubocop', '~> 0.52'
|
|
39
41
|
spec.add_development_dependency 'shoulda-matchers', '~> 3.1'
|
data/lib/iron_bank/action.rb
CHANGED
|
@@ -12,9 +12,10 @@ module IronBank
|
|
|
12
12
|
|
|
13
13
|
def call
|
|
14
14
|
@body = IronBank.client.connection.post(endpoint, params).body
|
|
15
|
-
return body if success?
|
|
16
15
|
|
|
17
|
-
raise ::IronBank::UnprocessableEntity, errors
|
|
16
|
+
raise ::IronBank::UnprocessableEntity, errors unless success?
|
|
17
|
+
|
|
18
|
+
IronBank::Object.new(body).deep_underscore
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
private
|
|
@@ -48,11 +49,5 @@ module IronBank
|
|
|
48
49
|
def errors
|
|
49
50
|
{ errors: response_object.fetch(:errors, []) }
|
|
50
51
|
end
|
|
51
|
-
|
|
52
|
-
def requests(type: :upper)
|
|
53
|
-
args.fetch(:objects).map do |object|
|
|
54
|
-
IronBank::Object.new(object).deep_camelize(type: type)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
52
|
end
|
|
58
53
|
end
|
|
@@ -6,10 +6,20 @@ module IronBank
|
|
|
6
6
|
# https://www.zuora.com/developer/api-reference/#operation/Action_POSTamend
|
|
7
7
|
#
|
|
8
8
|
class Amend < Action
|
|
9
|
+
def call
|
|
10
|
+
# NOTE: The amend response wraps all results in an object, which is
|
|
11
|
+
# inconsistent with the rest of the `/v1/action` responses.
|
|
12
|
+
super[:results]
|
|
13
|
+
end
|
|
14
|
+
|
|
9
15
|
private
|
|
10
16
|
|
|
11
17
|
def params
|
|
12
|
-
{ requests:
|
|
18
|
+
{ requests: requests }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def requests
|
|
22
|
+
IronBank::Object.new(args.fetch(:requests)).deep_camelize(type: :upper)
|
|
13
23
|
end
|
|
14
24
|
end
|
|
15
25
|
end
|
|
@@ -10,10 +10,18 @@ module IronBank
|
|
|
10
10
|
|
|
11
11
|
def params
|
|
12
12
|
{
|
|
13
|
-
objects:
|
|
14
|
-
type:
|
|
13
|
+
objects: objects,
|
|
14
|
+
type: type
|
|
15
15
|
}
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
def objects
|
|
19
|
+
IronBank::Object.new(args.fetch(:objects)).deep_camelize(type: :upper)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def type
|
|
23
|
+
IronBank::Utils.camelize(args.fetch(:type), type: :upper)
|
|
24
|
+
end
|
|
17
25
|
end
|
|
18
26
|
end
|
|
19
27
|
end
|
|
@@ -13,9 +13,13 @@ module IronBank
|
|
|
13
13
|
{
|
|
14
14
|
ids: args.fetch(:ids),
|
|
15
15
|
synchronous: args.fetch(:synchronous),
|
|
16
|
-
type:
|
|
16
|
+
type: type
|
|
17
17
|
}
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
def type
|
|
21
|
+
IronBank::Utils.camelize(args.fetch(:type), type: :upper)
|
|
22
|
+
end
|
|
19
23
|
end
|
|
20
24
|
end
|
|
21
25
|
end
|
|
@@ -10,10 +10,18 @@ module IronBank
|
|
|
10
10
|
|
|
11
11
|
def params
|
|
12
12
|
{
|
|
13
|
-
objects:
|
|
14
|
-
type:
|
|
13
|
+
objects: objects,
|
|
14
|
+
type: type
|
|
15
15
|
}
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
def objects
|
|
19
|
+
IronBank::Object.new(args.fetch(:objects)).deep_camelize(type: :upper)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def type
|
|
23
|
+
IronBank::Utils.camelize(args.fetch(:type), type: :upper)
|
|
24
|
+
end
|
|
17
25
|
end
|
|
18
26
|
end
|
|
19
27
|
end
|
|
@@ -7,25 +7,14 @@ module IronBank
|
|
|
7
7
|
# https://www.zuora.com/developer/api-reference/#operation/Action_POSTsubscribe
|
|
8
8
|
#
|
|
9
9
|
class Subscribe < Action
|
|
10
|
-
def call
|
|
11
|
-
body = IronBank.client.connection.post(endpoint, params).body
|
|
12
|
-
|
|
13
|
-
if body.is_a?(Array)
|
|
14
|
-
body.map { |result| IronBank::Object.new(result).deep_underscore }
|
|
15
|
-
else
|
|
16
|
-
IronBank::Object.new(body).deep_underscore
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
10
|
private
|
|
21
11
|
|
|
22
12
|
def params
|
|
23
|
-
{ subscribes:
|
|
13
|
+
{ subscribes: subscribes }
|
|
24
14
|
end
|
|
25
15
|
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
requests.map { |request| IronBank::Object.new(request).deep_camelize }
|
|
16
|
+
def subscribes
|
|
17
|
+
IronBank::Object.new(args.fetch(:subscribes)).deep_camelize
|
|
29
18
|
end
|
|
30
19
|
end
|
|
31
20
|
end
|
|
@@ -10,10 +10,18 @@ module IronBank
|
|
|
10
10
|
|
|
11
11
|
def params
|
|
12
12
|
{
|
|
13
|
-
objects:
|
|
14
|
-
type:
|
|
13
|
+
objects: objects,
|
|
14
|
+
type: type
|
|
15
15
|
}
|
|
16
16
|
end
|
|
17
|
+
|
|
18
|
+
def objects
|
|
19
|
+
IronBank::Object.new(args.fetch(:objects)).deep_camelize(type: :upper)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def type
|
|
23
|
+
IronBank::Utils.camelize(args.fetch(:type), type: :upper)
|
|
24
|
+
end
|
|
17
25
|
end
|
|
18
26
|
end
|
|
19
27
|
end
|
|
@@ -25,9 +25,8 @@ module IronBank
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
alias_method aka, name if aka
|
|
28
|
+
alias_name = options[:alias]
|
|
29
|
+
alias_method alias_name, name if alias_name
|
|
31
30
|
end
|
|
32
31
|
|
|
33
32
|
def with_many(name, options = {})
|
|
@@ -53,9 +52,8 @@ module IronBank
|
|
|
53
52
|
end
|
|
54
53
|
end
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
alias_method aka, name if aka
|
|
55
|
+
alias_name = options[:alias]
|
|
56
|
+
alias_method alias_name, name if alias_name
|
|
59
57
|
end
|
|
60
58
|
end
|
|
61
59
|
|
data/lib/iron_bank/endpoint.rb
CHANGED
|
@@ -6,9 +6,9 @@ module IronBank
|
|
|
6
6
|
class Endpoint
|
|
7
7
|
private_class_method :new
|
|
8
8
|
|
|
9
|
-
PRODUCTION = /\Arest\.zuora\.com\z/i
|
|
10
|
-
SERVICES = /\Aservices(\d+)\.zuora\.com(:\d+)?\z/i
|
|
11
|
-
APISANDBOX = /\Arest.apisandbox.zuora\.com\z/i
|
|
9
|
+
PRODUCTION = /\Arest\.zuora\.com\z/i.freeze
|
|
10
|
+
SERVICES = /\Aservices(\d+)\.zuora\.com(:\d+)?\z/i.freeze
|
|
11
|
+
APISANDBOX = /\Arest.apisandbox.zuora\.com\z/i.freeze
|
|
12
12
|
|
|
13
13
|
def self.base_url(domain = '')
|
|
14
14
|
new(domain).base_url
|
data/lib/iron_bank/object.rb
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module IronBank
|
|
4
|
-
# This object holds the initial payload
|
|
5
|
-
#
|
|
6
|
-
#
|
|
4
|
+
# This object holds the initial payload sent to an action/operation. It
|
|
5
|
+
# exposes methods to convert the payload keys to either upper camel case
|
|
6
|
+
# (typically used by actions) or lower camel case.
|
|
7
7
|
#
|
|
8
8
|
# It is also use to parse the response from Zuora and convert it into a Ruby-
|
|
9
9
|
# friendly Hash.
|
|
10
10
|
#
|
|
11
11
|
class Object
|
|
12
|
-
|
|
12
|
+
UNMODIFIED_FIELD_KEYS = %w[
|
|
13
|
+
fieldsToNull
|
|
14
|
+
].freeze
|
|
15
|
+
|
|
16
|
+
CAMELIZER = lambda do |type, key|
|
|
17
|
+
return key if UNMODIFIED_FIELD_KEYS.include?(key.to_s)
|
|
18
|
+
|
|
19
|
+
IronBank::Utils.camelize(key, type: type)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
UNDERSCORER = lambda do |key|
|
|
23
|
+
IronBank::Utils.underscore(key).to_sym
|
|
24
|
+
end
|
|
13
25
|
|
|
14
26
|
attr_reader :payload
|
|
15
27
|
|
|
@@ -17,72 +29,40 @@ module IronBank
|
|
|
17
29
|
@payload = payload
|
|
18
30
|
end
|
|
19
31
|
|
|
20
|
-
# FIXME: refactor both camelize/underscore methods into one
|
|
21
32
|
def deep_camelize(type: :upper)
|
|
22
|
-
|
|
23
|
-
field = field.to_s
|
|
24
|
-
|
|
25
|
-
key = if SNOWFLAKE_FIELDS.include?(field)
|
|
26
|
-
field
|
|
27
|
-
else
|
|
28
|
-
IronBank::Utils.camelize(field, type: type)
|
|
29
|
-
end
|
|
33
|
+
@prok = CAMELIZER.curry[type]
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
end
|
|
35
|
+
transform(payload)
|
|
33
36
|
end
|
|
34
37
|
|
|
35
|
-
# FIXME: refactor both camelize/underscore methods into one
|
|
36
38
|
def deep_underscore
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
39
|
+
@prok = UNDERSCORER
|
|
40
|
+
|
|
41
|
+
transform(payload)
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
private
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
def camelize(value, type: :upper)
|
|
47
|
-
if value.is_a?(Array)
|
|
48
|
-
camelize_array(value, type: type)
|
|
49
|
-
elsif value.is_a?(Hash)
|
|
50
|
-
IronBank::Object.new(value).deep_camelize(type: type)
|
|
51
|
-
elsif value.is_a?(IronBank::Object)
|
|
52
|
-
value.deep_camelize(type: type)
|
|
53
|
-
else
|
|
54
|
-
value
|
|
55
|
-
end
|
|
56
|
-
end
|
|
46
|
+
attr_reader :prok
|
|
57
47
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
value
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
payload.push(item)
|
|
48
|
+
def transform(value)
|
|
49
|
+
case value
|
|
50
|
+
when Array then transform_array(value)
|
|
51
|
+
when Hash then transform_hash(value)
|
|
52
|
+
when IronBank::Object then transform(value.payload)
|
|
53
|
+
else value
|
|
65
54
|
end
|
|
66
55
|
end
|
|
67
56
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if value.is_a?(Array)
|
|
71
|
-
underscore_array(value)
|
|
72
|
-
elsif value.is_a?(Hash)
|
|
73
|
-
IronBank::Object.new(value).deep_underscore
|
|
74
|
-
elsif value.is_a?(IronBank::Object)
|
|
75
|
-
value.deep_underscore
|
|
76
|
-
else
|
|
77
|
-
value
|
|
78
|
-
end
|
|
57
|
+
def transform_array(array)
|
|
58
|
+
array.map { |element| transform(element) }
|
|
79
59
|
end
|
|
80
60
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
61
|
+
def transform_hash(hash)
|
|
62
|
+
hash.each.with_object({}) do |(key, value), hsh|
|
|
63
|
+
key = prok.call(key.to_s)
|
|
64
|
+
|
|
65
|
+
hsh[key] = transform(value)
|
|
86
66
|
end
|
|
87
67
|
end
|
|
88
68
|
end
|
|
@@ -23,8 +23,8 @@ module IronBank
|
|
|
23
23
|
|
|
24
24
|
with_one :account
|
|
25
25
|
|
|
26
|
-
with_many :invoice_adjustments,
|
|
27
|
-
with_many :invoice_items,
|
|
26
|
+
with_many :invoice_adjustments, alias: :adjustments
|
|
27
|
+
with_many :invoice_items, alias: :items
|
|
28
28
|
with_many :invoice_payments
|
|
29
29
|
|
|
30
30
|
# We can only retrieve one invoice body at a time, hence Body is excluded
|
|
@@ -19,9 +19,9 @@ module IronBank
|
|
|
19
19
|
with_local_records
|
|
20
20
|
with_cache
|
|
21
21
|
|
|
22
|
-
with_one :product_rate_plan,
|
|
22
|
+
with_one :product_rate_plan, alias: :plan
|
|
23
23
|
|
|
24
|
-
with_many :product_rate_plan_charge_tiers,
|
|
24
|
+
with_many :product_rate_plan_charge_tiers, alias: :tiers
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -10,11 +10,11 @@ module IronBank
|
|
|
10
10
|
with_cache
|
|
11
11
|
|
|
12
12
|
with_one :amendment
|
|
13
|
-
with_one :product_rate_plan,
|
|
13
|
+
with_one :product_rate_plan, alias: :catalog_plan
|
|
14
14
|
with_one :subscription
|
|
15
15
|
|
|
16
16
|
with_many :rate_plan_charges,
|
|
17
|
-
|
|
17
|
+
alias: :charges,
|
|
18
18
|
conditions: { is_last_segment: true }
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -21,10 +21,10 @@ module IronBank
|
|
|
21
21
|
with_cache
|
|
22
22
|
|
|
23
23
|
with_one :original, resource_name: 'RatePlanCharge'
|
|
24
|
-
with_one :product_rate_plan_charge,
|
|
25
|
-
with_one :rate_plan,
|
|
24
|
+
with_one :product_rate_plan_charge, alias: :catalog_charge
|
|
25
|
+
with_one :rate_plan, alias: :plan
|
|
26
26
|
|
|
27
|
-
with_many :rate_plan_charge_tiers,
|
|
27
|
+
with_many :rate_plan_charge_tiers, alias: :tiers
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -15,9 +15,9 @@ module IronBank
|
|
|
15
15
|
with_one :original, resource_name: 'Subscription'
|
|
16
16
|
with_one :previous,
|
|
17
17
|
resource_name: 'Subscription',
|
|
18
|
-
foreign_key:
|
|
18
|
+
foreign_key: 'previous_subscription_id'
|
|
19
19
|
|
|
20
|
-
with_many :rate_plans,
|
|
20
|
+
with_many :rate_plans, alias: :plans
|
|
21
21
|
with_many :usages
|
|
22
22
|
|
|
23
23
|
# FIXME: a subscription can only have at most one amendment (no amendment
|
data/lib/iron_bank/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iron_bank
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mickael Pham
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: exe
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2018-
|
|
14
|
+
date: 2018-12-08 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: bump
|
|
@@ -103,14 +103,14 @@ dependencies:
|
|
|
103
103
|
requirements:
|
|
104
104
|
- - "~>"
|
|
105
105
|
- !ruby/object:Gem::Version
|
|
106
|
-
version: '
|
|
106
|
+
version: '5.0'
|
|
107
107
|
type: :development
|
|
108
108
|
prerelease: false
|
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
|
110
110
|
requirements:
|
|
111
111
|
- - "~>"
|
|
112
112
|
- !ruby/object:Gem::Version
|
|
113
|
-
version: '
|
|
113
|
+
version: '5.0'
|
|
114
114
|
- !ruby/object:Gem::Dependency
|
|
115
115
|
name: rspec
|
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -279,7 +279,7 @@ files:
|
|
|
279
279
|
- ".github/CODEOWNERS"
|
|
280
280
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
281
281
|
- ".gitignore"
|
|
282
|
-
- ".reek"
|
|
282
|
+
- ".reek.yml"
|
|
283
283
|
- ".rspec"
|
|
284
284
|
- ".rubocop.yml"
|
|
285
285
|
- ".travis.yml"
|
|
@@ -372,7 +372,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
372
372
|
requirements:
|
|
373
373
|
- - ">="
|
|
374
374
|
- !ruby/object:Gem::Version
|
|
375
|
-
version: '
|
|
375
|
+
version: '2.3'
|
|
376
376
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
377
377
|
requirements:
|
|
378
378
|
- - ">="
|
|
@@ -380,7 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
380
380
|
version: '0'
|
|
381
381
|
requirements: []
|
|
382
382
|
rubyforge_project:
|
|
383
|
-
rubygems_version: 2.
|
|
383
|
+
rubygems_version: 2.5.2.3
|
|
384
384
|
signing_key:
|
|
385
385
|
specification_version: 4
|
|
386
386
|
summary: An opinionated Ruby interface to the Zuora API.
|
data/.reek
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
|
|
3
|
-
# Exclude vendor/bundle directory for Travis
|
|
4
|
-
exclude_paths:
|
|
5
|
-
- vendor/bundle
|
|
6
|
-
|
|
7
|
-
Attribute:
|
|
8
|
-
exclude:
|
|
9
|
-
- IronBank#client
|
|
10
|
-
- IronBank#configuration
|
|
11
|
-
- IronBank::Configuration#auth_type
|
|
12
|
-
- IronBank::Configuration#cache
|
|
13
|
-
- IronBank::Configuration#client_id
|
|
14
|
-
- IronBank::Configuration#client_secret
|
|
15
|
-
- IronBank::Configuration#domain
|
|
16
|
-
- IronBank::Configuration#export_directory
|
|
17
|
-
- IronBank::Configuration#instrumenter
|
|
18
|
-
- IronBank::Configuration#instrumenter_options
|
|
19
|
-
- IronBank::Configuration#logger
|
|
20
|
-
- IronBank::Configuration#open_tracing_enabled
|
|
21
|
-
- IronBank::Configuration#open_tracing_service_name
|
|
22
|
-
- IronBank::Configuration#schema_directory
|
|
23
|
-
|
|
24
|
-
BooleanParameter:
|
|
25
|
-
exclude:
|
|
26
|
-
- IronBank::Cacheable::ClassMethods#find
|
|
27
|
-
|
|
28
|
-
DuplicateMethodCall:
|
|
29
|
-
exclude:
|
|
30
|
-
- IronBank::Utils#camelize
|
|
31
|
-
- IronBank::Local#all
|
|
32
|
-
|
|
33
|
-
FeatureEnvy:
|
|
34
|
-
exclude:
|
|
35
|
-
- IronBank::Client#connection
|
|
36
|
-
- IronBank::Authentications::Cookie#connection
|
|
37
|
-
- IronBank::Authentications::Token#connection
|
|
38
|
-
- IronBank::Configuration#schema_directory=
|
|
39
|
-
- IronBank::Resource#==
|
|
40
|
-
- IronBank::Object#camelize
|
|
41
|
-
- IronBank::Object#underscore
|
|
42
|
-
- IronBank::Actions::Subscribe#hash_args
|
|
43
|
-
- IronBank::Utils#camelize
|
|
44
|
-
|
|
45
|
-
InstanceVariableAssumption:
|
|
46
|
-
exclude:
|
|
47
|
-
- IronBank::FaradayMiddleware::RetriableAuth
|
|
48
|
-
|
|
49
|
-
IrresponsibleModule:
|
|
50
|
-
exclude:
|
|
51
|
-
- Sample
|
|
52
|
-
|
|
53
|
-
ManualDispatch:
|
|
54
|
-
exclude:
|
|
55
|
-
- IronBank::Resource#inspect
|
|
56
|
-
|
|
57
|
-
NestedIterators:
|
|
58
|
-
exclude:
|
|
59
|
-
- IronBank::Schema#self.import
|
|
60
|
-
- IronBank::Local#where
|
|
61
|
-
- IronBank::Local#load_records
|
|
62
|
-
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
|
63
|
-
|
|
64
|
-
NilCheck:
|
|
65
|
-
exclude:
|
|
66
|
-
- IronBank::Local#load_records
|
|
67
|
-
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
|
68
|
-
|
|
69
|
-
TooManyInstanceVariables:
|
|
70
|
-
max_instance_variables: 6
|
|
71
|
-
|
|
72
|
-
TooManyStatements:
|
|
73
|
-
exclude:
|
|
74
|
-
- IronBank::Associations::ClassMethods#with_many
|
|
75
|
-
- IronBank::Associations::ClassMethods#with_one
|
|
76
|
-
- IronBank::Authentications::Cookie#connection
|
|
77
|
-
- IronBank::Authentications::Token#connection
|
|
78
|
-
- IronBank::Client#connection
|
|
79
|
-
- IronBank::Configuration#schema_directory=
|
|
80
|
-
- IronBank::Configuration#initialize
|
|
81
|
-
- IronBank::Queryable#find_each
|
|
82
|
-
- IronBank::Queryable#where
|
|
83
|
-
- IronBank::Utils#camelize
|
|
84
|
-
- IronBank::Utils#underscore
|
|
85
|
-
- IronBank::Resources::ProductRatePlanChargeTier#self.load_records
|
|
86
|
-
- IronBank::Error#self.from_response
|
|
87
|
-
|
|
88
|
-
UtilityFunction:
|
|
89
|
-
exclude:
|
|
90
|
-
- IronBank::Cacheable::ClassMethods#cache
|
|
91
|
-
- IronBank::Object#convert
|
|
92
|
-
- IronBank::Object#camelize_array
|
|
93
|
-
- IronBank::Object#underscore_array
|
|
94
|
-
- IronBank::OpenTracing#open_tracing_enabled?
|
|
95
|
-
- IronBank::OpenTracing#open_tracing_options
|
|
96
|
-
- IronBank::QueryBuilder#range_query_builder
|
|
97
|
-
- IronBank::Utils#lower_camelize
|
|
98
|
-
- IronBank::Utils#upper_camelize
|
|
99
|
-
- IronBank::Instrumentation#instrumenter
|
|
100
|
-
- IronBank::Instrumentation#instrumenter_options
|