operators-service 0.1.1 → 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/README.md +9 -3
- data/Rakefile +2 -2
- data/lib/operators/service.rb +1 -3
- data/lib/operators-service.rb +2 -0
- data/operators-service.gemspec +4 -3
- data/spec/operators/service_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -1
- metadata +7 -7
- data/lib/operators_service.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02f0e60904dcfc6c7baeaa3eb7c5961569324a29
|
4
|
+
data.tar.gz: 581a8c1c10bb01243a3f7d6e8916d17143d5ed23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcee045378315213c2534675556e36fb2c656b705fac43364a473ba7c804406c802692310151a46ced25295846b34175348b12a178f8eff6c77fe4fc3317c7ee
|
7
|
+
data.tar.gz: cc75bb53af3b0a8218383af1a033e5c3596a9d6e92962c8b9d1ab2eca9124bda3dd54e7867eb6634617c19ba6d98191e595a56ef1c0085ddc8a5d0d5d3963296
|
data/README.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# Operators::Service
|
2
2
|
|
3
|
-
|
3
|
+
Operators::Service is a lightweight implementation of Service Object based on Either Monad. That gives an home of application business logic.
|
4
4
|
|
5
|
-
|
5
|
+
Service Objects are created when an action:
|
6
|
+
|
7
|
+
* Uses integration with external services
|
8
|
+
|
9
|
+
* Uses several models
|
10
|
+
|
11
|
+
* Is complex (such as calculating sales statistics)
|
6
12
|
|
7
13
|
## Installation
|
8
14
|
|
@@ -32,7 +38,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
38
|
|
33
39
|
## Contributing
|
34
40
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/operators-rb/operators-service.
|
36
42
|
|
37
43
|
|
38
44
|
## License
|
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
task :
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
task default: :spec
|
data/lib/operators/service.rb
CHANGED
data/operators-service.gemspec
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
6
7
|
spec.name = 'operators-service'
|
7
|
-
spec.version = '0.
|
8
|
+
spec.version = '0.2.0'
|
8
9
|
spec.authors = ['Yaroslav Bezrukavyi', 'Kirill Shevchenko']
|
9
10
|
spec.email = ['yaroslav.bezrukavyi@gmail.com', 'hello@kirillshevch.com']
|
10
11
|
|
11
12
|
spec.summary = 'You will always know the type of the result'
|
12
|
-
spec.description = 'Service is based on
|
13
|
+
spec.description = 'Service Object is based on Either Monad'
|
13
14
|
spec.homepage = 'http://operators-rb.org'
|
14
15
|
spec.license = 'MIT'
|
15
16
|
|
@@ -20,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
20
21
|
|
21
22
|
spec.add_dependency 'dry-monads', '~> 0.3.1'
|
22
23
|
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
24
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
27
|
spec.add_development_dependency 'byebug', '~> 3.5.0'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
describe Operators::Service do
|
2
2
|
before do
|
3
|
-
class
|
3
|
+
class TestService < Operators::Service
|
4
4
|
rescue_callbacks SyntaxError
|
5
5
|
|
6
6
|
def initialize(data, result)
|
@@ -19,17 +19,17 @@ RSpec.describe Operators::Service do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'success result' do
|
22
|
-
result =
|
22
|
+
result = TestService.call('data', true)
|
23
23
|
expect(result.success?).to be_truthy
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'failure result' do
|
27
|
-
result =
|
27
|
+
result = TestService.call('data', false)
|
28
28
|
expect(result.success?).to be_falsey
|
29
29
|
end
|
30
30
|
|
31
31
|
context 'catch error' do
|
32
|
-
subject {
|
32
|
+
subject { TestService.new('error', true) }
|
33
33
|
|
34
34
|
it 'catch' do
|
35
35
|
allow(subject).to receive(:calling).and_raise(SyntaxError)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: operators-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Bezrukavyi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-09-
|
12
|
+
date: 2017-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-monads
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: '1.14'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: '1.14'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 0.48.0
|
98
|
-
description: Service is based on
|
98
|
+
description: Service Object is based on Either Monad
|
99
99
|
email:
|
100
100
|
- yaroslav.bezrukavyi@gmail.com
|
101
101
|
- hello@kirillshevch.com
|
@@ -111,8 +111,8 @@ files:
|
|
111
111
|
- README.md
|
112
112
|
- Rakefile
|
113
113
|
- circle.yml
|
114
|
+
- lib/operators-service.rb
|
114
115
|
- lib/operators/service.rb
|
115
|
-
- lib/operators_service.rb
|
116
116
|
- operators-service.gemspec
|
117
117
|
- spec/operators/service_spec.rb
|
118
118
|
- spec/spec_helper.rb
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.5.2
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: You will always know the type of the result
|
data/lib/operators_service.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "operators/service"
|