wow_community_api 0.2.0 → 0.2.1
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.
@@ -13,7 +13,7 @@ module WowCommunityApi
|
|
13
13
|
base_uri "http://#{self.region}/api/wow"
|
14
14
|
|
15
15
|
results = super(URI.encode(path), build_query(options))
|
16
|
-
results.parsed_response
|
16
|
+
results.parsed_response if results.response.code == "200"
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.build_query(options)
|
@@ -2,7 +2,10 @@ module WowCommunityApi
|
|
2
2
|
class Character < BattleNet
|
3
3
|
def self.find_by_realm_and_name(realm, name, *field)
|
4
4
|
fields = { :fields => field.join(",") } unless field.empty?
|
5
|
-
get("/character/#{realm}/#{name}", fields)
|
5
|
+
results = get("/character/#{realm}/#{name}", fields)
|
6
|
+
|
7
|
+
results['class_id'] = results.delete('class') # handle reserved word "class"
|
8
|
+
results.to_ostruct
|
6
9
|
end
|
7
10
|
end
|
8
11
|
end
|
@@ -2,7 +2,7 @@ module WowCommunityApi
|
|
2
2
|
class Guild < BattleNet
|
3
3
|
def self.find_by_realm_and_name(realm, name, *field)
|
4
4
|
fields = { :fields => field.join(",") } unless field.empty?
|
5
|
-
get("/guild/#{realm}/#{name}", fields)
|
5
|
+
get("/guild/#{realm}/#{name}", fields).to_ostruct
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,7 +2,7 @@ module WowCommunityApi
|
|
2
2
|
class Realm < BattleNet
|
3
3
|
def self.find_by_name(*name)
|
4
4
|
names = { :realms => name.join(",") } unless name.empty?
|
5
|
-
results = get("/realm/status", names)
|
5
|
+
results = get("/realm/status", names).to_ostruct
|
6
6
|
(name.size == 1) ? results.realms.first : results.realms
|
7
7
|
end
|
8
8
|
|
data/spec/character_spec.rb
CHANGED
@@ -42,5 +42,12 @@ describe Character do
|
|
42
42
|
character = Character.find_by_realm_and_name('uther', 'malkyth', :titles)
|
43
43
|
character.titles[0].name.should == "Conquistador %s"
|
44
44
|
end
|
45
|
+
|
46
|
+
it 'gets the class of a character' do
|
47
|
+
stub_json "http://us.battle.net/api/wow/character/uther/malkyth", 'character.json'
|
48
|
+
|
49
|
+
character = Character.find_by_realm_and_name("uther", "malkyth")
|
50
|
+
character.class_id.should == 9
|
51
|
+
end
|
45
52
|
end
|
46
53
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: wow_community_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- eddie cianci
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-26 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|