unidom-certificate-china 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/app/models/unidom/certificate/china/business_license.rb +21 -0
- data/app/models/unidom/certificate/china/identity_card.rb +3 -3
- data/db/migrate/20010291560010_create_unidom_china_identity_cards.rb +2 -2
- data/db/migrate/20010291560110_create_unidom_china_business_licenses.rb +32 -0
- data/lib/unidom/certificate/china/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1ebb22113165762129d156c66a2e31ef07f7469
|
4
|
+
data.tar.gz: 78b7cc598c1175cc515db257f8d9ef068b77b65f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9550a44fac943eb754151bb9f4c593810bb28c8737256e2e6b2cf3c912d892139786376a466211d64727cd588a1be0431961636d5fd8e6decf6500985051df69
|
7
|
+
data.tar.gz: e49296df9f8595d5fd06b8a9bca6573e98a66348de5b1be51f779c282232bbd4e10cf08434f7021e4534a4f5205ec9fab1cd0905a66ab41ff3d7ac835f5895b6
|
data/README.md
CHANGED
@@ -33,4 +33,13 @@ identity_card = Unidom::Certificate::China::IdentityCard.identification_number_i
|
|
33
33
|
)
|
34
34
|
identity_card.gender_code # '1' male, calculated from the identification_number
|
35
35
|
identity_card.birth_date # '1980-12-31', calculated from the identification_number
|
36
|
+
|
37
|
+
Unidom::Certificate::China::BusinessLicense.registration_number_is('510105012345670').first_or_create(
|
38
|
+
name: 'Google',
|
39
|
+
address: '#1 Nanjing Street, Shanghai, China',
|
40
|
+
issuing_authority_name: 'Shanghai Industry & Commerce Administration',
|
41
|
+
legal_representative_name: 'Lawrence Edward Page',
|
42
|
+
validity_from_date: '2015-01-01',
|
43
|
+
validity_thru_date: '2025-01-01'
|
44
|
+
)
|
36
45
|
```
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Business License 是中国的工商营业执照。
|
2
|
+
|
3
|
+
class Unidom::Certificate::China::BusinessLicense < ActiveRecord::Base
|
4
|
+
|
5
|
+
FORMAT_VALIDATION_REGEX = /\A\d{15}\z/
|
6
|
+
|
7
|
+
self.table_name = 'unidom_china_business_licenses'
|
8
|
+
|
9
|
+
include Unidom::Common::Concerns::ModelExtension
|
10
|
+
|
11
|
+
validates :registration_number, presence: true, length: { is: columns_hash['registration_number'].limit }, numericality: { integer_only: true }, format: self::FORMAT_VALIDATION_REGEX
|
12
|
+
|
13
|
+
validates :address, presence: true, length: { in: 2..columns_hash['address'].limit }
|
14
|
+
validates :name, presence: true, length: { in: 2..columns_hash['name'].limit }
|
15
|
+
|
16
|
+
validates :legal_representative_name, presence: true, length: { in: 2..columns_hash['legal_representative_name'].limit }
|
17
|
+
validates :issuing_authority_name, allow_blank: true, length: { in: 2..columns_hash['issuing_authority_name'].limit }
|
18
|
+
|
19
|
+
scope :registration_number_is, ->(registration_number) { where registration_number: registration_number }
|
20
|
+
|
21
|
+
end
|
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
class Unidom::Certificate::China::IdentityCard < ActiveRecord::Base
|
4
4
|
|
5
|
+
FORMAT_VALIDATION_REGEX = /\A\d{17}[\dx]\z/i
|
6
|
+
|
5
7
|
self.table_name = 'unidom_china_identity_cards'
|
6
8
|
|
7
|
-
|
9
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
10
|
|
9
11
|
validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
|
10
12
|
validates :address, presence: true, length: { in: 2..self.columns_hash['address'].limit }
|
@@ -15,8 +17,6 @@ class Unidom::Certificate::China::IdentityCard < ActiveRecord::Base
|
|
15
17
|
|
16
18
|
scope :identification_number_is, ->(identification_number) { where identification_number: identification_number }
|
17
19
|
|
18
|
-
include Unidom::Common::Concerns::ModelExtension
|
19
|
-
|
20
20
|
before_validation do
|
21
21
|
self.identification_number = self.identification_number.upcase
|
22
22
|
self.birth_date = Date.parse "#{identification_number[6..9]}-#{identification_number[10..11]}-#{identification_number[12..13]}"
|
@@ -16,8 +16,8 @@ class CreateUnidomChinaIdentityCards < ActiveRecord::Migration
|
|
16
16
|
# t.column :encryption_pepper, 'char(21)', null: false, default: nil
|
17
17
|
|
18
18
|
t.string :issuing_authority_name, null: false, default: '', limit: 200
|
19
|
-
t.date :validity_from_date, null: false, default: '
|
20
|
-
t.date :validity_thru_date, null: false, default: '
|
19
|
+
t.date :validity_from_date, null: false, default: '1970-01-01'
|
20
|
+
t.date :validity_thru_date, null: false, default: '3000-01-01'
|
21
21
|
|
22
22
|
# t.string :slug, null: false, default: nil, limit: 200
|
23
23
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CreateUnidomChinaBusinessLicenses < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_china_business_licenses, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.column :registration_number, 'char(15)', null: false, default: nil
|
8
|
+
|
9
|
+
t.string :name, null: false, default: '', limit: 16
|
10
|
+
t.string :address, null: false, default: '', limit: 200
|
11
|
+
|
12
|
+
t.string :legal_representative_name, null: false, default: '', limit: 200
|
13
|
+
t.string :issuing_authority_name, null: false, default: '', limit: 200
|
14
|
+
|
15
|
+
t.date :validity_from_date, null: false, default: '1970-01-01'
|
16
|
+
t.date :validity_thru_date, null: false, default: '3000-01-01'
|
17
|
+
|
18
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
19
|
+
t.datetime :opened_at, null: false, default: ::Time.utc(1970)
|
20
|
+
t.datetime :closed_at, null: false, default: ::Time.utc(3000)
|
21
|
+
t.boolean :defunct, null: false, default: false
|
22
|
+
t.jsonb :notation, null: false, default: {}
|
23
|
+
|
24
|
+
t.timestamps null: false
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
add_index :unidom_china_business_licenses, [ :registration_number, :validity_from_date ], unique: true, name: 'index_unidom_china_business_licenses_on_registration_number'
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-certificate-china
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.5'
|
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-04-
|
11
|
+
date: 2016-04-10 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.8'
|
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.8'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The China Certificate domain model engine includes Identity Card, Driving License,
|
29
29
|
and Business License models. Unidom (统一领域对象模型)是一系列的领域模型引擎。中国证件领域模型引擎包括中国大陆的身份证、驾驶证、营业执照等模型。
|
@@ -40,10 +40,12 @@ files:
|
|
40
40
|
- app/assets/stylesheets/unidom/certificate/china/application.css
|
41
41
|
- app/controllers/unidom/certificate/china/application_controller.rb
|
42
42
|
- app/helpers/unidom/certificate/china/application_helper.rb
|
43
|
+
- app/models/unidom/certificate/china/business_license.rb
|
43
44
|
- app/models/unidom/certificate/china/identity_card.rb
|
44
45
|
- app/views/layouts/unidom/certificate/china/application.html.erb
|
45
46
|
- config/routes.rb
|
46
47
|
- db/migrate/20010291560010_create_unidom_china_identity_cards.rb
|
48
|
+
- db/migrate/20010291560110_create_unidom_china_business_licenses.rb
|
47
49
|
- lib/tasks/data_tasks.rake
|
48
50
|
- lib/unidom/certificate/china.rb
|
49
51
|
- lib/unidom/certificate/china/engine.rb
|