iron_bank 5.2.3 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +0 -1
- data/.reek.yml +1 -0
- data/.ruby-version +1 -1
- data/Gemfile +6 -6
- data/Gemfile.lock +41 -31
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/iron_bank.gemspec +2 -1
- data/lib/iron_bank/action.rb +5 -7
- data/lib/iron_bank/actions/query_more.rb +1 -1
- data/lib/iron_bank/client.rb +5 -1
- data/lib/iron_bank/collection.rb +2 -1
- data/lib/iron_bank/configuration.rb +11 -9
- data/lib/iron_bank/describe/object.rb +10 -0
- data/lib/iron_bank/error.rb +12 -14
- data/lib/iron_bank/local_records.rb +2 -0
- data/lib/iron_bank/metadata.rb +6 -0
- data/lib/iron_bank/schema.rb +3 -5
- data/lib/iron_bank/user.rb +6 -8
- data/lib/iron_bank/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 318930655ab8662b1aff972445f64db04b8d4a728bdd99efca68d7959be3ec2e
|
4
|
+
data.tar.gz: b70938147156d35cb100143d31c671af3273fc3d4615ed304eea335c0431e7c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57048f30a2514b52da75fa8269d4c29dc80ae490153bd86999ece894eac442b583780adb5d66a0b0b39d9eeb9e0f3f9997b479a6729215f2f18847c8cea00b34
|
7
|
+
data.tar.gz: fe64468e0f79b085ccbde1fbd1f90d483fb23ec52fafdf8e1adface0f13b98b6af23fa3b262a49a34132f7da3ffcd233b9ff73c7d607cc61d1eb4cfd63670d49
|
data/.github/workflows/ci.yml
CHANGED
data/.reek.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.7
|
data/Gemfile
CHANGED
@@ -11,10 +11,10 @@ gem "dotenv", "~> 2.2"
|
|
11
11
|
gem "factory_bot", "~> 6.0"
|
12
12
|
gem "pry-byebug", "~> 3.4"
|
13
13
|
gem "rake", "~> 13.0"
|
14
|
-
gem "reek", "~> 6
|
15
|
-
gem "rspec", "~> 3
|
16
|
-
gem "rubocop", "~> 1
|
17
|
-
gem "rubocop-performance", "~> 1
|
18
|
-
gem "shoulda-matchers", "~> 4
|
19
|
-
gem "simplecov", "~> 0.
|
14
|
+
gem "reek", "~> 6"
|
15
|
+
gem "rspec", "~> 3"
|
16
|
+
gem "rubocop", "~> 1"
|
17
|
+
gem "rubocop-performance", "~> 1"
|
18
|
+
gem "shoulda-matchers", "~> 4"
|
19
|
+
gem "simplecov", "~> 0.21"
|
20
20
|
gem "timecop", "~> 0.9"
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iron_bank (5.
|
4
|
+
iron_bank (5.3.0)
|
5
5
|
faraday (~> 1)
|
6
6
|
faraday_middleware (~> 1)
|
7
7
|
nokogiri (~> 1)
|
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
17
|
zeitwerk (~> 2.3)
|
18
|
-
ast (2.4.
|
18
|
+
ast (2.4.2)
|
19
19
|
bump (0.10.0)
|
20
20
|
byebug (11.1.3)
|
21
21
|
coderay (1.1.3)
|
@@ -25,33 +25,43 @@ GEM
|
|
25
25
|
dotenv (2.7.6)
|
26
26
|
factory_bot (6.1.0)
|
27
27
|
activesupport (>= 5.0.0)
|
28
|
-
faraday (1.
|
28
|
+
faraday (1.10.0)
|
29
29
|
faraday-em_http (~> 1.0)
|
30
30
|
faraday-em_synchrony (~> 1.0)
|
31
31
|
faraday-excon (~> 1.1)
|
32
|
+
faraday-httpclient (~> 1.0)
|
33
|
+
faraday-multipart (~> 1.0)
|
32
34
|
faraday-net_http (~> 1.0)
|
33
|
-
faraday-net_http_persistent (~> 1.
|
34
|
-
|
35
|
+
faraday-net_http_persistent (~> 1.0)
|
36
|
+
faraday-patron (~> 1.0)
|
37
|
+
faraday-rack (~> 1.0)
|
38
|
+
faraday-retry (~> 1.0)
|
35
39
|
ruby2_keywords (>= 0.0.4)
|
36
40
|
faraday-em_http (1.0.0)
|
37
41
|
faraday-em_synchrony (1.0.0)
|
38
42
|
faraday-excon (1.1.0)
|
43
|
+
faraday-httpclient (1.0.1)
|
44
|
+
faraday-multipart (1.0.4)
|
45
|
+
multipart-post (~> 2)
|
39
46
|
faraday-net_http (1.0.1)
|
40
|
-
faraday-net_http_persistent (1.
|
41
|
-
|
47
|
+
faraday-net_http_persistent (1.2.0)
|
48
|
+
faraday-patron (1.0.0)
|
49
|
+
faraday-rack (1.0.0)
|
50
|
+
faraday-retry (1.0.3)
|
51
|
+
faraday_middleware (1.2.0)
|
42
52
|
faraday (~> 1.0)
|
43
53
|
i18n (1.8.7)
|
44
54
|
concurrent-ruby (~> 1.0)
|
45
55
|
kwalify (0.7.2)
|
46
56
|
method_source (1.0.0)
|
47
|
-
mini_portile2 (2.
|
57
|
+
mini_portile2 (2.8.0)
|
48
58
|
minitest (5.14.3)
|
49
|
-
multipart-post (2.
|
50
|
-
nokogiri (1.
|
51
|
-
mini_portile2 (~> 2.
|
59
|
+
multipart-post (2.2.3)
|
60
|
+
nokogiri (1.13.6)
|
61
|
+
mini_portile2 (~> 2.8.0)
|
52
62
|
racc (~> 1.4)
|
53
|
-
parallel (1.
|
54
|
-
parser (3.0.
|
63
|
+
parallel (1.22.1)
|
64
|
+
parser (3.0.3.2)
|
55
65
|
ast (~> 2.4.1)
|
56
66
|
pry (0.13.1)
|
57
67
|
coderay (~> 1.1)
|
@@ -60,16 +70,16 @@ GEM
|
|
60
70
|
byebug (~> 11.0)
|
61
71
|
pry (~> 0.13.0)
|
62
72
|
psych (3.3.0)
|
63
|
-
racc (1.
|
64
|
-
rainbow (3.
|
73
|
+
racc (1.6.0)
|
74
|
+
rainbow (3.1.1)
|
65
75
|
rake (13.0.3)
|
66
76
|
reek (6.0.3)
|
67
77
|
kwalify (~> 0.7.0)
|
68
78
|
parser (~> 3.0.0)
|
69
79
|
psych (~> 3.1)
|
70
80
|
rainbow (>= 2.0, < 4.0)
|
71
|
-
regexp_parser (2.0
|
72
|
-
rexml (3.2.
|
81
|
+
regexp_parser (2.5.0)
|
82
|
+
rexml (3.2.5)
|
73
83
|
rspec (3.10.0)
|
74
84
|
rspec-core (~> 3.10.0)
|
75
85
|
rspec-expectations (~> 3.10.0)
|
@@ -83,22 +93,22 @@ GEM
|
|
83
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
94
|
rspec-support (~> 3.10.0)
|
85
95
|
rspec-support (3.10.1)
|
86
|
-
rubocop (1.
|
96
|
+
rubocop (1.24.1)
|
87
97
|
parallel (~> 1.10)
|
88
98
|
parser (>= 3.0.0.0)
|
89
99
|
rainbow (>= 2.2.2, < 4.0)
|
90
100
|
regexp_parser (>= 1.8, < 3.0)
|
91
101
|
rexml
|
92
|
-
rubocop-ast (>= 1.
|
102
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
93
103
|
ruby-progressbar (~> 1.7)
|
94
104
|
unicode-display_width (>= 1.4.0, < 3.0)
|
95
|
-
rubocop-ast (1.
|
96
|
-
parser (>=
|
105
|
+
rubocop-ast (1.15.2)
|
106
|
+
parser (>= 3.0.1.1)
|
97
107
|
rubocop-performance (1.9.2)
|
98
108
|
rubocop (>= 0.90.0, < 2.0)
|
99
109
|
rubocop-ast (>= 0.4.0)
|
100
110
|
ruby-progressbar (1.11.0)
|
101
|
-
ruby2_keywords (0.0.
|
111
|
+
ruby2_keywords (0.0.5)
|
102
112
|
shoulda-matchers (4.5.0)
|
103
113
|
activesupport (>= 4.2.0)
|
104
114
|
simplecov (0.21.2)
|
@@ -107,10 +117,10 @@ GEM
|
|
107
117
|
simplecov_json_formatter (~> 0.1)
|
108
118
|
simplecov-html (0.12.3)
|
109
119
|
simplecov_json_formatter (0.1.2)
|
110
|
-
timecop (0.9.
|
120
|
+
timecop (0.9.5)
|
111
121
|
tzinfo (2.0.4)
|
112
122
|
concurrent-ruby (~> 1.0)
|
113
|
-
unicode-display_width (2.
|
123
|
+
unicode-display_width (2.1.0)
|
114
124
|
zeitwerk (2.4.2)
|
115
125
|
|
116
126
|
PLATFORMS
|
@@ -124,13 +134,13 @@ DEPENDENCIES
|
|
124
134
|
iron_bank!
|
125
135
|
pry-byebug (~> 3.4)
|
126
136
|
rake (~> 13.0)
|
127
|
-
reek (~> 6
|
128
|
-
rspec (~> 3
|
129
|
-
rubocop (~> 1
|
130
|
-
rubocop-performance (~> 1
|
131
|
-
shoulda-matchers (~> 4
|
132
|
-
simplecov (~> 0.
|
137
|
+
reek (~> 6)
|
138
|
+
rspec (~> 3)
|
139
|
+
rubocop (~> 1)
|
140
|
+
rubocop-performance (~> 1)
|
141
|
+
shoulda-matchers (~> 4)
|
142
|
+
simplecov (~> 0.21)
|
133
143
|
timecop (~> 0.9)
|
134
144
|
|
135
145
|
BUNDLED WITH
|
136
|
-
2.
|
146
|
+
2.3.16
|
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.6`.
|
17
17
|
|
18
18
|
Please use [GitHub Issues][issues] to report bugs.
|
19
19
|
|
data/Rakefile
CHANGED
@@ -33,7 +33,7 @@ task :excluded_fields, [:filename] do |_t, args|
|
|
33
33
|
destination = args[:filename] || IronBank.configuration.excluded_fields_file
|
34
34
|
fields = IronBank::Schema.excluded_fields.sort.to_h
|
35
35
|
|
36
|
-
File.
|
36
|
+
File.write(destination, Psych.dump(fields))
|
37
37
|
end
|
38
38
|
|
39
39
|
# Helper function to set up an `IronBank::Client` instance
|
data/iron_bank.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
"mturan@zendesk.com"
|
20
20
|
]
|
21
21
|
|
22
|
-
spec.required_ruby_version = ">= 2.
|
22
|
+
spec.required_ruby_version = ">= 2.6"
|
23
23
|
|
24
24
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
25
|
f.match(%r{^(test|spec|features)/})
|
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency "faraday", "~> 1"
|
33
33
|
spec.add_dependency "faraday_middleware", "~> 1"
|
34
34
|
spec.add_dependency "nokogiri", "~> 1"
|
35
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
35
36
|
end
|
data/lib/iron_bank/action.rb
CHANGED
@@ -39,13 +39,11 @@ module IronBank
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def response_object
|
42
|
-
@response_object ||=
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
42
|
+
@response_object ||= if body.is_a?(Array)
|
43
|
+
::IronBank::Object.new(body.first).deep_underscore
|
44
|
+
else
|
45
|
+
{}
|
46
|
+
end
|
49
47
|
end
|
50
48
|
|
51
49
|
def errors
|
data/lib/iron_bank/client.rb
CHANGED
@@ -99,7 +99,11 @@ module IronBank
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def headers
|
102
|
-
|
102
|
+
config = IronBank.configuration
|
103
|
+
auth.header.reverse_merge(
|
104
|
+
"Content-Type" => "application/json",
|
105
|
+
"zuora-version" => config.api_minor_version
|
106
|
+
)
|
103
107
|
end
|
104
108
|
|
105
109
|
def reset_connection
|
data/lib/iron_bank/collection.rb
CHANGED
@@ -37,12 +37,16 @@ module IronBank
|
|
37
37
|
# File path for Zuora users export
|
38
38
|
attr_accessor :users_file
|
39
39
|
|
40
|
+
# Specify a minor version
|
41
|
+
attr_accessor :api_minor_version
|
42
|
+
|
40
43
|
def initialize
|
41
|
-
@schema_directory
|
42
|
-
@export_directory
|
43
|
-
@logger
|
44
|
-
@auth_type
|
45
|
-
@middlewares
|
44
|
+
@schema_directory = "./config/schema"
|
45
|
+
@export_directory = "./config/export"
|
46
|
+
@logger = IronBank::Logger.new
|
47
|
+
@auth_type = "token"
|
48
|
+
@middlewares = []
|
49
|
+
@api_minor_version = "211.0"
|
46
50
|
end
|
47
51
|
|
48
52
|
def schema_directory=(value)
|
@@ -94,10 +98,8 @@ module IronBank
|
|
94
98
|
return {}
|
95
99
|
end
|
96
100
|
|
97
|
-
@excluded_fields ||=
|
98
|
-
|
99
|
-
raise "Excluded fields must be a hash" unless fields.is_a?(Hash)
|
100
|
-
end
|
101
|
+
@excluded_fields ||= Psych.load_file(excluded_fields_file).tap do |fields|
|
102
|
+
raise "Excluded fields must be a hash" unless fields.is_a?(Hash)
|
101
103
|
end
|
102
104
|
end
|
103
105
|
end
|
@@ -56,6 +56,16 @@ module IronBank
|
|
56
56
|
@query_fields ||= fields.select(&:selectable?).map(&:name)
|
57
57
|
end
|
58
58
|
|
59
|
+
def query_custom_fields
|
60
|
+
@query_custom_fields ||= begin
|
61
|
+
custom_fields = fields.select do |field|
|
62
|
+
field.selectable? && field.custom?
|
63
|
+
end
|
64
|
+
|
65
|
+
custom_fields.map(&:name)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
59
69
|
def related
|
60
70
|
@related ||= doc.xpath(".//related-objects/object").map do |node|
|
61
71
|
IronBank::Describe::Related.from_xml(node)
|
data/lib/iron_bank/error.rb
CHANGED
@@ -6,20 +6,18 @@ module IronBank
|
|
6
6
|
# Returns the appropriate IronBank::Error subclass based on status and
|
7
7
|
# response message
|
8
8
|
def self.from_response(response)
|
9
|
-
klass =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
9
|
+
klass = case response.status
|
10
|
+
when 200 then from_body(response)
|
11
|
+
when 400 then IronBank::BadRequestError
|
12
|
+
when 401 then IronBank::UnauthorizedError
|
13
|
+
when 404 then IronBank::NotFoundError
|
14
|
+
when 422 then IronBank::UnprocessableEntityError
|
15
|
+
when 429 then IronBank::TooManyRequestsError
|
16
|
+
when 500 then IronBank::InternalServerError
|
17
|
+
when 400..499 then IronBank::ClientError
|
18
|
+
when 500..599 then IronBank::ServerError
|
19
|
+
else IronBank::Error
|
20
|
+
end
|
23
21
|
|
24
22
|
klass&.new(response)
|
25
23
|
end
|
data/lib/iron_bank/metadata.rb
CHANGED
@@ -31,6 +31,12 @@ module IronBank
|
|
31
31
|
@query_fields ||= schema.query_fields - excluded_fields
|
32
32
|
end
|
33
33
|
|
34
|
+
def query_custom_fields
|
35
|
+
return [] unless schema
|
36
|
+
|
37
|
+
@query_custom_fields ||= schema.query_custom_fields - excluded_fields
|
38
|
+
end
|
39
|
+
|
34
40
|
def schema
|
35
41
|
@schema ||= IronBank::Schema.for(object_name)
|
36
42
|
end
|
data/lib/iron_bank/schema.rb
CHANGED
@@ -39,11 +39,9 @@ module IronBank
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.excluded_fields
|
42
|
-
@excluded_fields ||=
|
43
|
-
|
44
|
-
|
45
|
-
IronBank::Describe::ExcludedFields.call(object_name: resource)
|
46
|
-
end
|
42
|
+
@excluded_fields ||= IronBank::Resources.constants.each.with_object({}) do |resource, fields|
|
43
|
+
fields[resource.to_s] =
|
44
|
+
IronBank::Describe::ExcludedFields.call(object_name: resource)
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
data/lib/iron_bank/user.rb
CHANGED
@@ -16,14 +16,12 @@ module IronBank
|
|
16
16
|
def store
|
17
17
|
return {} unless users_file
|
18
18
|
|
19
|
-
@store ||=
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
19
|
+
@store ||= if File.exist?(users_file)
|
20
|
+
load_records
|
21
|
+
else
|
22
|
+
IronBank.logger.warn "File does not exist: #{users_file}"
|
23
|
+
{}
|
24
|
+
end
|
27
25
|
end
|
28
26
|
|
29
27
|
def load_records
|
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: 5.
|
4
|
+
version: 5.3.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:
|
14
|
+
date: 2022-06-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -154,7 +154,8 @@ files:
|
|
154
154
|
homepage: https://github.com/zendesk/iron_bank
|
155
155
|
licenses:
|
156
156
|
- Apache-2.0
|
157
|
-
metadata:
|
157
|
+
metadata:
|
158
|
+
rubygems_mfa_required: 'true'
|
158
159
|
post_install_message:
|
159
160
|
rdoc_options: []
|
160
161
|
require_paths:
|
@@ -163,15 +164,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
164
|
requirements:
|
164
165
|
- - ">="
|
165
166
|
- !ruby/object:Gem::Version
|
166
|
-
version: '2.
|
167
|
+
version: '2.6'
|
167
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
169
|
requirements:
|
169
170
|
- - ">="
|
170
171
|
- !ruby/object:Gem::Version
|
171
172
|
version: '0'
|
172
173
|
requirements: []
|
173
|
-
|
174
|
-
rubygems_version: 2.7.6.2
|
174
|
+
rubygems_version: 3.0.3.1
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: An opinionated Ruby interface to the Zuora API.
|