process_chain 0.1.0 → 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/.coveralls.yml +1 -0
- data/.gitignore +2 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +1 -3
- data/README.md +12 -8
- data/lib/process_chain.rb +1 -3
- data/lib/process_chain/version.rb +1 -1
- data/process_chain.gemspec +0 -2
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 930db88dff70eb643cf8f446a35c917e1fa62cf6
|
4
|
+
data.tar.gz: 5d684897a3d3221f614e0cd4c896a6f3c719de42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a81fd64ebdc1660431fab8d3a26208a2ce5ac151a1debbfcd93c8a0f7046245c56f2ff4fabd970999fe8efd4b70968544ae6c81efef9832ae1dd96bc16157f4
|
7
|
+
data.tar.gz: ad73c8e57a89ecdd5060ca29cc637ec4fc1830bf1a911f5e6ac0deba67b560cf13f5516fd9116c39ed8eb6c84dee919ad67117a6343267b62343daa9b42816c0
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
process_chain (0.
|
5
|
-
hashie (~> 3.5)
|
4
|
+
process_chain (0.2.0)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: https://rubygems.org/
|
@@ -16,7 +15,6 @@ GEM
|
|
16
15
|
tins (~> 1.6)
|
17
16
|
diff-lcs (1.3)
|
18
17
|
docile (1.3.1)
|
19
|
-
hashie (3.5.6)
|
20
18
|
json (2.1.0)
|
21
19
|
parallel (1.12.1)
|
22
20
|
parser (2.5.1.0)
|
data/README.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# ProcessChain
|
2
|
+
[![Build Status](https://travis-ci.org/max-konin/process_chain.svg?branch=master)](https://travis-ci.org/max-konin/process_chain)
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/github/max-konin/process_chain/badge.svg?branch=master)](https://coveralls.io/github/max-konin/process_chain?branch=master)
|
4
|
+
[![Inline docs](http://inch-ci.org/github/max-konin/process_chain.svg?branch=master)](http://inch-ci.org/github/max-konin/process_chain)
|
5
|
+
|
2
6
|
|
3
7
|
ProcessChain gives you a simple way to using the Railsway oriented programming pattern. And allows you to write code in a more functional style.
|
4
8
|
|
@@ -27,14 +31,14 @@ class UpdateUserProcess
|
|
27
31
|
|
28
32
|
def assignee_attributes(attrs)
|
29
33
|
if_success do
|
30
|
-
return_success user: results
|
34
|
+
return_success user: results[:user].assigne_attributes(attrs)
|
31
35
|
end
|
32
36
|
end
|
33
37
|
|
34
38
|
def validate_user
|
35
39
|
if_success do
|
36
40
|
if results.user.valid?
|
37
|
-
return_fail errors: results
|
41
|
+
return_fail errors: results[:user].errors, user: results.user
|
38
42
|
else
|
39
43
|
return_success
|
40
44
|
end
|
@@ -42,12 +46,12 @@ class UpdateUserProcess
|
|
42
46
|
end
|
43
47
|
|
44
48
|
def save_user
|
45
|
-
user = results
|
49
|
+
user = results[:user]
|
46
50
|
if_success do
|
47
51
|
if user.save
|
48
52
|
return_success user: user
|
49
53
|
else
|
50
|
-
return_fail user:
|
54
|
+
return_fail user: user
|
51
55
|
end
|
52
56
|
end
|
53
57
|
end
|
@@ -60,9 +64,9 @@ def create
|
|
60
64
|
.validate_user
|
61
65
|
.save_user
|
62
66
|
if process.success?
|
63
|
-
render status: :ok, json: process.results
|
67
|
+
render status: :ok, json: process.results[:user]
|
64
68
|
else
|
65
|
-
render status: :bad_request, json: process.results
|
69
|
+
render status: :bad_request, json: process.results[:errors]
|
66
70
|
end
|
67
71
|
end
|
68
72
|
```
|
@@ -75,7 +79,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
75
79
|
|
76
80
|
## Contributing
|
77
81
|
|
78
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
82
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/max-konin/process_chain. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
79
83
|
|
80
84
|
## License
|
81
85
|
|
@@ -83,4 +87,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
83
87
|
|
84
88
|
## Code of Conduct
|
85
89
|
|
86
|
-
Everyone interacting in the ProcessChain project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
90
|
+
Everyone interacting in the ProcessChain project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/max-konin/process_chain/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/process_chain.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'process_chain/version'
|
4
4
|
|
5
|
-
require 'hashie'
|
6
|
-
|
7
5
|
# Base module for process chains
|
8
6
|
module ProcessChain
|
9
7
|
# :nodoc:
|
@@ -25,7 +23,7 @@ module ProcessChain
|
|
25
23
|
def initialize(input: {}, success: true)
|
26
24
|
raise ArgumentError, '"input" should be a Hash' unless input.is_a? Hash
|
27
25
|
@success = success
|
28
|
-
@results =
|
26
|
+
@results = input
|
29
27
|
end
|
30
28
|
|
31
29
|
# @return [true false]
|
data/process_chain.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: process_chain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Konin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: hashie
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.5'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.5'
|
69
55
|
description: Simple railway programming implementation for Ruby. To allow describe
|
70
56
|
business logic in Elixir style
|
71
57
|
email:
|
@@ -74,6 +60,7 @@ executables: []
|
|
74
60
|
extensions: []
|
75
61
|
extra_rdoc_files: []
|
76
62
|
files:
|
63
|
+
- ".coveralls.yml"
|
77
64
|
- ".gitignore"
|
78
65
|
- ".rspec"
|
79
66
|
- ".rubocop.yml"
|