cb_nitride 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cb_nitride/category_sorter.rb +5 -3
- data/lib/cb_nitride/diamond_item.rb +6 -10
- data/lib/cb_nitride/private_hasher.rb +3 -0
- data/lib/cb_nitride/version.rb +1 -1
- data/test/unit/diamond_item_test.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aa1250b7f2deacfbf3f1bec44e3b163fb5e2819
|
4
|
+
data.tar.gz: 015c504fe928d9227eddb02be3f7a778b2e0569b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f037679b84db72da768d7cbecde8c8967f3666a4e6ee40fcb6eeb7774b46bc5b5e742be9020813c6f6070709eb1d1ab924b3208a574f2ec090dde37bb56237c
|
7
|
+
data.tar.gz: 24d38999380fd572cebd2fdf8352daa5a7685d99e3ef95db4e543c0c9adaacfbf08c0d637df66fc80f22069d58910c8dc1cfd100591884d52ea03a33a0fc976a
|
@@ -19,14 +19,14 @@ module CbNitride
|
|
19
19
|
return ISSUE_CODE if is_issue?
|
20
20
|
end
|
21
21
|
|
22
|
-
private
|
23
|
-
|
24
22
|
def is_variant?
|
25
23
|
return @is_variant unless @is_variant.nil?
|
26
24
|
@is_variant = true if hash[:title].include? "VAR ED"
|
27
25
|
@is_variant = true if hash[:title].include? "COMBO PACK"
|
26
|
+
@is_variant = true if hash[:title].include? "STANDARD ED"
|
28
27
|
@is_variant = true if hash[:title].match(/(CVR)\s[B-Z]/)
|
29
28
|
@is_variant = false if @is_variant.nil?
|
29
|
+
@is_variant = false if specific_issue_patterns(hash[:title])
|
30
30
|
return @is_variant
|
31
31
|
end
|
32
32
|
|
@@ -67,12 +67,14 @@ module CbNitride
|
|
67
67
|
return @is_merch
|
68
68
|
end
|
69
69
|
|
70
|
+
private
|
71
|
+
|
70
72
|
def strict_issue_title_matcher(title)
|
71
73
|
/^(#{title})\s[#]/
|
72
74
|
end
|
73
75
|
|
74
76
|
def specific_issue_patterns(title)
|
75
|
-
title.match(/(CVR)\s[A]/)
|
77
|
+
title.match(/(CVR)\s[A]/) ||
|
76
78
|
title.match(strict_issue_title_matcher("RED SONJA")) ||
|
77
79
|
title.match(strict_issue_title_matcher("VAMPIRELLA")) ||
|
78
80
|
title.match(strict_issue_title_matcher("ARMY OF DARKNESS VS HACK SLASH")) ||
|
@@ -117,19 +117,15 @@ module CbNitride
|
|
117
117
|
|
118
118
|
def is_issue?
|
119
119
|
@_is_issue ||=
|
120
|
-
category_code == CategorySorter::ISSUE_CODE &&
|
120
|
+
category_code == CategorySorter::ISSUE_CODE && category_sorter.is_issue?
|
121
|
+
end
|
122
|
+
|
123
|
+
def category_sorter
|
124
|
+
@_category_sorter ||= CategorySorter.new({title: title, category_code: category_code })
|
121
125
|
end
|
122
126
|
|
123
127
|
def is_variant?
|
124
|
-
@_is_variant ||=
|
125
|
-
value = false
|
126
|
-
if category_code == CategorySorter::ISSUE_CODE
|
127
|
-
value = true if title.include?("VAR ED")
|
128
|
-
value = true if title.include?("COMBO PACK")
|
129
|
-
value = true if title.include?("STANDARD ED")
|
130
|
-
value = true if title.include?(" CVR") unless title.include?("REG CVR") || title.include?("CVR A")
|
131
|
-
end
|
132
|
-
value
|
128
|
+
@_is_variant ||= category_code == CategorySorter::ISSUE_CODE && category_sorter.is_variant?
|
133
129
|
end
|
134
130
|
end
|
135
131
|
end
|
data/lib/cb_nitride/version.rb
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
require_relative '../test_helper'
|
2
2
|
|
3
3
|
class DiamondItemTest < MiniTest::Unit::TestCase
|
4
|
+
def specific_issue
|
5
|
+
@_type ||= CbNitride::DiamondItem.new(
|
6
|
+
{
|
7
|
+
category_code: "1",
|
8
|
+
title: "RED SONJA #12 SECOND CVR"
|
9
|
+
}).product_type?
|
10
|
+
end
|
11
|
+
|
12
|
+
def main_cvrs_check
|
13
|
+
@_type ||= CbNitride::DiamondItem.new(
|
14
|
+
{
|
15
|
+
category_code: "1",
|
16
|
+
title: "SOMETHING SOMETHING #20 MAIN CVRS"
|
17
|
+
}).product_type?
|
18
|
+
end
|
19
|
+
|
4
20
|
def ideal_collection
|
5
21
|
@_ideal_collection ||= CbNitride::DiamondItem.new(
|
6
22
|
{
|
@@ -8,6 +24,7 @@ class DiamondItemTest < MiniTest::Unit::TestCase
|
|
8
24
|
title: "BATTLING BOY HC GN"
|
9
25
|
}).product_type?
|
10
26
|
end
|
27
|
+
|
11
28
|
def ideal_merchandise
|
12
29
|
@_ideal_merchandise ||= CbNitride::DiamondItem.new(
|
13
30
|
{
|
@@ -15,6 +32,7 @@ class DiamondItemTest < MiniTest::Unit::TestCase
|
|
15
32
|
title: "ADV TIME MARCELINE NAME ONLY PX JRS RAGLAN LG (C: 0-1-0)"
|
16
33
|
}).product_type?
|
17
34
|
end
|
35
|
+
|
18
36
|
def ideal_variant
|
19
37
|
@_ideal_variant ||= CbNitride::DiamondItem.new(
|
20
38
|
{
|
@@ -22,6 +40,7 @@ class DiamondItemTest < MiniTest::Unit::TestCase
|
|
22
40
|
title: "SANDMAN OVERTURE #1 (OF 6) CVR B (MR)"
|
23
41
|
}).product_type?
|
24
42
|
end
|
43
|
+
|
25
44
|
def ideal_issue
|
26
45
|
@_ideal_issue ||= CbNitride::DiamondItem.new(
|
27
46
|
{
|
@@ -31,6 +50,8 @@ class DiamondItemTest < MiniTest::Unit::TestCase
|
|
31
50
|
end
|
32
51
|
|
33
52
|
def test_that_they_are_the_right_items
|
53
|
+
assert_equal :issue, specific_issue
|
54
|
+
assert_equal :issue, main_cvrs_check
|
34
55
|
assert_equal :issue, ideal_issue
|
35
56
|
assert_equal :variant, ideal_variant
|
36
57
|
assert_equal :collection, ideal_collection
|