wowget 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wowget.rb +1 -1
- data/lib/wowget/item.rb +8 -0
- data/spec/item_spec.rb +4 -0
- metadata +2 -2
data/lib/wowget.rb
CHANGED
data/lib/wowget/item.rb
CHANGED
@@ -237,6 +237,14 @@ module Wowget
|
|
237
237
|
items.length == 1 ? items[0] : items
|
238
238
|
end
|
239
239
|
|
240
|
+
def self.inventory_slot_from_slug(slug)
|
241
|
+
found = nil
|
242
|
+
INVENTORY_SLOTS.each_pair do |id, slot|
|
243
|
+
found = slot if slot[:slug] == slug
|
244
|
+
end
|
245
|
+
found
|
246
|
+
end
|
247
|
+
|
240
248
|
def initialize(item_id)
|
241
249
|
item_xml = Nokogiri::XML(open("http://www.wowhead.com/item=#{item_id}&xml"))
|
242
250
|
if item_id.nil?
|
data/spec/item_spec.rb
CHANGED
@@ -2,6 +2,10 @@ require_relative "../lib/wowget/item.rb"
|
|
2
2
|
|
3
3
|
describe Wowget::Item do
|
4
4
|
|
5
|
+
it "can find an item slot by its slug" do
|
6
|
+
Wowget::Item.inventory_slot_from_slug('held_in_off_hand').should == {:name => 'Held In Off-hand', :slug => 'held_in_off_hand'}
|
7
|
+
end
|
8
|
+
|
5
9
|
describe "With a valid ID" do
|
6
10
|
item = Wowget::Item.find(4817)
|
7
11
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: wowget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.6
|
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-
|
13
|
+
date: 2011-07-18 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|