unidom-article_number 2.3.5 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +30 -0
- data/app/controllers/unidom/article_number/application_controller.rb +8 -2
- data/app/helpers/unidom/article_number/application_helper.rb +8 -1
- data/app/jobs/unidom/article_number/application_job.rb +7 -1
- data/app/mailers/unidom/article_number/application_mailer.rb +9 -3
- data/app/models/unidom/article_number/application_record.rb +8 -2
- data/app/models/unidom/article_number/concerns/as_barcode.rb +27 -19
- data/app/models/unidom/article_number/concerns/as_ean13_marked.rb +16 -8
- data/app/models/unidom/article_number/concerns/as_ean8_marked.rb +16 -8
- data/app/models/unidom/article_number/concerns/as_marked.rb +26 -18
- data/app/models/unidom/article_number/concerns/code128_barcode.rb +23 -15
- data/app/models/unidom/article_number/ean13_barcode.rb +35 -29
- data/app/models/unidom/article_number/ean8_barcode.rb +28 -22
- data/app/models/unidom/article_number/marking.rb +30 -24
- data/app/models/unidom/article_number/vehicle_identification_number.rb +30 -24
- data/app/validators/unidom/article_number/vehicle_identification_number_validator.rb +28 -22
- data/app/views/layouts/unidom/article_number/application.html.erb +1 -1
- data/db/migrate/20020101000000_create_unidom_markings.rb +4 -4
- data/db/migrate/20020102000000_create_unidom_ean_13_barcodes.rb +4 -4
- data/db/migrate/20020103000000_create_unidom_ean_8_barcodes.rb +4 -4
- data/db/migrate/20020111000000_create_unidom_vehicle_identification_numbers.rb +4 -4
- data/lib/rspec/models/unidom/article_number/concerns/as_barcode_shared_examples.rb +19 -0
- data/lib/rspec/models/unidom/article_number/concerns/as_marked_shared_examples.rb +25 -0
- data/lib/rspec/models/unidom/article_number/ean13_barcode_spec.rb +3 -3
- data/lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb +3 -3
- data/lib/rspec/models/unidom/article_number/marking_spec.rb +1 -14
- data/lib/rspec/models/unidom/article_number/vehicle_identification_number_spec.rb +18 -1
- data/lib/unidom/article_number/engine.rb +1 -1
- data/lib/unidom/article_number/rspec_shared_examples.rb +2 -0
- data/lib/unidom/article_number/version.rb +1 -1
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 20387d317914c567cade086d61a214bdc1544df3db3188765a6d1d876fbbf0d4
|
4
|
+
data.tar.gz: f3122b1aff3157ba6e49b2c60a1dbd832debe28c985482cb64ff0aee74e5f1da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41c78fa15b41db235ca0cd303c64127aa548339287eabe3d8a0f76ceecb277160457fec56f3a50233c825837258c0f909d21b2650cd36465522a9753cdc11096
|
7
|
+
data.tar.gz: 53956165e31e623a47cc60dfd1bba815050f0498d63a585d254c81886d03ecb39429132a5a35250c7322c96a82d05687a334b50df3ed49a40aac91e88f943186
|
data/README.md
CHANGED
@@ -120,6 +120,8 @@ end
|
|
120
120
|
|
121
121
|
## RSpec examples
|
122
122
|
|
123
|
+
### RSpec example manifest (run automatically)
|
124
|
+
|
123
125
|
```ruby
|
124
126
|
# spec/models/unidom_spec.rb
|
125
127
|
require 'unidom/article_number/models_rspec'
|
@@ -130,3 +132,31 @@ require 'unidom/article_number/types_rspec'
|
|
130
132
|
# spec/validators/unidom_spec.rb
|
131
133
|
require 'unidom/article_number/validators_rspec'
|
132
134
|
```
|
135
|
+
|
136
|
+
### RSpec shared examples (to be integrated)
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
# The Unidom::ArticleNumber::Ean13Barcode model, the Unidom::ArticleNumber::Ean8Barcode model, & the Unidom::ArticleNumber::VehicleIdentificationNumber model already include the Unidom::ArticleNumber::Concerns::AsBarcode concern
|
140
|
+
|
141
|
+
# app/models/your_barcode.rb
|
142
|
+
class YourBarcode < ActiveRecord::Base
|
143
|
+
|
144
|
+
include Unidom::Common::Concerns::ModelExtension
|
145
|
+
include Unidom::ArticleNumber::Concerns::AsBarcode
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
150
|
+
require 'unidom/article_number/rspec_shared_examples'
|
151
|
+
|
152
|
+
# spec/models/your_barcode_spec.rb
|
153
|
+
describe YourBarcode do
|
154
|
+
|
155
|
+
model_attribtues = {
|
156
|
+
code: 'AABBCCDDEEFF'
|
157
|
+
}
|
158
|
+
|
159
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attribtues
|
160
|
+
|
161
|
+
end
|
162
|
+
```
|
@@ -1,6 +1,12 @@
|
|
1
1
|
##
|
2
2
|
# Application controller 是模块内所有控制器的基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
6
|
+
|
7
|
+
class ApplicationController < ActionController::Base
|
8
|
+
protect_from_forgery with: :exception
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
6
12
|
end
|
@@ -1,7 +1,13 @@
|
|
1
1
|
##
|
2
2
|
# Application mailer 是模块内所有电子邮件发送类的基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
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
|
-
|
5
|
-
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
6
|
+
|
7
|
+
class ApplicationRecord < ActiveRecord::Base
|
8
|
+
self.abstract_class = true
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
6
12
|
end
|
@@ -1,31 +1,39 @@
|
|
1
1
|
##
|
2
2
|
# As Barcode 是条形码的领域逻辑关注点。
|
3
3
|
|
4
|
-
module Unidom
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
6
|
+
module Concerns
|
5
7
|
|
6
|
-
|
8
|
+
module AsBarcode
|
7
9
|
|
8
|
-
|
10
|
+
extend ActiveSupport::Concern
|
9
11
|
|
10
|
-
|
11
|
-
has_many :marked_products, through: :markings, source: :marked, source_type: 'Unidom::Product::Product'
|
12
|
+
included do |includer|
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
raise ArgumentError.new('The by argument is required.' ) if by.blank?
|
16
|
-
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
17
|
-
markings.create! marked: marked, marker: by, opened_at: at
|
18
|
-
end
|
14
|
+
has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode
|
15
|
+
has_many :marked_products, through: :markings, source: :marked, source_type: 'Unidom::Product::Product'
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
def mark!(marked, by: nil, at: Time.now)
|
18
|
+
raise ArgumentError.new('The marked argument is required.') if marked.blank?
|
19
|
+
raise ArgumentError.new('The by argument is required.' ) if by.blank?
|
20
|
+
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
21
|
+
markings.create! marked: marked, marker: by, opened_at: at
|
22
|
+
end
|
25
23
|
|
26
|
-
|
24
|
+
def mark?(marked, at: Time.now)
|
25
|
+
raise ArgumentError.new('The marked argument is required.') if marked.blank?
|
26
|
+
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
27
|
+
markings.marked_is(marked).valid_at(now: at).alive.exists?
|
28
|
+
end
|
27
29
|
|
28
|
-
|
29
|
-
end
|
30
|
+
end
|
30
31
|
|
32
|
+
module ClassMethods
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
31
39
|
end
|
@@ -1,19 +1,27 @@
|
|
1
1
|
##
|
2
2
|
# As EAN-13 Marked 是被 EAN-13 条形码标注的物品的领域逻辑关注点。
|
3
3
|
|
4
|
-
module Unidom
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
6
|
+
module Concerns
|
5
7
|
|
6
|
-
|
8
|
+
module AsEan13Marked
|
7
9
|
|
8
|
-
|
10
|
+
extend ActiveSupport::Concern
|
9
11
|
|
10
|
-
|
12
|
+
include Unidom::ArticleNumber::Concerns::AsMarked
|
11
13
|
|
12
|
-
|
14
|
+
included do |includer|
|
13
15
|
|
14
|
-
|
16
|
+
has_many :ean13_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean13Barcode'
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
+
end
|
19
|
+
|
20
|
+
module ClassMethods
|
21
|
+
end
|
18
22
|
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
19
27
|
end
|
@@ -1,19 +1,27 @@
|
|
1
1
|
##
|
2
2
|
# As EAN-8 Marked 是被 EAN-8 条形码标注的物品的领域逻辑关注点。
|
3
3
|
|
4
|
-
module Unidom
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
6
|
+
module Concerns
|
5
7
|
|
6
|
-
|
8
|
+
module AsEan8Marked
|
7
9
|
|
8
|
-
|
10
|
+
extend ActiveSupport::Concern
|
9
11
|
|
10
|
-
|
12
|
+
include Unidom::ArticleNumber::Concerns::AsMarked
|
11
13
|
|
12
|
-
|
14
|
+
included do |includer|
|
13
15
|
|
14
|
-
|
16
|
+
has_many :ean8_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean8Barcode'
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
+
end
|
19
|
+
|
20
|
+
module ClassMethods
|
21
|
+
end
|
18
22
|
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
19
27
|
end
|
@@ -1,30 +1,38 @@
|
|
1
1
|
##
|
2
2
|
# As Marked 是被条形码标注的物品的领域逻辑关注点。
|
3
3
|
|
4
|
-
module Unidom
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
6
|
+
module Concerns
|
5
7
|
|
6
|
-
|
8
|
+
module AsMarked
|
7
9
|
|
8
|
-
|
10
|
+
extend ActiveSupport::Concern
|
9
11
|
|
10
|
-
|
12
|
+
included do |includer|
|
11
13
|
|
12
|
-
|
13
|
-
raise ArgumentError.new('The as argument is required.') if as.blank?
|
14
|
-
raise ArgumentError.new('The by argument is required.') if by.blank?
|
15
|
-
raise ArgumentError.new('The at argument is required.') if at.blank?
|
16
|
-
markings.create! barcode: as, marker: by, opened_at: at
|
17
|
-
end
|
14
|
+
has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked
|
18
15
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
16
|
+
def is_marked!(as: nil, by: nil, at: Time.now)
|
17
|
+
raise ArgumentError.new('The as argument is required.') if as.blank?
|
18
|
+
raise ArgumentError.new('The by argument is required.') if by.blank?
|
19
|
+
raise ArgumentError.new('The at argument is required.') if at.blank?
|
20
|
+
markings.create! barcode: as, marker: by, opened_at: at
|
21
|
+
end
|
24
22
|
|
25
|
-
|
23
|
+
def is_marked?(as: nil, at: Time.now)
|
24
|
+
raise ArgumentError.new('The as argument is required.') if as.blank?
|
25
|
+
raise ArgumentError.new('The at argument is required.') if at.blank?
|
26
|
+
markings.barcode_is(as).valid_at(now: at).alive.exists?
|
27
|
+
end
|
26
28
|
|
27
|
-
|
28
|
-
end
|
29
|
+
end
|
29
30
|
|
31
|
+
module ClassMethods
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
30
38
|
end
|
@@ -4,28 +4,36 @@
|
|
4
4
|
# Code 128 B 条形码 code set: ASCII characters 32 to 127 (0-9, A-Z, a-z), special characters, and FNC 1-4.
|
5
5
|
# Code 128 C 条形码 code set: 00-99 (encodes each two digits with one code) and FNC1.
|
6
6
|
|
7
|
-
module Unidom
|
7
|
+
module Unidom
|
8
|
+
module ArticleNumber
|
9
|
+
module Concerns
|
8
10
|
|
9
|
-
|
11
|
+
module Code128Barcode
|
10
12
|
|
11
|
-
|
13
|
+
extend ActiveSupport::Concern
|
12
14
|
|
13
|
-
|
14
|
-
validates :code, numericality: { only_integer: true }, if: Proc.new { |barcode| 'C'==barcode.code_set_code }
|
15
|
+
included do |includer|
|
15
16
|
|
16
|
-
|
17
|
+
validates :code, uniqueness: true
|
18
|
+
validates :code, numericality: { only_integer: true }, if: Proc.new { |barcode| 'C'==barcode.code_set_code }
|
17
19
|
|
18
|
-
|
20
|
+
has_many :markings, class_name: 'Unidom::ArticleNumber::Marking'
|
19
21
|
|
20
|
-
|
21
|
-
# sum = 103
|
22
|
-
# codes.each_with_index do |char, index| sum += (char.unpack('C').first-32)*(index+1) end
|
23
|
-
# sum%103
|
24
|
-
#end
|
22
|
+
include Unidom::Common::Concerns::ModelExtension
|
25
23
|
|
26
|
-
|
24
|
+
#def weighted_modulo_103_checksum(codes)
|
25
|
+
# sum = 103
|
26
|
+
# codes.each_with_index do |char, index| sum += (char.unpack('C').first-32)*(index+1) end
|
27
|
+
# sum%103
|
28
|
+
#end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
+
end
|
31
|
+
|
32
|
+
module ClassMethods
|
33
|
+
end
|
30
34
|
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
31
39
|
end
|
@@ -3,34 +3,40 @@
|
|
3
3
|
# https://en.wikipedia.org/wiki/EAN-13
|
4
4
|
# https://en.wikipedia.org/wiki/International_Article_Number_(EAN)
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
RESTRICTED_DISTRIBUTION_GS1_PREFIXES = (('020'..'029').to_a + ('040'..'049').to_a + ('200'..'299').to_a).freeze
|
9
|
-
|
10
|
-
self.table_name = 'unidom_ean_13_barcodes'
|
11
|
-
|
12
|
-
include Unidom::Common::Concerns::ModelExtension
|
13
|
-
include Unidom::ArticleNumber::Concerns::AsBarcode
|
14
|
-
|
15
|
-
validates :code, uniqueness: true, length: { minimum: 13 }, numericality: { only_integer: true }
|
16
|
-
validates :gs1_prefix, presence: true, length: { is: 3 }, numericality: { only_integer: true }
|
17
|
-
validates :company_number, presence: true, length: { is: 4 }, numericality: { only_integer: true }
|
18
|
-
validates :item_reference, presence: true, length: { is: 5 }, numericality: { only_integer: true }
|
19
|
-
validates :check_digit, presence: true, length: { is: 1 }, numericality: { only_integer: true }
|
20
|
-
|
21
|
-
def code=(code)
|
22
|
-
code = code.to_s
|
23
|
-
write_attribute :code, code
|
24
|
-
if code.present?
|
25
|
-
write_attribute :gs1_prefix, code[0..2]
|
26
|
-
write_attribute :company_number, code[3..6]
|
27
|
-
write_attribute :item_reference, code[7..11]
|
28
|
-
write_attribute :check_digit, code[12]
|
29
|
-
end
|
30
|
-
end
|
6
|
+
module Unidom
|
7
|
+
module ArticleNumber
|
31
8
|
|
32
|
-
|
33
|
-
|
34
|
-
|
9
|
+
class Ean13Barcode < ApplicationRecord
|
10
|
+
|
11
|
+
RESTRICTED_DISTRIBUTION_GS1_PREFIXES = (('020'..'029').to_a + ('040'..'049').to_a + ('200'..'299').to_a).freeze
|
12
|
+
|
13
|
+
self.table_name = 'unidom_ean_13_barcodes'
|
14
|
+
|
15
|
+
include Unidom::Common::Concerns::ModelExtension
|
16
|
+
include Unidom::ArticleNumber::Concerns::AsBarcode
|
35
17
|
|
36
|
-
|
18
|
+
validates :code, uniqueness: true, length: { minimum: 13 }, numericality: { only_integer: true }
|
19
|
+
validates :gs1_prefix, presence: true, length: { is: 3 }, numericality: { only_integer: true }
|
20
|
+
validates :company_number, presence: true, length: { is: 4 }, numericality: { only_integer: true }
|
21
|
+
validates :item_reference, presence: true, length: { is: 5 }, numericality: { only_integer: true }
|
22
|
+
validates :check_digit, presence: true, length: { is: 1 }, numericality: { only_integer: true }
|
23
|
+
|
24
|
+
def code=(code)
|
25
|
+
code = code.to_s
|
26
|
+
write_attribute :code, code
|
27
|
+
if code.present?
|
28
|
+
write_attribute :gs1_prefix, code[0..2]
|
29
|
+
write_attribute :company_number, code[3..6]
|
30
|
+
write_attribute :item_reference, code[7..11]
|
31
|
+
write_attribute :check_digit, code[12]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def restricted_distribution?
|
36
|
+
self.class::RESTRICTED_DISTRIBUTION_GS1_PREFIXES.include? gs1_prefix
|
37
|
+
end
|
38
|
+
|
39
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::Ean13Barcode'
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -2,32 +2,38 @@
|
|
2
2
|
# EAN-8 Barcode 是8位条形码。
|
3
3
|
# https://en.wikipedia.org/wiki/EAN-8
|
4
4
|
|
5
|
-
|
5
|
+
module Unidom
|
6
|
+
module ArticleNumber
|
6
7
|
|
7
|
-
|
8
|
+
class Ean8Barcode < ApplicationRecord
|
8
9
|
|
9
|
-
|
10
|
+
RESTRICTED_DISTRIBUTION_GS1_PREFIXES = (('020'..'029').to_a + ('040'..'049').to_a + ('200'..'299').to_a).freeze
|
10
11
|
|
11
|
-
|
12
|
-
include Unidom::ArticleNumber::Concerns::AsBarcode
|
12
|
+
self.table_name = 'unidom_ean_8_barcodes'
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
validates :item_reference, presence: true, length: { is: 4 }, numericality: { only_integer: true }
|
17
|
-
validates :check_digit, presence: true, length: { is: 1 }, numericality: { only_integer: true }
|
14
|
+
include Unidom::Common::Concerns::ModelExtension
|
15
|
+
include Unidom::ArticleNumber::Concerns::AsBarcode
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
write_attribute :gs1_prefix, code[0..2]
|
24
|
-
write_attribute :item_reference, code[3..6]
|
25
|
-
write_attribute :check_digit, code[7]
|
26
|
-
end
|
27
|
-
end
|
17
|
+
validates :code, uniqueness: true, length: { minimum: 8 }, numericality: { only_integer: true }
|
18
|
+
validates :gs1_prefix, presence: true, length: { is: 3 }, numericality: { only_integer: true }
|
19
|
+
validates :item_reference, presence: true, length: { is: 4 }, numericality: { only_integer: true }
|
20
|
+
validates :check_digit, presence: true, length: { is: 1 }, numericality: { only_integer: true }
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
def code=(code)
|
23
|
+
code = code.to_s
|
24
|
+
write_attribute :code, code
|
25
|
+
if code.present?
|
26
|
+
write_attribute :gs1_prefix, code[0..2]
|
27
|
+
write_attribute :item_reference, code[3..6]
|
28
|
+
write_attribute :check_digit, code[7]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def restricted_distribution?
|
33
|
+
self.class::RESTRICTED_DISTRIBUTION_GS1_PREFIXES.include? gs1_prefix
|
34
|
+
end
|
32
35
|
|
33
|
-
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::Ean8Barcode'
|
36
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::Ean8Barcode'
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -1,36 +1,42 @@
|
|
1
1
|
##
|
2
2
|
# Marking 是条码和物品的标记关系。
|
3
3
|
|
4
|
-
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
5
6
|
|
6
|
-
|
7
|
+
class Marking < ApplicationRecord
|
7
8
|
|
8
|
-
|
9
|
+
self.table_name = 'unidom_markings'
|
9
10
|
|
10
|
-
|
11
|
-
belongs_to :marked, polymorphic: true
|
12
|
-
belongs_to :marker, polymorphic: true
|
11
|
+
include Unidom::Common::Concerns::ModelExtension
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
belongs_to :barcode, polymorphic: true
|
14
|
+
belongs_to :marked, polymorphic: true
|
15
|
+
belongs_to :marker, polymorphic: true
|
17
16
|
|
18
|
-
|
17
|
+
scope :barcode_is, ->(barcode) { where barcode: barcode }
|
18
|
+
scope :marked_by, ->(marker) { where marker: marker }
|
19
|
+
scope :marked_is, ->(marked) { where marked: marked }
|
19
20
|
|
20
|
-
|
21
|
-
raise ArgumentError.new('The marked argument is required.' ) if marked.blank?
|
22
|
-
raise ArgumentError.new('The opened_at argument is required.') if opened_at.blank?
|
21
|
+
def self.mark!(barcode: nil, marked: nil, marker: nil, opened_at: Time.now)
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
creation[:marker] = marker
|
28
|
-
else
|
29
|
-
creation[:marker_id] = Unidom::Common::NULL_UUID
|
30
|
-
creation[:marker_type] = ''
|
31
|
-
end
|
32
|
-
query.first_or_create! creation
|
23
|
+
raise ArgumentError.new('The barcode argument is required.' ) if barcode.blank?
|
24
|
+
raise ArgumentError.new('The marked argument is required.' ) if marked.blank?
|
25
|
+
raise ArgumentError.new('The opened_at argument is required.') if opened_at.blank?
|
33
26
|
|
34
|
-
|
27
|
+
query = barcode_is(barcode).marked_is(marked).valid_at.alive
|
28
|
+
creation = { opened_at: opened_at }
|
29
|
+
if marker.present? && marker.respond_to?(:id)
|
30
|
+
creation[:marker] = marker
|
31
|
+
else
|
32
|
+
creation[:marker_id] = Unidom::Common::NULL_UUID
|
33
|
+
creation[:marker_type] = ''
|
34
|
+
end
|
35
|
+
query.first_or_create! creation
|
36
|
+
|
37
|
+
end
|
35
38
|
|
36
|
-
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::Marking'
|
39
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::Marking'
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -3,28 +3,34 @@
|
|
3
3
|
# https://en.wikipedia.org/wiki/Vehicle_identification_number
|
4
4
|
# GB 16735-2004
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
validates :vehicle_descriptor_section, presence: true, length: { is: columns_hash['vehicle_descriptor_section'].limit }
|
16
|
-
validates :check_digit, presence: true, length: { is: columns_hash['check_digit'].limit }
|
17
|
-
validates :vehicle_identifier_section, presence: true, length: { is: columns_hash['vehicle_identifier_section'].limit }
|
18
|
-
|
19
|
-
def code=(code)
|
20
|
-
code = code.to_s
|
21
|
-
write_attribute :code, code
|
22
|
-
if code.present?
|
23
|
-
write_attribute :world_manufacturer_identifier, code[0..2]
|
24
|
-
write_attribute :vehicle_descriptor_section, code[3..7]
|
25
|
-
write_attribute :check_digit, code[8]
|
26
|
-
write_attribute :vehicle_identifier_section, code[9..16]
|
27
|
-
end
|
28
|
-
end
|
6
|
+
module Unidom
|
7
|
+
module ArticleNumber
|
8
|
+
|
9
|
+
class VehicleIdentificationNumber < ApplicationRecord
|
10
|
+
|
11
|
+
self.table_name = 'unidom_vehicle_identification_numbers'
|
12
|
+
|
13
|
+
include Unidom::Common::Concerns::ModelExtension
|
14
|
+
include Unidom::ArticleNumber::Concerns::AsBarcode
|
29
15
|
|
30
|
-
|
16
|
+
validates :code, uniqueness: true, 'unidom/article_number/vehicle_identification_number': true
|
17
|
+
validates :world_manufacturer_identifier, presence: true, length: { is: columns_hash['world_manufacturer_identifier'].limit }
|
18
|
+
validates :vehicle_descriptor_section, presence: true, length: { is: columns_hash['vehicle_descriptor_section'].limit }
|
19
|
+
validates :check_digit, presence: true, length: { is: columns_hash['check_digit'].limit }
|
20
|
+
validates :vehicle_identifier_section, presence: true, length: { is: columns_hash['vehicle_identifier_section'].limit }
|
21
|
+
|
22
|
+
def code=(code)
|
23
|
+
code = code.to_s
|
24
|
+
write_attribute :code, code
|
25
|
+
if code.present?
|
26
|
+
write_attribute :world_manufacturer_identifier, code[0..2]
|
27
|
+
write_attribute :vehicle_descriptor_section, code[3..7]
|
28
|
+
write_attribute :check_digit, code[8]
|
29
|
+
write_attribute :vehicle_identifier_section, code[9..16]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::VehicleIdentificationNumber'
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -1,29 +1,35 @@
|
|
1
1
|
# https://en.wikipedia.org/wiki/Vehicle_identification_number#Check-digit_calculation
|
2
2
|
# GB 16735-2004
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
WEIGHTS = '8765432X098765432'.freeze
|
7
|
-
TRANSLITERATION = '0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ'.freeze
|
8
|
-
CHECK_DIGITS = '0123456789X'.freeze
|
9
|
-
|
10
|
-
def validate_each(record, attribute, value)
|
11
|
-
value = value.to_s.upcase
|
12
|
-
if value.length>17
|
13
|
-
record.errors[attribute] << (options[:message]||'The length should be 17')
|
14
|
-
elsif value.match /I|O|Q/
|
15
|
-
record.errors[attribute] << (options[:message]||'I, O, Q should be excluded')
|
16
|
-
else
|
17
|
-
record.errors[attribute] << (options[:message]||'is invalid') unless check_digit(value)==value[8]
|
18
|
-
end
|
19
|
-
end
|
4
|
+
module Unidom
|
5
|
+
module ArticleNumber
|
20
6
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
7
|
+
class VehicleIdentificationNumberValidator < ActiveModel::EachValidator
|
8
|
+
|
9
|
+
WEIGHTS = '8765432X098765432'.freeze
|
10
|
+
TRANSLITERATION = '0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ'.freeze
|
11
|
+
CHECK_DIGITS = '0123456789X'.freeze
|
12
|
+
|
13
|
+
def validate_each(record, attribute, value)
|
14
|
+
value = value.to_s.upcase
|
15
|
+
if value.length>17
|
16
|
+
record.errors[attribute] << (options[:message]||'The length should be 17')
|
17
|
+
elsif value.match /I|O|Q/
|
18
|
+
record.errors[attribute] << (options[:message]||'I, O, Q should be excluded')
|
19
|
+
else
|
20
|
+
record.errors[attribute] << (options[:message]||'is invalid') unless check_digit(value)==value[8]
|
21
|
+
end
|
22
|
+
end
|
26
23
|
|
27
|
-
|
24
|
+
def check_digit(value)
|
25
|
+
checksum = 0
|
26
|
+
value.chars.each_with_index do |char, index| checksum += self.class::TRANSLITERATION.index(char)%10*self.class::CHECK_DIGITS.index(self.class::WEIGHTS.at(index)) end
|
27
|
+
self.class::CHECK_DIGITS.at checksum%11
|
28
|
+
end
|
28
29
|
|
30
|
+
private :check_digit
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
29
35
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateUnidomMarkings < ActiveRecord::Migration
|
1
|
+
class CreateUnidomMarkings < ActiveRecord::Migration[6.0]
|
2
2
|
|
3
3
|
def change
|
4
4
|
|
@@ -11,9 +11,9 @@ class CreateUnidomMarkings < ActiveRecord::Migration
|
|
11
11
|
t.references :marker, type: :uuid, null: false,
|
12
12
|
polymorphic: { null: false, default: '', limit: 200 }
|
13
13
|
|
14
|
-
t.column :state, 'char(1)', null: false, default:
|
15
|
-
t.datetime :opened_at, null: false, default: ::
|
16
|
-
t.datetime :closed_at, null: false, default: ::
|
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,4 +1,4 @@
|
|
1
|
-
class CreateUnidomEan13Barcodes < ActiveRecord::Migration
|
1
|
+
class CreateUnidomEan13Barcodes < ActiveRecord::Migration[6.0]
|
2
2
|
|
3
3
|
def change
|
4
4
|
|
@@ -10,9 +10,9 @@ class CreateUnidomEan13Barcodes < ActiveRecord::Migration
|
|
10
10
|
t.string :item_reference, null: false, default: '0'*2, limit: 6
|
11
11
|
t.column :check_digit, 'char(1)', null: false, default: '0'
|
12
12
|
|
13
|
-
t.column :state, 'char(1)', null: false, default:
|
14
|
-
t.datetime :opened_at, null: false, default: ::
|
15
|
-
t.datetime :closed_at, null: false, default: ::
|
13
|
+
t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
|
14
|
+
t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
|
15
|
+
t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
|
16
16
|
t.boolean :defunct, null: false, default: false
|
17
17
|
t.jsonb :notation, null: false, default: {}
|
18
18
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateUnidomEan8Barcodes < ActiveRecord::Migration
|
1
|
+
class CreateUnidomEan8Barcodes < ActiveRecord::Migration[6.0]
|
2
2
|
|
3
3
|
def change
|
4
4
|
|
@@ -9,9 +9,9 @@ class CreateUnidomEan8Barcodes < ActiveRecord::Migration
|
|
9
9
|
t.column :item_reference, 'char(4)', null: false, default: '0'*4
|
10
10
|
t.column :check_digit, 'char(1)', null: false, default: '0'
|
11
11
|
|
12
|
-
t.column :state, 'char(1)', null: false, default:
|
13
|
-
t.datetime :opened_at, null: false, default: ::
|
14
|
-
t.datetime :closed_at, null: false, default: ::
|
12
|
+
t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
|
13
|
+
t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
|
14
|
+
t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
|
15
15
|
t.boolean :defunct, null: false, default: false
|
16
16
|
t.jsonb :notation, null: false, default: {}
|
17
17
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateUnidomVehicleIdentificationNumbers < ActiveRecord::Migration
|
1
|
+
class CreateUnidomVehicleIdentificationNumbers < ActiveRecord::Migration[6.0]
|
2
2
|
|
3
3
|
def change
|
4
4
|
|
@@ -10,9 +10,9 @@ class CreateUnidomVehicleIdentificationNumbers < ActiveRecord::Migration
|
|
10
10
|
t.column :check_digit, 'char(1)', null: false, default: '0'
|
11
11
|
t.column :vehicle_identifier_section, 'char(8)', null: false, default: '0'*8
|
12
12
|
|
13
|
-
t.column :state, 'char(1)', null: false, default:
|
14
|
-
t.datetime :opened_at, null: false, default: ::
|
15
|
-
t.datetime :closed_at, null: false, default: ::
|
13
|
+
t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
|
14
|
+
t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
|
15
|
+
t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
|
16
16
|
t.boolean :defunct, null: false, default: false
|
17
17
|
t.jsonb :notation, null: false, default: {}
|
18
18
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
shared_examples 'Unidom::ArticleNumber::Concerns::AsBarcode' do |model_attributes|
|
2
|
+
|
3
|
+
marking_1_attribtues = {
|
4
|
+
marked_id: SecureRandom.uuid,
|
5
|
+
marked_type: 'Unidom::ArticleNumber::Marked::Mock',
|
6
|
+
marker_id: SecureRandom.uuid,
|
7
|
+
marker_type: 'Unidom::ArticleNumber::Marker::Mock'
|
8
|
+
}
|
9
|
+
|
10
|
+
marking_2_attribtues = {
|
11
|
+
marked_id: SecureRandom.uuid,
|
12
|
+
marked_type: 'Unidom::ArticleNumber::Marked::Mock',
|
13
|
+
marker_id: SecureRandom.uuid,
|
14
|
+
marker_type: 'Unidom::ArticleNumber::Marker::Mock'
|
15
|
+
}
|
16
|
+
|
17
|
+
it_behaves_like 'has_many', model_attributes, :markings, Unidom::ArticleNumber::Marking, [ marking_1_attribtues, marking_2_attribtues ]
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
shared_examples 'Unidom::ArticleNumber::Concerns::AsMarked' do |model_attributes|
|
2
|
+
|
3
|
+
marking_1_attribtues = {
|
4
|
+
marker_id: SecureRandom.uuid,
|
5
|
+
marker_type: 'Unidom::ArticleNumber::Marker::Mock'
|
6
|
+
}
|
7
|
+
|
8
|
+
marking_2_attribtues = {
|
9
|
+
marker_id: SecureRandom.uuid,
|
10
|
+
marker_type: 'Unidom::ArticleNumber::Marker::Mock'
|
11
|
+
}
|
12
|
+
|
13
|
+
marking_1_attribtues[:barcode] = Unidom::ArticleNumber::Ean13Barcode.coded_as('1234567899527').first_or_create!
|
14
|
+
marking_1_attribtues[:barcode] = Unidom::ArticleNumber::Ean13Barcode.coded_as('1234567899526').first_or_create!
|
15
|
+
it_behaves_like 'has_many', model_attributes, :markings, Unidom::ArticleNumber::Marking, [ marking_1_attribtues, marking_2_attribtues ]
|
16
|
+
|
17
|
+
marking_1_attribtues[:barcode] = Unidom::ArticleNumber::Ean8Barcode.coded_as('95279527').first_or_create!
|
18
|
+
marking_1_attribtues[:barcode] = Unidom::ArticleNumber::Ean8Barcode.coded_as('95269526').first_or_create!
|
19
|
+
it_behaves_like 'has_many', model_attributes, :markings, Unidom::ArticleNumber::Marking, [ marking_1_attribtues, marking_2_attribtues ]
|
20
|
+
|
21
|
+
#marking_1_attribtues[:barcode] = Unidom::ArticleNumber::VehicleIdentificationNumber.coded_as('LVHCU165XD5002138').first_or_create!
|
22
|
+
#marking_1_attribtues[:barcode] = Unidom::ArticleNumber::VehicleIdentificationNumber.coded_as('LFVAA11A6X2075355').first_or_create!
|
23
|
+
#it_behaves_like 'has_many', model_attributes, :markings, Unidom::ArticleNumber::Marking, [ marking_1_attribtues, marking_2_attribtues ]
|
24
|
+
|
25
|
+
end
|
@@ -12,10 +12,10 @@ describe Unidom::ArticleNumber::Ean13Barcode, type: :model do
|
|
12
12
|
code: '1234567890123'
|
13
13
|
}
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
15
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attributes
|
18
17
|
|
18
|
+
code_max_length = described_class.columns_hash['code'].limit
|
19
19
|
it_behaves_like 'validates', model_attributes, :code,
|
20
20
|
{ } => 0,
|
21
21
|
{ code: nil } => 3,
|
@@ -12,10 +12,10 @@ describe Unidom::ArticleNumber::Ean8Barcode, type: :model do
|
|
12
12
|
code: '12345678'
|
13
13
|
}
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
15
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attributes
|
18
17
|
|
18
|
+
code_max_length = described_class.columns_hash['code'].limit
|
19
19
|
it_behaves_like 'validates', model_attributes, :code,
|
20
20
|
{ } => 0,
|
21
21
|
{ code: nil } => 3,
|
@@ -19,20 +19,7 @@ describe Unidom::ArticleNumber::Marking, type: :model do
|
|
19
19
|
|
20
20
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
21
21
|
|
22
|
-
it_behaves_like 'scope', :barcode_is, [
|
23
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ Unidom::ArticleNumber::Ean13Barcode.new( id: model_attributes[:barcode_id]) ] },
|
24
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ Unidom::ArticleNumber::Ean8Barcode.new( id: model_attributes[:barcode_id]) ] },
|
25
|
-
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ Unidom::ArticleNumber::VehicleIdentificationNumber.new(id: model_attributes[:barcode_id]) ] },
|
26
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::Ean13Barcode' ) ], count_diff: 1, args: [ Unidom::ArticleNumber::Ean13Barcode.new( id: model_attributes[:barcode_id]) ] },
|
27
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::Ean13Barcode' ) ], count_diff: 0, args: [ Unidom::ArticleNumber::Ean8Barcode.new( id: model_attributes[:barcode_id]) ] },
|
28
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::Ean13Barcode' ) ], count_diff: 0, args: [ Unidom::ArticleNumber::VehicleIdentificationNumber.new(id: model_attributes[:barcode_id]) ] },
|
29
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::Ean8Barcode' ) ], count_diff: 0, args: [ Unidom::ArticleNumber::Ean13Barcode.new( id: model_attributes[:barcode_id]) ] },
|
30
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::Ean8Barcode' ) ], count_diff: 1, args: [ Unidom::ArticleNumber::Ean8Barcode.new( id: model_attributes[:barcode_id]) ] },
|
31
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::Ean8Barcode' ) ], count_diff: 0, args: [ Unidom::ArticleNumber::VehicleIdentificationNumber.new(id: model_attributes[:barcode_id]) ] },
|
32
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::VehicleIdentificationNumber') ], count_diff: 0, args: [ Unidom::ArticleNumber::Ean13Barcode.new( id: model_attributes[:barcode_id]) ] },
|
33
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::VehicleIdentificationNumber') ], count_diff: 0, args: [ Unidom::ArticleNumber::Ean8Barcode.new( id: model_attributes[:barcode_id]) ] },
|
34
|
-
{ attributes_collection: [ model_attributes.merge(barcode_type: 'Unidom::ArticleNumber::VehicleIdentificationNumber') ], count_diff: 1, args: [ Unidom::ArticleNumber::VehicleIdentificationNumber.new(id: model_attributes[:barcode_id]) ] }
|
35
|
-
]
|
22
|
+
it_behaves_like 'polymorphic scope', model_attributes, :barcode_is, :barcode, [ Unidom::ArticleNumber::Ean13Barcode, Unidom::ArticleNumber::Ean8Barcode, Unidom::ArticleNumber::VehicleIdentificationNumber ]
|
36
23
|
|
37
24
|
end
|
38
25
|
|
@@ -12,7 +12,24 @@ describe Unidom::ArticleNumber::VehicleIdentificationNumber, type: :model do
|
|
12
12
|
code: 'LVHCU165XD5002138'
|
13
13
|
}
|
14
14
|
|
15
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension',
|
15
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
|
+
it_behaves_like 'Unidom::ArticleNumber::Concerns::AsBarcode', model_attributes
|
17
|
+
|
18
|
+
it_behaves_like 'validates', model_attributes, :code,
|
19
|
+
{ } => 0,
|
20
|
+
{ code: nil } => 2,
|
21
|
+
{ code: '' } => 2,
|
22
|
+
{ code: '1' } => 1,
|
23
|
+
{ code: 'A' } => 1,
|
24
|
+
{ code: '11' } => 1,
|
25
|
+
{ code: 'AA' } => 1,
|
26
|
+
{ code: '111' } => 1,
|
27
|
+
{ code: 'AAA' } => 1,
|
28
|
+
{ code: 'LFVAA11A6X207535' } => 1,
|
29
|
+
{ code: 'LFVAA11A6X2075354' } => 1,
|
30
|
+
{ code: 'LFVAA11A6X2075355' } => 0,
|
31
|
+
{ code: 'LFVAA11A6X2075356' } => 1,
|
32
|
+
{ code: 'LFVAA11A6X20753559' } => 2
|
16
33
|
|
17
34
|
end
|
18
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-article_number
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
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:
|
11
|
+
date: 2021-08-07 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: '
|
19
|
+
version: '2.0'
|
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: '
|
26
|
+
version: '2.0'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Article Number domain model engine includes EAN-13, EAN-8, and IMEI models.
|
29
29
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。物品编码领域模型引擎包括EAN-13、EAN-8和IMEI的模型。
|
@@ -60,6 +60,8 @@ files:
|
|
60
60
|
- db/migrate/20020102000000_create_unidom_ean_13_barcodes.rb
|
61
61
|
- db/migrate/20020103000000_create_unidom_ean_8_barcodes.rb
|
62
62
|
- db/migrate/20020111000000_create_unidom_vehicle_identification_numbers.rb
|
63
|
+
- lib/rspec/models/unidom/article_number/concerns/as_barcode_shared_examples.rb
|
64
|
+
- lib/rspec/models/unidom/article_number/concerns/as_marked_shared_examples.rb
|
63
65
|
- lib/rspec/models/unidom/article_number/ean13_barcode_spec.rb
|
64
66
|
- lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb
|
65
67
|
- lib/rspec/models/unidom/article_number/marking_spec.rb
|
@@ -69,14 +71,15 @@ files:
|
|
69
71
|
- lib/unidom/article_number.rb
|
70
72
|
- lib/unidom/article_number/engine.rb
|
71
73
|
- lib/unidom/article_number/models_rspec.rb
|
74
|
+
- lib/unidom/article_number/rspec_shared_examples.rb
|
72
75
|
- lib/unidom/article_number/types_rspec.rb
|
73
76
|
- lib/unidom/article_number/validators_rspec.rb
|
74
77
|
- lib/unidom/article_number/version.rb
|
75
|
-
homepage: https://
|
78
|
+
homepage: https://gitee.com/Unidom/unidom-article_number
|
76
79
|
licenses:
|
77
80
|
- MIT
|
78
81
|
metadata: {}
|
79
|
-
post_install_message:
|
82
|
+
post_install_message:
|
80
83
|
rdoc_options: []
|
81
84
|
require_paths:
|
82
85
|
- lib
|
@@ -91,9 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
94
|
- !ruby/object:Gem::Version
|
92
95
|
version: '0'
|
93
96
|
requirements: []
|
94
|
-
|
95
|
-
|
96
|
-
signing_key:
|
97
|
+
rubygems_version: 3.2.3
|
98
|
+
signing_key:
|
97
99
|
specification_version: 4
|
98
100
|
summary: Unidom Article Number Domain Model Engine 物品编码领域模型引擎
|
99
101
|
test_files: []
|