dryer_services 1.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 +7 -0
- data/Gemfile +2 -0
- data/LICENSE +18 -0
- data/README.md +1 -0
- data/dryer_services.gemspec +28 -0
- data/lib/dryer/services/services/result_service.rb +25 -0
- data/lib/dryer/services/services/simple_service.rb +15 -0
- data/lib/dryer/services/version.rb +9 -0
- data/lib/dryer_services.rb +11 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 87e8da1d4f76f45004b8f9e2e815abc712cd4489a81b9f5d9f0edcb4b90b094d
|
4
|
+
data.tar.gz: 85ee11f54acb826d9a0b8f5ff1de144de45e88f7d813000ad7ff8012636aa526
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bb3db4e4444fa4fa9e566227cbe2b6f56a08bcfad58a404b3b283acfebb421b0460b987dd86f2602b97b73190b16bd5d8e797a83f72cdb4044d95b41f77f7457
|
7
|
+
data.tar.gz: 2cd1e93e893bd0955baa20abe72e40a45d19998aaaab2bfa4ad1ae570cc16aa620a3f126ae6793d48963f1cc20eccbe5ab123e1651b8bf236ed5d1fefa70fe4f
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
MIT License
|
2
|
+
Copyright (c) 2023 John Bernier
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
The above copyright notice and this permission notice shall be
|
11
|
+
included in all copies or substantial portions of the Software.
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
13
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
14
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
15
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
16
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
17
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
18
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Dryer Services
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = 'dryer_services'
|
3
|
+
spec.version = "1.0.0"
|
4
|
+
spec.authors = ['John Bernier']
|
5
|
+
spec.email = ['john.b.bernier@gmail.com']
|
6
|
+
spec.summary = 'A service object leveraging the dry-monads gem'
|
7
|
+
spec.description = <<~DOC
|
8
|
+
An extension of the Dry family of gems (dry-rb.org).
|
9
|
+
This gem provides a base service class that leverages the dry-monads gem
|
10
|
+
to build composable service objects.
|
11
|
+
DOC
|
12
|
+
spec.homepage = 'https://github.com/jbernie2/dryer_services'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
spec.platform = Gem::Platform::RUBY
|
15
|
+
spec.required_ruby_version = '>= 3.0.0'
|
16
|
+
spec.files = Dir[
|
17
|
+
'README.md',
|
18
|
+
'LICENSE',
|
19
|
+
'CHANGELOG.md',
|
20
|
+
'lib/**/*.rb',
|
21
|
+
'dryer_services.gemspec',
|
22
|
+
'.github/*.md',
|
23
|
+
'Gemfile'
|
24
|
+
]
|
25
|
+
spec.add_dependency "dry-monads", "~> 1.6"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.10"
|
27
|
+
spec.add_development_dependency "debug", "~> 1.8"
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative './simple_service.rb'
|
2
|
+
require 'dry-monads'
|
3
|
+
|
4
|
+
module Dryer
|
5
|
+
module Services
|
6
|
+
module Services
|
7
|
+
class ResultService < SimpleService
|
8
|
+
|
9
|
+
def self.call(*args)
|
10
|
+
wrap_result(super(*args))
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.wrap_result(result)
|
14
|
+
if result.is_a?(Dry::Monads::Failure) || result.is_a?(Dry::Monads::Success)
|
15
|
+
result
|
16
|
+
elsif result.is_a?(StandardError)
|
17
|
+
Dry::Monads::Failure(result)
|
18
|
+
else
|
19
|
+
Dry::Monads::Success(result)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative "./dryer/services/services/result_service.rb"
|
2
|
+
require_relative "./dryer/services/services/simple_service.rb"
|
3
|
+
|
4
|
+
module Dryer
|
5
|
+
module Services
|
6
|
+
class SimpleService < Dryer::Services::Services::SimpleService
|
7
|
+
end
|
8
|
+
class ResultService < Dryer::Services::Services::ResultService
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dryer_services
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Bernier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-12-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-monads
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: debug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.8'
|
55
|
+
description: |
|
56
|
+
An extension of the Dry family of gems (dry-rb.org).
|
57
|
+
This gem provides a base service class that leverages the dry-monads gem
|
58
|
+
to build composable service objects.
|
59
|
+
email:
|
60
|
+
- john.b.bernier@gmail.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE
|
67
|
+
- README.md
|
68
|
+
- dryer_services.gemspec
|
69
|
+
- lib/dryer/services/services/result_service.rb
|
70
|
+
- lib/dryer/services/services/simple_service.rb
|
71
|
+
- lib/dryer/services/version.rb
|
72
|
+
- lib/dryer_services.rb
|
73
|
+
homepage: https://github.com/jbernie2/dryer_services
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 3.0.0
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubygems_version: 3.4.13
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: A service object leveraging the dry-monads gem
|
96
|
+
test_files: []
|