wow_community_api 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wow_community_api/character.rb +1 -1
- data/lib/wow_community_api/guild.rb +1 -1
- data/lib/wow_community_api/realm.rb +5 -4
- data/lib/wow_community_api/version.rb +1 -1
- data/lib/wow_community_api.rb +1 -1
- data/spec/character_spec.rb +1 -0
- data/spec/fixtures/realms.json +8 -0
- data/spec/guild_spec.rb +1 -0
- data/spec/realm_spec.rb +10 -0
- data/wow_community_api.gemspec +1 -0
- metadata +16 -5
@@ -1,9 +1,10 @@
|
|
1
1
|
module WowCommunityApi
|
2
2
|
class Realm < BattleNet
|
3
|
-
def self.find_by_name(name)
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
def self.find_by_name(*name)
|
4
|
+
names = { :realms => name.join(",") }
|
5
|
+
results = get("/realm/status", :query => names).to_ostruct
|
6
|
+
realms = results.realms
|
7
|
+
(name.size == 1) ? realms.first : realms
|
7
8
|
end
|
8
9
|
end
|
9
10
|
end
|
data/lib/wow_community_api.rb
CHANGED
data/spec/character_spec.rb
CHANGED
@@ -4,6 +4,7 @@ describe Character do
|
|
4
4
|
describe "#find_by_realm_and_name" do
|
5
5
|
it "gets character by realm and name" do
|
6
6
|
stub_json "http://us.battle.net/api/wow/character/uther/malkyth", 'character.json'
|
7
|
+
|
7
8
|
character = Character.find_by_realm_and_name("uther", "malkyth")
|
8
9
|
character.name.should == "Malkyth"
|
9
10
|
end
|
data/spec/fixtures/realms.json
CHANGED
data/spec/guild_spec.rb
CHANGED
data/spec/realm_spec.rb
CHANGED
@@ -4,6 +4,7 @@ describe Realm do
|
|
4
4
|
describe "#find_by_name" do
|
5
5
|
it "gets the status of a realm by name" do
|
6
6
|
stub_json 'http://us.battle.net/api/wow/realm/status?realms=medivh', 'realms.json'
|
7
|
+
|
7
8
|
realm = Realm.find_by_name("medivh")
|
8
9
|
realm.status.should be_true
|
9
10
|
end
|
@@ -14,5 +15,14 @@ describe Realm do
|
|
14
15
|
realm = Realm.find_by_name("altar of storms")
|
15
16
|
realm.status.should be_true
|
16
17
|
end
|
18
|
+
|
19
|
+
it "gets multiple realms by name" do
|
20
|
+
stub_json 'http://us.battle.net/api/wow/realm/status?realms=medivh,lightbringer', 'realms.json'
|
21
|
+
|
22
|
+
realms = Realm.find_by_name("medivh", "lightbringer")
|
23
|
+
realms.size.should == 2
|
24
|
+
realms[0].name.should == "Medivh"
|
25
|
+
realms[1].name.should == "Lightbringer"
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
data/wow_community_api.gemspec
CHANGED
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.0.
|
5
|
+
version: 0.0.4
|
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-19 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
27
|
+
name: hash-to-ostruct
|
28
28
|
prerelease: false
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: "0"
|
35
|
-
type: :
|
35
|
+
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: rspec
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
@@ -45,6 +45,17 @@ dependencies:
|
|
45
45
|
version: "0"
|
46
46
|
type: :development
|
47
47
|
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: webmock
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
48
59
|
description: a Ruby library for Blizzard's World of Warcraft Community Platform API
|
49
60
|
email:
|
50
61
|
- defeated2k4@gmail.com
|