wow_community_api 0.0.4 → 0.0.5
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.
- data/lib/wow_community_api/realm.rb +5 -1
- data/lib/wow_community_api/version.rb +1 -1
- data/spec/fixtures/realms-all.json +28 -0
- data/spec/realm_spec.rb +10 -0
- metadata +3 -1
@@ -1,10 +1,14 @@
|
|
1
1
|
module WowCommunityApi
|
2
2
|
class Realm < BattleNet
|
3
3
|
def self.find_by_name(*name)
|
4
|
-
names = { :realms => name.join(",") }
|
4
|
+
names = { :realms => name.join(",") } if name.size > 0
|
5
5
|
results = get("/realm/status", :query => names).to_ostruct
|
6
6
|
realms = results.realms
|
7
7
|
(name.size == 1) ? realms.first : realms
|
8
8
|
end
|
9
|
+
|
10
|
+
def self.find_all()
|
11
|
+
find_by_name
|
12
|
+
end
|
9
13
|
end
|
10
14
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"realms":[
|
3
|
+
{
|
4
|
+
"type":"pve",
|
5
|
+
"queue":false,
|
6
|
+
"status":true,
|
7
|
+
"population":"medium",
|
8
|
+
"name":"Medivh",
|
9
|
+
"slug":"medivh"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"type":"pve",
|
13
|
+
"queue":false,
|
14
|
+
"status":true,
|
15
|
+
"population":"high",
|
16
|
+
"name":"Lightbringer",
|
17
|
+
"slug":"lightbringer"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type":"pve",
|
21
|
+
"queue":false,
|
22
|
+
"status":true,
|
23
|
+
"population":"high",
|
24
|
+
"name":"Aerie Peak",
|
25
|
+
"slug":"aerie-peak"
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
data/spec/realm_spec.rb
CHANGED
@@ -24,5 +24,15 @@ describe Realm do
|
|
24
24
|
realms[0].name.should == "Medivh"
|
25
25
|
realms[1].name.should == "Lightbringer"
|
26
26
|
end
|
27
|
+
|
28
|
+
it "gets all realms" do
|
29
|
+
stub_json 'http://us.battle.net/api/wow/realm/status', 'realms-all.json'
|
30
|
+
|
31
|
+
realms = Realm.find_all
|
32
|
+
realms.size.should == 3
|
33
|
+
realms[0].name.should == "Medivh"
|
34
|
+
realms[1].name.should == "Lightbringer"
|
35
|
+
realms[2].name.should == "Aerie Peak"
|
36
|
+
end
|
27
37
|
end
|
28
38
|
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.0.
|
5
|
+
version: 0.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- eddie cianci
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- spec/fixtures/character.json
|
87
87
|
- spec/fixtures/guild-dmc.json
|
88
88
|
- spec/fixtures/guild.json
|
89
|
+
- spec/fixtures/realms-all.json
|
89
90
|
- spec/fixtures/realms-aos.json
|
90
91
|
- spec/fixtures/realms.json
|
91
92
|
- spec/guild_spec.rb
|
@@ -127,6 +128,7 @@ test_files:
|
|
127
128
|
- spec/fixtures/character.json
|
128
129
|
- spec/fixtures/guild-dmc.json
|
129
130
|
- spec/fixtures/guild.json
|
131
|
+
- spec/fixtures/realms-all.json
|
130
132
|
- spec/fixtures/realms-aos.json
|
131
133
|
- spec/fixtures/realms.json
|
132
134
|
- spec/guild_spec.rb
|