sea_food 0.1.0 → 0.1.1
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 +49 -0
- data/README.md +31 -1
- data/lib/sea_food/form.rb +2 -2
- data/lib/sea_food/service.rb +2 -1
- data/lib/sea_food/version.rb +1 -1
- data/sea_food.gemspec +2 -2
- metadata +15 -16
- data/.ruby-version +0 -1
- data/Gemfile.lock +0 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 229c5e0090e1f77fe0603d6dd101c2a95a4b8b2ac6df8e3e6a4bfb2a33fe1dba
|
4
|
+
data.tar.gz: a214594cb13e3f68a19780e89379396cc3555fe704d6aa5bd560c5d961b8592f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eccdcd9327f73be12b69603edf85868c24004a60e8e772682369fab85bc19404a6d7d59bf541b8481504577570ace291b4e816778bebed229bd71a66e71a328b
|
7
|
+
data.tar.gz: 0d03a7f7a0ced6aa30bc611239863c2f4a38bad6a4869c641a3be80d49338ebf367098e14a1260b06c0ed75117a26b4071f22fcac5f382c4f1c8124ddd0b40fd
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: Test Matrix
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
|
15
|
+
strategy:
|
16
|
+
matrix:
|
17
|
+
gemfile: [5_2.gemfile, 6_1.gemfile, 7_0.gemfile, 7_1.gemfile, 7_2.gemfile]
|
18
|
+
ruby-version: [ '2.7', '3.0', '3.1', '3.3']
|
19
|
+
exclude:
|
20
|
+
- ruby-version: '2.7'
|
21
|
+
gemfile: '7_0.gemfile'
|
22
|
+
- ruby-version: '2.7'
|
23
|
+
gemfile: '7_1.gemfile'
|
24
|
+
- ruby-version: '2.7'
|
25
|
+
gemfile: '7_2.gemfile'
|
26
|
+
- ruby-version: '3.0'
|
27
|
+
gemfile: '5_2.gemfile'
|
28
|
+
- ruby-version: '3.0'
|
29
|
+
gemfile: '7_2.gemfile'
|
30
|
+
- ruby-version: '3.1'
|
31
|
+
gemfile: '5_2.gemfile'
|
32
|
+
- ruby-version: '3.3'
|
33
|
+
gemfile: '5_2.gemfile'
|
34
|
+
|
35
|
+
env:
|
36
|
+
BUNDLE_GEMFILE: spec/gemfiles/${{ matrix.gemfile }}
|
37
|
+
steps:
|
38
|
+
- name: Checkout code
|
39
|
+
uses: actions/checkout@v2
|
40
|
+
|
41
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
42
|
+
uses: ruby/setup-ruby@v1
|
43
|
+
with:
|
44
|
+
ruby-version: ${{ matrix.ruby-version }}
|
45
|
+
bundler-cache: true
|
46
|
+
|
47
|
+
- name: Run tests
|
48
|
+
run: |
|
49
|
+
bundle exec rspec
|
data/README.md
CHANGED
@@ -21,7 +21,37 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
|
24
|
+
### Service usage
|
25
|
+
```ruby
|
26
|
+
class Invoices::ApproveService < SeaFood::Service
|
27
|
+
def initialize(invoice:, user:)
|
28
|
+
@invoice = invoice
|
29
|
+
@user = user
|
30
|
+
end
|
31
|
+
|
32
|
+
def call
|
33
|
+
fail!("You are not authorized to approve invoices") unless authorized?
|
34
|
+
|
35
|
+
@invoice.update!(status: :approved)
|
36
|
+
success(invoice: @invoice)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
result = Invoices::ApproveService.call(invoice: invoice, user: user)
|
41
|
+
result.success?
|
42
|
+
#=> true
|
43
|
+
result.invoice
|
44
|
+
#=> <Invoice(...>
|
45
|
+
```
|
46
|
+
If you want to enforce the interface and not allow users to use `call`
|
47
|
+
without arguments defined in the `initialize` you can add an initializer.
|
48
|
+
```ruby
|
49
|
+
# initializers/sea_food.rb
|
50
|
+
SeaFood.configure do |config|
|
51
|
+
config.enforce_interface = true
|
52
|
+
end
|
53
|
+
```
|
54
|
+
It will raise an `ArgumentError`.
|
25
55
|
|
26
56
|
## Development
|
27
57
|
|
data/lib/sea_food/form.rb
CHANGED
data/lib/sea_food/service.rb
CHANGED
@@ -21,7 +21,8 @@ module SeaFood
|
|
21
21
|
# @param args [Hash] Arguments to pass to the service.
|
22
22
|
# @return [ServiceResult] The result of the service call.
|
23
23
|
def call(params = {})
|
24
|
-
|
24
|
+
# debugger
|
25
|
+
service = new(**params)
|
25
26
|
service.call
|
26
27
|
service.result || ServiceResult.new
|
27
28
|
rescue ServiceError => e
|
data/lib/sea_food/version.rb
CHANGED
data/sea_food.gemspec
CHANGED
@@ -38,10 +38,10 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_dependency 'activesupport', '>= 5.2'
|
39
39
|
|
40
40
|
spec.add_development_dependency 'activerecord', '>= 5.2'
|
41
|
-
spec.add_development_dependency 'bundler'
|
41
|
+
spec.add_development_dependency 'bundler'
|
42
42
|
spec.add_development_dependency 'database_cleaner-active_record', '~> 2.2.0'
|
43
43
|
spec.add_development_dependency 'debug'
|
44
|
-
spec.add_development_dependency 'rake'
|
44
|
+
spec.add_development_dependency 'rake'
|
45
45
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
46
46
|
spec.add_development_dependency 'rubocop', '~> 0.80.0'
|
47
47
|
spec.add_development_dependency 'sqlite3', '~> 1.5.0'
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sea_food
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Aldunate
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-10-01 00:00:00.000000000 Z
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: database_cleaner-active_record
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,21 +150,20 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 1.5.0
|
153
|
-
description:
|
153
|
+
description:
|
154
154
|
email:
|
155
155
|
- federico.aldunatec@gmail.com
|
156
156
|
executables: []
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
+
- ".github/workflows/ci.yml"
|
160
161
|
- ".gitignore"
|
161
162
|
- ".rspec"
|
162
163
|
- ".rubocop.yml"
|
163
|
-
- ".ruby-version"
|
164
164
|
- ".travis.yml"
|
165
165
|
- CODE_OF_CONDUCT.md
|
166
166
|
- Gemfile
|
167
|
-
- Gemfile.lock
|
168
167
|
- LICENSE.txt
|
169
168
|
- README.md
|
170
169
|
- Rakefile
|
@@ -185,7 +184,7 @@ metadata:
|
|
185
184
|
source_code_uri: https://github.com/eagerworks/sea_food/
|
186
185
|
changelog_uri: https://github.com/eagerworks/sea_food/releases
|
187
186
|
bug_tracker_uri: https://github.com/eagerworks/sea_food/issues
|
188
|
-
post_install_message:
|
187
|
+
post_install_message:
|
189
188
|
rdoc_options: []
|
190
189
|
require_paths:
|
191
190
|
- lib
|
@@ -200,8 +199,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
199
|
- !ruby/object:Gem::Version
|
201
200
|
version: '0'
|
202
201
|
requirements: []
|
203
|
-
rubygems_version: 3.
|
204
|
-
signing_key:
|
202
|
+
rubygems_version: 3.3.26
|
203
|
+
signing_key:
|
205
204
|
specification_version: 4
|
206
205
|
summary: A Ruby gem for seamlessly integrating form and service object patterns.
|
207
206
|
test_files: []
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.7.2
|
data/Gemfile.lock
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
sea_food (0.1.0)
|
5
|
-
activemodel (>= 5.2)
|
6
|
-
activesupport (>= 5.2)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activemodel (6.1.7.8)
|
12
|
-
activesupport (= 6.1.7.8)
|
13
|
-
activerecord (6.1.7.8)
|
14
|
-
activemodel (= 6.1.7.8)
|
15
|
-
activesupport (= 6.1.7.8)
|
16
|
-
activesupport (6.1.7.8)
|
17
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>= 1.6, < 2)
|
19
|
-
minitest (>= 5.1)
|
20
|
-
tzinfo (~> 2.0)
|
21
|
-
zeitwerk (~> 2.3)
|
22
|
-
ast (2.4.2)
|
23
|
-
concurrent-ruby (1.3.4)
|
24
|
-
database_cleaner-active_record (2.2.0)
|
25
|
-
activerecord (>= 5.a)
|
26
|
-
database_cleaner-core (~> 2.0.0)
|
27
|
-
database_cleaner-core (2.0.1)
|
28
|
-
debug (1.8.0)
|
29
|
-
irb (>= 1.5.0)
|
30
|
-
reline (>= 0.3.1)
|
31
|
-
diff-lcs (1.5.1)
|
32
|
-
i18n (1.14.5)
|
33
|
-
concurrent-ruby (~> 1.0)
|
34
|
-
io-console (0.7.2)
|
35
|
-
irb (1.6.3)
|
36
|
-
reline (>= 0.3.0)
|
37
|
-
jaro_winkler (1.5.6)
|
38
|
-
mini_portile2 (2.8.7)
|
39
|
-
minitest (5.24.1)
|
40
|
-
parallel (1.24.0)
|
41
|
-
parser (3.3.4.2)
|
42
|
-
ast (~> 2.4.1)
|
43
|
-
racc
|
44
|
-
racc (1.8.1)
|
45
|
-
rainbow (3.1.1)
|
46
|
-
rake (10.5.0)
|
47
|
-
reline (0.5.9)
|
48
|
-
io-console (~> 0.5)
|
49
|
-
rexml (3.3.5)
|
50
|
-
strscan
|
51
|
-
rspec (3.13.0)
|
52
|
-
rspec-core (~> 3.13.0)
|
53
|
-
rspec-expectations (~> 3.13.0)
|
54
|
-
rspec-mocks (~> 3.13.0)
|
55
|
-
rspec-core (3.13.0)
|
56
|
-
rspec-support (~> 3.13.0)
|
57
|
-
rspec-expectations (3.13.1)
|
58
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.13.0)
|
60
|
-
rspec-mocks (3.13.1)
|
61
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
-
rspec-support (~> 3.13.0)
|
63
|
-
rspec-support (3.13.1)
|
64
|
-
rubocop (0.80.1)
|
65
|
-
jaro_winkler (~> 1.5.1)
|
66
|
-
parallel (~> 1.10)
|
67
|
-
parser (>= 2.7.0.1)
|
68
|
-
rainbow (>= 2.2.2, < 4.0)
|
69
|
-
rexml
|
70
|
-
ruby-progressbar (~> 1.7)
|
71
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
72
|
-
ruby-progressbar (1.13.0)
|
73
|
-
sqlite3 (1.5.4)
|
74
|
-
mini_portile2 (~> 2.8.0)
|
75
|
-
strscan (3.1.0)
|
76
|
-
tzinfo (2.0.6)
|
77
|
-
concurrent-ruby (~> 1.0)
|
78
|
-
unicode-display_width (1.6.1)
|
79
|
-
zeitwerk (2.6.17)
|
80
|
-
|
81
|
-
PLATFORMS
|
82
|
-
ruby
|
83
|
-
|
84
|
-
DEPENDENCIES
|
85
|
-
activerecord (>= 5.2)
|
86
|
-
bundler (~> 2.0)
|
87
|
-
database_cleaner-active_record (~> 2.2.0)
|
88
|
-
debug
|
89
|
-
rake (~> 10.0)
|
90
|
-
rspec (~> 3.0)
|
91
|
-
rubocop (~> 0.80.0)
|
92
|
-
sea_food!
|
93
|
-
sqlite3 (~> 1.5.0)
|
94
|
-
|
95
|
-
BUNDLED WITH
|
96
|
-
2.1.4
|