service_pattern 0.0.2 → 0.0.3

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: d6787a4f53bfdd57a07123e7eced76fdce0857cd
4
- data.tar.gz: 1dede4fdc6bfcd28b8fef48927f8d1362c0a0dfa
3
+ metadata.gz: 8d475628b9f7d75075a9069a45e64849402685d7
4
+ data.tar.gz: 06c1e5aa4f668b258a753503c74edaaa30dcf858
5
5
  SHA512:
6
- metadata.gz: 1de0f2175621e1ab35333e41ce768bb0b44bc92468b0c5266faee84658bff910fa1fdceb766dcfe649b16a4711ced4c34b40569e9602c847d6706ac72f6b05f0
7
- data.tar.gz: 5332d4b8173004adee2ba1e6061e793cf3c7ee39cee66b2cac2df390218260c63dddbd5204903e545b7622d7061e4dd799768e26dafc7630773389133a28cc0b
6
+ metadata.gz: ec2869750e398a401e478bc755f8d1a351f1264ffa5be853e5e79bf0441bc23f11bf4f0abd7dd5446ed222a16e7eda9148d049df013d0a0ffac7557d6c8e3ed6
7
+ data.tar.gz: a77b1ad0406d8693ab31397ba307b306f627120baf0dd9ee09ca7eccbd68987b72a9b53371c0aa965797275b00bab5ef1004c3ba0dee4e80ef62d67c0c4f7a9c
data/README.md CHANGED
@@ -12,5 +12,32 @@ Add this line to your application's Gemfile:
12
12
  gem "service_pattern"
13
13
  ```
14
14
 
15
+ Create an application service that your other services will enherit from in "app/services/application_service":
16
+ ```ruby
17
+ class ApplicationService < ServicePattern::Service
18
+ end
19
+ ```
20
+
21
+ Create your first service in "app/services/users/activator_service":
22
+ ```ruby
23
+ class Users::ActivatorService < ApplicationService
24
+ def execute!
25
+ User.all.find_each(&:activate!)
26
+ ServicePattern::Response.new(success: true)
27
+ end
28
+ end
29
+ ```
30
+
31
+ Then call it like this:
32
+ ```ruby
33
+ response = Users::ActivatorService.()
34
+
35
+ if response.success?
36
+ puts "Wee"
37
+ else
38
+ puts "Errors: #{result.errors.join(". ")}"
39
+ end
40
+ ```
41
+
15
42
  ## License
16
43
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -4,9 +4,6 @@ class ServicePattern::Service
4
4
 
5
5
  begin
6
6
  can_execute_response = service.can_execute?
7
-
8
- puts "can_execute_response: #{can_execute_response.success?} (#{can_execute_response.errors})"
9
-
10
7
  return can_execute_response unless can_execute_response.success?
11
8
  service.execute!
12
9
  rescue => e
@@ -1,3 +1,3 @@
1
1
  module ServicePattern
2
- VERSION = "0.0.2".freeze
2
+ VERSION = "0.0.3".freeze
3
3
  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: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-19 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ServicePattern for Ruby on Rails.
14
14
  email: