unidom-certificate-china 1.2.4 → 1.3

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: 158aeeb08f26333930b0a58644742ba87c6d0745
4
- data.tar.gz: aeaaa0dc3bac05ef5540b5ac2ae07883039e0e09
3
+ metadata.gz: 41d0bd8693c28537c3cd040291581e45aed30df4
4
+ data.tar.gz: da6f0dec683aa96d48ccba5efc62574737eecafd
5
5
  SHA512:
6
- metadata.gz: fefdda9ced7ba799b4d0ac27af86a9f16ca676d6c899f4bd60cf87b870a336ef4a59900c4100ceb9859b46301a2834bb080c72c7bc265257bde5badcbb8877da
7
- data.tar.gz: 78291a317efa2641c8db0f9573e419acfea585e3e61d6550734be0fdd68a6073459d771efccf487c9c22d4c18556e9f5f0653458b00133436bf12ab83831099d
6
+ metadata.gz: 2b6bbac06200b5536b9598b413d9a1c555ba5367d05f8a85b0bc895672a38aa30e30f3ae5e16c4181531cb4df10ab1294d91a4bc823e698fbe76a7e76b6f9a29
7
+ data.tar.gz: b5beebe420dffddd5a323aaeaf2088c1ff9cd9bb679eb6eb4d92e8c819603c07f6ee3bd3938be6ac63681b62f128d60e4270d32de906ec01e0dd400d84df045c
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Unidom Certificate China 中国证件领域模型引擎
2
2
 
