wowget 0.1.7 → 0.1.8

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 (3) hide show
  1. data/lib/wowget/spell.rb +21 -0
  2. data/spec/spell_spec.rb +1 -0
  3. metadata +1 -1
@@ -8,6 +8,7 @@ module Wowget
8
8
  attr_accessor :item_id
9
9
  attr_accessor :reagents
10
10
  attr_accessor :profession
11
+ attr_accessor :profession_id
11
12
  attr_accessor :skill
12
13
  attr_accessor :error
13
14
 
@@ -45,6 +46,26 @@ module Wowget
45
46
  p = spell_xml.xpath("//script[contains(., 'Markup')]").inner_text.scan(/\[ul\]\[li\](.+?)\[\/li\]/)[0][0].scan(/Requires (.+?) \(([0-9]+?)\)/)[0]
46
47
  self.profession = p[0]
47
48
  self.skill = p[1].to_i
49
+
50
+ self.profession_id = case self.profession
51
+ when "Alchemy" then 1
52
+ when "Blacksmithing" then 2
53
+ when "Cooking" then 3
54
+ when "Enchanting" then 4
55
+ when "Engineering" then 5
56
+ when "First Aid" then 6
57
+ when "Jewelcrafting" then 7
58
+ when "Leatherworking" then 8
59
+ when "Mining" then 9
60
+ when "Tailoring" then 10
61
+ when "Yes" then 11
62
+ when "No" then 12
63
+ when "Fishing" then 13
64
+ when "Herbalism" then 14
65
+ when "Inscription" then 15
66
+ when "Archaeology" then 16
67
+ end
68
+
48
69
  end
49
70
  end
50
71
  end
@@ -29,6 +29,7 @@ describe Wowget::Spell do
29
29
  end
30
30
 
31
31
  it "should have a professional skill requirement" do
32
+ spell.profession_id.should == 2 and
32
33
  spell.profession.should == 'Blacksmithing' and
33
34
  spell.skill.should == 450
34
35
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wowget
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.7
5
+ version: 0.1.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ben Darlow