wowget 0.3.1 → 0.4.0

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.
Files changed (4) hide show
  1. data/lib/wowget/item.rb +132 -116
  2. data/lib/wowget.rb +1 -1
  3. data/spec/item_spec.rb +14 -6
  4. metadata +2 -2
data/lib/wowget/item.rb CHANGED
@@ -24,140 +24,140 @@ module Wowget
24
24
 
25
25
  QUALITIES = ['Poor', 'Common', 'Uncommon', 'Rare', 'Epic', 'Legendary', 'Artifact', 'Heirloom']
26
26
  CATEGORIES = {
27
- 0 => 'Consumables',
28
- 1 => 'Containers',
29
- 2 => 'Weapons',
30
- 3 => 'Gems',
31
- 4 => 'Armor',
32
- 7 => 'Trade Goods',
33
- 9 => 'Recipes',
34
- 10 => 'Currency',
35
- 12 => 'Quest',
36
- 13 => 'Keys',
37
- 15 => 'Miscellaneous',
38
- 16 => 'Glyphs'
27
+ 0 => {:name => 'Consumables', :slug => 'consumables'},
28
+ 1 => {:name => 'Containers', :slug => 'containers'},
29
+ 2 => {:name => 'Weapons', :slug => 'weapons'},
30
+ 3 => {:name => 'Gems', :slug => 'gems'},
31
+ 4 => {:name => 'Armor', :slug => 'armor'},
32
+ 7 => {:name => 'Trade Goods', :slug => 'tradegoods'},
33
+ 9 => {:name => 'Recipes', :slug => 'recipes'},
34
+ 10 => {:name => 'Currency', :slug => 'currency'},
35
+ 12 => {:name => 'Quest', :slug => 'quest'},
36
+ 13 => {:name => 'Keys', :slug => 'keys'},
37
+ 15 => {:name => 'Miscellaneous', :slug => 'miscellaneous'},
38
+ 16 => {:name => 'Glyphs', :slug => 'glyphs'}
39
39
  }
