service_pattern 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94ca486bb1607f167123d393bc42c03f7786430a83eff2628c5e07099332fdc7
|
4
|
+
data.tar.gz: 6c8f24a858cb72f8e5766fb5ff78508bd7d98d5598ab2d0a31a8daf67c5d5620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ba2a11e72514b6e9db753c6c6e63327ff815456ba563f755ee258b42d6550fbbb37fdd73eaa9188c63d88b1a6cde5ea2271884a6cc8263e3dc192d04d140d4f
|
7
|
+
data.tar.gz: dcd0e3e808ac4c8aec52f24c4ad58dc33af96af830892c7e32cc65490f43c5b8d52f6f3f8712f7e0b788c43ee2fd6d71fcff8649d527ed156de02c1cd00fd74e
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class ServicePattern::ModelsSave < ServicePattern::Service
|
2
2
|
attr_reader :models, :simple_model_errors
|
3
3
|
|
4
|
-
def initialize(models:, simple_model_errors:
|
4
|
+
def initialize(models:, simple_model_errors: true)
|
5
5
|
@models = models
|
6
6
|
@simple_model_errors = simple_model_errors
|
7
7
|
end
|
@@ -113,7 +113,7 @@ class ServicePattern::Service
|
|
113
113
|
ServicePattern::Service.fail!(errors)
|
114
114
|
end
|
115
115
|
|
116
|
-
def save_models_or_fail(*models, simple_model_errors:
|
116
|
+
def save_models_or_fail(*models, simple_model_errors: true)
|
117
117
|
ServicePattern::ModelsSave.execute!(models: models, simple_model_errors: simple_model_errors)
|
118
118
|
end
|
119
119
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class ServicePattern::SimpleModelErrors
|
1
|
+
class ServicePattern::SimpleModelErrors < ServicePattern::Service
|
2
2
|
attr_reader :additional_attributes, :errors, :model, :models_inspected
|
3
3
|
|
4
4
|
def initialize(model:, additional_attributes: [])
|
@@ -10,7 +10,7 @@ class ServicePattern::SimpleModelErrors
|
|
10
10
|
|
11
11
|
def perform
|
12
12
|
inspect_model(model)
|
13
|
-
errors
|
13
|
+
succeed!(errors)
|
14
14
|
end
|
15
15
|
|
16
16
|
def inspect_model(model_to_inspect)
|
data/lib/service_pattern.rb
CHANGED
@@ -8,5 +8,5 @@ module ServicePattern
|
|
8
8
|
autoload :ModelsSave, "#{path}/models_save"
|
9
9
|
autoload :Response, "#{path}/response"
|
10
10
|
autoload :Service, "#{path}/service"
|
11
|
-
autoload :
|
11
|
+
autoload :SimpleModelErrors, "#{path}/simple_model_errors"
|
12
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service_pattern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaspernj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -166,7 +166,7 @@ files:
|
|
166
166
|
- lib/service_pattern/models_save.rb
|
167
167
|
- lib/service_pattern/response.rb
|
168
168
|
- lib/service_pattern/service.rb
|
169
|
-
- lib/service_pattern/
|
169
|
+
- lib/service_pattern/simple_model_errors.rb
|
170
170
|
- lib/service_pattern/version.rb
|
171
171
|
- lib/tasks/service_pattern_tasks.rake
|
172
172
|
homepage: https://www.github.com/kaspernj/service_pattern
|