unidom-certificate-china 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 367cb07f19c0240c362f2850ca519e2f033112f9
4
- data.tar.gz: 4f5a4896ca07d4c9e213c35c068f2d5a26a31574
3
+ metadata.gz: 75ee24f248120ed7a73e6b785a753ee8f5a47482
4
+ data.tar.gz: 7b6ccfefe37727fe5c71960aaa2da248f5fbb3f5
5
5
  SHA512:
6
- metadata.gz: 1580a74418a880324a8af138257b47db22844a68bb8c3556f89ff4cd6c2ac9bcfda7fc7ca4c89bfe42e525ea13f46e0e9e4351d7e6384978f71094d4d31700b8
7
- data.tar.gz: 40d22ab278ab589e093a1e38faf06eb3d997eafde6d19a03c4638a757ddbbdff6706318bc7d10b3286d0ed8f17ac8dc2ae66bed8298af4578c1acc5606e1dbff
6
+ metadata.gz: e26dc412abdf230908a289f4292c66a09890b21de1bf07d3a25c196d3173e082bc4efcaa9b96b04f702b21b67479e178a54dde7d678f72cb444bccce1ae55c4e
7
+ data.tar.gz: ab746af3e50e5de0b2effba98bff4c07d5a55a4383d927bc6b3a87fe523b0657c28075ef9710dc9a91cf47810979274030f739f35e1db38faf1528404dd2f8bd
data/README.md CHANGED
@@ -6,6 +6,10 @@
6
6
  Unidom (UNIfied Domain Object Model) is a series of domain model engines. The China Certificate domain model engine includes Identity Card, Driving License, 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-china'
@@ -15,6 +19,7 @@ gem 'unidom-certificate-china'
15
19
  ```shell
16
20
  rake db:migrate
17
21
  ```
22
+ The migration versions start with 2001029156.
18
23
 
19
24
  ## Call the Model
20
25
  ```ruby
@@ -6,10 +6,10 @@ class Unidom::Certificate::China::IdentityCard < ActiveRecord::Base
6
6
 
7
7
  FORMAT_VALIDATION_REGEX = /\A\d{17}[\dx]\z/i
8
8
 
9
- validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
10
- validates :address, presence: true, length: { in: 2..self.columns_hash['address'].limit }
11
- validates :identification_number, presence: true, length: { is: self.columns_hash['identification_number'].limit }, format: FORMAT_VALIDATION_REGEX
12
- validates :issuing_authority_name, presence: true, length: { in: 2..self.columns_hash['issuing_authority_name'].limit }
9
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
10
+ validates :address, presence: true, length: { in: 2..self.columns_hash['address'].limit }
11
+ validates :identification_number, presence: true, length: { is: self.columns_hash['identification_number'].limit }, format: FORMAT_VALIDATION_REGEX
12
+ validates :issuing_authority_name, allow_blank: true, length: { in: 2..self.columns_hash['issuing_authority_name'].limit }
13
13
 
14
14
  has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification
15
15
 
@@ -18,8 +18,9 @@ class Unidom::Certificate::China::IdentityCard < ActiveRecord::Base
18
18
  include Unidom::Common::Concerns::ModelExtension
19
19
 
20
20
  before_validation do
21
- self.birth_date = Date.parse "#{identification_number[6..9]}-#{identification_number[10..11]}-#{identification_number[12..13]}"
22
- self.gender_code = identification_number[16].to_i.odd? ? '1' : '2'
21
+ self.identification_number = self.identification_number.upcase
22
+ self.birth_date = Date.parse "#{identification_number[6..9]}-#{identification_number[10..11]}-#{identification_number[12..13]}"
23
+ self.gender_code = identification_number[16].to_i.odd? ? '1' : '2'
23
24
  end
24
25
 
25
26
  end
@@ -31,7 +31,7 @@ class CreateUnidomChinaIdentityCards < ActiveRecord::Migration
31
31
 
32
32
  end
33
33
 
34
- add_index :unidom_china_identity_cards, :identification_number, unique: true
34
+ add_index :unidom_china_identity_cards, [ :identification_number, :validity_from_date ], unique: true, name: 'index_unidom_china_identity_cards_on_identification_number'
35
35
  # add_index :unidom_china_identity_cards, :encrypted_identification_number
36
36
  # add_index :unidom_china_identity_cards, :slug, unique: true
37
37
 
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Certificate
3
3
  module China
4
- VERSION = '0.3'.freeze
4
+ VERSION = '0.4'.freeze
5
5
  end
6
6
  end
7
7
  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.3'
4
+ version: '0.4'
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-03-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.5'
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.5'
26
+ version: '0.7'
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 (统一领域对象模型)是一系列的领域模型引擎。中国证件领域模型引擎包括中国大陆的身份证、驾驶证、营业执照等模型。