armory-ruby 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/armory-ruby-0.0.8.gem +0 -0
- data/lib/armory.rb +31 -20
- data/lib/armory/version.rb +1 -1
- data/spec/requests/armory_test.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a940e83fdd137ba6559850313970bb6e796dd4f3
|
4
|
+
data.tar.gz: da81c9e308fdba9661162e45c76558a9300f1e55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8415ef5fd56d74c977fb9c026ee3c04b17a6018424327b61ec14101be333c5aa57b8a51a2715a1a1611e51587a82a54f6b60192252e91213ac2a52bcabf004c5
|
7
|
+
data.tar.gz: 135a236c68dded4f6967d63ea9bddbcf5fccfb3aed6065d7bb4ed43876b9b6227a4daee400f024dcffc56c44a95a7d51d0896e1bf214c9fafa6802b4956cb43a
|
Binary file
|
data/lib/armory.rb
CHANGED
@@ -1,34 +1,45 @@
|
|
1
|
-
require
|
1
|
+
require "json"
|
2
2
|
|
3
3
|
module Armory
|
4
4
|
|
5
5
|
#default parameters
|
6
|
-
@locale =
|
6
|
+
@locale = "us"
|
7
7
|
|
8
8
|
def self.character(name, realm, locale = @locale)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
#set default locale to what is passed into the method
|
10
|
+
#host = locale + ".battle.net"
|
11
|
+
host = "127.0.0.1:9081"
|
12
|
+
# URL = Host + "/api/wow/character/" + Realm + "/" + CharacterName
|
13
|
+
fullurl = "http://" + host + "/api/character/" + name
|
14
|
+
uri = URI(URI.encode(fullurl))
|
15
|
+
response = Net::HTTP.get_response(uri)
|
16
|
+
# Return ruby object parsed from json
|
17
|
+
json = JSON.parse(response.body)
|
18
|
+
return json
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.guild(name, realm, locale = @locale)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
#host = locale + ".battle.net"
|
23
|
+
host = "127.0.0.1:9081"
|
24
|
+
# Host + "/api/wow/guild/" + Realm + "/" + GuildName
|
25
|
+
fullurl = "http://" + host + "/api/guilds/" + name
|
26
|
+
uri = URI(URI.encode(fullurl))
|
27
|
+
response = Net::HTTP.get_response(uri)
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
json = JSON.parse(response.body)
|
30
|
+
return json
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.guildMembers(name, realm, locale = @locale)
|
34
|
+
#host = locale + ".battle.net"
|
35
|
+
host = "127.0.0.1:9081"
|
36
|
+
# Host + "/api/wow/guild/" + Realm + "/" + GuildName ?fields=members
|
37
|
+
fullurl = "http://" + host + "/api/guilds/members/" + name + ""
|
38
|
+
uri = URI(URI.encode(fullurl))
|
39
|
+
response = Net::HTTP.get_response(uri)
|
31
40
|
|
41
|
+
json = JSON.parse(response.body)
|
42
|
+
return json
|
32
43
|
end
|
33
44
|
|
34
45
|
end
|
data/lib/armory/version.rb
CHANGED
@@ -23,5 +23,9 @@ describe 'Character API' do
|
|
23
23
|
response = Armory.guild('SUPERBOOMKINFUNTIME', 'burning-legion')
|
24
24
|
expect(response['reason']).to eq('Guild not found.')
|
25
25
|
end
|
26
|
+
it 'gets all of the characters from a guild' do
|
27
|
+
response = Armory.guildMembers('HC', 'burning-legion')
|
28
|
+
expect(response['members']).to be
|
29
|
+
end
|
26
30
|
end
|
27
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: armory-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Volin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A World of Warcraft Armory API Adapter for Ruby
|
14
14
|
email:
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- README.rdoc
|
27
27
|
- Rakefile
|
28
28
|
- armory-ruby-0.0.2.gem
|
29
|
+
- armory-ruby-0.0.8.gem
|
29
30
|
- armory.gemspec
|
30
31
|
- lib/armory.rb
|
31
32
|
- lib/armory/version.rb
|