battlenet 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -2
- data/lib/battlenet/adapter_manager.rb +5 -1
- data/lib/battlenet/version.rb +1 -1
- data/spec/adapter_manager_spec.rb +9 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Battlenet is available as a Ruby gem. Install it via
|
|
17
17
|
Use
|
18
18
|
===
|
19
19
|
|
20
|
-
In general, the API is split into several sub-modules, each corresponding to an entity in Blizzard's API. For example, methods for using the Realm Status API are located in the module `Battlenet::API::Realm`. Methods on the
|
20
|
+
In general, the API is split into several sub-modules, each corresponding to an entity in Blizzard's API. For example, methods for using the Realm Status API are located in the module `Battlenet::API::Realm`. Methods on the module allow you to fetch certain information about the given entity. Arguments passed to the methods allow you to specify query string parameters. As an example, here are some sample API calls and the URLs they translate into.
|
21
21
|
|
22
22
|
Battlenet::API::Realm.status
|
23
23
|
# => "http://us.battle.net/api/wow/realm/status"
|
@@ -26,7 +26,7 @@ In general, the API is split into several sub-modules, each corresponding to an
|
|
26
26
|
Battlenet::API::Realm.status :realm => ["Nazjatar", "Shadowsong"]
|
27
27
|
# => "http://us.battle.net/api/wow/realm/status?realm=Nazjatar&realm=Shadowsong"
|
28
28
|
|
29
|
-
Calls to the methods return an array of Hashes, and each hash contains the data for the queried resources.
|
29
|
+
Calls to the methods return an array of Hashes, and each hash contains the data for the queried resources.
|
30
30
|
|
31
31
|
**Note**: This is all subject to change depending on how Blizzard architects the rest of their API.
|
32
32
|
|
@@ -56,6 +56,11 @@ The following adapters are currently supported (more may be added later):
|
|
56
56
|
|
57
57
|
Note that the adapter must be set before any API calls are made.
|
58
58
|
|
59
|
+
|
60
|
+
### Creating an Adapter
|
61
|
+
|
62
|
+
If you wish to, you can create your own adapters. See the [Creating an Adapter wiki page](https://github.com/BinaryMuse/battlenet/wiki/Creating-an-Adapter) for more details.
|
63
|
+
|
59
64
|
Currently Supported APIs
|
60
65
|
========================
|
61
66
|
|
@@ -24,6 +24,10 @@ module Battlenet
|
|
24
24
|
adapter = load_adapter adapter_name, adapter_class
|
25
25
|
end
|
26
26
|
|
27
|
+
def register(identifier, klass)
|
28
|
+
@adapters[identifier] = klass
|
29
|
+
end
|
30
|
+
|
27
31
|
private
|
28
32
|
|
29
33
|
def load_adapter(adapter_name, klass_name)
|
@@ -44,4 +48,4 @@ module Battlenet
|
|
44
48
|
return klass.new
|
45
49
|
end
|
46
50
|
end
|
47
|
-
end
|
51
|
+
end
|
data/lib/battlenet/version.rb
CHANGED
@@ -44,4 +44,12 @@ describe Battlenet::AdapterManager do
|
|
44
44
|
adapter.should be_a Battlenet::Adapter::NetHTTP
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
|
+
context "#register" do
|
49
|
+
it "registers an adapter" do
|
50
|
+
lambda do
|
51
|
+
subject.register(:adapter_identifier, 'AdapterClass')
|
52
|
+
end.should change(subject.adapters, :count).by(1)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: battlenet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brandon Tilley
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-02 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|