unidom-certificate 1.2.1 → 1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0db1dcf0b863b018cc73707e774fb3a8db3730f8
|
4
|
+
data.tar.gz: fbdd282226e7ac28b6b192037acf5c62cd370705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5367ff037a52d7589e2d05f36e61d56ae968a7e0ab07b6c5c2309dd15b9fa7730e6a0a14106aaf843dc398781096ea8b905d695092dc1453046e25b768a8e96
|
7
|
+
data.tar.gz: 86f5888581c03a93c01d1bd8070bb3e0432003661edb52aa2f491320497764cc501098ce6dfb7b4923b9c0496aaba5aa887f5160d701a70cf97dfc13a68efede
|
data/README.md
CHANGED
@@ -39,8 +39,10 @@ include Unidom::Certificate::Concerns::AsCertification
|
|
39
39
|
The As Certificated concern do the following tasks for the includer automatically:
|
40
40
|
1. Define the has_many :certificatings macro as: ``has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated``
|
41
41
|
2. Define the #is_certificated! method as: ``def is_certificated!(certification, by: nil, at: Time.now)``
|
42
|
+
3. Define the #is_certificated? method as: ``def is_certificated?(certification, at: Time.now)``
|
42
43
|
|
43
44
|
### As Certification concern
|
44
45
|
The As Certification concern do the following tasks for the includer automatically:
|
45
46
|
1. Define the has_many :certificatings macro as: ``has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification``
|
46
47
|
2. Define the #certificate! method as: ``def certificate!(certificated, by: nil, at: Time.now)``
|
48
|
+
3. Define the #certificate? method as: ``def certificate?(certificated, at: Time.now)``
|
@@ -2,12 +2,27 @@ module Unidom::Certificate::Concerns::AsCertificated
|
|
2
2
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
|
5
|
+
included do |includer|
|
6
6
|
|
7
7
|
has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated
|
8
8
|
|
9
9
|
def is_certificated!(certification, by: nil, at: Time.now)
|
10
|
+
|
11
|
+
raise ArgumentError.new('The certification argument is required.') if certification.blank?
|
12
|
+
raise ArgumentError.new('The by argument is required.' ) if by.blank?
|
13
|
+
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
14
|
+
|
10
15
|
certificatings.create! certification: certification, certificator: by, opened_at: at
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def is_certificated?(certification, at: Time.now)
|
20
|
+
|
21
|
+
raise ArgumentError.new('The certification argument is required.') if certification.blank?
|
22
|
+
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
23
|
+
|
24
|
+
certificatings.certification_is(certification).valid_at(now: at).alive.exists?
|
25
|
+
|
11
26
|
end
|
12
27
|
|
13
28
|
end
|
@@ -2,14 +2,27 @@ module Unidom::Certificate::Concerns::AsCertification
|
|
2
2
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
|
5
|
+
included do |includer|
|
6
6
|
|
7
7
|
has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification
|
8
8
|
|
9
9
|
def certificate!(certificated, by: nil, at: Time.now)
|
10
|
+
|
11
|
+
raise ArgumentError.new('The certificated argument is required.') if certificated.blank?
|
12
|
+
raise ArgumentError.new('The by argument is required.' ) if by.blank?
|
13
|
+
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
14
|
+
|
10
15
|
certificatings.create! certificated: certificated, certificator: by, opened_at: at
|
11
16
|
end
|
12
17
|
|
18
|
+
def certificate?(certificated, at: Time.now)
|
19
|
+
|
20
|
+
raise ArgumentError.new('The certificated argument is required.') if certificated.blank?
|
21
|
+
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
22
|
+
|
23
|
+
certificatings.certificated_is(certificated).valid_at(now: at).alive.exists?
|
24
|
+
end
|
25
|
+
|
13
26
|
end
|
14
27
|
|
15
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-certificate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|