activeinteractor 1.2.2 → 2.0.0.alpha.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/LICENSE +1 -1
  4. data/README.md +4 -64
  5. data/lib/active_interactor/base.rb +77 -29
  6. data/lib/active_interactor/errors.rb +12 -0
  7. data/lib/active_interactor/result.rb +73 -0
  8. data/lib/active_interactor.rb +3 -101
  9. data/sig/active_interactor.rbs +3 -0
  10. metadata +23 -86
  11. data/.yardopts +0 -12
  12. data/lib/active_interactor/config.rb +0 -60
  13. data/lib/active_interactor/configurable.rb +0 -53
  14. data/lib/active_interactor/context/attributes.rb +0 -179
  15. data/lib/active_interactor/context/base.rb +0 -333
  16. data/lib/active_interactor/context/errors.rb +0 -57
  17. data/lib/active_interactor/context/loader.rb +0 -50
  18. data/lib/active_interactor/context/status.rb +0 -106
  19. data/lib/active_interactor/error.rb +0 -46
  20. data/lib/active_interactor/interactor/callbacks.rb +0 -293
  21. data/lib/active_interactor/interactor/context.rb +0 -378
  22. data/lib/active_interactor/interactor/perform.rb +0 -260
  23. data/lib/active_interactor/interactor/worker.rb +0 -120
  24. data/lib/active_interactor/models.rb +0 -50
  25. data/lib/active_interactor/organizer/base.rb +0 -18
  26. data/lib/active_interactor/organizer/callbacks.rb +0 -275
  27. data/lib/active_interactor/organizer/interactor_interface.rb +0 -127
  28. data/lib/active_interactor/organizer/interactor_interface_collection.rb +0 -62
  29. data/lib/active_interactor/organizer/organize.rb +0 -67
  30. data/lib/active_interactor/organizer/perform.rb +0 -112
  31. data/lib/active_interactor/rails/orm/active_record.rb +0 -5
  32. data/lib/active_interactor/rails/orm/dynamoid.rb +0 -5
  33. data/lib/active_interactor/rails/orm/mongoid.rb +0 -5
  34. data/lib/active_interactor/rails/railtie.rb +0 -21
  35. data/lib/active_interactor/rails.rb +0 -4
  36. data/lib/active_interactor/version.rb +0 -45
  37. data/lib/rails/generators/active_interactor/application_context_generator.rb +0 -21
  38. data/lib/rails/generators/active_interactor/application_interactor_generator.rb +0 -21
  39. data/lib/rails/generators/active_interactor/application_organizer_generator.rb +0 -21
  40. data/lib/rails/generators/active_interactor/base.rb +0 -29
  41. data/lib/rails/generators/active_interactor/generator.rb +0 -21
  42. data/lib/rails/generators/active_interactor/install_generator.rb +0 -16
  43. data/lib/rails/generators/active_interactor.rb +0 -5
  44. data/lib/rails/generators/interactor/context/rspec_generator.rb +0 -17
  45. data/lib/rails/generators/interactor/context/test_unit_generator.rb +0 -17
  46. data/lib/rails/generators/interactor/context_generator.rb +0 -22
  47. data/lib/rails/generators/interactor/generates_context.rb +0 -28
  48. data/lib/rails/generators/interactor/interactor_generator.rb +0 -25
  49. data/lib/rails/generators/interactor/organizer_generator.rb +0 -39
  50. data/lib/rails/generators/interactor/rspec_generator.rb +0 -15
  51. data/lib/rails/generators/interactor/test_unit_generator.rb +0 -15
  52. data/lib/rails/generators/templates/active_interactor.erb +0 -17
  53. data/lib/rails/generators/templates/application_context.rb +0 -4
  54. data/lib/rails/generators/templates/application_interactor.rb +0 -4
  55. data/lib/rails/generators/templates/application_organizer.rb +0 -4
  56. data/lib/rails/generators/templates/context.erb +0 -7
  57. data/lib/rails/generators/templates/context_spec.erb +0 -7
  58. data/lib/rails/generators/templates/context_test_unit.erb +0 -9
  59. data/lib/rails/generators/templates/interactor.erb +0 -15
  60. data/lib/rails/generators/templates/interactor_spec.erb +0 -7
  61. data/lib/rails/generators/templates/interactor_test_unit.erb +0 -9
  62. data/lib/rails/generators/templates/organizer.erb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 764c2b65284b79d85ff2a20f7c5d9a3c3983dd06a869c7cc961b530ef77a7d28
