unidom-certificate 3.0 → 3.0.1

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: becb46752c607438b703b866ad757fe682ab162d9242fd5a2036c7333ef4aaae
4
- data.tar.gz: fa9125b7354eac9fa147458dfa2691418ac9f3d657c95b74e70ce895a8b7163e
3
+ metadata.gz: 2ace38c6993c47828a11094f9db7c0b2e1ff0f2a6fec99957557fb9a8bf1652a
4
+ data.tar.gz: 3c7cc35a01cc4ae967f516f459f1c86f355bcafb56a34fb47ecede72148f7cdf
5
5
  SHA512:
6
- metadata.gz: 1abf041152133d662384251a60c4da088ecd2ce9425cc5fe2f9c8c40dc8d72b83ee4a6733dfd64ec4f0a9521f007db2aa2d25b561eed896d87b83b859057bb9c
7
- data.tar.gz: '02585cd57a187933262556ff4ab391ff1a211f51d284bc65f3903d044e97e224761d332ca2e4df5b6dc28e201cb20d47b28a065f6d96388fa668b7ac3d84df01'
6
+ metadata.gz: d64e1c619a1b2cea5183a7917d23f4634f7c598fa5b32b80fd736a29fa1ca258fae4a46b89bb0aa461ac0c81644ab47451c2df4248f8f90514d73ead59d14511
7
+ data.tar.gz: 71df4b7f664652f53819f0e5b6f818a0c804ca177617644a7ed23d1c9429b46c646e4e921fedef6aa53c73dfc0bf07096ff252ef5939698eb1699c058f71ba77
data/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
  [![Gem Version](https://badge.fury.io/rb/unidom-certificate.svg)](https://badge.fury.io/rb/unidom-certificate)
7
7
  [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-certificate.svg)](https://gemnasium.com/github.com/topbitdu/unidom-certificate)
8
8
 
9
- Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Certificate domain model engine includes Identity Card and Business License models.
10
- Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括身份证和营业执照的模型。
9
+ Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Certificate domain model engine includes the Certificating model.
10
+ Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括认证的模型。
11
11
 
12
12
 
13
13
 
@@ -1,6 +1,12 @@
1
1
  ##
2
2
  # Application controller 是模块内所有控制器的基类。
3
3
 
4
- class Unidom::Certificate::ApplicationController < ActionController::Base
5
- protect_from_forgery with: :exception
4
+ module Unidom
5
+ module Certificate
6
+
7
+ class ApplicationController < ActionController::Base
8
+ protect_from_forgery with: :exception
9
+ end
10
+
11
+ end
6
12
  end
@@ -1,2 +1,8 @@
1
- module Unidom::Certificate::ApplicationHelper
1
+ module Unidom
2
+ module Certificate
3
+
4
+ module ApplicationHelper
5
+ end
6
+
7
+ end
2
8
  end
@@ -1,5 +1,11 @@
1
1
  ##
2
2
  # Application job 是模块内所有异步任务的基类。
3
3
 
4
- class Unidom::Certificate::ApplicationJob < ActiveJob::Base
4
+ module Unidom
5
+ module Certificate
6
+
7
+ class ApplicationJob < ActiveJob::Base
8
+ end
9
+
10
+ end
5
11
  end
@@ -1,7 +1,13 @@
1
1
  ##
2
2
  # Application mailer 是模块内所有电子邮件发送类的基类。
3
3
 
4
- class Unidom::Certificate::ApplicationMailer < ActionMailer::Base
5
- default from: 'from@example.com'
6
- layout 'mailer'
4
+ module Unidom
5
+ module Certificate
6
+
7
+ class ApplicationMailer < ActionMailer::Base
8
+ default from: 'from@example.com'
9
+ layout 'mailer'
10
+ end
11
+
12
+ end
7
13
  end
@@ -1,6 +1,12 @@
1
1
  ##
2
2
  # Application record 是模块内所有模型的抽象基类。
3
3
 
4
- class Unidom::Certificate::ApplicationRecord < ActiveRecord::Base
5
- self.abstract_class = true
4
+ module Unidom
5
+ module Certificate
6
+
7
+ class ApplicationRecord < ActiveRecord::Base
8
+ self.abstract_class = true
9
+ end
10
+
11
+ end
6
12
  end
@@ -1,35 +1,41 @@
1
1
  ##
2
2
  # Certificating 是参与者和证书之间的认证关系。
3
3
 
4
- class Unidom::Certificate::Certificating < Unidom::Certificate::ApplicationRecord
5
-
6
- self.table_name = 'unidom_certificatings'
7
-
8
- include Unidom::Common::Concerns::ModelExtension
9
-
10
- belongs_to :certificator, polymorphic: true
11
- belongs_to :certificated, polymorphic: true
12
- belongs_to :certification, polymorphic: true
13
-
14
- scope :certificated_by, ->(certificator) { where certificator: certificator }
15
- scope :certificated_is, ->(certificated) { where certificated: certificated }
16
- scope :certification_is, ->(certification) { where certification: certification }
17
-
18
- ##
19
- # 由认证者 certificator 用证书 certification 去认证的人或者机构 certificated ,认证时间是: opened_at。
20
- def self.certificate!(certification: nil, certificated: nil, certificator: nil, opened_at: Time.now)
21
- assert_present! :certification, certification
22
- assert_present! :certificated, certificated
23
- assert_present! :opened_at, opened_at
24
-
25
- attributes = { opened_at: opened_at }
26
- if certificator.present?
27
- attributes[:certificator] = certificator
28
- else
29
- attributes[:certificator_id] = Unidom::Common::NULL_UUID
30
- attributes[:certificator_type] = ''
31
- end
32
- self.certification_is(certification).certificated_is(certificated).valid_at(now: opened_at).alive.first_or_create! attributes
33
- end
4
+ module Unidom
5
+ module Certificate
6
+
7
+ class Certificating < ApplicationRecord
8
+
9
+ self.table_name = 'unidom_certificatings'
10
+
11
+ include Unidom::Common::Concerns::ModelExtension
12
+
13
+ belongs_to :certificator, polymorphic: true
14
+ belongs_to :certificated, polymorphic: true
15
+ belongs_to :certification, polymorphic: true
34
16
 
35
- end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Certificate::Certificating'
17
+ scope :certificated_by, ->(certificator) { where certificator: certificator }
18
+ scope :certificated_is, ->(certificated) { where certificated: certificated }
19
+ scope :certification_is, ->(certification) { where certification: certification }
20
+
21
+ ##
22
+ # 由认证者 certificator 用证书 certification 去认证的人或者机构 certificated ,认证时间是: opened_at。
23
+ def self.certificate!(certification: nil, certificated: nil, certificator: nil, opened_at: Time.now)
24
+ assert_present! :certification, certification
25
+ assert_present! :certificated, certificated
26
+ assert_present! :opened_at, opened_at
27
+
28
+ attributes = { opened_at: opened_at }
29
+ if certificator.present?
30
+ attributes[:certificator] = certificator
31
+ else
32
+ attributes[:certificator_id] = Unidom::Common::NULL_UUID
33
+ attributes[:certificator_type] = ''
34
+ end
35
+ self.certification_is(certification).certificated_is(certificated).valid_at(now: opened_at).alive.first_or_create! attributes
36
+ end
37
+
38
+ end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Certificate::Certificating'
39
+
40
+ end
41
+ end
@@ -1,43 +1,51 @@
1
1
  ##
2
2
  # As Certificated 是被认证参与者的领域关注点。
3
3
 
4
- module Unidom::Certificate::Concerns::AsCertificated
4
+ module Unidom
5
+ module Certificate
6
+ module Concerns
5
7
 
6
- extend ActiveSupport::Concern
7
- include Unidom::Common::Concerns::ArgumentValidation
8
+ module AsCertificated
8
9
 
9
- included do |includer|
10
+ extend ActiveSupport::Concern
11
+ include Unidom::Common::Concerns::ArgumentValidation
10
12
 
11
- has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated
13
+ included do |includer|
12
14
 
13
- ##
14
- # 被认证者被证书 certification 认证,认证者为 by ,认证时间是 at (缺省为当前时间)。
15
- # 如: person.is_certificated! mcse, by: bill_gates, at: Time.now
16
- def is_certificated!(certification, by: nil, at: Time.now)
15
+ has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated
17
16
 
18
- assert_present! :certification, certification
19
- assert_present! :by, by
20
- assert_present! :at, at
17
+ ##
18
+ # 被认证者被证书 certification 认证,认证者为 by ,认证时间是 at (缺省为当前时间)。
19
+ # 如: person.is_certificated! mcse, by: bill_gates, at: Time.now
20
+ def is_certificated!(certification, by: nil, at: Time.now)
21
21
 
22
- certificatings.certification_is(certification).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
22
+ assert_present! :certification, certification
23
+ assert_present! :by, by
24
+ assert_present! :at, at
23
25
 
24
- end
26
+ certificatings.certification_is(certification).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
25
27
 
26
- ##
27
- # 判断当前被认证者在指定的时间 at (缺省为当前时间)是否有指定的证书 certification 。如:
28
- # person.is_certificated? mcse, at: Time.now
29
- def is_certificated?(certification, at: Time.now)
28
+ end
30
29
 
31
- assert_present! :certification, certification
32
- assert_present! :at, at
30
+ ##
31
+ # 判断当前被认证者在指定的时间 at (缺省为当前时间)是否有指定的证书 certification 。如:
32
+ # person.is_certificated? mcse, at: Time.now
33
+ def is_certificated?(certification, at: Time.now)
33
34
 
34
- certificatings.certification_is(certification).valid_at(now: at).alive.exists?
35
+ assert_present! :certification, certification
36
+ assert_present! :at, at
35
37
 
36
- end
38
+ certificatings.certification_is(certification).valid_at(now: at).alive.exists?
37
39
 
38
- end
40
+ end
39
41
 
40
- module ClassMethods
41
- end
42
+ end
42
43
 
44
+ module ClassMethods
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
43
51
  end
@@ -1,43 +1,51 @@
1
1
  ##
2
2
  # As Certification 是证书的领域关注点。
3
3
 
4
- module Unidom::Certificate::Concerns::AsCertification
4
+ module Unidom
5
+ module Certificate
6
+ module Concerns
5
7
 
6
- extend ActiveSupport::Concern
7
- include Unidom::Common::Concerns::ArgumentValidation
8
+ module AsCertification
8
9
 
9
- included do |includer|
10
+ extend ActiveSupport::Concern
11
+ include Unidom::Common::Concerns::ArgumentValidation
10
12
 
11
- has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification
13
+ included do |includer|
12
14
 
13
- ##
14
- # 用证书去认证参与者(被认证者)。 by 是认证者, at 是认证时间(缺省为当前时间)。
15
- # 如:mcse.certificate! person, by: bill_gates, at: Time.now
16
- def certificate!(certificated, by: nil, at: Time.now)
15
+ has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification
17
16
 
18
- assert_present! :certificated, certificated
19
- assert_present! :by, by
20
- assert_present! :at, at
17
+ ##
18
+ # 用证书去认证参与者(被认证者)。 by 是认证者, at 是认证时间(缺省为当前时间)。
19
+ # 如:mcse.certificate! person, by: bill_gates, at: Time.now
20
+ def certificate!(certificated, by: nil, at: Time.now)
21
21
 
22
- certificatings.certificated_is(certificated).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
22
+ assert_present! :certificated, certificated
23
+ assert_present! :by, by
24
+ assert_present! :at, at
23
25
 
24
- end
26
+ certificatings.certificated_is(certificated).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
25
27
 
26
- ##
27
- # 判断当前认证书在指定的时间 at (缺省为当前时间)是否对被认证者 certificated 生效。如:
28
- # mcse.certificated? person, at: Time.now
29
- def certificate?(certificated, at: Time.now)
28
+ end
30
29
 
31
- assert_present! :certificated, certificated
32
- assert_present! :at, at
30
+ ##
31
+ # 判断当前认证书在指定的时间 at (缺省为当前时间)是否对被认证者 certificated 生效。如:
32
+ # mcse.certificated? person, at: Time.now
33
+ def certificate?(certificated, at: Time.now)
33
34
 
34
- certificatings.certificated_is(certificated).valid_at(now: at).alive.exists?
35
+ assert_present! :certificated, certificated
36
+ assert_present! :at, at
35
37
 
36
- end
38
+ certificatings.certificated_is(certificated).valid_at(now: at).alive.exists?
37
39
 
38
- end
40
+ end
39
41
 
40
- module ClassMethods
41
- end
42
+ end
42
43
 
44
+ module ClassMethods
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
43
51
  end
@@ -1,4 +1,4 @@
1
- class CreateUnidomCertificatings < ActiveRecord::Migration
1
+ class CreateUnidomCertificatings < ActiveRecord::Migration[6.0]
2
2
 
3
3
  def change
4
4
 
@@ -11,9 +11,9 @@ class CreateUnidomCertificatings < ActiveRecord::Migration
11
11
  t.references :certification, type: :uuid, null: false,
12
12
  polymorphic: { null: false, default: '', limit: 200 }
13
13
 
14
- t.column :state, 'char(1)', null: false, default: 'C'
15
- t.datetime :opened_at, null: false, default: ::Time.utc(1970)
16
- t.datetime :closed_at, null: false, default: ::Time.utc(3000)
14
+ t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
15
+ t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
16
+ t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
17
17
  t.boolean :defunct, null: false, default: false
18
18
  t.jsonb :notation, null: false, default: {}
19
19
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Certificate
3
- VERSION = '3.0'.freeze
3
+ VERSION = '3.0.1'.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: '3.0'
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-20 00:00:00.000000000 Z
11
+ date: 2021-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -25,8 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
- The Certificate domain model engine includes Identity Card and Business License
29
- models. Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括身份证和营业执照的模型。
28
+ The Certificate domain model engine includes Certificating model. Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括认证的模型。
30
29
  email:
31
30
  - topbit.du@gmail.com
32
31
  executables: []
@@ -61,11 +60,11 @@ files:
61
60
  - lib/unidom/certificate/types_rspec.rb
62
61
  - lib/unidom/certificate/validators_rspec.rb
63
62
  - lib/unidom/certificate/version.rb
64
- homepage: https://github.com/topbitdu/unidom-certificate
63
+ homepage: https://gitee.com/Unidom/unidom-certificate
65
64
  licenses:
66
65
  - MIT
67
66
  metadata: {}
68
- post_install_message:
67
+ post_install_message:
69
68
  rdoc_options: []
70
69
  require_paths:
71
70
  - lib
@@ -80,8 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
79
  - !ruby/object:Gem::Version
81
80
  version: '0'
82
81
  requirements: []
83
- rubygems_version: 3.1.2
84
- signing_key:
82
+ rubygems_version: 3.2.3
83
+ signing_key:
85
84
  specification_version: 4
86
85
  summary: Unidom Certificate Domain Model Engine 证书领域模型引擎
87
86
  test_files: []