40
40
  SUBCATEGORIES = {
41
41
  'Consumables' => {
42
- 0 => 'Consumables',
43
- 1 => 'Potions',
44
- 2 => 'Elixirs',
45
- 3 => 'Flasks',
46
- 4 => 'Scrolls',
47
- 5 => 'Food & Drinks',
48
- 6 => 'Item Enhancements (Permanent)',
49
- -3 => 'Item Enhancements (Temporary)',
50
- 7 => 'Bandages',
51
- 8 => 'Other'
42
+ 0 => {:name => 'Consumables', :slug => 'consumables'},
43
+ 1 => {:name => 'Potions', :slug => 'potions'},
44
+ 2 => {:name => 'Elixirs', :slug => 'elixirs'},
45
+ 3 => {:name => 'Flasks', :slug => 'flasks'},
46
+ 4 => {:name => 'Scrolls', :slug => 'scrolls'},
47
+ 5 => {:name => 'Food & Drinks', :slug => 'food_and_drinks'},
48
+ 6 => {:name => 'Item Enhancements (Permanent)', :slug => 'item_enhancements_permanent'},
49
+ -3 => {:name => 'Item Enhancements (Temporary)', :slug => 'item_enhancements_temporary'},
50
+ 7 => {:name => 'Bandages', :slug => 'bandages'},
51
+ 8 => {:name => 'Other', :slug => 'other'}
52
52
  },
53
53
  'Containers' => {
54
- 0 => 'Bags',
55
- 2 => 'Herb Bags',
56
- 3 => 'Enchanting Bags',
57
- 4 => 'Engineering Bags',
58
- 5 => 'Gem Bags',
59
- 6 => 'Mining Bags',
60
- 7 => 'Leatherworking Bags',
61
- 8 => 'Inscription Bags',
62
- 9 => 'Tackle Boxes'
54
+ 0 => {:name => 'Bags', :slug => 'bags'},
55
+ 2 => {:name => 'Herb Bags', :slug => 'herb'},
56
+ 3 => {:name => 'Enchanting Bags', :slug => 'enchanting'},
57
+ 4 => {:name => 'Engineering Bags', :slug => 'engineering'},
58
+ 5 => {:name => 'Gem Bags', :slug => 'gem'},
59
+ 6 => {:name => 'Mining Bags', :slug => 'mining'},
60
+ 7 => {:name => 'Leatherworking Bags', :slug => 'leatherworking'},
61
+ 8 => {:name => 'Inscription Bags', :slug => 'inscription'},
62
+ 9 => {:name => 'Tackle Boxes', :slug => 'tackleboxes'}
63
63
  },
64
64
  'Weapons' => {
65
- 1 => 'Two-Handed Axes',
66
- 2 => 'Bows',
67
- 3 => 'Guns',
68
- 4 => 'One-Handed Maces',
69
- 5 => 'Two-Handed Maces',
70
- 6 => 'Polearms',
71
- 7 => 'One-Handed Swords',
72
- 8 => 'Two-Handed Swords',
73
- 10 => 'Staves',
74
- 13 => 'Fist Weapons',
75
- 14 => 'Miscellaneous',
76
- 15 => 'Daggers',
77
- 16 => 'Thrown',
78
- 18 => 'Crossbows',
79
- 19 => 'Wands',
80
- 20 => 'Fishing Poles'
65
+ 1 => {:name => 'Two-Handed Axes', :slug => 'two_handed_axes'},
66
+ 2 => {:name => 'Bows', :slug => 'bows'},
67
+ 3 => {:name => 'Guns', :slug => 'guns'},
68
+ 4 => {:name => 'One-Handed Maces', :slug => 'one_handed_maces'},
69
+ 5 => {:name => 'Two-Handed Maces', :slug => 'two_handed_maces'},
70
+ 6 => {:name => 'Polearms', :slug => 'polearms'},
71
+ 7 => {:name => 'One-Handed Swords', :slug => 'one_handed_swords'},
72
+ 8 => {:name => 'Two-Handed Swords', :slug => 'two_handed_swords'},
73
+ 10 => {:name => 'Staves', :slug => 'staves'},
74
+ 13 => {:name => 'Fist Weapons', :slug => 'fist_weapons'},
75
+ 14 => {:name => 'Miscellaneous', :slug => 'miscellaneous'},
76
+ 15 => {:name => 'Daggers', :slug => 'daggers'},
77
+ 16 => {:name => 'Thrown', :slug => 'thrown'},
78
+ 18 => {:name => 'Crossbows', :slug => 'crossbows'},
79
+ 19 => {:name => 'Wands', :slug => 'wands'},
80
+ 20 => {:name => 'Fishing Poles', :slug => 'fishing_poles'}
81
81
  },
82
82
  'Gems' => {
83
- 1 => 'Blue',
84
- 2 => 'Yellow',
85
- 3 => 'Purple',
86
- 4 => 'Green',
87
- 5 => 'Orange',
88
- 6 => 'Meta',
89
- 7 => 'Simple',
90
- 8 => 'Prismatic',
91
- 9 => 'Hydraulic',
92
- 10 => 'Cogwheel'
83
+ 1 => {:name => 'Blue', :slug => 'blue'},
84
+ 2 => {:name => 'Yellow', :slug => 'yellow'},
85
+ 3 => {:name => 'Purple', :slug => 'purple'},
86
+ 4 => {:name => 'Green', :slug => 'green'},
87
+ 5 => {:name => 'Orange', :slug => 'orange'},
88
+ 6 => {:name => 'Meta', :slug => 'meta'},
89
+ 7 => {:name => 'Simple', :slug => 'simple'},
90
+ 8 => {:name => 'Prismatic', :slug => 'prismatic'},
91
+ 9 => {:name => 'Hydraulic', :slug => 'hydraulic'},
92
+ 10 => {:name => 'Cogwheel', :slug => 'cogwheel'}
93
93
  },
94
94
  'Armor' => {
95
- -8 => 'Shirts',
96
- -7 => 'Tabards',
97
- -6 => 'Cloaks',
98
- -5 => 'Off-hand Frills',
99
- -4 => 'Trinkets',
100
- -3 => 'Amulets',
101
- -2 => 'Rings',
102
- 0 => 'Miscellaneous',
103
- 1 => 'Cloth Armor',
104
- 2 => 'Leather Armor',
105
- 3 => 'Mail Armor',
106
- 4 => 'Plate Armor',
107
- 6 => 'Shields',
108
- 11 => 'Relics'
95
+ -8 => {:name => 'Shirts', :slug => 'shirts'},
96
+ -7 => {:name => 'Tabards', :slug => 'tabards'},
97
+ -6 => {:name => 'Cloaks', :slug => 'cloaks'},
98
+ -5 => {:name => 'Off-hand Frills', :slug => 'off_hand_frills'},
99
+ -4 => {:name => 'Trinkets', :slug => 'trinkets'},
100
+ -3 => {:name => 'Amulets', :slug => 'amulets'},
101
+ -2 => {:name => 'Rings', :slug => 'rings'},
102
+ 0 => {:name => 'Miscellaneous', :slug => 'miscellaneous'},
103
+ 1 => {:name => 'Cloth', :slug => 'cloth'},
104
+ 2 => {:name => 'Leather', :slug => 'leather'},
105
+ 3 => {:name => 'Mail', :slug => 'mail'},
106
+ 4 => {:name => 'Plate', :slug => 'plate'},
107
+ 6 => {:name => 'Shields', :slug => 'shields'},
108
+ 11 => {:name => 'Relics', :slug => 'relics'}
109
109
  },
110
110
  'Trade Goods' => {
111
- 1 => 'Parts',
112
- 2 => 'Explosives',
113
- 3 => 'Devices',
114
- 4 => 'Jewelcrafting',
115
- 5 => 'Cloth',
116
- 6 => 'Leather',
117
- 7 => 'Metal & Stone',
118
- 8 => 'Meat',
119
- 9 => 'Herbs',
120
- 10 => 'Elemental',
121
- 11 => 'Other',
122
- 12 => 'Enchanting',
123
- 13 => 'Materials',
124
- 14 => 'Armor Enchantments',
125
- 15 => 'Weapon Enchantments'
111
+ 1 => {:name => 'Parts', :slug => 'parts'},
112
+ 2 => {:name => 'Explosives', :slug => 'explosives'},
113
+ 3 => {:name => 'Devices', :slug => 'devices'},
114
+ 4 => {:name => 'Jewelcrafting', :slug => 'jewelcrafting'},
115
+ 5 => {:name => 'Cloth', :slug => 'cloth'},
116
+ 6 => {:name => 'Leather', :slug => 'leather'},
117
+ 7 => {:name => 'Metal & Stone', :slug => 'metal_and_stone'},
118
+ 8 => {:name => 'Meat', :slug => 'meat'},
119
+ 9 => {:name => 'Herbs', :slug => 'herbs'},
120
+ 10 => {:name => 'Elemental', :slug => 'elemental'},
121
+ 11 => {:name => 'Other', :slug => 'other'},
122
+ 12 => {:name => 'Enchanting', :slug => 'enchanting'},
123
+ 13 => {:name => 'Materials', :slug => 'materials'},
124
+ 14 => {:name => 'Armor Enchantments', :slug => 'armor_enchantments'},
125
+ 15 => {:name => 'Weapon Enchantments', :slug => 'weapon_enchantments'}
126
126
  },
127
127
  'Recipes' => {
128
- 0 => 'Books ',
129
- 1 => 'Leatherworking Patterns',
130
- 2 => 'Tailoring Patterns',
131
- 3 => 'Engineering Schematics',
132
- 4 => 'Blacksmithing Plans',
133
- 5 => 'Cooking Recipes',
134
- 6 => 'Alchemy Recipes',
135
- 7 => 'First Aid Manuals',
136
- 8 => 'Enchanting Formulae',
137
- 9 => 'Fishing Books',
138
- 10 => 'Jewelcrafting Designs',
139
- 11 => 'Inscription Techniques'
128
+ 0 => {:name => 'Books ', :slug => 'books'},
129
+ 1 => {:name => 'Leatherworking Patterns', :slug => 'leatherworking'},
130
+ 2 => {:name => 'Tailoring Patterns', :slug => 'tailoring'},
131
+ 3 => {:name => 'Engineering Schematics', :slug => 'engineering'},
132
+ 4 => {:name => 'Blacksmithing Plans', :slug => 'blacksmithing'},
133
+ 5 => {:name => 'Cooking Recipes', :slug => 'cooking'},
134
+ 6 => {:name => 'Alchemy Recipes', :slug => 'alchemy'},
135
+ 7 => {:name => 'First Aid Manuals', :slug => 'first_aid'},
136
+ 8 => {:name => 'Enchanting Formulae', :slug => 'enchanting'},
137
+ 9 => {:name => 'Fishing Books', :slug => 'fishing'},
138
+ 10 => {:name => 'Jewelcrafting Designs', :slug => 'jewelcrafting'},
139
+ 11 => {:name => 'Inscription Techniques', :slug => 'inscription'}
140
140
  },
141
141
  'Miscellaneous' => {
142
- -2 => 'Armor Tokens',
143
- 0 => 'Junk',
144
- 1 => 'Reagents',
145
- 2 => 'Companions',
146
- 3 => 'Holiday',
147
- 4 => 'Other',
148
- 5 => 'Mounts'
142
+ -2 => {:name => 'Armor Tokens', :slug => 'armor_tokens'},
143
+ 0 => {:name => 'Junk', :slug => 'junk'},
144
+ 1 => {:name => 'Reagents', :slug => 'reagents'},
145
+ 2 => {:name => 'Companions', :slug => 'companions'},
146
+ 3 => {:name => 'Holiday', :slug => 'holiday'},
147
+ 4 => {:name => 'Other', :slug => 'other'},
148
+ 5 => {:name => 'Mounts', :slug => 'mounts'}
149
149
  },
150
150
  'Glyphs' => {
151
- 1 => 'Warrior',
152
- 2 => 'Paladin',
153
- 3 => 'Hunter',
154
- 4 => 'Rogue',
155
- 5 => 'Priest',
156
- 6 => 'Death Knight',
157
- 7 => 'Shaman',
158
- 8 => 'Mage',
159
- 9 => 'Warlock',
160
- 11 => 'Druid'
151
+ 1 => {:name => 'Warrior', :slug => 'warrior'},
152
+ 2 => {:name => 'Paladin', :slug => 'paladin'},
153
+ 3 => {:name => 'Hunter', :slug => 'hunter'},
154
+ 4 => {:name => 'Rogue', :slug => 'rogue'},
155
+ 5 => {:name => 'Priest', :slug => 'priest'},
156
+ 6 => {:name => 'Death Knight', :slug => 'death_knight'},
157
+ 7 => {:name => 'Shaman', :slug => 'shaman'},
158
+ 8 => {:name => 'Mage', :slug => 'mage'},
159
+ 9 => {:name => 'Warlock', :slug => 'warlock'},
160
+ 11 => {:name => 'Druid', :slug => 'druid'}
161
161
  }
162
162
  }