4
- data.tar.gz: 02cdcb760098151105d1b9d1367ee2cefca765353b0ebcd302141dcea009c198
3
+ metadata.gz: b84d76be97bd543c4583c588b6f7dae50424c640fa675b7a4fb154bc8bdb1051
4
+ data.tar.gz: c0846db96ac34ed824b79118395afea967e528f4b8eb797eb7411c156ddb5d55
5
5
  SHA512:
6
- metadata.gz: 8a87326136160d7d3fe3cbea58b42b42b80206249938d7adf9496f000c260c490c902f32d1dc78983e67e05d1559a190a4738cb73dfa166c7f5deafb9a637547
7
- data.tar.gz: cc3789900b6a46067a51944f1d8280455e41b014ceb31b5d9e1819fe2e7836f84e9bc5c79871a4fd72f7ad4d85146cf18b9554dd7f15955c8c0f4d7b017aa20a
6
+ metadata.gz: 2ce8f776d073318c6bfdc47e6d822febde4570aa4777eab9ff2096bac4e8162a5849e01b929f8ed4e33f04b45edeca018e9a7381e651a3ec1556b68826c2e891
7
+ data.tar.gz: 822f52d219f12aaec5f373e1eed23f70568b3dd44972eda16f6a2c27f03fb1895b3566d605602448443db263765dae6e0b7a0c2e1dfdd0f61d0392c92c064977
data/CHANGELOG.md CHANGED
@@ -276,7 +276,7 @@ and this project adheres to [Semantic Versioning].
276
276
 
277
277
  <!-- versions -->
278
278
 
