unidom-article_number 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a29fd6d5c6f21d2016c5faa65052dc1dc9dc3ace
|
4
|
+
data.tar.gz: bf76bf71a94e1301eaab9877c90e3f4fd671e9df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c287260d33edcd24f5e3f255f247e53910ad6ca8c267b30d04cba92cd0b4c5ecf80c3f03a8eaa6a50e0ef9c171345a2e0d069580cc5931da2b3d96865fa302
|
7
|
+
data.tar.gz: db7529debdbe029f8338d4eead0fced65434ee908a42576c7018be68335401629762f69a33beb773a6fa3c86a03d564cc56168750cdac3a344897ed6d2a46e35
|
data/README.md
CHANGED
@@ -44,13 +44,14 @@ include Unidom::ArticleNumber::Concerns::AsEan8Marked
|
|
44
44
|
### As Barcode concern
|
45
45
|
The As Barcode concern do the following tasks for the includer automatically:
|
46
46
|
1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode``
|
47
|
-
2. Define the
|
48
|
-
3. Define the #mark
|
47
|
+
2. Define the #mark! method as: ``def mark!(marked, by: nil, at: Time.now)``
|
48
|
+
3. Define the #mark? mathod as: ``def mark?(marked, at: Time.now)``
|
49
49
|
|
50
50
|
### As Marked concern
|
51
51
|
The As Marked concern do the following tasks for the includer automatically:
|
52
52
|
1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked``
|
53
53
|
2. Define the #is_marked! method as: ``def is_marked!(as: nil, by: nil, at: Time.now)``
|
54
|
+
3. Define the #is_marked? method as: ``def is_marked?(as: nil, at: Time.now)``
|
54
55
|
|
55
56
|
### As EAN-13 Marked concern
|
56
57
|
The As EAN-13 Marked concern do the following tasks for the includer automatically:
|
@@ -2,7 +2,7 @@ module Unidom::ArticleNumber::Concerns::AsBarcode
|
|
2
2
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
|
5
|
+
included do |includer|
|
6
6
|
|
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'
|
@@ -14,6 +14,12 @@ module Unidom::ArticleNumber::Concerns::AsBarcode
|
|
14
14
|
markings.create! marked: marked, marker: by, opened_at: at
|
15
15
|
end
|
16
16
|
|
17
|
+
def mark?(marked, at: Time.now)
|
18
|
+
raise ArgumentError.new('The marked argument is required.') if marked.blank?
|
19
|
+
raise ArgumentError.new('The at argument is required.' ) if at.blank?
|
20
|
+
markings.marked_is(marked).valid_at(now: at).alive.exists?
|
21
|
+
end
|
22
|
+
|
17
23
|
end
|
18
24
|
|
19
25
|
end
|
@@ -2,7 +2,7 @@ module Unidom::ArticleNumber::Concerns::AsMarked
|
|
2
2
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
|
5
|
+
included do |includer|
|
6
6
|
|
7
7
|
has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked
|
8
8
|
|
@@ -13,6 +13,12 @@ module Unidom::ArticleNumber::Concerns::AsMarked
|
|
13
13
|
markings.create! barcode: as, marker: by, opened_at: at
|
14
14
|
end
|
15
15
|
|
16
|
+
def is_marked?(as: nil, at: Time.now)
|
17
|
+
raise ArgumentError.new('The as argument is required.') if as.blank?
|
18
|
+
raise ArgumentError.new('The at argument is required.') if at.blank?
|
19
|
+
markings.barcode_is(as).valid_at(now: at).alive.exists?
|
20
|
+
end
|
21
|
+
|
16
22
|
end
|
17
23
|
|
18
24
|
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: '1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|