active_interaction 4.0.5 → 5.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 +4 -4
- data/CHANGELOG.md +149 -6
- data/README.md +67 -32
- data/lib/active_interaction/array_input.rb +77 -0
- data/lib/active_interaction/base.rb +14 -98
- data/lib/active_interaction/concerns/active_recordable.rb +3 -3
- data/lib/active_interaction/concerns/missable.rb +2 -2
- data/lib/active_interaction/errors.rb +6 -88
- data/lib/active_interaction/exceptions.rb +47 -0
- data/lib/active_interaction/filter/column.rb +59 -0
- data/lib/active_interaction/filter/error.rb +40 -0
- data/lib/active_interaction/filter.rb +44 -53
- data/lib/active_interaction/filters/abstract_date_time_filter.rb +9 -6
- data/lib/active_interaction/filters/abstract_numeric_filter.rb +7 -3
- data/lib/active_interaction/filters/array_filter.rb +36 -10
- data/lib/active_interaction/filters/boolean_filter.rb +4 -3
- data/lib/active_interaction/filters/date_filter.rb +1 -1
- data/lib/active_interaction/filters/date_time_filter.rb +1 -1
- data/lib/active_interaction/filters/decimal_filter.rb +1 -1
- data/lib/active_interaction/filters/float_filter.rb +1 -1
- data/lib/active_interaction/filters/hash_filter.rb +23 -15
- data/lib/active_interaction/filters/integer_filter.rb +1 -1
- data/lib/active_interaction/filters/interface_filter.rb +12 -12
- data/lib/active_interaction/filters/object_filter.rb +9 -3
- data/lib/active_interaction/filters/record_filter.rb +21 -11
- data/lib/active_interaction/filters/string_filter.rb +1 -1
- data/lib/active_interaction/filters/symbol_filter.rb +1 -1
- data/lib/active_interaction/filters/time_filter.rb +4 -4
- data/lib/active_interaction/hash_input.rb +43 -0
- data/lib/active_interaction/input.rb +23 -0
- data/lib/active_interaction/inputs.rb +157 -46
- data/lib/active_interaction/locale/en.yml +0 -1
- data/lib/active_interaction/locale/fr.yml +0 -1
- data/lib/active_interaction/locale/it.yml +0 -1
- data/lib/active_interaction/locale/ja.yml +0 -1
- data/lib/active_interaction/locale/pt-BR.yml +0 -1
- data/lib/active_interaction/modules/validation.rb +6 -17
- data/lib/active_interaction/version.rb +1 -1
- data/lib/active_interaction.rb +43 -36
- data/spec/active_interaction/array_input_spec.rb +166 -0
- data/spec/active_interaction/base_spec.rb +15 -240
- data/spec/active_interaction/concerns/active_modelable_spec.rb +3 -3
- data/spec/active_interaction/concerns/active_recordable_spec.rb +7 -7
- data/spec/active_interaction/concerns/hashable_spec.rb +8 -8
- data/spec/active_interaction/concerns/missable_spec.rb +9 -9
- data/spec/active_interaction/concerns/runnable_spec.rb +34 -32
- data/spec/active_interaction/errors_spec.rb +60 -43
- data/spec/active_interaction/{filter_column_spec.rb → filter/column_spec.rb} +3 -10
- data/spec/active_interaction/filter_spec.rb +6 -6
- data/spec/active_interaction/filters/abstract_date_time_filter_spec.rb +2 -2
- data/spec/active_interaction/filters/abstract_numeric_filter_spec.rb +2 -2
- data/spec/active_interaction/filters/array_filter_spec.rb +99 -24
- data/spec/active_interaction/filters/boolean_filter_spec.rb +12 -11
- data/spec/active_interaction/filters/date_filter_spec.rb +32 -27
- data/spec/active_interaction/filters/date_time_filter_spec.rb +34 -29
- data/spec/active_interaction/filters/decimal_filter_spec.rb +20 -18
- data/spec/active_interaction/filters/file_filter_spec.rb +7 -7
- data/spec/active_interaction/filters/float_filter_spec.rb +19 -17
- data/spec/active_interaction/filters/hash_filter_spec.rb +16 -18
- data/spec/active_interaction/filters/integer_filter_spec.rb +24 -22
- data/spec/active_interaction/filters/interface_filter_spec.rb +105 -82
- data/spec/active_interaction/filters/object_filter_spec.rb +52 -36
- data/spec/active_interaction/filters/record_filter_spec.rb +61 -39
- data/spec/active_interaction/filters/string_filter_spec.rb +7 -7
- data/spec/active_interaction/filters/symbol_filter_spec.rb +6 -6
- data/spec/active_interaction/filters/time_filter_spec.rb +57 -34
- data/spec/active_interaction/hash_input_spec.rb +58 -0
- data/spec/active_interaction/i18n_spec.rb +22 -17
- data/spec/active_interaction/inputs_spec.rb +167 -23
- data/spec/active_interaction/integration/array_interaction_spec.rb +3 -7
- data/spec/active_interaction/modules/validation_spec.rb +8 -31
- data/spec/spec_helper.rb +8 -0
- data/spec/support/concerns.rb +2 -2
- data/spec/support/filters.rb +27 -51
- data/spec/support/interactions.rb +4 -4
- metadata +45 -95
- data/lib/active_interaction/filter_column.rb +0 -57
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_interaction
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Lasseigne
|
@@ -9,90 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '5'
|
20
|
+
version: '5.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '8'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: '5'
|
30
|
+
version: '5.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: activesupport
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5'
|
41
|
-
- - "<"
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '7'
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '5'
|
51
|
-
- - "<"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '7'
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: actionpack
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
|
-
type: :development
|
62
|
-
prerelease: false
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: activerecord
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
75
|
-
type: :development
|
76
|
-
prerelease: false
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: benchmark-ips
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '2.7'
|
89
|
-
type: :development
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '2.7'
|
33
|
+
version: '8'
|
96
34
|
- !ruby/object:Gem::Dependency
|
97
35
|
name: kramdown
|
98
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,73 +79,75 @@ dependencies:
|
|
141
79
|
requirements:
|
142
80
|
- - "~>"
|
143
81
|
- !ruby/object:Gem::Version
|
144
|
-
version: 1.
|
82
|
+
version: 1.26.1
|
145
83
|
type: :development
|
146
84
|
prerelease: false
|
147
85
|
version_requirements: !ruby/object:Gem::Requirement
|
148
86
|
requirements:
|
149
87
|
- - "~>"
|
150
88
|
- !ruby/object:Gem::Version
|
151
|
-
version: 1.
|
89
|
+
version: 1.26.1
|
152
90
|
- !ruby/object:Gem::Dependency
|
153
91
|
name: rubocop-rake
|
154
92
|
requirement: !ruby/object:Gem::Requirement
|
155
93
|
requirements:
|
156
94
|
- - "~>"
|
157
95
|
- !ruby/object:Gem::Version
|
158
|
-
version: 0.
|
96
|
+
version: 0.6.0
|
159
97
|
type: :development
|
160
98
|
prerelease: false
|
161
99
|
version_requirements: !ruby/object:Gem::Requirement
|
162
100
|
requirements:
|
163
101
|
- - "~>"
|
164
102
|
- !ruby/object:Gem::Version
|
165
|
-
version: 0.
|
103
|
+
version: 0.6.0
|
166
104
|
- !ruby/object:Gem::Dependency
|
167
105
|
name: rubocop-rspec
|
168
106
|
requirement: !ruby/object:Gem::Requirement
|
169
107
|
requirements:
|
170
108
|
- - "~>"
|
171
109
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
110
|
+
version: 2.9.0
|
173
111
|
type: :development
|
174
112
|
prerelease: false
|
175
113
|
version_requirements: !ruby/object:Gem::Requirement
|
176
114
|
requirements:
|
177
115
|
- - "~>"
|
178
116
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
117
|
+
version: 2.9.0
|
180
118
|
- !ruby/object:Gem::Dependency
|
181
|
-
name:
|
119
|
+
name: sqlite3
|
182
120
|
requirement: !ruby/object:Gem::Requirement
|
183
121
|
requirements:
|
184
|
-
- - "
|
122
|
+
- - ">="
|
185
123
|
- !ruby/object:Gem::Version
|
186
|
-
version: '0
|
124
|
+
version: '0'
|
187
125
|
type: :development
|
188
126
|
prerelease: false
|
189
127
|
version_requirements: !ruby/object:Gem::Requirement
|
190
128
|
requirements:
|
191
|
-
- - "
|
129
|
+
- - ">="
|
192
130
|
- !ruby/object:Gem::Version
|
193
|
-
version: '0
|
131
|
+
version: '0'
|
194
132
|
- !ruby/object:Gem::Dependency
|
195
|
-
name:
|
133
|
+
name: yard
|
196
134
|
requirement: !ruby/object:Gem::Requirement
|
197
135
|
requirements:
|
198
|
-
- - "
|
136
|
+
- - "~>"
|
199
137
|
- !ruby/object:Gem::Version
|
200
|
-
version: '0'
|
138
|
+
version: '0.9'
|
201
139
|
type: :development
|
202
140
|
prerelease: false
|
203
141
|
version_requirements: !ruby/object:Gem::Requirement
|
204
142
|
requirements:
|
205
|
-
- - "
|
143
|
+
- - "~>"
|
206
144
|
- !ruby/object:Gem::Version
|
207
|
-
version: '0'
|
208
|
-
description: |
|
209
|
-
|
210
|
-
|
145
|
+
version: '0.9'
|
146
|
+
description: |
|
147
|
+
ActiveInteraction manages application-specific business logic. It is an
|
148
|
+
implementation of what are called service objects, interactors, or the
|
149
|
+
command pattern. No matter what you call it, its built to work seamlessly
|
150
|
+
with Rails.
|
211
151
|
email:
|
212
152
|
- aaron.lasseigne@gmail.com
|
213
153
|
- taylor@fausak.me
|
@@ -220,6 +160,7 @@ files:
|
|
220
160
|
- LICENSE.md
|
221
161
|
- README.md
|
222
162
|
- lib/active_interaction.rb
|
163
|
+
- lib/active_interaction/array_input.rb
|
223
164
|
- lib/active_interaction/base.rb
|
224
165
|
- lib/active_interaction/concerns/active_modelable.rb
|
225
166
|
- lib/active_interaction/concerns/active_recordable.rb
|
@@ -227,8 +168,10 @@ files:
|
|
227
168
|
- lib/active_interaction/concerns/missable.rb
|
228
169
|
- lib/active_interaction/concerns/runnable.rb
|
229
170
|
- lib/active_interaction/errors.rb
|
171
|
+
- lib/active_interaction/exceptions.rb
|
230
172
|
- lib/active_interaction/filter.rb
|
231
|
-
- lib/active_interaction/
|
173
|
+
- lib/active_interaction/filter/column.rb
|
174
|
+
- lib/active_interaction/filter/error.rb
|
232
175
|
- lib/active_interaction/filters/abstract_date_time_filter.rb
|
233
176
|
- lib/active_interaction/filters/abstract_numeric_filter.rb
|
234
177
|
- lib/active_interaction/filters/array_filter.rb
|
@@ -247,6 +190,8 @@ files:
|
|
247
190
|
- lib/active_interaction/filters/symbol_filter.rb
|
248
191
|
- lib/active_interaction/filters/time_filter.rb
|
249
192
|
- lib/active_interaction/grouped_input.rb
|
193
|
+
- lib/active_interaction/hash_input.rb
|
194
|
+
- lib/active_interaction/input.rb
|
250
195
|
- lib/active_interaction/inputs.rb
|
251
196
|
- lib/active_interaction/locale/en.yml
|
252
197
|
- lib/active_interaction/locale/fr.yml
|
@@ -255,6 +200,7 @@ files:
|
|
255
200
|
- lib/active_interaction/locale/pt-BR.yml
|
256
201
|
- lib/active_interaction/modules/validation.rb
|
257
202
|
- lib/active_interaction/version.rb
|
203
|
+
- spec/active_interaction/array_input_spec.rb
|
258
204
|
- spec/active_interaction/base_spec.rb
|
259
205
|
- spec/active_interaction/concerns/active_modelable_spec.rb
|
260
206
|
- spec/active_interaction/concerns/active_recordable_spec.rb
|
@@ -262,7 +208,7 @@ files:
|
|
262
208
|
- spec/active_interaction/concerns/missable_spec.rb
|
263
209
|
- spec/active_interaction/concerns/runnable_spec.rb
|
264
210
|
- spec/active_interaction/errors_spec.rb
|
265
|
-
- spec/active_interaction/
|
211
|
+
- spec/active_interaction/filter/column_spec.rb
|
266
212
|
- spec/active_interaction/filter_spec.rb
|
267
213
|
- spec/active_interaction/filters/abstract_date_time_filter_spec.rb
|
268
214
|
- spec/active_interaction/filters/abstract_numeric_filter_spec.rb
|
@@ -282,6 +228,7 @@ files:
|
|
282
228
|
- spec/active_interaction/filters/symbol_filter_spec.rb
|
283
229
|
- spec/active_interaction/filters/time_filter_spec.rb
|
284
230
|
- spec/active_interaction/grouped_input_spec.rb
|
231
|
+
- spec/active_interaction/hash_input_spec.rb
|
285
232
|
- spec/active_interaction/i18n_spec.rb
|
286
233
|
- spec/active_interaction/inputs_spec.rb
|
287
234
|
- spec/active_interaction/integration/array_interaction_spec.rb
|
@@ -302,13 +249,14 @@ files:
|
|
302
249
|
- spec/support/concerns.rb
|
303
250
|
- spec/support/filters.rb
|
304
251
|
- spec/support/interactions.rb
|
305
|
-
homepage:
|
252
|
+
homepage: https://github.com/AaronLasseigne/active_interaction
|
306
253
|
licenses:
|
307
254
|
- MIT
|
308
255
|
metadata:
|
309
256
|
homepage_uri: https://github.com/AaronLasseigne/active_interaction
|
310
257
|
source_code_uri: https://github.com/AaronLasseigne/active_interaction
|
311
|
-
changelog_uri: https://github.com/AaronLasseigne/active_interaction/blob/
|
258
|
+
changelog_uri: https://github.com/AaronLasseigne/active_interaction/blob/main/CHANGELOG.md
|
259
|
+
rubygems_mfa_required: 'true'
|
312
260
|
post_install_message:
|
313
261
|
rdoc_options: []
|
314
262
|
require_paths:
|
@@ -317,18 +265,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
317
265
|
requirements:
|
318
266
|
- - ">="
|
319
267
|
- !ruby/object:Gem::Version
|
320
|
-
version: '2.
|
268
|
+
version: '2.7'
|
321
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
322
270
|
requirements:
|
323
271
|
- - ">="
|
324
272
|
- !ruby/object:Gem::Version
|
325
273
|
version: '0'
|
326
274
|
requirements: []
|
327
|
-
rubygems_version: 3.
|
275
|
+
rubygems_version: 3.3.7
|
328
276
|
signing_key:
|
329
277
|
specification_version: 4
|
330
278
|
summary: Manage application specific business logic.
|
331
279
|
test_files:
|
280
|
+
- spec/active_interaction/array_input_spec.rb
|
332
281
|
- spec/active_interaction/base_spec.rb
|
333
282
|
- spec/active_interaction/concerns/active_modelable_spec.rb
|
334
283
|
- spec/active_interaction/concerns/active_recordable_spec.rb
|
@@ -336,7 +285,7 @@ test_files:
|
|
336
285
|
- spec/active_interaction/concerns/missable_spec.rb
|
337
286
|
- spec/active_interaction/concerns/runnable_spec.rb
|
338
287
|
- spec/active_interaction/errors_spec.rb
|
339
|
-
- spec/active_interaction/
|
288
|
+
- spec/active_interaction/filter/column_spec.rb
|
340
289
|
- spec/active_interaction/filter_spec.rb
|
341
290
|
- spec/active_interaction/filters/abstract_date_time_filter_spec.rb
|
342
291
|
- spec/active_interaction/filters/abstract_numeric_filter_spec.rb
|
@@ -356,6 +305,7 @@ test_files:
|
|
356
305
|
- spec/active_interaction/filters/symbol_filter_spec.rb
|
357
306
|
- spec/active_interaction/filters/time_filter_spec.rb
|
358
307
|
- spec/active_interaction/grouped_input_spec.rb
|
308
|
+
- spec/active_interaction/hash_input_spec.rb
|
359
309
|
- spec/active_interaction/i18n_spec.rb
|
360
310
|
- spec/active_interaction/inputs_spec.rb
|
361
311
|
- spec/active_interaction/integration/array_interaction_spec.rb
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ActiveInteraction
|
4
|
-
# A minimal implementation of an `ActiveRecord::ConnectionAdapters::Column`.
|
5
|
-
class FilterColumn
|
6
|
-
# @return [nil]
|
7
|
-
attr_reader :limit
|
8
|
-
|
9
|
-
# @return [Symbol]
|
10
|
-
attr_reader :type
|
11
|
-
|
12
|
-
class << self
|
13
|
-
# Find or create the `FilterColumn` for a specific type.
|
14
|
-
#
|
15
|
-
# @param type [Symbol] A database column type.
|
16
|
-
#
|
17
|
-
# @example
|
18
|
-
# FilterColumn.intern(:string)
|
19
|
-
# # => #<ActiveInteraction::FilterColumn:0x007feeaa649c @type=:string>
|
20
|
-
#
|
21
|
-
# FilterColumn.intern(:string)
|
22
|
-
# # => #<ActiveInteraction::FilterColumn:0x007feeaa649c @type=:string>
|
23
|
-
#
|
24
|
-
# FilterColumn.intern(:boolean)
|
25
|
-
# # => #<ActiveInteraction::FilterColumn:0x007feeab8a08 @type=:boolean>
|
26
|
-
#
|
27
|
-
# @return [FilterColumn]
|
28
|
-
def intern(type)
|
29
|
-
@columns ||= {}
|
30
|
-
@columns[type] ||= new(type)
|
31
|
-
end
|
32
|
-
|
33
|
-
private :new
|
34
|
-
end
|
35
|
-
|
36
|
-
# @param type [type] The database column type.
|
37
|
-
#
|
38
|
-
# @private
|
39
|
-
def initialize(type)
|
40
|
-
@type = type
|
41
|
-
end
|
42
|
-
|
43
|
-
# Returns `true` if the column is either of type :integer or :float.
|
44
|
-
#
|
45
|
-
# @return [Boolean]
|
46
|
-
def number?
|
47
|
-
%i[integer float].include?(type)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Returns `true` if the column is of type :string.
|
51
|
-
#
|
52
|
-
# @return [Boolean]
|
53
|
-
def text?
|
54
|
-
type == :string
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|