163
163
  INVENTORY_SLOTS = {
@@ -274,8 +274,24 @@ module Wowget
274
274
  CATEGORIES[self.category_id]
275
275
  end
276
276
 
277
+ def category_name
278
+ CATEGORIES[self.category_id][:name]
279
+ end
280
+
281
+ def category_slug
282
+ CATEGORIES[self.category_id][:slug]
283
+ end
284
+
277
285
  def subcategory
278
- SUBCATEGORIES[self.category][self.subcategory_id]
286
+ SUBCATEGORIES[self.category[:name]][self.subcategory_id]
287
+ end
288
+
289
+ def subcategory_name
290
+ SUBCATEGORIES[self.category[:name]][self.subcategory_id][:name]
291
+ end
292
+
293
+ def subcategory_slug
294
+ SUBCATEGORIES[self.category[:name]][self.subcategory_id][:slug]
279
295
  end
280
296
 
281
297
  def inventory_slot
data/lib/wowget.rb CHANGED
@@ -2,5 +2,5 @@ require 'wowget/item.rb'
2
2
  require 'wowget/spell.rb'
3
3
 
4
4
  module Wowget
5
- VERSION = '0.3.1'
5
+ VERSION = '0.4.0'
6
6
  end
data/spec/item_spec.rb CHANGED
@@ -21,20 +21,28 @@ describe Wowget::Item do
21
21
  item.quality.should == "Uncommon"
22
22
  end
23
23
 
24
- it "should have an item class value" do
24
+ it "should have an item category value" do
25
25
  item.category_id.should == 2
26
26
  end
27
27
 
28
- it "should have an item class name" do
29
- item.category.should == "Weapons"
28
+ it "should have an item category name" do
29
+ item.category_name.should == "Weapons"
30
+ end
31
+
32
+ it "should have an item category slug" do
33
+ item.category_slug.should == "weapons"
30
34
  end
31
35
 
32
- it "should have an item subclass value" do
36
+ it "should have an item subcategory value" do
33
37
  item.subcategory_id.should == 8
34
38
  end
35
39
 
36
- it "should have an item subclass name" do
37
- item.subcategory.should == "Two-Handed Swords"
40
+ it "should have an item subcategory name" do
41
+ item.subcategory_name.should == "Two-Handed Swords"
42
+ end
43
+
44
+ it "should have an item subcategory slug" do
45
+ item.subcategory_slug.should == "two_handed_swords"
38
46
  end
39
47
 
40
48
  it "should have an icon value" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wowget
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.1
5
+ version: 0.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ben Darlow
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-14 00:00:00 +01:00
13
+ date: 2011-07-16 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency