unidom-certificate 0.2 → 0.3
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 +4 -4
- data/README.md +9 -1
- data/app/models/unidom/certificate/certificating.rb +8 -2
- data/lib/unidom/certificate/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 921a866879b9dd27268ed691d958809433f07deb
|
4
|
+
data.tar.gz: 6be6334765933ac2f46135c99e1e997107db0cc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc9b59e910fe87114a443141e295f9b3845646665607d65773a21fa71b664347a3b2502e42333605fe99009a548454e4e6d6d16db3383fef0282051a045f4398
|
7
|
+
data.tar.gz: 28b38c4c2e50d8aae6b1676c09da834c3c0fda5fde28a65db9acf16aa73d4f5607c1253f78b8b05e3797211d5598fbdb007449ce9255bfbf0efa312b0663b3b6
|
data/README.md
CHANGED
@@ -6,6 +6,10 @@
|
|
6
6
|
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Certificate domain model engine includes Identity Card and Business License models.
|
7
7
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括身份证和营业执照的模型。
|
8
8
|
|
9
|
+
## Recent Update
|
10
|
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
11
|
+
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
12
|
+
|
9
13
|
## Usage in Gemfile
|
10
14
|
```ruby
|
11
15
|
gem 'unidom-certificate'
|
@@ -15,8 +19,12 @@ gem 'unidom-certificate'
|
|
15
19
|
```shell
|
16
20
|
rake db:migrate
|
17
21
|
```
|
22
|
+
The migration versions start with 200102.
|
18
23
|
|
19
24
|
## Call the Model
|
20
25
|
```ruby
|
21
|
-
|
26
|
+
officer = Person.create name: 'John'
|
27
|
+
mall = Shop.create name: 'WalMart'
|
28
|
+
certification = BusinessLicense.create number: '8888-6666'
|
29
|
+
certificating = Unidom::Certificate::Certificating.certificate(certification, mall, certificator: officer, opened_at: Time.now)
|
22
30
|
```
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# Certificating 是参与者和证书之间的认证关系。
|
2
2
|
|
3
|
-
class Unidom::Certificate::Certificating
|
3
|
+
class Unidom::Certificate::Certificating < ActiveRecord::Base
|
4
4
|
|
5
5
|
self.table_name = 'unidom_certificatings'
|
6
6
|
|
7
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
|
+
|
7
9
|
belongs_to :certificator, polymorphic: true
|
8
10
|
belongs_to :certificated, polymorphic: true
|
9
11
|
belongs_to :certification, polymorphic: true
|
@@ -12,6 +14,10 @@ class Unidom::Certificate::Certificating
|
|
12
14
|
scope :certificated_is, ->(certificated) { where certificated: certificated }
|
13
15
|
scope :certification_is, ->(certification) { where certification: certification }
|
14
16
|
|
15
|
-
|
17
|
+
def self.certificate(certification, certificated, certificator: nil, opened_at: Time.now)
|
18
|
+
self.certification_is(certification).certificated_is(certificated).valid_at.alive.first_or_create! opened_at: opened_at,
|
19
|
+
certificator_id: (certificator.present? ? certificator.id : Unidom::Common::NULL_UUID),
|
20
|
+
certificator_type: (certificator.present? ? certificator.class.name : '')
|
21
|
+
end
|
16
22
|
|
17
23
|
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: '0.
|
4
|
+
version: '0.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-
|
11
|
+
date: 2016-04-06 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: '0.
|
19
|
+
version: '0.7'
|
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: '0.
|
26
|
+
version: '0.7'
|
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 (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括身份证和营业执照的模型。
|