service_record 1.2.1 → 1.2.2

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
  SHA256:
3
- metadata.gz: 8b23ad5166c690ec30fa91fa0c637a0d3bfd64d38701faea13f97227ac252685
4
- data.tar.gz: dd33a9b4cd704ba9eb3359b70b86c230b794933cc60a3e8721136281c0d4eba6
3
+ metadata.gz: a7480968cffcfeaa22303ad0e8e0eefbe9eb5c748a562eb24651e1a0563fdaec
4
+ data.tar.gz: cd4d145d8bf049e67586a5bc64d1b9c70939815a42996407ffd26744de2e2328
5
5
  SHA512:
6
- metadata.gz: 204fb25c50a741f3b888dd3064d0a3f9682da4e81ff6fb0ac72c96afb292ea41b012a7438ee9afc04552a5c9c921fbd908fe2e831f1cde033f6b668635a82df9
7
- data.tar.gz: b4b301a4a6daf42d10c4febc30abb28e163dc1ea58a194a163786c2083884241d92d94f4b88e0af8dd2131d89218a4ecff959b0532587b5d35015e81b208c747
6
+ metadata.gz: e1cf4a2872060a83ac89f578721a9169db038bc4502f31a0382162ac3ea5402aa76effc3cd7f5e66c05b66a160f3148dd094fd3f9ea476d0d0902eea81a01b6e
7
+ data.tar.gz: 6ea144985aa85012173f7275782e118473f22c5cc2a9a5c85c7ef8d49409f4c68b7a97de4e8fd479a9ae90e58a7e635eb594f191bafec97e29d76e7b7b2cd565
@@ -1,3 +1,4 @@
1
+ require 'service_record/failure'
1
2
  require 'service_record/callbacks'
2
3
 
3
4
  module ServiceRecord
@@ -19,6 +20,12 @@ module ServiceRecord
19
20
  end
20
21
  end
21
22
 
23
+ def self.perform!(args = {})
24
+ service = perform(args)
25
+
26
+ raise Failure, service if service.failure?
27
+ end
28
+
22
29
  attr_accessor :result
23
30
 
24
31
  def success?
@@ -0,0 +1,11 @@
1
+ module ServiceRecord
2
+ class Failure < StandardError
3
+ attr_reader :service
4
+
5
+ def initialize(service)
6
+ @service = service
7
+
8
+ super(@service.errors.full_messages.join(','))
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module ServiceRecord
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.2.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muhammad Usman
@@ -41,6 +41,7 @@ files:
41
41
  - lib/service_record.rb
42
42
  - lib/service_record/base.rb
43
43
  - lib/service_record/callbacks.rb
44
+ - lib/service_record/failure.rb
44
45
  - lib/service_record/version.rb
45
46
  homepage: https://github.com/uxxman/service_record
46
47
  licenses: