cb_nitride 0.1.41 → 0.1.43
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 +4 -4
- data/lib/cb_nitride/diamond_item.rb +2 -112
- data/lib/cb_nitride/public_hasher.rb +3 -10
- data/lib/cb_nitride/version.rb +1 -1
- data/lib/cb_nitride.rb +0 -2
- data/test/test_helper.rb +1 -0
- data/test/unit/private_hasher_test.rb +3 -23
- data/test/unit/public_hasher_test.rb +3 -24
- metadata +2 -6
- data/lib/cb_nitride/category_sorter.rb +0 -95
- data/lib/cb_nitride/title_formatter.rb +0 -68
- data/test/unit/diamond_item_test.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 802e587affbe9f50bd597c55ae1e7cabdc806a6c
|
4
|
+
data.tar.gz: c199b4958ef85e82aa4bfc974c0e118d2b343935
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4af2cbb519619f1f9ed41e2deaf5f1be49bc1b5cea9c471095d9ffb614c889900e4786f09ef4c737f692891eedc3e47a47df54430a87813b8ad5d91838cd336
|
7
|
+
data.tar.gz: 52fa620cb30c0553e3c1035de475f2c5208e10a67dbe32f92757aff1d7a98def294ecc478e5a249b487a64afb2a4c902b5dc2f6f964597b3506cc9eedce2e767
|
@@ -3,11 +3,11 @@ module CbNitride
|
|
3
3
|
|
4
4
|
SHORT_PAREN_OF_PATTERN = /\s*[O][f][(]/
|
5
5
|
|
6
|
-
|
6
|
+
attr_accessor :state, :diamond_number, :stock_number, :image_url, :publisher, :creators, :description, :release_date, :price, :category_code, :errors, :raw_title, :image
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
9
|
@state = options[:state]
|
10
|
-
@raw_title = options[:title]
|
10
|
+
@raw_title = options[:title].sub(SHORT_PAREN_OF_PATTERN, ' (Of ')
|
11
11
|
@diamond_number = options[:diamond_number]
|
12
12
|
@stock_number = options[:stock_number]
|
13
13
|
@image = options[:image]
|
@@ -20,115 +20,5 @@ module CbNitride
|
|
20
20
|
@category_code = options[:category_code]
|
21
21
|
@errors = options[:errors]
|
22
22
|
end
|
23
|
-
|
24
|
-
def release_year
|
25
|
-
if release_date.nil?
|
26
|
-
return nil
|
27
|
-
else
|
28
|
-
return release_date.year.to_i
|
29
|
-
end
|
30
|
-
end
|
31
|
-
def raw_title
|
32
|
-
@_raw_title ||= @raw_title.sub(SHORT_PAREN_OF_PATTERN, ' (Of ')
|
33
|
-
end
|
34
|
-
|
35
|
-
def author
|
36
|
-
@_author ||= creators_hash["W"]
|
37
|
-
end
|
38
|
-
|
39
|
-
def artist
|
40
|
-
@_artist ||= creators_hash["A"]
|
41
|
-
end
|
42
|
-
|
43
|
-
def cover_artist
|
44
|
-
@_cover_artist ||= creators_hash["CA"]
|
45
|
-
end
|
46
|
-
|
47
|
-
def series_title
|
48
|
-
@_series_title ||= title_formatter.series_title || title
|
49
|
-
end
|
50
|
-
|
51
|
-
def title
|
52
|
-
@_title ||= title_formatter.clean_title
|
53
|
-
end
|
54
|
-
|
55
|
-
def special_number
|
56
|
-
@_special_number ||= title_formatter.special_number
|
57
|
-
end
|
58
|
-
|
59
|
-
def issue_number
|
60
|
-
@issue_number ||= title_formatter.issue_number
|
61
|
-
end
|
62
|
-
|
63
|
-
def limited_series_max_issue
|
64
|
-
@_limited_series_max_issue ||= title_formatter.limited_series_max_issue
|
65
|
-
end
|
66
|
-
|
67
|
-
def variant_description
|
68
|
-
@_variant_description ||= title_formatter.variant_description
|
69
|
-
end
|
70
|
-
|
71
|
-
def product_type?
|
72
|
-
return :issue if is_issue?
|
73
|
-
return :variant if is_variant?
|
74
|
-
return :collection if is_collection?
|
75
|
-
return :merchandise if is_merch?
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def creators_hash
|
81
|
-
return @_creators_hash if @_creators_hash
|
82
|
-
array = creators.split('(').map {|x| x.split(')')}.flatten.map {|x| x.strip}
|
83
|
-
hash ={}
|
84
|
-
array.each_with_index do |val, i|
|
85
|
-
if i.even? || i == 0
|
86
|
-
if val.include? '/'
|
87
|
-
val.split('/').each_with_index do |key, index|
|
88
|
-
instance_variable_set("@key#{index + 1}".to_sym, key)
|
89
|
-
end
|
90
|
-
else
|
91
|
-
@key = val
|
92
|
-
end
|
93
|
-
elsif i.odd?
|
94
|
-
@value = val
|
95
|
-
hash.merge! @key => @value if @key
|
96
|
-
hash.merge! @key1 => @value if @key1
|
97
|
-
hash.merge! @key2 => @value if @key2
|
98
|
-
hash.merge! @key3 => @value if @key3
|
99
|
-
@value = nil
|
100
|
-
@key = nil
|
101
|
-
@key1= nil
|
102
|
-
@key2 = nil
|
103
|
-
@key3 = nil
|
104
|
-
end
|
105
|
-
end
|
106
|
-
@_creators_hash = hash
|
107
|
-
end
|
108
|
-
|
109
|
-
def title_formatter
|
110
|
-
@_formatted_title ||= TitleFormatter.new(raw_title)
|
111
|
-
end
|
112
|
-
|
113
|
-
def is_collection?
|
114
|
-
@_is_collection ||= CategorySorter::COLLECTION_CODE == category_code
|
115
|
-
end
|
116
|
-
|
117
|
-
def is_merch?
|
118
|
-
@_is_merch ||= CategorySorter::MERCHANDISE_CODES.include? category_code
|
119
|
-
end
|
120
|
-
|
121
|
-
def is_issue?
|
122
|
-
@_is_issue ||=
|
123
|
-
category_code == CategorySorter::ISSUE_CODE && category_sorter.is_issue?
|
124
|
-
end
|
125
|
-
|
126
|
-
def category_sorter
|
127
|
-
@_category_sorter ||= CategorySorter.new({title: title, category_code: category_code })
|
128
|
-
end
|
129
|
-
|
130
|
-
def is_variant?
|
131
|
-
@_is_variant ||= category_code == CategorySorter::ISSUE_CODE && category_sorter.is_variant?
|
132
|
-
end
|
133
23
|
end
|
134
24
|
end
|
@@ -26,7 +26,7 @@ module CbNitride
|
|
26
26
|
if item.valid_diamond_number?
|
27
27
|
item.spawn_item
|
28
28
|
else
|
29
|
-
return
|
29
|
+
return NullItem.new(diamond_number)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -53,8 +53,8 @@ module CbNitride
|
|
53
53
|
item_page.css("a.FancyPopupImage").children[1]["alt"].gsub(" Image", "")
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
57
|
-
@
|
56
|
+
def branded_hash
|
57
|
+
@_branded_hash ||= {
|
58
58
|
title: find_text_with(TITLE_CLASS),
|
59
59
|
diamond_number: diamond_number,
|
60
60
|
stock_number: get_stock_number,
|
@@ -73,13 +73,6 @@ module CbNitride
|
|
73
73
|
MechanizeClip.get get_image_url(BASE_URL, IMAGE_CLASS), agent
|
74
74
|
end
|
75
75
|
|
76
|
-
def branded_hash
|
77
|
-
@_branded_hash ||=
|
78
|
-
uncategorized_hash.merge!(
|
79
|
-
category_code: CategorySorter.new(uncategorized_hash).sort
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
76
|
def item_page
|
84
77
|
@item_page ||= Nokogiri::HTML(agent.get(SEARCH_URL + diamond_number).content)
|
85
78
|
end
|
data/lib/cb_nitride/version.rb
CHANGED
data/lib/cb_nitride.rb
CHANGED
@@ -6,11 +6,9 @@ require "cb_nitride/configuration"
|
|
6
6
|
require "cb_nitride/diamond_login"
|
7
7
|
require "cb_nitride/public_hasher"
|
8
8
|
require "cb_nitride/private_hasher"
|
9
|
-
require "cb_nitride/category_sorter"
|
10
9
|
require "cb_nitride/diamond_item"
|
11
10
|
require "cb_nitride/diamond_number_set"
|
12
11
|
require "cb_nitride/diamond_number_formatter"
|
13
|
-
require "cb_nitride/title_formatter"
|
14
12
|
require "cb_nitride/null_item"
|
15
13
|
|
16
14
|
module CbNitride
|
data/test/test_helper.rb
CHANGED
@@ -27,7 +27,6 @@ class PrivateHasherTest < MiniTest::Unit::TestCase
|
|
27
27
|
|
28
28
|
def test_that_the_private_diamond_item_contains_the_right_fields
|
29
29
|
setup_object(ISSUE_CODE)
|
30
|
-
refute_equal @item.title, "Pug Party Parade"
|
31
30
|
assert_equal @item.stock_number, "STK611169"
|
32
31
|
assert_equal @item.diamond_number, ISSUE_CODE
|
33
32
|
assert_equal @item.image.class, MechanizeClip::PageTmpFile
|
@@ -40,28 +39,9 @@ class PrivateHasherTest < MiniTest::Unit::TestCase
|
|
40
39
|
assert_equal @item.category_code, "1"
|
41
40
|
end
|
42
41
|
|
43
|
-
def test_that_the_private_hash_identifies_issues
|
44
|
-
setup_object(ISSUE_CODE)
|
45
|
-
assert_equal @item.category_code, ISSUE_CATEGORY_CODE
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_that_the_private_hash_identifies_variants
|
49
|
-
setup_object(VARIANT_CODE)
|
50
|
-
assert_equal @item.category_code, ISSUE_CATEGORY_CODE
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_that_the_private_hash_identifies_merchandise
|
54
|
-
setup_object(MERCH_CODE)
|
55
|
-
assert_includes MERCHANDISE_CATEGORY_CODES, @item.category_code
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_that_the_private_hash_identifies_collection
|
59
|
-
setup_object(COLLECTION_CODE)
|
60
|
-
assert_equal @item.category_code, COLLECTION_CATEGORY_CODE
|
61
|
-
end
|
62
|
-
|
63
42
|
def test_that_the_private_hash_identifies_invalid_diamond_codes
|
64
|
-
setup_object(
|
65
|
-
assert_equal @item,
|
43
|
+
setup_object(BAD_CODE)
|
44
|
+
assert_equal @item.class, CbNitride::NullItem
|
45
|
+
assert_equal @item.diamond_number, BAD_CODE
|
66
46
|
end
|
67
47
|
end
|
@@ -18,7 +18,6 @@ class PublicHasherTest < MiniTest::Unit::TestCase
|
|
18
18
|
|
19
19
|
def test_that_the_public_diamond_item_contains_the_right_fields
|
20
20
|
setup_object(ISSUE_CODE)
|
21
|
-
refute_equal @item.title, "Pug Party Parade"
|
22
21
|
assert_equal @item.stock_number, "STK611169"
|
23
22
|
assert_equal @item.diamond_number, ISSUE_CODE
|
24
23
|
assert_equal @item.image.class, MechanizeClip::PageTmpFile
|
@@ -28,32 +27,12 @@ class PublicHasherTest < MiniTest::Unit::TestCase
|
|
28
27
|
assert_equal @item.release_date.to_s, "2013-06-05"
|
29
28
|
assert_equal @item.price, 2.99
|
30
29
|
assert_equal @item.state, :public
|
31
|
-
assert_equal @item.category_code, "1"
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_that_the_public_hash_identifies_issues
|
35
|
-
setup_object(ISSUE_CODE)
|
36
|
-
assert_equal @item.category_code, ISSUE_CATEGORY_CODE
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_that_the_public_hash_identifies_variants
|
40
|
-
setup_object(VARIANT_CODE)
|
41
|
-
assert_equal @item.category_code, ISSUE_CATEGORY_CODE
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_that_the_public_hash_identifies_merchandise
|
45
|
-
setup_object(MERCH_CODE)
|
46
|
-
assert_includes MERCHANDISE_CATEGORY_CODES, @item.category_code
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_that_the_public_hash_identifies_collection
|
50
|
-
setup_object(COLLECTION_CODE)
|
51
|
-
assert_equal @item.category_code, COLLECTION_CATEGORY_CODE
|
52
30
|
end
|
53
31
|
|
54
32
|
def test_that_the_public_hash_identifies_invalid_diamond_codes
|
55
|
-
setup_object(
|
56
|
-
assert_equal @item,
|
33
|
+
setup_object(BAD_CODE)
|
34
|
+
assert_equal @item.class, CbNitride::NullItem
|
35
|
+
assert_equal @item.diamond_number, BAD_CODE
|
57
36
|
end
|
58
37
|
|
59
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cb_nitride
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Jarvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,6 @@ files:
|
|
94
94
|
- Rakefile
|
95
95
|
- cb_nitride.gemspec
|
96
96
|
- lib/cb_nitride.rb
|
97
|
-
- lib/cb_nitride/category_sorter.rb
|
98
97
|
- lib/cb_nitride/configuration.rb
|
99
98
|
- lib/cb_nitride/diamond_item.rb
|
100
99
|
- lib/cb_nitride/diamond_login.rb
|
@@ -106,7 +105,6 @@ files:
|
|
106
105
|
- lib/cb_nitride/null_item.rb
|
107
106
|
- lib/cb_nitride/private_hasher.rb
|
108
107
|
- lib/cb_nitride/public_hasher.rb
|
109
|
-
- lib/cb_nitride/title_formatter.rb
|
110
108
|
- lib/cb_nitride/version.rb
|
111
109
|
- test/cassettes/test_that_it_can_log_in_cassette.yml
|
112
110
|
- test/cassettes/test_that_it_fails_with_bad_information_cassette.yml
|
@@ -129,7 +127,6 @@ files:
|
|
129
127
|
- test/cassettes/test_that_the_public_hash_produces_a_diamond_item_cassette.yml
|
130
128
|
- test/test_helper.rb
|
131
129
|
- test/unit/configuration_test.rb
|
132
|
-
- test/unit/diamond_item_test.rb
|
133
130
|
- test/unit/diamond_login_test.rb
|
134
131
|
- test/unit/diamond_number_formatter_test.rb
|
135
132
|
- test/unit/private_hasher_test.rb
|
@@ -182,7 +179,6 @@ test_files:
|
|
182
179
|
- test/cassettes/test_that_the_public_hash_produces_a_diamond_item_cassette.yml
|
183
180
|
- test/test_helper.rb
|
184
181
|
- test/unit/configuration_test.rb
|
185
|
-
- test/unit/diamond_item_test.rb
|
186
182
|
- test/unit/diamond_login_test.rb
|
187
183
|
- test/unit/diamond_number_formatter_test.rb
|
188
184
|
- test/unit/private_hasher_test.rb
|
@@ -1,95 +0,0 @@
|
|
1
|
-
module CbNitride
|
2
|
-
class CategorySorter
|
3
|
-
|
4
|
-
ISSUE_CODE = "1"
|
5
|
-
COLLECTION_CODE = "3"
|
6
|
-
MERCHANDISE_CODES = ["2", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"]
|
7
|
-
|
8
|
-
attr_reader :hash
|
9
|
-
|
10
|
-
def initialize(hash)
|
11
|
-
@hash = hash
|
12
|
-
end
|
13
|
-
|
14
|
-
def sort
|
15
|
-
return hash[:category_code] unless hash[:category_code].nil?
|
16
|
-
return ISSUE_CODE if is_variant?
|
17
|
-
return COLLECTION_CODE if is_collection?
|
18
|
-
return "16" if is_merch?
|
19
|
-
return ISSUE_CODE if is_issue?
|
20
|
-
end
|
21
|
-
|
22
|
-
def is_variant?
|
23
|
-
return @is_variant unless @is_variant.nil?
|
24
|
-
@is_variant = true if hash[:title].include? "VAR ED"
|
25
|
-
@is_variant = true if hash[:title].include? "COMBO PACK"
|
26
|
-
@is_variant = true if hash[:title].include? "STANDARD ED"
|
27
|
-
@is_variant = true if hash[:title].match(/(CVR)\s[B-Z]/)
|
28
|
-
@is_variant = true if specific_issue_patterns(hash[:title])
|
29
|
-
@is_variant = false if @is_variant.nil?
|
30
|
-
return @is_variant
|
31
|
-
end
|
32
|
-
|
33
|
-
def is_issue?
|
34
|
-
return @is_issue unless @is_issue.nil?
|
35
|
-
if specific_issue_patterns(hash[:title])
|
36
|
-
@is_issue = true
|
37
|
-
elsif is_variant?
|
38
|
-
@is_issue = false
|
39
|
-
elsif is_collection?
|
40
|
-
@is_issue = false
|
41
|
-
elsif is_merch?
|
42
|
-
@is_issue = false
|
43
|
-
else
|
44
|
-
@is_issue = true
|
45
|
-
end
|
46
|
-
return @is_issue
|
47
|
-
end
|
48
|
-
|
49
|
-
def is_collection?
|
50
|
-
return @is_collection unless @is_collection.nil?
|
51
|
-
@is_collection = true if hash[:title].include?(" GN ")
|
52
|
-
@is_collection = true if hash[:title].include?(" TP ")
|
53
|
-
@is_collection = true if hash[:title].match(/\s(VOL)\s\d+/)
|
54
|
-
@is_collection = false if hash[:title].match(/\s[#]\d+/)
|
55
|
-
@is_collection = false if @is_collection.nil?
|
56
|
-
return @is_collection
|
57
|
-
end
|
58
|
-
|
59
|
-
def is_merch?
|
60
|
-
return @is_merch unless @is_merch.nil?
|
61
|
-
case hash[:creators]
|
62
|
-
when ""
|
63
|
-
@is_merch = true
|
64
|
-
else
|
65
|
-
@is_merch = false
|
66
|
-
end
|
67
|
-
return @is_merch
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def strict_issue_title_matcher(title)
|
73
|
-
/^(#{title})\s[#]/
|
74
|
-
end
|
75
|
-
|
76
|
-
def specific_issue_patterns(title)
|
77
|
-
title.match(/(CVR)\s[A]/) ||
|
78
|
-
title.match(strict_issue_title_matcher("RED SONJA")) ||
|
79
|
-
title.match(strict_issue_title_matcher("VAMPIRELLA")) ||
|
80
|
-
title.match(strict_issue_title_matcher("ARMY OF DARKNESS VS HACK SLASH")) ||
|
81
|
-
split_issue_patterns(title)
|
82
|
-
end
|
83
|
-
|
84
|
-
def split_issue_patterns(title)
|
85
|
-
return nil unless title.split("#")[1]
|
86
|
-
title.split("#")[1].match(/\d\D+(PTG)/) ||
|
87
|
-
title.split('#')[1].match(/(REORDER ED)/) ||
|
88
|
-
title.split('#')[1].match(/(SKETCH ED)/) ||
|
89
|
-
title.split('#')[1].match(/(FOIL CVR)/) ||
|
90
|
-
title.split("#")[1].include?("VAR INCENTIVE CVR") ||
|
91
|
-
title.split("#")[1].include?("DIRECT MARKET CVR") ||
|
92
|
-
title.split("#")[1].include?("MAIN CVRS")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module CbNitride
|
2
|
-
class TitleFormatter
|
3
|
-
|
4
|
-
attr_accessor :raw_title
|
5
|
-
|
6
|
-
#TODO: This really only works for variants and issues.
|
7
|
-
|
8
|
-
def initialize(raw_title)
|
9
|
-
@raw_title = raw_title
|
10
|
-
end
|
11
|
-
|
12
|
-
LONG_PAREN_OF_PATTERN = /[(].*[Oo][fF].*\d+.*[)]/
|
13
|
-
|
14
|
-
def series_title
|
15
|
-
@_series_title ||=
|
16
|
-
if clean_title.include? "#"
|
17
|
-
clean_title.split("#").first.strip
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def special_number
|
22
|
-
@_special_number ||=
|
23
|
-
match = clean_title.match(/#\S+/).to_s.gsub('#', '').strip
|
24
|
-
if match.nil? || match.empty?
|
25
|
-
nil
|
26
|
-
else
|
27
|
-
match
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def issue_number
|
32
|
-
@_issue_number ||=
|
33
|
-
match = clean_title.match(/#\d+/).to_s.gsub('#', '').strip
|
34
|
-
if match.nil? || match.empty?
|
35
|
-
nil
|
36
|
-
else
|
37
|
-
match.to_i
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def limited_series_max_issue
|
42
|
-
@_limited_series_max_issue ||=
|
43
|
-
if clean_title.match(LONG_PAREN_OF_PATTERN)
|
44
|
-
clean_long_paren_of_text
|
45
|
-
else
|
46
|
-
nil
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def variant_description
|
51
|
-
@_variant_description ||=
|
52
|
-
array = clean_title.split(/#\S+/)
|
53
|
-
return nil if array.size == 1
|
54
|
-
string = array.last.gsub(LONG_PAREN_OF_PATTERN, '').strip
|
55
|
-
string.empty? ? nil : string
|
56
|
-
end
|
57
|
-
|
58
|
-
def clean_long_paren_of_text
|
59
|
-
clean_title.match(LONG_PAREN_OF_PATTERN).to_s.match(/\d+/).to_s.strip.to_i
|
60
|
-
end
|
61
|
-
|
62
|
-
def clean_title
|
63
|
-
@_clean_title ||=
|
64
|
-
raw_title.gsub(/[(][C].*[)]?/, '').gsub('(MR)', '').gsub('(NET)', '').strip
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
|
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
|
-
|
20
|
-
def ideal_collection
|
21
|
-
@_ideal_collection ||= CbNitride::DiamondItem.new(
|
22
|
-
{
|
23
|
-
category_code: "3",
|
24
|
-
title: "BATTLING BOY HC GN"
|
25
|
-
}).product_type?
|
26
|
-
end
|
27
|
-
|
28
|
-
def ideal_merchandise
|
29
|
-
@_ideal_merchandise ||= CbNitride::DiamondItem.new(
|
30
|
-
{
|
31
|
-
category_code: "16",
|
32
|
-
title: "ADV TIME MARCELINE NAME ONLY PX JRS RAGLAN LG (C: 0-1-0)"
|
33
|
-
}).product_type?
|
34
|
-
end
|
35
|
-
|
36
|
-
def ideal_variant
|
37
|
-
@_ideal_variant ||= CbNitride::DiamondItem.new(
|
38
|
-
{
|
39
|
-
category_code: "1",
|
40
|
-
title: "SANDMAN OVERTURE #1 (OF 6) CVR B (MR)"
|
41
|
-
}).product_type?
|
42
|
-
end
|
43
|
-
|
44
|
-
def ideal_issue
|
45
|
-
@_ideal_issue ||= CbNitride::DiamondItem.new(
|
46
|
-
{
|
47
|
-
category_code: "1",
|
48
|
-
title: "SANDMAN OVERTURE #1 (OF 6) CVR A (MR)"
|
49
|
-
}).product_type?
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_that_they_are_the_right_items
|
53
|
-
assert_equal :issue, specific_issue
|
54
|
-
assert_equal :issue, main_cvrs_check
|
55
|
-
assert_equal :issue, ideal_issue
|
56
|
-
assert_equal :variant, ideal_variant
|
57
|
-
assert_equal :collection, ideal_collection
|
58
|
-
assert_equal :merchandise, ideal_merchandise
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|