strum-service 0.0.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile.lock +20 -20
- data/lib/strum/service.rb +21 -8
- data/lib/strum/service/version.rb +1 -1
- data/strum-service.gemspec +5 -4
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fb6ced97fb4ca360125eacaaf126b16cd20d1eaec11fa44da8e7343bcd6824b
|
4
|
+
data.tar.gz: 18f2f7e2379143b136c5200320880c6592adb5968f16f15c6471b5da33a4737c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd0b7a43efc17cd92dc80748e94fc7339e14ebeb8c8c38b508d73b92fde28c3c77d6500df03c3a5493ddf388b53a8ea4b1500533b456ee3c9d4cd746d8f012a4
|
7
|
+
data.tar.gz: a95e51946cb31f1424b621bb938e96da89f0e751bf3865585b027edb0235b6b358354ac4fdda2979bf1327d591f9ebff722657f17689beef78806dab11d7822e
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,51 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
strum-service (0.0
|
4
|
+
strum-service (0.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.4.
|
9
|
+
ast (2.4.2)
|
10
10
|
diff-lcs (1.4.4)
|
11
11
|
parallel (1.20.1)
|
12
|
-
parser (
|
12
|
+
parser (3.0.2.0)
|
13
13
|
ast (~> 2.4.1)
|
14
14
|
rainbow (3.0.0)
|
15
15
|
rake (12.3.3)
|
16
|
-
regexp_parser (2.
|
17
|
-
rexml (3.2.
|
16
|
+
regexp_parser (2.1.1)
|
17
|
+
rexml (3.2.5)
|
18
18
|
rspec (3.10.0)
|
19
19
|
rspec-core (~> 3.10.0)
|
20
20
|
rspec-expectations (~> 3.10.0)
|
21
21
|
rspec-mocks (~> 3.10.0)
|
22
|
-
rspec-core (3.10.
|
22
|
+
rspec-core (3.10.1)
|
23
23
|
rspec-support (~> 3.10.0)
|
24
|
-
rspec-expectations (3.10.
|
24
|
+
rspec-expectations (3.10.1)
|
25
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
26
26
|
rspec-support (~> 3.10.0)
|
27
|
-
rspec-mocks (3.10.
|
27
|
+
rspec-mocks (3.10.2)
|
28
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
29
29
|
rspec-support (~> 3.10.0)
|
30
|
-
rspec-support (3.10.
|
31
|
-
rubocop (1.
|
30
|
+
rspec-support (3.10.2)
|
31
|
+
rubocop (1.18.4)
|
32
32
|
parallel (~> 1.10)
|
33
|
-
parser (>=
|
33
|
+
parser (>= 3.0.0.0)
|
34
34
|
rainbow (>= 2.2.2, < 4.0)
|
35
|
-
regexp_parser (>=
|
35
|
+
regexp_parser (>= 1.8, < 3.0)
|
36
36
|
rexml
|
37
|
-
rubocop-ast (>= 1.2.0)
|
37
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
38
38
|
ruby-progressbar (~> 1.7)
|
39
|
-
unicode-display_width (>= 1.4.0, <
|
40
|
-
rubocop-ast (1.
|
41
|
-
parser (>=
|
39
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
40
|
+
rubocop-ast (1.8.0)
|
41
|
+
parser (>= 3.0.1.1)
|
42
42
|
rubocop-rake (0.5.1)
|
43
43
|
rubocop
|
44
|
-
rubocop-rspec (2.0.
|
44
|
+
rubocop-rspec (2.0.1)
|
45
45
|
rubocop (~> 1.0)
|
46
46
|
rubocop-ast (>= 1.1.0)
|
47
|
-
ruby-progressbar (1.
|
48
|
-
unicode-display_width (
|
47
|
+
ruby-progressbar (1.11.0)
|
48
|
+
unicode-display_width (2.0.0)
|
49
49
|
|
50
50
|
PLATFORMS
|
51
51
|
ruby
|
@@ -60,4 +60,4 @@ DEPENDENCIES
|
|
60
60
|
strum-service!
|
61
61
|
|
62
62
|
BUNDLED WITH
|
63
|
-
2.
|
63
|
+
2.2.15
|
data/lib/strum/service.rb
CHANGED
@@ -25,24 +25,28 @@ module Strum
|
|
25
25
|
|
26
26
|
# Internal: Interactor class methods.
|
27
27
|
module ClassMethods
|
28
|
-
def call(main_input,
|
29
|
-
|
28
|
+
def call(main_input, args = {}, &block)
|
29
|
+
raise ArgumentError, "Only Hash are allowed for args" unless args.is_a?(Hash)
|
30
|
+
|
31
|
+
new(main_input, **args).execute(&block)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
35
|
# Instance methods
|
34
|
-
def initialize(main_input,
|
36
|
+
def initialize(main_input, args = {})
|
35
37
|
self.strum_errors = {}
|
36
38
|
self.service_handlers = { on: {}, success: {}, failure: {} }
|
37
39
|
self.outputs = {}
|
38
40
|
self.inputs = args.merge(default: main_input)
|
39
41
|
self._inputs = inputs.dup.freeze
|
42
|
+
setup_default_proc
|
43
|
+
setup_input_default_proc
|
40
44
|
end
|
41
45
|
|
42
|
-
def execute
|
46
|
+
def execute
|
43
47
|
catch(:exit) do
|
44
48
|
audit
|
45
|
-
|
49
|
+
yield(self) if block_given?
|
46
50
|
call if valid?
|
47
51
|
end
|
48
52
|
valid? ? valid_result : invalid_result
|
@@ -73,9 +77,10 @@ module Strum
|
|
73
77
|
end
|
74
78
|
|
75
79
|
def method_missing(method_name, *args, &_block)
|
76
|
-
|
77
|
-
|
78
|
-
|
80
|
+
(args.count.zero? &&
|
81
|
+
(input.is_a?(Hash) && input[method_name.to_sym]) ||
|
82
|
+
inputs[method_name.to_sym]) ||
|
83
|
+
super
|
79
84
|
end
|
80
85
|
|
81
86
|
def respond_to_missing?(method_name, include_private = false)
|
@@ -181,6 +186,14 @@ module Strum
|
|
181
186
|
|
182
187
|
private
|
183
188
|
|
189
|
+
def setup_default_proc
|
190
|
+
inputs.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil }
|
191
|
+
end
|
192
|
+
|
193
|
+
def setup_input_default_proc
|
194
|
+
input.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil } if input.is_a?(Hash)
|
195
|
+
end
|
196
|
+
|
184
197
|
def key_to_sym(key)
|
185
198
|
key.to_sym
|
186
199
|
rescue StandardError
|
data/strum-service.gemspec
CHANGED
@@ -10,20 +10,21 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = "Light ruby framework"
|
12
12
|
spec.description = "Strum Service"
|
13
|
-
spec.homepage = "https://
|
13
|
+
spec.homepage = "https://gitlab.com/strum-rb/strum-service"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
16
16
|
|
17
17
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
18
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
-
spec.metadata["source_code_uri"] = "https://
|
21
|
-
spec.metadata["changelog_uri"] = "https://
|
20
|
+
spec.metadata["source_code_uri"] = "https://gitlab.com/strum-rb/strum-service"
|
21
|
+
spec.metadata["changelog_uri"] = "https://gitlab.com/strum-rb/strum-service/-/blob/master/CHANGELOG.md"
|
22
|
+
spec.metadata["bug_tracker_uri"] = "https://gitlab.com/strum-rb/strum-service/issues"
|
22
23
|
|
23
24
|
# Specify which files should be added to the gem when it is released.
|
24
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(/^(test|spec|features|\.ruby-version)/) }
|
27
28
|
end
|
28
29
|
spec.bindir = "exe"
|
29
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strum-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serhiy Nazarov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Strum Service
|
14
14
|
email:
|
@@ -33,14 +33,15 @@ files:
|
|
33
33
|
- lib/strum/service.rb
|
34
34
|
- lib/strum/service/version.rb
|
35
35
|
- strum-service.gemspec
|
36
|
-
homepage: https://
|
36
|
+
homepage: https://gitlab.com/strum-rb/strum-service
|
37
37
|
licenses:
|
38
38
|
- MIT
|
39
39
|
metadata:
|
40
40
|
allowed_push_host: https://rubygems.org
|
41
|
-
homepage_uri: https://
|
42
|
-
source_code_uri: https://
|
43
|
-
changelog_uri: https://
|
41
|
+
homepage_uri: https://gitlab.com/strum-rb/strum-service
|
42
|
+
source_code_uri: https://gitlab.com/strum-rb/strum-service
|
43
|
+
changelog_uri: https://gitlab.com/strum-rb/strum-service/-/blob/master/CHANGELOG.md
|
44
|
+
bug_tracker_uri: https://gitlab.com/strum-rb/strum-service/issues
|
44
45
|
post_install_message:
|
45
46
|
rdoc_options: []
|
46
47
|
require_paths:
|
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
57
|
- !ruby/object:Gem::Version
|
57
58
|
version: '0'
|
58
59
|
requirements: []
|
59
|
-
rubygems_version: 3.1.
|
60
|
+
rubygems_version: 3.1.6
|
60
61
|
signing_key:
|
61
62
|
specification_version: 4
|
62
63
|
summary: Light ruby framework
|