rails_use_case 0.0.8 → 0.0.9
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 +9 -2
- data/lib/rails/callable.rb +2 -2
- data/lib/rails/service.rb +2 -2
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56f84c351e857b7fd1ac1963d18138f96608376c4952fe3a12e8e7db2dbc0152
|
4
|
+
data.tar.gz: 46de14ac109e227a1a36dfdbb7f75a4e0595652c3d0e59189788cbbe8ea1ccd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 990f15747a27962ea59d7428416c8b525cf297e5e18f592fbaf3feeed8d4eecfe231bc7608acaa6516bc6273973ab651639a272c8b885f8b672fc4cb9b699ecf
|
7
|
+
data.tar.gz: '009f04d247c31452fec07815ff7be8c6af90ba3e5e03ef08f3ac4fd4b87cfcd4103cf44963ffc2a09f8791e8f9430327dd7db98f0d2e11d06feba3b646cbabd1'
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Rails Use Case gem
|
2
2
|
|
3
|
-
Opinionated gem for UseCases and Services in
|
3
|
+
Opinionated gem for UseCases and Services in Rails to keep your Models and Controllers slim.
|
4
|
+
|
5
|
+
Read more: https://dev.to/phortx/pimp-your-rails-application-32d0
|
4
6
|
|
5
7
|
The purpose of a UseCase is to contain reusable high level business logic which would normally be
|
6
8
|
located in the controller. Examples are: Place an item in the cart, create a new user or delete a comment.
|
@@ -20,7 +22,7 @@ gem 'rails_use_case'
|
|
20
22
|
|
21
23
|
The purpose of a UseCase is to contain reusable high level business logic which would normally be
|
22
24
|
located in the controller. It defines a process via `step` definitions. A UseCase takes params
|
23
|
-
and has a outcome, which is
|
25
|
+
and has a outcome, which is either successful or failed. It doesn't have a configuration file and doesn't
|
24
26
|
log anything. Examples are: Place an item in the cart, create a new user or delete a comment.
|
25
27
|
|
26
28
|
Steps are executed in the defined order. Only when a step succeeds (returns true) the next step will
|
@@ -83,6 +85,11 @@ puts result.inspect
|
|
83
85
|
# }
|
84
86
|
```
|
85
87
|
|
88
|
+
- You can check whether a UseCase was successful via `result.success?`.
|
89
|
+
- You can access the value of `@record` via `result.record`.
|
90
|
+
- You can stop the UseCase process with a error message via throwing `Rails::UseCase::Error` exception.
|
91
|
+
|
92
|
+
|
86
93
|
|
87
94
|
## Behavior
|
88
95
|
|
data/lib/rails/callable.rb
CHANGED
data/lib/rails/service.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_use_case
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Klein
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 6.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 6.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler-audit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -195,7 +195,7 @@ homepage: https://github.com/phortx/rails-use-case
|
|
195
195
|
licenses:
|
196
196
|
- MIT
|
197
197
|
metadata: {}
|
198
|
-
post_install_message:
|
198
|
+
post_install_message:
|
199
199
|
rdoc_options: []
|
200
200
|
require_paths:
|
201
201
|
- lib
|
@@ -210,8 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
- !ruby/object:Gem::Version
|
211
211
|
version: '0'
|
212
212
|
requirements: []
|
213
|
-
rubygems_version: 3.
|
214
|
-
signing_key:
|
213
|
+
rubygems_version: 3.1.2
|
214
|
+
signing_key:
|
215
215
|
specification_version: 4
|
216
216
|
summary: Rails UseCase and Service classes
|
217
217
|
test_files: []
|