unidom-article_number 1.1 → 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e103c694c4ed80ec65b731cda49a3e0783e0b437
4
- data.tar.gz: 6fc564bfd5fdaeef8c35500e6304c5ec989a7f48
3
+ metadata.gz: 1bd0366fe5076a382f8d53c53cfd18229206997d
4
+ data.tar.gz: 8931aa52ef188018890a8a00aa2276a07946da57
5
5
  SHA512:
6
- metadata.gz: 72a46da309964735cbd859632f7fbef9cbc52ae82130e7737ae3c676513bd697f328e9b065116514e8cfa685b65ac89e8126f3e77187003142e3f526afe468d5
7
- data.tar.gz: 0c183c6d24e22f7cf1217dbe5c30f28a404078ef37ddf71c76f37e613a7088c6a27c6fc3c8f826d32418cf180d299c77a48fbd621bfa0893412981176f1c330c
6
+ metadata.gz: ef6494bd161fe72e543a71d1ac7db12fa700e5488f871f513814a20d7996b4c8b2ec46e150bfd855f128c24bf08efb86bd3242dbb422e412bcac29920be330cd
7
+ data.tar.gz: c172f6c2d00e83bd48bc2ba11953dd6cd14709cc4ef7d4d0d9fefe0465f39381e04d5c073b1ed5466b5f6ae897eb8df818a300dd69591f790e332c58637a25d4
data/README.md CHANGED
@@ -41,8 +41,11 @@ include Unidom::ArticleNumber::Concerns::AsMarked
41
41
 
42
42
  ### As Barcode concern
43
43
  The As Barcode concern do the following tasks for the includer automatically:
44
- 1. Define the Has Many macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode``
44
+ 1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode``
45
+ 2. Define the has_many :marked_products macro as: ``has_many :marked_products, through: :markings, source: :marked, source_type: 'Unidom::Product::Product'``
46
+ 3. Define the mark! method as: ``def mark!(marked, by: nil, at: Time.now)``
45
47
 
46
48
  ### As Marked concern
47
49
  The As Marked concern do the following tasks for the includer automatically:
48
- 1. Define the Has Many macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked``
50
+ 1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked``
51
+ 2. Define the is_marked! method as: ``def is_marked!(as: nil, by: nil, at: Time.now)``
@@ -7,6 +7,13 @@ module Unidom::ArticleNumber::Concerns::AsBarcode
7
7
  has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode
8
8
  has_many :marked_products, through: :markings, source: :marked, source_type: 'Unidom::Product::Product'
9
9
 
10
+ def mark!(marked, by: nil, at: Time.now)
11
+ raise ArgumentError.new('The marked argument is required.') if marked.blank?
12
+ raise ArgumentError.new('The by argument is required.' ) if by.blank?
13
+ raise ArgumentError.new('The at argument is required.' ) if at.blank?
14
+ markings.create! marked: marked, marker: by, opened_at: at
15
+ end
16
+
10
17
  end
11
18
 
12
19
  end
@@ -6,6 +6,13 @@ module Unidom::ArticleNumber::Concerns::AsMarked
6
6
 
7
7
  has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked
8
8
 
9
+ def is_marked!(as: nil, by: nil, at: Time.now)
10
+ raise ArgumentError.new('The as argument is required.') if as.blank?
11
+ raise ArgumentError.new('The by argument is required.') if by.blank?
12
+ raise ArgumentError.new('The at argument is required.') if at.blank?
13
+ markings.create! barcode: as, marker: by, opened_at: at
14
+ end
15
+
9
16
  end
10
17
 
11
18
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module ArticleNumber
3
- VERSION = '1.1'.freeze
3
+ VERSION = '1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-article_number
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
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-07-20 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
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
26
  version: '0.9'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.