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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3e98a6a60f2736a9beb752b52e51d7ccee6f12e
4
- data.tar.gz: 7574bb1bf6e6d7e5b385af1cb737fa8dbf95f935
3
+ metadata.gz: 02f0e60904dcfc6c7baeaa3eb7c5961569324a29
4
+ data.tar.gz: 581a8c1c10bb01243a3f7d6e8916d17143d5ed23
5
5
  SHA512:
6
- metadata.gz: 8567e1d164d484f9958e489ab6671ed02a9812c99dc3aebcb69ec204e06f3db7ee749a13233985d860334ae75b73edcf2f784f1287d702dcc4d5218acd551e1d
7
- data.tar.gz: 7abbec2ef6d7abe19ed0ec63128c25d012058de5e3a132bf6330aca237b7a8e99d41833f9b4fb57ce59c5960b611f301a96923cc5f405d07660601d4736194a7
6
+ metadata.gz: fcee045378315213c2534675556e36fb2c656b705fac43364a473ba7c804406c802692310151a46ced25295846b34175348b12a178f8eff6c77fe4fc3317c7ee
7
+ data.tar.gz: cc75bb53af3b0a8218383af1a033e5c3596a9d6e92962c8b9d1ab2eca9124bda3dd54e7867eb6634617c19ba6d98191e595a56ef1c0085ddc8a5d0d5d3963296
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # Operators::Service
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/operators/service`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Delete this and the text above, and describe your gem
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/[USERNAME]/operators-service.
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 "bundler/gem_tasks"
2
- task :default => :spec
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
@@ -1,5 +1,3 @@
1
- require 'dry-monads'
2
-
3
1
  module Operators
4
2
  class Service
5
3
  def self.rescue_callbacks(*exceptions)
@@ -37,7 +35,7 @@ module Operators
37
35
  end
38
36
 
39
37
  def calling
40
- raise 'Must be redefined'
38
+ raise 'Not implemented'
41
39
  end
42
40
  end
43
41
  end
@@ -0,0 +1,2 @@
1
+ require 'dry-monads'
2
+ require 'operators/service'
@@ -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.1.1'
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 Dry::Monads'
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.15.4'
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
- RSpec.describe Operators::Service do
1
+ describe Operators::Service do
2
2
  before do
3
- class TestSerivce < Operators::Service
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 = TestSerivce.call('data', true)
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 = TestSerivce.call('data', false)
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 { TestSerivce.new('error', true) }
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
@@ -1,6 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  require 'byebug'
3
- require 'operators/service'
3
+ require 'operators-service'
4
4
 
5
5
  RSpec.configure do |config|
6
6
  config.order = :random
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.1.1
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-05 00:00:00.000000000 Z
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.15.4
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.15.4
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 Dry::Monads
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.6.11
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
@@ -1 +0,0 @@
1
- require "operators/service"