service_actor 3.1.1 → 3.1.2
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/README.md +16 -12
- data/lib/service_actor/base.rb +1 -3
- data/lib/service_actor/collectionable.rb +2 -1
- data/lib/service_actor/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 182079e8ce5159c685b472dcecec697cd640e2006266f9f8e71b1fe829e24743
|
4
|
+
data.tar.gz: 28522d5045e623f0fb55ac77519720e3d76168f070c108a1785c46b322a04a9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c4ae5e139ac02cc1244c24c8b245161cebe2246112bdfe25646c38d09f5b83d34d68f902ded72477149c1f6a928a617d1bbfbf5dd7479ee35d0d6f87c0b08a8
|
7
|
+
data.tar.gz: 2f0d5c297e68ba61db4467d6ef83e14ec92e12b839a5bea78d0fdd072ae08f7077676fd88cd8ad22f7e1e5790e987be69695c8bb0c465eea58d0e3a59cac7c04
|
data/README.md
CHANGED
@@ -23,7 +23,6 @@ and controllers thin.
|
|
23
23
|
- [Rollback](#rollback)
|
24
24
|
- [Lambdas](#lambdas)
|
25
25
|
- [Play conditions](#play-conditions)
|
26
|
-
- [Use with Rails](#use-with-rails)
|
27
26
|
- [Testing](#testing)
|
28
27
|
- [Build your own actor](#build-your-own-actor)
|
29
28
|
- [Influences](#influences)
|
@@ -34,13 +33,21 @@ and controllers thin.
|
|
34
33
|
|
35
34
|
## Installation
|
36
35
|
|
37
|
-
Add these lines to your application
|
36
|
+
Add these lines to your application’s Gemfile:
|
38
37
|
|
39
38
|
```rb
|
40
39
|
# Composable service objects
|
41
40
|
gem 'service_actor'
|
42
41
|
```
|
43
42
|
|
43
|
+
When using Rails, you can include the
|
44
|
+
[service_actor-rails](https://github.com/sunny/actor-rails) gem:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# Composable service objects
|
48
|
+
gem "service_actor-rails"
|
49
|
+
```
|
50
|
+
|
44
51
|
## Usage
|
45
52
|
|
46
53
|
Actors are single-purpose actions in your application that represent your
|
@@ -351,11 +358,6 @@ class PlaceOrder < Actor
|
|
351
358
|
end
|
352
359
|
```
|
353
360
|
|
354
|
-
## Use with Rails
|
355
|
-
|
356
|
-
The [service_actor-rails](https://github.com/sunny/actor-rails/) gem includes a
|
357
|
-
Rails generator to create an actor and its spec.
|
358
|
-
|
359
361
|
## Testing
|
360
362
|
|
361
363
|
In your application, add automated testing to your actors as you would do to any
|
@@ -385,7 +387,7 @@ end
|
|
385
387
|
|
386
388
|
This gem is heavily influenced by
|
387
389
|
[Interactor](https://github.com/collectiveidea/interactor) ♥.
|
388
|
-
|
390
|
+
Some key differences make `actor` unique:
|
389
391
|
|
390
392
|
- Does not [hide errors when an actor fails inside another
|
391
393
|
actor](https://github.com/collectiveidea/interactor/issues/170).
|
@@ -416,14 +418,16 @@ Photo by [Lloyd Dirks](https://unsplash.com/photos/4SLz_RCk6kQ).
|
|
416
418
|
## Development
|
417
419
|
|
418
420
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
419
|
-
`rake` to run the tests and linting. You can also run `bin/console` for an
|
421
|
+
`bin/rake` to run the tests and linting. You can also run `bin/console` for an
|
420
422
|
interactive prompt.
|
421
423
|
|
422
424
|
To release a new version, update the version number in `version.rb`, and in the
|
423
425
|
`CHANGELOG.md`. Update the `README.md` if there are missing segments, make sure
|
424
|
-
tests and linting are pristine by calling `bundle && rake`, then create a
|
425
|
-
for this version.
|
426
|
-
|
426
|
+
tests and linting are pristine by calling `bundle && bin/rake`, then create a
|
427
|
+
commit for this version.
|
428
|
+
|
429
|
+
You can then run `rake release`, which will assign a git tag, push using git,
|
430
|
+
and push the gem to [rubygems.org](https://rubygems.org).
|
427
431
|
|
428
432
|
## Contributing
|
429
433
|
|
data/lib/service_actor/base.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'service_actor/core'
|
4
|
-
|
5
3
|
# Exceptions
|
6
4
|
require 'service_actor/error'
|
7
5
|
require 'service_actor/failure'
|
@@ -33,8 +31,8 @@ module ServiceActor
|
|
33
31
|
base.include(TypeCheckable)
|
34
32
|
base.include(NilCheckable)
|
35
33
|
base.include(Conditionable)
|
36
|
-
base.include(Defaultable)
|
37
34
|
base.include(Collectionable)
|
35
|
+
base.include(Defaultable)
|
38
36
|
base.include(Failable)
|
39
37
|
end
|
40
38
|
end
|
@@ -22,7 +22,8 @@ module ServiceActor
|
|
22
22
|
next if options[:in].include?(result[key])
|
23
23
|
|
24
24
|
raise ArgumentError,
|
25
|
-
"Input #{key} must be included in #{options[:in].inspect}"
|
25
|
+
"Input #{key} must be included in #{options[:in].inspect} " \
|
26
|
+
"but instead was #{result[key].inspect}"
|
26
27
|
end
|
27
28
|
|
28
29
|
super
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service_actor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sunny Ripert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
|
-
rubygems_version: 3.1.
|
174
|
+
rubygems_version: 3.1.4
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Service objects for your application logic
|