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.
Files changed (32) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +30 -0
  3. data/app/controllers/unidom/article_number/application_controller.rb +8 -2
  4. data/app/helpers/unidom/article_number/application_helper.rb +8 -1
  5. data/app/jobs/unidom/article_number/application_job.rb +7 -1
  6. data/app/mailers/unidom/article_number/application_mailer.rb +9 -3
  7. data/app/models/unidom/article_number/application_record.rb +8 -2
  8. data/app/models/unidom/article_number/concerns/as_barcode.rb +27 -19
  9. data/app/models/unidom/article_number/concerns/as_ean13_marked.rb +16 -8
  10. data/app/models/unidom/article_number/concerns/as_ean8_marked.rb +16 -8
  11. data/app/models/unidom/article_number/concerns/as_marked.rb +26 -18
  12. data/app/models/unidom/article_number/concerns/code128_barcode.rb +23 -15
  13. data/app/models/unidom/article_number/ean13_barcode.rb +35 -29
  14. data/app/models/unidom/article_number/ean8_barcode.rb +28 -22
  15. data/app/models/unidom/article_number/marking.rb +30 -24
  16. data/app/models/unidom/article_number/vehicle_identification_number.rb +30 -24
  17. data/app/validators/unidom/article_number/vehicle_identification_number_validator.rb +28 -22
  18. data/app/views/layouts/unidom/article_number/application.html.erb +1 -1
  19. data/db/migrate/20020101000000_create_unidom_markings.rb +4 -4
  20. data/db/migrate/20020102000000_create_unidom_ean_13_barcodes.rb +4 -4
  21. data/db/migrate/20020103000000_create_unidom_ean_8_barcodes.rb +4 -4
  22. data/db/migrate/20020111000000_create_unidom_vehicle_identification_numbers.rb +4 -4
  23. data/lib/rspec/models/unidom/article_number/concerns/as_barcode_shared_examples.rb +19 -0
  24. data/lib/rspec/models/unidom/article_number/concerns/as_marked_shared_examples.rb +25 -0
  25. data/lib/rspec/models/unidom/article_number/ean13_barcode_spec.rb +3 -3
  26. data/lib/rspec/models/unidom/article_number/ean8_barcode_spec.rb +3 -3
  27. data/lib/rspec/models/unidom/article_number/marking_spec.rb +1 -14
  28. data/lib/rspec/models/unidom/article_number/vehicle_identification_number_spec.rb +18 -1
  29. data/lib/unidom/article_number/engine.rb +1 -1
  30. data/lib/unidom/article_number/rspec_shared_examples.rb +2 -0
  31. data/lib/unidom/article_number/version.rb +1 -1
  32. metadata +12 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f230184a9348c0a6540ff87054d0e237210f44a9
4
- data.tar.gz: 1680b0164bcdf2569392dcac358db9c414c47092
2
+ SHA256:
3
+ metadata.gz: 20387d317914c567cade086d61a214bdc1544df3db3188765a6d1d876fbbf0d4
4
+ data.tar.gz: f3122b1aff3157ba6e49b2c60a1dbd832debe28c985482cb64ff0aee74e5f1da
5
5
  SHA512:
6
- metadata.gz: 1ec8c735447b02c849a1b36479b895861ad88fd01e0f582df8e3586c455a7306c4b9f6eba335c53d454dc4204fa9758a204bc3caeabb1ea17784bc4064b7dac7
7
- data.tar.gz: 34161d493bbf609110bcab81f9184b55bbaea889adc5294c141abec00a853f90eb27a6bc99523cd387893121ac9bc49a361e6d5466ccdeef61f219b1e41dac6e
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
- class Unidom::ArticleNumber::ApplicationController < ActionController::Base
5
- protect_from_forgery with: :exception
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,2 +1,9 @@
1
- module Unidom::ArticleNumber::ApplicationHelper
1
+
2
+ module Unidom
3
+ module ArticleNumber
4
+
5
+ module ApplicationHelper
6
+ end
7
+
8
+ end
2
9
  end
@@ -1,5 +1,11 @@
1
1
  ##
2
2
  # Application job 是模块内所有异步任务的基类。
3
3
 
4
- class Unidom::ArticleNumber::ApplicationJob < ActiveJob::Base
4
+ module Unidom
5
+ module ArticleNumber
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::ArticleNumber::ApplicationMailer < ActionMailer::Base
5
- default from: 'from@example.com'
6
- layout 'mailer'
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
- class Unidom::ArticleNumber::ApplicationRecord < ActiveRecord::Base
5
- self.abstract_class = true
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::ArticleNumber::Concerns::AsBarcode
4
+ module Unidom
5
+ module ArticleNumber
6
+ module Concerns
5
7
 
6
- extend ActiveSupport::Concern
8
+ module AsBarcode
7
9
 
8
- included do |includer|
10
+ extend ActiveSupport::Concern
9
11
 
