unidom-certificate 2.1.2 → 3.0
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 +5 -5
- data/README.md +4 -0
- data/app/models/unidom/certificate/concerns/as_certificated.rb +7 -6
- data/app/models/unidom/certificate/concerns/as_certification.rb +5 -6
- data/lib/rspec/models/unidom/certificate/concerns/as_certification_shared_examples.rb +17 -1
- data/lib/unidom/certificate/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: becb46752c607438b703b866ad757fe682ab162d9242fd5a2036c7333ef4aaae
|
4
|
+
data.tar.gz: fa9125b7354eac9fa147458dfa2691418ac9f3d657c95b74e70ce895a8b7163e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1abf041152133d662384251a60c4da088ecd2ce9425cc5fe2f9c8c40dc8d72b83ee4a6733dfd64ec4f0a9521f007db2aa2d25b561eed896d87b83b859057bb9c
|
7
|
+
data.tar.gz: '02585cd57a187933262556ff4ab391ff1a211f51d284bc65f3903d044e97e224761d332ca2e4df5b6dc28e201cb20d47b28a065f6d96388fa668b7ac3d84df01'
|
data/README.md
CHANGED
@@ -57,14 +57,18 @@ include Unidom::Certificate::Concerns::AsCertification
|
|
57
57
|
|
58
58
|
The As Certificated concern do the following tasks for the includer automatically:
|
59
59
|
1. Define the has_many :certificatings macro as: ``has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated``
|
60
|
+
|
60
61
|
2. Define the #is_certificated! method as: ``def is_certificated!(certification, by: nil, at: Time.now)``
|
62
|
+
|
61
63
|
3. Define the #is_certificated? method as: ``def is_certificated?(certification, at: Time.now)``
|
62
64
|
|
63
65
|
### As Certification concern
|
64
66
|
|
65
67
|
The As Certification concern do the following tasks for the includer automatically:
|
66
68
|
1. Define the has_many :certificatings macro as: ``has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification``
|
69
|
+
|
67
70
|
2. Define the #certificate! method as: ``def certificate!(certificated, by: nil, at: Time.now)``
|
71
|
+
|
68
72
|
3. Define the #certificate? method as: ``def certificate?(certificated, at: Time.now)``
|
69
73
|
|
70
74
|
|
@@ -3,7 +3,8 @@
|
|
3
3
|
|
4
4
|
module Unidom::Certificate::Concerns::AsCertificated
|
5
5
|
|
6
|
-
extend
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
include Unidom::Common::Concerns::ArgumentValidation
|
7
8
|
|
8
9
|
included do |includer|
|
9
10
|
|
@@ -14,9 +15,9 @@ module Unidom::Certificate::Concerns::AsCertificated
|
|
14
15
|
# 如: person.is_certificated! mcse, by: bill_gates, at: Time.now
|
15
16
|
def is_certificated!(certification, by: nil, at: Time.now)
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
assert_present! :certification, certification
|
19
|
+
assert_present! :by, by
|
20
|
+
assert_present! :at, at
|
20
21
|
|
21
22
|
certificatings.certification_is(certification).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
|
22
23
|
|
@@ -27,8 +28,8 @@ module Unidom::Certificate::Concerns::AsCertificated
|
|
27
28
|
# person.is_certificated? mcse, at: Time.now
|
28
29
|
def is_certificated?(certification, at: Time.now)
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
assert_present! :certification, certification
|
32
|
+
assert_present! :at, at
|
32
33
|
|
33
34
|
certificatings.certification_is(certification).valid_at(now: at).alive.exists?
|
34
35
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
module Unidom::Certificate::Concerns::AsCertification
|
5
5
|
|
6
|
-
extend
|
6
|
+
extend ActiveSupport::Concern
|
7
7
|
include Unidom::Common::Concerns::ArgumentValidation
|
8
8
|
|
9
9
|
included do |includer|
|
@@ -16,9 +16,8 @@ module Unidom::Certificate::Concerns::AsCertification
|
|
16
16
|
def certificate!(certificated, by: nil, at: Time.now)
|
17
17
|
|
18
18
|
assert_present! :certificated, certificated
|
19
|
-
|
20
|
-
|
21
|
-
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
19
|
+
assert_present! :by, by
|
20
|
+
assert_present! :at, at
|
22
21
|
|
23
22
|
certificatings.certificated_is(certificated).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
|
24
23
|
|
@@ -29,8 +28,8 @@ module Unidom::Certificate::Concerns::AsCertification
|
|
29
28
|
# mcse.certificated? person, at: Time.now
|
30
29
|
def certificate?(certificated, at: Time.now)
|
31
30
|
|
32
|
-
|
33
|
-
|
31
|
+
assert_present! :certificated, certificated
|
32
|
+
assert_present! :at, at
|
34
33
|
|
35
34
|
certificatings.certificated_is(certificated).valid_at(now: at).alive.exists?
|
36
35
|
|
@@ -1,4 +1,12 @@
|
|
1
|
-
shared_examples 'Unidom::Certificate::Concerns::AsCertification' do |model_attributes|
|
1
|
+
shared_examples 'Unidom::Certificate::Concerns::AsCertification' do |model_attributes, model, certificated, certificator|
|
2
|
+
|
3
|
+
#subject do described_class.create! model_attributes end
|
4
|
+
#it '#certificate!' do
|
5
|
+
it_behaves_like 'assert_present!', model, :certificate!, [ certificated, { by: certificator, at: Time.now } ], [ { 0 => :certificated }, :by, :at ]
|
6
|
+
#end
|
7
|
+
#it '#certificate?' do
|
8
|
+
it_behaves_like 'assert_present!', model, :certificate?, [ certificated, { at: Time.now } ], [ { 0 => :certificated }, :at ]
|
9
|
+
#end
|
2
10
|
|
3
11
|
context do
|
4
12
|
|
@@ -20,4 +28,12 @@ shared_examples 'Unidom::Certificate::Concerns::AsCertification' do |model_attri
|
|
20
28
|
|
21
29
|
end
|
22
30
|
|
31
|
+
context do
|
32
|
+
|
33
|
+
#model = described_class.create! model_attributes
|
34
|
+
#it_behaves_like 'assert_present!', model, :certificate!, [ certificated, { by: certificator, at: Time.now } ], [ { 0 => :certificated }, :by, :at ]
|
35
|
+
#it_behaves_like 'assert_present!', model, :certificate?, [ certificated, { at: Time.now } ], [ { 0 => :certificated }, :at ]
|
36
|
+
|
37
|
+
end
|
38
|
+
|
23
39
|
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:
|
4
|
+
version: '3.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Certificate domain model engine includes Identity Card and Business License
|
29
29
|
models. Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括身份证和营业执照的模型。
|
@@ -80,8 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
|
84
|
-
rubygems_version: 2.6.4
|
83
|
+
rubygems_version: 3.1.2
|
85
84
|
signing_key:
|
86
85
|
specification_version: 4
|
87
86
|
summary: Unidom Certificate Domain Model Engine 证书领域模型引擎
|