3
+ [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/unidom-certificate-china/frames)
3
4
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
5
+
4
6
  [![Gem Version](https://badge.fury.io/rb/unidom-certificate-china.svg)](https://badge.fury.io/rb/unidom-certificate-china)
5
7
  [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-certificate-china.svg)](https://gemnasium.com/github.com/topbitdu/unidom-certificate-china)
6
8
 
@@ -47,6 +49,7 @@ identity_card = Unidom::Certificate::China::IdentityCard.identification_number_i
47
49
  identity_card.gender_code # '1' male, calculated from the identification_number
48
50
  identity_card.birth_date # '1980-12-31', calculated from the identification_number
49
51
 
52
+ # Find a business license per the 15-digit registration number
50
53
  Unidom::Certificate::China::BusinessLicense.registration_number_is('510105012345670').first_or_create(
51
54
  name: 'Google',
52
55
  address: '#1 Nanjing Street, Shanghai, China',
@@ -55,6 +58,16 @@ Unidom::Certificate::China::BusinessLicense.registration_number_is('510105012345
55
58
  validity_from_date: '2015-01-01',
56
59
  validity_thru_date: '2025-01-01'
57
60
  )
61
+
62
+ # Find a business license per the 18-digit unified social credit identifier
63
+ Unidom::Certificate::China::BusinessLicense.unified_social_credit_identifier_is('51010501234567890X').first_or_create(
64
+ name: 'Google',
65
+ address: '#1 Nanjing Street, Shanghai, China',
66
+ issuing_authority_name: 'Shanghai Industry & Commerce Administration',
67
+ legal_representative_name: 'Lawrence Edward Page',
68
+ validity_from_date: '2015-01-01',
69
+ validity_thru_date: '2025-01-01'
70
+ )
58
71
  ```
59
72
 
60
73
 
@@ -69,13 +82,13 @@ include Unidom::Certificate::China::Concerns::AsIdentityCardCertificated
69
82
  ### As Business License Certificated
70
83
 
71
84
  The As Business License Certificated do the following tasks for the includer automatically:
72
- 1. Include the [As Certificated](http://https://github.com/topbitdu/unidom-certificated) concern
85
+ 1. Include the [As Certificated](http://https://github.com/topbitdu/unidom-certificated) concern
73
86
  2. Define the has_many :china_business_licenses macro as: ``has_many :china_business_licenses, through: :certificatings, source: :certification, source_type: 'Unidom::Certificate::China::BusinessLicense'``
74
87
 
75
88
  ### As Identity Card Certificated
76
89
 
77
90
  The As Identity Card Certificated do the following tasks for the includer automatically:
78
- 1. Include the [As Certificated](http://https://github.com/topbitdu/unidom-certificated) concern
91
+ 1. Include the [As Certificated](http://https://github.com/topbitdu/unidom-certificated) concern
79
92
  2. Define the has_many :china_identity_cards macro as: ``has_many :china_identity_cards, through: :certificatings, source: :certification, source_type: 'Unidom::Certificate::China::IdentityCard'``
80
93
 
81
94
 
@@ -1,4 +1,3 @@
1
- ##
2
1
  # Business License 是中国的工商营业执照。
3
2
 
4
3
  class Unidom::Certificate::China::BusinessLicense < Unidom::Certificate::China::ApplicationRecord
@@ -10,7 +9,9 @@ class Unidom::Certificate::China::BusinessLicense < Unidom::Certificate::China::
10
9
  include Unidom::Common::Concerns::ModelExtension
11
10
  include Unidom::Certificate::Concerns::AsCertification
12
11
 
13
- validates :registration_number, presence: true, length: { is: columns_hash['registration_number'].limit }, numericality: { integer_only: true }, format: self::FORMAT_VALIDATION_REGEX
12
+ validates :registration_number, allow_blank: true, length: { is: columns_hash['registration_number'].limit }, numericality: { integer_only: true }, format: self::FORMAT_VALIDATION_REGEX
13
+ # GB 32100-2015《法人和其他组织统一社会信用代码编码规则》
14
+ validates :unified_social_credit_identifier, allow_blank: true, length: { is: columns_hash['unified_social_credit_identifier'].limit }
14
15
 
15
16
  validates :address, presence: true, length: { in: 2..columns_hash['address'].limit }
16
17
  validates :name, presence: true, length: { in: 2..columns_hash['name'].limit }
@@ -18,6 +19,7 @@ class Unidom::Certificate::China::BusinessLicense < Unidom::Certificate::China::
18
19
  validates :legal_representative_name, presence: true, length: { in: 2..columns_hash['legal_representative_name'].limit }
19
20
  validates :issuing_authority_name, allow_blank: true, length: { in: 2..columns_hash['issuing_authority_name'].limit }
20
21
 
21
- scope :registration_number_is, ->(registration_number) { where registration_number: registration_number }
22
+ scope :registration_number_is, ->(registration_number) { where registration_number: registration_number }
23
+ scope :unified_social_credit_identifier_is, ->(unified_social_credit_identifier) { where unified_social_credit_identifier: unified_social_credit_identifier }
22
24
 
23
25
  end
@@ -0,0 +1,9 @@
1
+ class AddUnifiedSocialCreditIdentifierToBusinessLicenses < ActiveRecord::Migration[5.0]
2
+
3
+ def change
4
+ change_column_null :unidom_china_business_licenses, :registration_number, true
5
+ add_column :unidom_china_business_licenses, :unified_social_credit_identifier, 'char(18)', null: true, default: nil
6
+ add_index :unidom_china_business_licenses, :unified_social_credit_identifier, name: 'index_unidom_china_business_licenses_on_usci', unique: true
7
+ end
8
+
9
+ end
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module Certificate
3
3
  module China
4
- VERSION = '1.2.4'.freeze
4
+ VERSION = '1.3'.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: 1.2.4
4
+ version: '1.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: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-certificate
@@ -59,6 +59,7 @@ files:
59
59
  - config/routes.rb
60
60
  - db/migrate/20010291560010_create_unidom_china_identity_cards.rb
61
61
  - db/migrate/20010291560110_create_unidom_china_business_licenses.rb
62
+ - db/migrate/20010291560111_add_unified_social_credit_identifier_to_business_licenses.rb
62
63
  - lib/tasks/data_tasks.rake
63
64
  - lib/unidom/certificate/china.rb
64
65
  - lib/unidom/certificate/china/engine.rb