10
- has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode
11
- has_many :marked_products, through: :markings, source: :marked, source_type: 'Unidom::Product::Product'
12
+ included do |includer|
12
13
 
13
- def mark!(marked, by: nil, at: Time.now)
14
- raise ArgumentError.new('The marked argument is required.') if marked.blank?
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
- def mark?(marked, at: Time.now)
21
- raise ArgumentError.new('The marked argument is required.') if marked.blank?
22
- raise ArgumentError.new('The at argument is required.' ) if at.blank?
23
- markings.marked_is(marked).valid_at(now: at).alive.exists?
24
- end
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
- end
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
- module ClassMethods
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::ArticleNumber::Concerns::AsEan13Marked
4
+ module Unidom
5
+ module ArticleNumber
6
+ module Concerns
5
7
 
6
- extend ActiveSupport::Concern
8
+ module AsEan13Marked
7
9
 
8
- include Unidom::ArticleNumber::Concerns::AsMarked
10
+ extend ActiveSupport::Concern
9
11
 
10
- included do |includer|
12
+ include Unidom::ArticleNumber::Concerns::AsMarked
11
13
 
12
- has_many :ean13_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean13Barcode'
14
+ included do |includer|
13
15
 
14
- end
16
+ has_many :ean13_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean13Barcode'
15
17
 
16
- module ClassMethods
17
- end
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::ArticleNumber::Concerns::AsEan8Marked
4
+ module Unidom
5
+ module ArticleNumber
6
+ module Concerns
5
7
 
6
- extend ActiveSupport::Concern
8
+ module AsEan8Marked
7
9
 
8
- include Unidom::ArticleNumber::Concerns::AsMarked
10
+ extend ActiveSupport::Concern
9
11
 
10
- included do |includer|
12
+ include Unidom::ArticleNumber::Concerns::AsMarked
11
13
 
12
- has_many :ean8_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean8Barcode'
14
+ included do |includer|
13
15
 
14
- end
16
+ has_many :ean8_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean8Barcode'
15
17
 
16
- module ClassMethods
17
- end
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::ArticleNumber::Concerns::AsMarked
4
+ module Unidom
5
+ module ArticleNumber
6
+ module Concerns
5
7
 
6
- extend ActiveSupport::Concern
8
+ module AsMarked
7
9
 
8
- included do |includer|
10
+ extend ActiveSupport::Concern
9
11
 
10
- has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked
12
+ included do |includer|
11
13
 
12
- def is_marked!(as: nil, by: nil, at: Time.now)
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
- def is_marked?(as: nil, at: Time.now)
20
- raise ArgumentError.new('The as argument is required.') if as.blank?
21
- raise ArgumentError.new('The at argument is required.') if at.blank?
22
- markings.barcode_is(as).valid_at(now: at).alive.exists?
23
- end
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
- end
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
- module ClassMethods
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::ArticleNumber::Concerns::Code128Barcode
7
+ module Unidom
8
+ module ArticleNumber
9
+ module Concerns
8
10
 
9
- extend ActiveSupport::Concern
11
+ module Code128Barcode
10
12
 
11
- included do |includer|
13
+ extend ActiveSupport::Concern
12
14
 
13
- validates :code, uniqueness: true
14
- validates :code, numericality: { only_integer: true }, if: Proc.new { |barcode| 'C'==barcode.code_set_code }
15
+ included do |includer|
15
16
 
16
- has_many :markings, class_name: 'Unidom::ArticleNumber::Marking'
17
+ validates :code, uniqueness: true
18
+ validates :code, numericality: { only_integer: true }, if: Proc.new { |barcode| 'C'==barcode.code_set_code }
17
19
 
18
- include Unidom::Common::Concerns::ModelExtension
20
+ has_many :markings, class_name: 'Unidom::ArticleNumber::Marking'
19
21
 
20
- #def weighted_modulo_103_checksum(codes)
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
- end
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
- module ClassMethods
29
- end
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
- class Unidom::ArticleNumber::Ean13Barcode < Unidom::ArticleNumber::ApplicationRecord
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
- def restricted_distribution?
33
- self.class::RESTRICTED_DISTRIBUTION_GS1_PREFIXES.include? gs1_prefix
34
- end
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
- end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::Ean13Barcode'
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
- class Unidom::ArticleNumber::Ean8Barcode < Unidom::ArticleNumber::ApplicationRecord
5
+ module Unidom
6
+ module ArticleNumber
6
7
 
7
- RESTRICTED_DISTRIBUTION_GS1_PREFIXES = (('020'..'029').to_a + ('040'..'049').to_a + ('200'..'299').to_a).freeze
8
+ class Ean8Barcode < ApplicationRecord
8
9
 
9
- self.table_name = 'unidom_ean_8_barcodes'
10
+ RESTRICTED_DISTRIBUTION_GS1_PREFIXES = (('020'..'029').to_a + ('040'..'049').to_a + ('200'..'299').to_a).freeze
10
11
 
