command_service_object 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28de0190d89c14e5850b1de269a0e36fc0686e95ebf2d1051e7d2ab06a469dbb
|
|
4
|
+
data.tar.gz: 61a880a5ab49bd1247333158c93c8286f22e9985a1806137a73f7cc146a6f96e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c1c4763e2e342ab1344674910c6a32bafe78cdf0bd19dabc4df66facd67b736cb2c6bee6582527e06ef5a28ff96f6f0ba936d8c6236bcf4e46baf012e703eac
|
|
7
|
+
data.tar.gz: bb0b8c631d55ffd5cc18485bf2c5a9ff319fa8f54c21724ab4a2c3c47c3dbb0e6ecedff38b6f9dd6682d7c7cac8e99c8f32fed04edf4ed63fef09a7527298356
|
data/Gemfile.lock
CHANGED
|
@@ -2,13 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
class CaseBase
|
|
4
4
|
include CommandServiceObject::FailureHelper
|
|
5
|
-
include CommandServiceObject::Hooks
|
|
6
5
|
|
|
7
|
-
attr_reader :cmd
|
|
6
|
+
attr_reader :cmd, :issuer, :right_name
|
|
8
7
|
alias_attribute :payload, :cmd
|
|
9
8
|
|
|
10
9
|
def initialize(cmd)
|
|
11
10
|
@cmd = cmd
|
|
11
|
+
@issuer = cmd.try(:issuer)
|
|
12
|
+
@right_name = "#{service_name}.#{case_name}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def case_name
|
|
16
|
+
self.class.name.split('::').last.downcase
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def service_name
|
|
20
|
+
self.class.name.split('::').first.remove('Service').downcase
|
|
12
21
|
end
|
|
13
22
|
|
|
14
23
|
def allowed?
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
class CommandBase
|
|
4
|
-
include Virtus.model
|
|
5
4
|
include ActiveModel::Validations
|
|
5
|
+
include Virtus.model(nullify_blank: true)
|
|
6
6
|
|
|
7
7
|
# if you need to enable policies add issuer attribute
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
attribute :issuer, Object, default: :default_issuer
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def default_issuer
|
|
13
|
+
nil
|
|
14
|
+
end
|
|
10
15
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: command_service_object
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adham EL-Deeb
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2019-
|
|
12
|
+
date: 2019-11-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|