279
- [Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v1.2.2...HEAD
279
+ [Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v2.0.0-alpha.1.0.0...HEAD
280
280
  [v1.2.2]: https://github.com/aaronmallen/activeinteractor/compare/v1.2.1...v1.2.2
281
281
  [v1.2.1]: https://github.com/aaronmallen/activeinteractor/compare/v1.2.0...v1.2.1
282
282
  [v1.2.0]: https://github.com/aaronmallen/activeinteractor/compare/v1.1.7...v1.2.0
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Aaron Allen
3
+ Copyright (c) 2023 Aaron Allen
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,69 +1,9 @@
1
1
  # ActiveInteractor
2
2
 
3
3
  [![Version](https://img.shields.io/gem/v/activeinteractor.svg?logo=ruby)](https://rubygems.org/gems/activeinteractor)
4
- [![Build Status](https://github.com/aaronmallen/activeinteractor/workflows/Build/badge.svg)](https://github.com/aaronmallen/activeinteractor/actions)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/2f1cb318f681a1eebb27/maintainability)](https://codeclimate.com/github/aaronmallen/activeinteractor/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/2f1cb318f681a1eebb27/test_coverage)](https://codeclimate.com/github/aaronmallen/activeinteractor/test_coverage)
7
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/gems/activeinteractor)
8
- [![Inline docs](http://inch-ci.org/github/aaronmallen/activeinteractor.svg?branch=main)](http://inch-ci.org/github/aaronmallen/activeinteractor)
9
- [![License](https://img.shields.io/github/license/aaronmallen/activeinteractor.svg?maxAge=300)](https://github.com/aaronmallen/activeinteractor/blob/main/LICENSE)
4
+ [![Build](https://github.com/activeinteractor/activeinteractor/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/activeinteractor/activeinteractor/actions/workflows/build.yml)
5
+ [![License](https://img.shields.io/github/license/activeinteractor/activeinteractor.svg?maxAge=300)](https://github.com/activeinteractor/activeinteractor/blob/main/LICENSE)
10
6
 
11
- An implementation of the [command pattern] for Ruby with [ActiveModel::Validations] inspired by the
12
- [interactor][collective_idea_interactors] gem. Rich support for attributes, callbacks, and validations,
13
- and thread safe performance methods.
7
+ ## DISCLAIMER
14
8
 
15
- Reduce controller bloat with procedural service objects. Checkout this [Medium article] for a crash
16
- course on how to use ActiveInteractors. Read the [wiki] for detailed usage information.
17
-
18
- ## Features
19
-
20
- * [Context validation][wiki_context_validation]
21
- * [Callbacks][wiki_callbacks]
22
- * Thread safe performance calls
23
- * Organize multiple interactors [conditionally][wiki_organizers_conditionally] or in [parallel][wiki_organizers_parallel]
24
-
25
- ## Documentation
26
-
27
- Be sure to read the [wiki] for detailed information on how to use ActiveInteractor.
28
-
29
- For technical documentation please see the gem's [ruby docs].
30
-
31
- ## Install
32
-
33
- Add this line to your application's Gemfile:
34
-
35
- ```ruby
36
- gem 'activeinteractor', require: 'active_interactor'
37
- ```
38
-
39
- Or install it yourself as:
40
-
41
- ```sh
42
- gem install activeinteractor
43
- ```
44
-
45
- ## Contributing
46
-
47
- Read our guidelines for [Contributing](CONTRIBUTING.md).
48
-
49
- ## Acknowledgements
50
-
51
- ActiveInteractor is made possible by wonderful [humans].
52
-
53
- ## License
54
-
55
- The gem is available as open source under the terms of the [MIT License][mit_license].
56
-
57
- [ActiveModel::Validations]: https://api.rubyonrails.org/classes/ActiveModel/Validations.html
58
- [business_logic_wikipedia]: https://en.wikipedia.org/wiki/Business_logic
59
- [collective_idea_interactors]: https://github.com/collectiveidea/interactor
60
- [command pattern]: https://en.wikipedia.org/wiki/Command_pattern
61
- [humans]: https://github.com/aaronmallen/activeinteractor/tree/main/HUMANS.md
62
- [Medium article]: https://medium.com/@aaronmallen/activeinteractor-8557c0dc78db
63
- [mit_license]: https://opensource.org/licenses/MIT
64
- [ruby docs]: https://www.rubydoc.info/gems/activeinteractor
65
- [wiki]: https://github.com/aaronmallen/activeinteractor/wiki
66
- [wiki_callbacks]: https://github.com/aaronmallen/activeinteractor/wiki/Callbacks
67
- [wiki_context_validation]: https://github.com/aaronmallen/activeinteractor/wiki/Context#validating-the-context
68
- [wiki_organizers_conditionally]: https://github.com/aaronmallen/activeinteractor/wiki/Interactors#organizing-interactors-conditionally
69
- [wiki_organizers_parallel]: https://github.com/aaronmallen/activeinteractor/wiki/Interactors#running-interactors-in-parallel
9
+ This project is a work in progress. Go [here](https://github.com/aaronmallen/activeinteractor) for information on the current version of ActiveInteractor.
@@ -1,35 +1,83 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveInteractor
4
- # The base class all {Base interactors} should inherit from.
5
- #
6
- # When {Base} is loaded by your application an
7
- # {https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html ActiveSupport load hook} is called
8
- # with `:active_interactor` and {Base}.
9
- #
10
- # @author Aaron Allen <hello@aaronmallen.me>
11
- # @since 0.1.0
12
- #
13
- # @example a basic {Base interactor}
14
- # class MyInteractor < ActiveInteractor::Base
15
- # def perform
16
- # # TODO: implement the perform method
17
- # end
18
- #
19
- # def rollback
20
- # # TODO: implement the rollback method
21
- # end
22
- # end
23
4
  class Base
24
- extend ActiveInteractor::Interactor::Callbacks::ClassMethods
25
- extend ActiveInteractor::Interactor::Context::ClassMethods
26
- extend ActiveInteractor::Interactor::Perform::ClassMethods
27
-
28
- include ActiveSupport::Callbacks
29
- include ActiveInteractor::Interactor::Callbacks
30
- include ActiveInteractor::Interactor::Context
31
- include ActiveInteractor::Interactor::Perform
32
- end
5
+ class << self
6
+ def argument(name, type, description = nil, **options)
7
+ attributes[:arguments][name.to_sym] = { name: name, type: type, description: description }.merge(options)
8
+ end
9
+
10
+ def perform(input_context = {})
11
+ new(input_context).send(:exec_perform!)
12
+ rescue Error => e
13
+ e.result
14
+ rescue StandardError => e
15
+ Result.failure(errors: e.message)
16
+ end
17
+
18
+ def returns(name, type, description = nil, **options)
19
+ attributes[:fields][name.to_sym] = { name: name, type: type, description: description }.merge(options)
20
+ end
21
+
22
+ private
23
+
24
+ def attributes
25
+ @attributes ||= { arguments: {}, fields: {} }
26
+ end
27
+ end
28
+
29
+ def initialize(input = {})
30
+ @input = input.freeze
31
+ @context = parse_input!
32
+ end
33
+
34
+ def perform; end
35
+ def rollback; end
36
+
37
+ protected
38
+
39
+ attr_accessor :context
40
+
41
+ def exec_perform!
42
+ perform
43
+ Result.success(data: parse_output!)
44
+ end
33
45
 
34
- ActiveSupport.run_load_hooks(:active_interactor, Base)
46
+ def fail!(errors = {})
47
+ rollback
48
+ raise Error, Result.failure(data: context, errors: errors)
49
+ end
50
+
51
+ def parse_input!
52
+ errors = {}
53
+ context = self.class.send(:attributes)[:arguments].each_with_object({}) do |(name, options), hash|
54
+ errors = validate_attribute_value(@input[name], name, options, errors)
55
+ hash[name] = @input[name] || options[:default]
56
+ end
57
+
58
+ raise Error, Result.failure(errors: errors, status: Result::STATUS[:failed_on_input]) unless errors.empty?
59
+
60
+ context
61
+ end
62
+
63
+ def parse_output!
64
+ errors = {}
65
+ context = self.class.send(:attributes)[:fields].each_with_object({}) do |(name, options), hash|
66
+ errors = validate_attribute_value(self.context[name], name, options, errors)
67
+ hash[name] = self.context[name] || options[:default]
68
+ end
69
+
70
+ raise Error, Result.failure(errors: errors, status: Result::STATUS[:failed_on_output]) unless errors.empty?
71
+
72
+ context
73
+ end
74
+
75
+ def validate_attribute_value(value, attribute_name, attribute_options, errors)
76
+ return errors unless value.blank? && attribute_options[:required] && !attribute_options[:default]
77
+
78
+ errors[attribute_name] ||= []
79
+ errors[attribute_name] << :blank
80
+ errors
81
+ end
82
+ end
35
83
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveInteractor
4
+ class Error < StandardError
5
+ attr_reader :result
6
+
7
+ def initialize(result, message = nil)
8
+ @result = result
9
+ super(message)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveInteractor
4
+ class Result
5
+ extend ActiveModel::Naming
6
+
7
+ STATUS = {
8
+ success: 0,
9
+ failed_at_input: 1,
10
+ failed_at_runtime: 2,
11
+ failed_at_output: 3
12
+ }.freeze
13
+
14
+ attr_reader :data, :errors
15
+
16
+ class << self
17
+ def success(data: {})
18
+ new(status: STATUS[:success], data: data)
19
+ end
20
+
21
+ def failure(data: {}, errors: {}, status: STATUS[:failed_at_runtime])
22
+ result = new(status: status, data: data)
23
+ parse_errors(errors).each_pair do |attribute, messages|
24
+ Array.wrap(messages).each { |message| result.errors.add(attribute, message) }
25
+ end
26
+ result
27
+ end
28
+
29
+ def human_attribute_name(attribute, _options = {})
30
+ attribute.respond_to?(:to_s) ? attribute.to_s.humanize : attribute
31
+ end
32
+
33
+ def lookup_ancestors
34
+ [self]
35
+ end
36
+
37
+ private
38
+
39
+ def parse_errors(errors)
40
+ case errors
41
+ when String
42
+ { generic: [errors] }
43
+ when ActiveModel::Errors
44
+ errors.as_json
45
+ else
46
+ errors
47
+ end
48
+ end
49
+ end
50
+
51
+ private_class_method :new
52
+
53
+ def initialize(status:, data: {})
54
+ @status = status
55
+ @data = data
56
+ @errors = ActiveModel::Errors.new(self)
57
+ end
58
+
59
+ def failure?
60
+ !success?
61
+ end
62
+ alias failed? failure?
63
+
64
+ def read_attribute_for_validation(attribute_name)
65
+ data[attribute_name]
66
+ end
67
+
68
+ def success?
69
+ @status == STATUS[:success]
70
+ end
71
+ alias successful? success?
72
+ end
73
+ end
@@ -1,111 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_model'
4
- require 'active_support/callbacks'
5
- require 'active_support/core_ext/array/extract_options'
6
- require 'active_support/core_ext/class/attribute'
7
- require 'active_support/core_ext/string/inflections'
8
- require 'active_support/dependencies/autoload'
9
- require 'logger'
10
- require 'ostruct'
4
+ require 'active_support'
11
5
 
12
- require 'active_interactor/configurable'
13
- require 'active_interactor/config'
14
- require 'active_interactor/version'
6
+ require_relative 'active_interactor/errors'
15
7
 
16
- # An {Base interactor} is a simple, single-purpose service object. {Base Interactors} can be used to reduce the
17
- # responsibility of your controllers, workers, and models and encapsulate your application's
18
- # {https://en.wikipedia.org/wiki/Business_logic business logic}. Each {Base interactor} represents one thing that your
19
- # application does.
20
- #
21
- # Each {Base interactor} has it's own immutable {Context::Base context} which contains everything the
22
- # {Base interactor} needs to do its work. When an {Base interactor} does its single purpose, it affects its given
23
- # {Context::Base context}.
24
- #
25
- # @see https://medium.com/@aaronmallen/activeinteractor-8557c0dc78db Basic Usage
26
- # @see https://github.com/aaronmallen/activeinteractor/wiki Advanced Usage
27
- # @see https://github.com/aaronmallen/activeinteractor Source Code
28
- # @see https://github.com/aaronmallen/activeinteractor/issues Issues
29
- #
30
- # ## License
31
- #
32
- # Copyright (c) 2019 Aaron Allen
33
- #
34
- # Permission is hereby granted, free of charge, to any person obtaining a copy
35
- # of this software and associated documentation files (the "Software"), to deal
36
- # in the Software without restriction, including without limitation the rights
37
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
38
- # copies of the Software, and to permit persons to whom the Software is
39
- # furnished to do so, subject to the following conditions:
40
- #
41
- # The above copyright notice and this permission notice shall be included in
42
- # all copies or substantial portions of the Software.
43
- #
44
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
45
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
49
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
50
- # THE SOFTWARE.
51
8
  module ActiveInteractor
52
9
  extend ActiveSupport::Autoload
53
10
 
54
11
  autoload :Base
55
-
56
- # {Context::Base Context} classes and modules
57
- #
58
- # @see https://github.com/aaronmallen/activeinteractor/wiki/Context Context
59
- #
60
- # @author Aaron Allen <hello@aaronmallen.me>
61
- # @since 0.1.0
62
- module Context
63
- extend ActiveSupport::Autoload
64
-
65
- autoload :Attributes
66
- autoload :Base
67
- autoload :Errors
68
- autoload :Loader
69
- autoload :Status
70
- end
71
-
72
- # {Base Interactor} classes and modules
73
- #
74
- # @see https://github.com/aaronmallen/activeinteractor/wiki/Interactors Interactors
75
- #
76
- # @author Aaron Allen <hello@aaronmallen.me>
77
- # @since 0.1.0
78
- module Interactor
79
- extend ActiveSupport::Autoload
80
-
81
- autoload :Callbacks
82
- autoload :Context
83
- autoload :Perform
84
- autoload :Worker
85
- end
86
-
87
- autoload :Models
88
-
89
- # {Organizer::Base Organizer} classes and modules
90
- #
91
- # @see https://github.com/aaronmallen/activeinteractor/wiki/Interactors#organizers Organizers
92
- #
93
- # @author Aaron Allen <hello@aaronmallen.me>
94
- # @since 0.1.0
95
- module Organizer
96
- extend ActiveSupport::Autoload
97
-
98
- autoload :Base
99
- autoload :Callbacks
100
- autoload :InteractorInterface
101
- autoload :InteractorInterfaceCollection
102
- autoload :Organize
103
- autoload :Perform
104
- end
105
-
106
- eager_autoload do
107
- autoload :Error
108
- end
12
+ autoload :Result
109
13
  end
110
-
111
- require 'active_interactor/rails' if defined?(::Rails)
@@ -0,0 +1,3 @@
1
+ module Activeinteractor
2
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeinteractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.0.0.alpha.1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Allen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-01 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '6.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '8'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.2'
29
+ version: '6.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8'
@@ -36,7 +36,7 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '4.2'
39
+ version: '6.1'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '8'
@@ -46,24 +46,10 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '4.2'
49
+ version: '6.1'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '8'
53
- - !ruby/object:Gem::Dependency
54
- name: bundler
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "~>"
58
- - !ruby/object:Gem::Version
59
- version: '2.3'
60
- type: :development
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: '2.3'
67
53
  description: |
68
54
  An implementation of the Command Pattern for Ruby with ActiveModel::Validations inspired by the interactor gem.
69
55
  Rich support for attributes, callbacks, and validations, and thread safe performance methods.
@@ -73,74 +59,25 @@ executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
76
- - ".yardopts"
77
62
  - CHANGELOG.md
78
63
  - LICENSE
79
64
  - README.md
80
65
  - lib/active_interactor.rb
81
66
  - lib/active_interactor/base.rb
82
- - lib/active_interactor/config.rb
83
- - lib/active_interactor/configurable.rb
84
- - lib/active_interactor/context/attributes.rb
85
- - lib/active_interactor/context/base.rb
86
- - lib/active_interactor/context/errors.rb
87
- - lib/active_interactor/context/loader.rb
88
- - lib/active_interactor/context/status.rb
89
- - lib/active_interactor/error.rb
90
- - lib/active_interactor/interactor/callbacks.rb
91
- - lib/active_interactor/interactor/context.rb
92
- - lib/active_interactor/interactor/perform.rb
93
- - lib/active_interactor/interactor/worker.rb
94
- - lib/active_interactor/models.rb
95
- - lib/active_interactor/organizer/base.rb
96
- - lib/active_interactor/organizer/callbacks.rb
97
- - lib/active_interactor/organizer/interactor_interface.rb
98
- - lib/active_interactor/organizer/interactor_interface_collection.rb
99
- - lib/active_interactor/organizer/organize.rb
100
- - lib/active_interactor/organizer/perform.rb
101
- - lib/active_interactor/rails.rb
102
- - lib/active_interactor/rails/orm/active_record.rb
103
- - lib/active_interactor/rails/orm/dynamoid.rb
104
- - lib/active_interactor/rails/orm/mongoid.rb
105
- - lib/active_interactor/rails/railtie.rb
106
- - lib/active_interactor/version.rb
107
- - lib/rails/generators/active_interactor.rb
108
- - lib/rails/generators/active_interactor/application_context_generator.rb
109
- - lib/rails/generators/active_interactor/application_interactor_generator.rb
110
- - lib/rails/generators/active_interactor/application_organizer_generator.rb
111
- - lib/rails/generators/active_interactor/base.rb
112
- - lib/rails/generators/active_interactor/generator.rb
113
- - lib/rails/generators/active_interactor/install_generator.rb
114
- - lib/rails/generators/interactor/context/rspec_generator.rb
115
- - lib/rails/generators/interactor/context/test_unit_generator.rb
116
- - lib/rails/generators/interactor/context_generator.rb
117
- - lib/rails/generators/interactor/generates_context.rb
118
- - lib/rails/generators/interactor/interactor_generator.rb
119
- - lib/rails/generators/interactor/organizer_generator.rb
120
- - lib/rails/generators/interactor/rspec_generator.rb
121
- - lib/rails/generators/interactor/test_unit_generator.rb
122
- - lib/rails/generators/templates/active_interactor.erb
123
- - lib/rails/generators/templates/application_context.rb
124
- - lib/rails/generators/templates/application_interactor.rb
125
- - lib/rails/generators/templates/application_organizer.rb
126
- - lib/rails/generators/templates/context.erb
127
- - lib/rails/generators/templates/context_spec.erb
128
- - lib/rails/generators/templates/context_test_unit.erb
129
- - lib/rails/generators/templates/interactor.erb
130
- - lib/rails/generators/templates/interactor_spec.erb
131
- - lib/rails/generators/templates/interactor_test_unit.erb
132
- - lib/rails/generators/templates/organizer.erb
133
- homepage: https://github.com/aaronmallen/activeinteractor
67
+ - lib/active_interactor/errors.rb
68
+ - lib/active_interactor/result.rb
69
+ - sig/active_interactor.rbs
70
+ homepage: https://github.com/activeinteractor/activeinteractor
134
71
  licenses:
135
72
  - MIT
136
73
  metadata:
137
- bug_tracker_uri: https://github.com/aaronmallen/activeinteractor/issues
138
- changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v1.2.2/CHANGELOG.md
139
- documentation_uri: https://www.rubydoc.info/gems/activeinteractor/1.2.2
140
- hompage_uri: https://github.com/aaronmallen/activeinteractor
141
- source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v1.2.2
142
- wiki_uri: https://github.com/aaronmallen/activeinteractor/wiki
143
- post_install_message:
74
+ bug_tracker_uri: https://github.com/activeinteractor/activeinteractor/issues
75
+ changelog_uri: https://github.com/activeinteractor/activeinteractor/blob/v2.0.0-alpha.1.0.0/CHANGELOG.md
76
+ homepage_uri: https://github.com/activeinteractor/activeinteractor
77
+ source_code_uri: https://github.com/activeinteractor/activeinteractor/tree/v2.0.0-alpha.1.0.0
78
+ wiki_uri: https://github.com/activeinteractor/activeinteractor/wiki
79
+ rubygems_mfa_required: 'true'
80
+ post_install_message:
144
81
  rdoc_options: []
145
82
  require_paths:
146
83
  - lib
@@ -148,15 +85,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
85
  requirements:
149
86
  - - ">="
150
87
  - !ruby/object:Gem::Version
151
- version: 2.5.0
88
+ version: '3.0'
152
89
  required_rubygems_version: !ruby/object:Gem::Requirement
153
90
  requirements:
154
- - - ">="
91
+ - - ">"
155
92
  - !ruby/object:Gem::Version
156
- version: '0'
93
+ version: 1.3.1
157
94
  requirements: []
158
- rubygems_version: 3.1.6
159
- signing_key:
95
+ rubygems_version: 3.4.19
96
+ signing_key:
160
97
  specification_version: 4
161
98
  summary: Ruby interactors with ActiveModel::Validations
162
99
  test_files: []
data/.yardopts DELETED
@@ -1,12 +0,0 @@
1
- --title ActiveInteractor
2
- --readme README.md
3
- --markup-provider redcarpet
4
- --markup markdown
5
- --exclude lib/rails
6
- --protected
7
- --no-private
8
- --embed-mixins
9
- lib/**/*.rb
10
- -
11
- CHANGELOG.md
12
- LICENSE
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveInteractor
4
- # The ActiveInteractor configuration object
5
- #
6
- # @author Aaron Allen <hello@aaronmallen.me>
7
- # @since 1.0.0
8
- #
9
- # @!attribute [rw] logger
10
- # The logger instance to use for logging.
11
- #
12
- # @since 1.0.0
13
- #
14
- # @return [Class] an instance of Logger.
15
- #
16
- # @!method initialize(options = {})
17
- # Initialize a new instance of {Config}
18
- #
19
- # @since 1.0.0
20
- #
21
- # @param options [Hash{Symbol=>*}] the attributes to assign to {Config}
22
- # @option options [Class] :logger (Logger.new(STDOUT)) the {Config#logger} attribute
23
- # @return [Config] a new instance of {Config}
24
- class Config
25
- include ActiveInteractor::Configurable
26
- defaults logger: Logger.new($stdout)
27
- end
28
-
29
- # The ActiveInteractor configuration
30
- #
31
- # @since 0.1.0
32
- #
33
- # @return [Config] a {Config} instance
34
- def self.config
35
- @config ||= ActiveInteractor::Config.new
36
- end
37
-
38
- # Configure the ActiveInteractor gem
39
- #
40
- # @since 0.1.0
41
- #
42
- # @example Configure ActiveInteractor
43
- # require 'active_interactor'
44
- # ActiveInteractor.configure do |config|
45
- # config.logger = ::Rails.logger
46
- # end
47
- # @yield [#config]
48
- def self.configure
49
- yield config
50
- end
51
-
52
- # The logger instance to use for logging
53
- #
54
- # @since 0.1.0
55
- #
56
- # @return [Class] the {Config#logger #config#logger} instance
57
- def self.logger
58
- config.logger
59
- end
60
- end