11
- include Unidom::Common::Concerns::ModelExtension
12
- include Unidom::ArticleNumber::Concerns::AsBarcode
12
+ self.table_name = 'unidom_ean_8_barcodes'
13
13
 
14
- validates :code, uniqueness: true, length: { minimum: 8 }, numericality: { only_integer: true }
15
- validates :gs1_prefix, presence: true, length: { is: 3 }, numericality: { only_integer: true }
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
- def code=(code)
20
- code = code.to_s
21
- write_attribute :code, code
22
- if code.present?
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
- def restricted_distribution?
30
- self.class::RESTRICTED_DISTRIBUTION_GS1_PREFIXES.include? gs1_prefix
31
- end
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
- class Unidom::ArticleNumber::Marking < Unidom::ArticleNumber::ApplicationRecord
4
+ module Unidom
5
+ module ArticleNumber
5
6
 
6
- self.table_name = 'unidom_markings'
7
+ class Marking < ApplicationRecord
7
8
 
8
- include Unidom::Common::Concerns::ModelExtension
9
+ self.table_name = 'unidom_markings'
9
10
 
10
- belongs_to :barcode, polymorphic: true
11
- belongs_to :marked, polymorphic: true
12
- belongs_to :marker, polymorphic: true
11
+ include Unidom::Common::Concerns::ModelExtension
13
12
 
14
- scope :barcode_is, ->(barcode) { where barcode: barcode }
15
- scope :marked_by, ->(marker) { where marker: marker }
16
- scope :marked_is, ->(marked) { where marked: marked }
13
+ belongs_to :barcode, polymorphic: true
14
+ belongs_to :marked, polymorphic: true
15
+ belongs_to :marker, polymorphic: true
17
16
 
18
- def self.mark!(barcode: nil, marked: nil, marker: nil, opened_at: Time.now)
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
- raise ArgumentError.new('The barcode argument is required.' ) if barcode.blank?
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
- query = barcode_is(barcode).marked_is(marked).valid_at.alive
25
- creation = { opened_at: opened_at }
26
- if marker.present? && marker.respond_to?(:id)
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
- end
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
- class Unidom::ArticleNumber::VehicleIdentificationNumber < Unidom::ArticleNumber::ApplicationRecord
7
-
8
- self.table_name = 'unidom_vehicle_identification_numbers'
9
-
10
- include Unidom::Common::Concerns::ModelExtension
11
- include Unidom::ArticleNumber::Concerns::AsBarcode
12
-
13
- validates :code, uniqueness: true, 'unidom/article_number/vehicle_identification_number': true
14
- validates :world_manufacturer_identifier, presence: true, length: { is: columns_hash['world_manufacturer_identifier'].limit }
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
- end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::ArticleNumber::VehicleIdentificationNumber'
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
- class Unidom::ArticleNumber::VehicleIdentificationNumberValidator < ActiveModel::EachValidator
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
- def check_digit(value)
22
- checksum = 0
23
- 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
24
- self.class::CHECK_DIGITS.at checksum%11
25
- end
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
- private :check_digit
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
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Unidom Article Number</title>
5
- <%= stylesheet_link_tag 'unidom/article_number/application', media: "all" %>
5
+ <%= stylesheet_link_tag 'unidom/article_number/application', media: 'all' %>
6
6
  <%= csrf_meta_tags %>
7
7
  </head>
8
8
  <body>
@@ -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: '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,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: 'C'
14
- t.datetime :opened_at, null: false, default: ::Time.utc(1970)
15
- t.datetime :closed_at, null: false, default: ::Time.utc(3000)
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: 'C'
13
- t.datetime :opened_at, null: false, default: ::Time.utc(1970)
14
- t.datetime :closed_at, null: false, default: ::Time.utc(3000)
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: 'C'
14
- t.datetime :opened_at, null: false, default: ::Time.utc(1970)
15
- t.datetime :closed_at, null: false, default: ::Time.utc(3000)
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
- code_max_length = described_class.columns_hash['code'].limit
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
- code_max_length = described_class.columns_hash['code'].limit
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', model_attributes
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
 
@@ -1,7 +1,7 @@
1
1
  module Unidom
2
2
  module ArticleNumber
3
3
 
4
- class Engine < ::Rails::Engine
4
+ class Engine < Rails::Engine
5
5
 
6
6
  include Unidom::Common::EngineExtension
7
7
 
@@ -0,0 +1,2 @@
1
+ require 'rspec/models/unidom/article_number/concerns/as_barcode_shared_examples'
2
+ # require 'rspec/models/unidom/article_number/concerns/as_marked_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module ArticleNumber
3
- VERSION = '2.3.5'.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-article_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.5
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: 2017-03-11 00:00:00.000000000 Z
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: '1.9'
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: '1.9'
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://github.com/topbitdu/unidom-article_number
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
- rubyforge_project:
95
- rubygems_version: 2.6.4
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: []