mywowarmory-ruby 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mywowarmory.rb +7 -6
- data/mywowarmory-ruby.gemspec +2 -2
- data/test/test_mywowarmory.rb +25 -4
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/lib/mywowarmory.rb
CHANGED
@@ -6,7 +6,6 @@ require 'multi_json'
|
|
6
6
|
|
7
7
|
class MyWoWArmory
|
8
8
|
include HTTParty
|
9
|
-
# base_uri 'www.mywowarmory.com'
|
10
9
|
base_uri 'www.mywowarmory.com'
|
11
10
|
|
12
11
|
# def initialize(username,password,options={})
|
@@ -15,16 +14,18 @@ class MyWoWArmory
|
|
15
14
|
|
16
15
|
def get_profile(country,realm,character_name,options={})
|
17
16
|
# options.merge!({:basic_auth => @auth})
|
18
|
-
|
19
|
-
#
|
17
|
+
|
18
|
+
# Hack to get the character_name encode once
|
19
|
+
name = URI::encode(URI::decode(character_name))
|
20
20
|
|
21
21
|
# Check the realm
|
22
22
|
realm_response = HTTParty.get("http://#{country}.battle.net/api/wow/realm/status", :query => {:realms => URI.encode(realm)} ).parsed_response
|
23
23
|
realm = realm_response['realms'].select{|r| r['name'] == realm}.first['slug']
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
query = {:name => character_name, :server => realm, :country => country}
|
26
|
+
query.merge!(:style => options[:style]) if options[:style].present?
|
27
|
+
|
28
|
+
MultiJson.decode(self.class.get("/api/getprofile.php", options.merge(:query => query)).parsed_response)
|
28
29
|
end
|
29
30
|
class Profile < OpenStruct
|
30
31
|
end
|
data/mywowarmory-ruby.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mywowarmory-ruby}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Benjamin Wong"]
|
12
|
-
s.date = %q{2011-09-
|
12
|
+
s.date = %q{2011-09-30}
|
13
13
|
s.description = %q{This library uses HTTParty to provide simple, reliable access to the MyWoWArmory API. Good for building reporting scripts and simple apps. Note that this library does not support the complete MyWoWArmory API at this time. See Features/Issues below for details. }
|
14
14
|
s.email = %q{tkwong@railsant.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/test/test_mywowarmory.rb
CHANGED
@@ -9,14 +9,35 @@ class TestMywowarmory < Test::Unit::TestCase
|
|
9
9
|
api = MyWoWArmory.new
|
10
10
|
# response = api.get_profile('us','kul-tiras','gary')
|
11
11
|
# puts response.inspect
|
12
|
-
response = api.get_profile('us','Tichondrius','Slapshøt')
|
13
|
-
puts response.inspect
|
12
|
+
# response = api.get_profile('us','Tichondrius','Slapshøt')
|
13
|
+
# puts response.inspect
|
14
14
|
response = api.get_profile("us", "Mal'Ganis", 'gary')
|
15
15
|
puts response.inspect
|
16
|
-
response = api.get_profile("us", "Kel'Thuzad", 'Chaoticblade')
|
16
|
+
# response = api.get_profile("us", "Kel'Thuzad", 'Chaoticblade')
|
17
|
+
# puts response.inspect
|
18
|
+
#
|
19
|
+
# response = api.get_profile "us","Lightning's Blade","Bools"
|
20
|
+
# puts response.inspect
|
21
|
+
#
|
22
|
+
response = api.get_profile("us", "Mal'Ganis", "Gimlì")
|
17
23
|
puts response.inspect
|
18
24
|
|
19
|
-
response = api.get_profile
|
25
|
+
response = api.get_profile("us", "Mal'Ganis", "Giml%C3%AC")
|
20
26
|
puts response.inspect
|
27
|
+
|
28
|
+
response = api.get_profile("us", "Aegwynn", "R%C3%A1y")
|
29
|
+
puts response.inspect
|
30
|
+
|
31
|
+
response = api.get_profile "us", "Stormrage", "Dieslówly"
|
32
|
+
puts response.inspect
|
33
|
+
|
34
|
+
response = api.get_profile "us", "Dalaran", "Wølfenstein"
|
35
|
+
puts response.inspect
|
36
|
+
|
37
|
+
response = api.get_profile "us","Zangarmarsh", "Jésuschrist"
|
38
|
+
puts response.inspect
|
39
|
+
|
40
|
+
response = api.get_profile "us", "Dragonblight","Këk", :style => :vbarrack
|
41
|
+
puts response.inspect
|
21
42
|
end
|
22
43
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mywowarmory-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Wong
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-30 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|