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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b3f2dcda98b1225872f249e99e8c4b21a5b2669
4
- data.tar.gz: 94395c61123f10afe28b3e11b32ce65ab8ad651d
3
+ metadata.gz: 921a866879b9dd27268ed691d958809433f07deb
4
+ data.tar.gz: 6be6334765933ac2f46135c99e1e997107db0cc9
5
5
  SHA512:
6
- metadata.gz: a7f52cdb4dd2a13945229135aa29a9af8b6f8d65aef365ff39d1623917fe18292a524dd5295b0824358c0223ca03886a3329d892a324a25aed09010d76220db9
7
- data.tar.gz: 083f5b247e2df2017208ba0d103608277cb452e80fb5a38c15310c5c8d580f1f9a0219843f7217a4eacab5d0b835c152f82fad269f83a85bb01395a77a5a8026
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
- Unidom::Certificate::Certificating.valid_at.alive.first
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
- include Unidom::Common::Concerns::ModelExtension
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
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Certificate
3
- VERSION = '0.2'.freeze
3
+ VERSION = '0.3'.freeze
4
4
  end
5
5
  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.2'
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-02-25 00:00:00.000000000 Z
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.2'
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.2'
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 (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括身份证和营业执照的模型。