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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93f4436426d9597cff0264f811ffc7788baf4491
4
- data.tar.gz: 843a14c73cd07f3061ce7b8ddd079c1d61bfac84
3
+ metadata.gz: 0aa1250b7f2deacfbf3f1bec44e3b163fb5e2819
4
+ data.tar.gz: 015c504fe928d9227eddb02be3f7a778b2e0569b
5
5
  SHA512:
6
- metadata.gz: cfe2451f13775b4709376feb073787a70bf44d158d76727b523d5df7c57115ad413e456bc11c5589f73d06e103f19cce5a18f3bf6e98cab5b0e2e8456026ad1c
7
- data.tar.gz: cad7ce264a8247fe788ac9950f8204933e39c1ffeeebb0481e5ea8e9fff9389c4c21778e279bd938ca19f876d54b2ffd18aa891749e53f95198e97311907bdb4
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 && is_variant? == false
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
@@ -71,6 +71,9 @@ module CbNitride
71
71
  MechanizeClip.get(get_image_url(BASE_URL, IMAGE_CLASS), agent)
72
72
  end
73
73
 
74
+ def fine_sort
75
+ end
76
+
74
77
  def item_page
75
78
  @item_page ||= Nokogiri::HTML(agent.get(SEARCH_URL + diamond_number).content)
76
79
  end
@@ -1,3 +1,3 @@
1
1
  module CbNitride
2
- VERSION = "0.1.19"
2
+ VERSION = "0.1.20"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb_nitride
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Jarvis