battlenet-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +9 -0
- data/Rakefile +2 -0
- data/battlenet-api.gemspec +27 -0
- data/examples/example_oauth.rb +23 -0
- data/lib/battlenet/api.rb +6 -0
- data/lib/battlenet/api/client.rb +61 -0
- data/lib/battlenet/api/d3_client.rb +22 -0
- data/lib/battlenet/api/sc2_client.rb +23 -0
- data/lib/battlenet/api/version.rb +5 -0
- data/lib/battlenet/api/wow_client.rb +33 -0
- data/lib/battlenet/modules/d3/data.rb +23 -0
- data/lib/battlenet/modules/d3/profile.rb +18 -0
- data/lib/battlenet/modules/sc2/data.rb +13 -0
- data/lib/battlenet/modules/sc2/ladder.rb +11 -0
- data/lib/battlenet/modules/sc2/profile.rb +29 -0
- data/lib/battlenet/modules/wow/achievement.rb +11 -0
- data/lib/battlenet/modules/wow/auction_data_status.rb +11 -0
- data/lib/battlenet/modules/wow/battlepet.rb +21 -0
- data/lib/battlenet/modules/wow/challenge_mode.rb +14 -0
- data/lib/battlenet/modules/wow/character_profile.rb +114 -0
- data/lib/battlenet/modules/wow/data.rb +36 -0
- data/lib/battlenet/modules/wow/guild.rb +55 -0
- data/lib/battlenet/modules/wow/item.rb +17 -0
- data/lib/battlenet/modules/wow/pvp.rb +11 -0
- data/lib/battlenet/modules/wow/quest.rb +11 -0
- data/lib/battlenet/modules/wow/realm.rb +10 -0
- data/lib/battlenet/modules/wow/recipe.rb +11 -0
- data/lib/battlenet/modules/wow/spell.rb +11 -0
- data/spec/battlenetapi_spec.rb +11 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 683fb02cb8c591d4c10d640cbd8180906f63bff4
|
4
|
+
data.tar.gz: 19c5877277059a1f544599f934b1c6c49ca2f4fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 624d4c74aec95c3e5e4b908e7b683e29bef24e840ce740898d73cf5c7e31946f289e406a08dcf657db79c403edcd14642ec12a129a4a17eb4e449f46e32588cd
|
7
|
+
data.tar.gz: dcc0b456b88ebef73c8533a98cdef94518f57725b4ae439691745baee5c1fd5d34e9269badd9d774fb414a3352bb41333c9a39693439de127091bf72af50fb0c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 goodcodeguy
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Battlenet API Gem [![Dependency Status](https://gemnasium.com/goodcodeguy/battlenet-api.svg)](https://gemnasium.com/goodcodeguy/battlenet-api) [![Code Climate](https://codeclimate.com/github/goodcodeguy/battlenet-api/badges/gpa.svg)](https://codeclimate.com/github/goodcodeguy/battlenet-api)
|
2
|
+
|
3
|
+
TODO:
|
4
|
+
|
5
|
+
- Community OAuth Profile APIs
|
6
|
+
- Account APIs
|
7
|
+
- Unit Tests for All APIs
|
8
|
+
|
9
|
+
- Refactor Client Code to Utilize OpenStruct on JSON Responses
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'battlenet/api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "battlenet-api"
|
8
|
+
spec.version = Battlenet::Api::VERSION
|
9
|
+
spec.authors = ["goodcodeguy"]
|
10
|
+
spec.email = ["goodcodeguy@gmail.com"]
|
11
|
+
spec.summary = "Battlenet Client API"
|
12
|
+
spec.description = "API Wrapper for the Battlenet API"
|
13
|
+
spec.homepage = "https://github.com/goodcodeguy/battlenet-api"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "httparty"
|
22
|
+
spec.add_dependency "oauth2"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'sinatra'
|
2
|
+
require 'battlenet/api'
|
3
|
+
|
4
|
+
enable :sessions
|
5
|
+
|
6
|
+
CALLBACK_URI = "http://localhost:4567/oath/callback"
|
7
|
+
|
8
|
+
get "/" do
|
9
|
+
'<a href="/oauth/connect">Connect with Battlenet</a>'
|
10
|
+
end
|
11
|
+
|
12
|
+
get "/oauth/connect" do
|
13
|
+
''
|
14
|
+
end
|
15
|
+
|
16
|
+
get "/oauth/callback" do
|
17
|
+
session[:access_token] = access_token
|
18
|
+
redirect "/info"
|
19
|
+
end
|
20
|
+
|
21
|
+
get "/info" do
|
22
|
+
'[access token]: ' + session[:access_token]
|
23
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'battlenet/api/version'
|
2
|
+
require 'httparty'
|
3
|
+
|
4
|
+
module Battlenet
|
5
|
+
|
6
|
+
class Client
|
7
|
+
include HTTParty
|
8
|
+
|
9
|
+
def initialize(api_key = nil, region = :us)
|
10
|
+
|
11
|
+
@api_key = api_key
|
12
|
+
@endpoint = nil
|
13
|
+
|
14
|
+
domain = region_uri(region)
|
15
|
+
|
16
|
+
self.class.base_uri "https://#{domain}#{endpoint}"
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def region_uri(region = :us)
|
21
|
+
domain = case region
|
22
|
+
when :us
|
23
|
+
'us.api.battle.net'
|
24
|
+
when :eu
|
25
|
+
'eu.api.battle.net'
|
26
|
+
when :kr
|
27
|
+
'kr.api.battle.net'
|
28
|
+
when :tw
|
29
|
+
'tw.api.battle.net'
|
30
|
+
else
|
31
|
+
raise "Invalid region: #{region.to_s}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def endpoint
|
36
|
+
raise "Invalid Game Endpoint" if @endpoint == nil
|
37
|
+
@endpoint
|
38
|
+
end
|
39
|
+
|
40
|
+
def get(path, params = {})
|
41
|
+
make_request :get, path, params
|
42
|
+
end
|
43
|
+
|
44
|
+
def make_request(verb, path, params = {})
|
45
|
+
options = {}
|
46
|
+
headers = {}
|
47
|
+
|
48
|
+
options[:headers] = headers unless headers.empty?
|
49
|
+
options[:query] = params unless params.empty?
|
50
|
+
|
51
|
+
if @api_key
|
52
|
+
options[:query] ||= {}
|
53
|
+
options[:query].merge!({ :apikey => @api_key })
|
54
|
+
end
|
55
|
+
|
56
|
+
response = self.class.send(verb, path, options)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'battlenet/api/client'
|
2
|
+
|
3
|
+
require 'battlenet/modules/d3/profile'
|
4
|
+
require 'battlenet/modules/d3/data'
|
5
|
+
|
6
|
+
module Battlenet
|
7
|
+
|
8
|
+
class D3Client < Client
|
9
|
+
|
10
|
+
include Battlenet::D3
|
11
|
+
|
12
|
+
def initialize(api_key = nil, region = :us)
|
13
|
+
super(api_key, region)
|
14
|
+
end
|
15
|
+
|
16
|
+
def endpoint
|
17
|
+
@endpoint = '/d3'
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'battlenet/api/client'
|
2
|
+
|
3
|
+
require 'battlenet/modules/sc2/profile'
|
4
|
+
require 'battlenet/modules/sc2/ladder'
|
5
|
+
require 'battlenet/modules/sc2/data'
|
6
|
+
|
7
|
+
module Battlenet
|
8
|
+
|
9
|
+
class SC2Client < Client
|
10
|
+
|
11
|
+
include Battlenet::SC2
|
12
|
+
|
13
|
+
def initialize(api_key = nil, region = :us)
|
14
|
+
super(api_key, region)
|
15
|
+
end
|
16
|
+
|
17
|
+
def endpoint
|
18
|
+
@endpoint = '/sc2'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'battlenet/api/client'
|
2
|
+
|
3
|
+
require 'battlenet/modules/wow/achievement'
|
4
|
+
require 'battlenet/modules/wow/auction_data_status'
|
5
|
+
require 'battlenet/modules/wow/battlepet'
|
6
|
+
require 'battlenet/modules/wow/challenge_mode'
|
7
|
+
require 'battlenet/modules/wow/character_profile'
|
8
|
+
require 'battlenet/modules/wow/guild'
|
9
|
+
require 'battlenet/modules/wow/item'
|
10
|
+
require 'battlenet/modules/wow/pvp'
|
11
|
+
require 'battlenet/modules/wow/quest'
|
12
|
+
require 'battlenet/modules/wow/realm'
|
13
|
+
require 'battlenet/modules/wow/recipe'
|
14
|
+
require 'battlenet/modules/wow/spell'
|
15
|
+
require 'battlenet/modules/wow/data'
|
16
|
+
|
17
|
+
module Battlenet
|
18
|
+
|
19
|
+
class WOWClient < Client
|
20
|
+
|
21
|
+
include Battlenet::WOW
|
22
|
+
|
23
|
+
def initialize(api_key = nil, region = :us)
|
24
|
+
super(api_key, region)
|
25
|
+
end
|
26
|
+
|
27
|
+
def endpoint
|
28
|
+
@endpoint = '/wow'
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module D3
|
5
|
+
def data_item(data, options = {})
|
6
|
+
data = URI.escape data
|
7
|
+
|
8
|
+
get "/data/item/#{data}", options
|
9
|
+
end
|
10
|
+
|
11
|
+
def data_follower(follower, options = {})
|
12
|
+
follower = URI.escape follower
|
13
|
+
|
14
|
+
get "/data/follower/#{follower}", options
|
15
|
+
end
|
16
|
+
|
17
|
+
def data_artisan(artisan, options = {})
|
18
|
+
artisan = URI.escape artisan
|
19
|
+
|
20
|
+
get "/data/artisan/#{artisan}", options
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module D3
|
5
|
+
def career_profile(battletag, options = {})
|
6
|
+
battletag = URI.escape battletag
|
7
|
+
|
8
|
+
get "/profile/#{battletag}", options
|
9
|
+
end
|
10
|
+
|
11
|
+
def hero_profile(battletag, id, options = {})
|
12
|
+
battletag = URI.escape battletag
|
13
|
+
id = URI.escape id
|
14
|
+
|
15
|
+
get "/profile/#{battletag}/hero/#{id}", options
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module SC2
|
5
|
+
def profile(id, region, name, options = {})
|
6
|
+
id = URI.escape id
|
7
|
+
region = URI.escape region
|
8
|
+
name = URI.escape name
|
9
|
+
|
10
|
+
get "/profile/#{id}/#{region}/#{name}", options
|
11
|
+
end
|
12
|
+
|
13
|
+
def profile_ladders(id, region, name, options = {})
|
14
|
+
id = URI.escape id
|
15
|
+
region = URI.escape region
|
16
|
+
name = URI.escape name
|
17
|
+
|
18
|
+
get "/profile/#{id}/#{region}/#{name}/ladders", options
|
19
|
+
end
|
20
|
+
|
21
|
+
def profile_match_history(id, region, name, options = {})
|
22
|
+
id = URI.escape id
|
23
|
+
region = URI.escape region
|
24
|
+
name = URI.escape name
|
25
|
+
|
26
|
+
get "/profile/#{id}/#{region}/#{name}/matches", options
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module WOW
|
5
|
+
def battlepet_ability(ability_id, options = {})
|
6
|
+
ability_id = URI.escape ability_id
|
7
|
+
|
8
|
+
get "/battlepet/ability/#{ability_id}", options
|
9
|
+
end
|
10
|
+
def battlepet_species(species_id, options = {})
|
11
|
+
species_id = URI.escape species_id
|
12
|
+
|
13
|
+
get "/battlepet/species/#{species_id}"
|
14
|
+
end
|
15
|
+
def battlepet_stats(species_id, options = {})
|
16
|
+
species_id = URI.escape species_id
|
17
|
+
|
18
|
+
get "/battlepet/stats/#{species_id}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module WOW
|
5
|
+
def challengemode_realm_leaderboard(realm, options = {})
|
6
|
+
realm = URI.escape realm
|
7
|
+
|
8
|
+
get "/challenge/realm/#{realm}", options
|
9
|
+
end
|
10
|
+
def challengemode_region_leaderboard(options = {})
|
11
|
+
get "/challenge/region", options
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module WOW
|
5
|
+
def character_profile(realm, character_name, options = {})
|
6
|
+
realm = URI.escape realm
|
7
|
+
character_name = URI.escape character_name
|
8
|
+
|
9
|
+
get "/character/#{realm}/#{character_name}", options
|
10
|
+
end
|
11
|
+
def character_achievements(realm, character_name, options = {})
|
12
|
+
options[:query] ||= {}
|
13
|
+
options[:query].merge!({ :fields => 'achievements' })
|
14
|
+
|
15
|
+
character_profile(realm, character_name, options)
|
16
|
+
end
|
17
|
+
def character_appearance(realm, character_name, options = {})
|
18
|
+
options[:query] ||= {}
|
19
|
+
options[:query].merge!({ :fields => 'appearance' })
|
20
|
+
|
21
|
+
character_profile(realm, character_name, options)
|
22
|
+
end
|
23
|
+
def character_feed(realm, character_name, options = {})
|
24
|
+
options[:query] ||= {}
|
25
|
+
options[:query].merge!({ :fields => 'feed' })
|
26
|
+
|
27
|
+
character_profile(realm, character_name, options)
|
28
|
+
end
|
29
|
+
def character_guild(realm, character_name, options = {})
|
30
|
+
options[:query] ||= {}
|
31
|
+
options[:query].merge!({ :fields => 'guild' })
|
32
|
+
|
33
|
+
character_profile(realm, character_name, options)
|
34
|
+
end
|
35
|
+
def character_hunter_pets(realm, character_name, options = {})
|
36
|
+
options[:query] ||= {}
|
37
|
+
options[:query].merge!({ :fields => 'hunter_pets' })
|
38
|
+
|
39
|
+
character_profile(realm, character_name, options)
|
40
|
+
end
|
41
|
+
def character_items(realm, character_name, options = {})
|
42
|
+
options[:query] ||= {}
|
43
|
+
options[:query].merge!({ :fields => 'items' })
|
44
|
+
|
45
|
+
character_profile(realm, character_name, options)
|
46
|
+
end
|
47
|
+
def character_mounts(realm, character_name, options = {})
|
48
|
+
options[:query] ||= {}
|
49
|
+
options[:query].merge!({ :fields => 'mounts' })
|
50
|
+
|
51
|
+
character_profile(realm, character_name, options)
|
52
|
+
end
|
53
|
+
def character_pets(realm, character_name, options = {})
|
54
|
+
options[:query] ||= {}
|
55
|
+
options[:query].merge!({ :fields => 'pets' })
|
56
|
+
|
57
|
+
character_profile(realm, character_name, options)
|
58
|
+
end
|
59
|
+
def character_pet_slots(realm, character_name, options = {})
|
60
|
+
options[:query] ||= {}
|
61
|
+
options[:query].merge!({ :fields => 'pet_slots' })
|
62
|
+
|
63
|
+
character_profile(realm, character_name, options)
|
64
|
+
end
|
65
|
+
def character_progression(realm, character_name, options = {})
|
66
|
+
options[:query] ||= {}
|
67
|
+
options[:query].merge!({ :fields => 'progression' })
|
68
|
+
|
69
|
+
character_profile(realm, character_name, options)
|
70
|
+
end
|
71
|
+
def character_pvp(realm, character_name, options = {})
|
72
|
+
options[:query] ||= {}
|
73
|
+
options[:query].merge!({ :fields => 'pvp' })
|
74
|
+
|
75
|
+
character_profile(realm, character_name, options)
|
76
|
+
end
|
77
|
+
def character_quests(realm, character_name, options = {})
|
78
|
+
options[:query] ||= {}
|
79
|
+
options[:query].merge!({ :fields => 'quests' })
|
80
|
+
|
81
|
+
character_profile(realm, character_name, options)
|
82
|
+
end
|
83
|
+
def character_reputation(realm, character_name, options = {})
|
84
|
+
options[:query] ||= {}
|
85
|
+
options[:query].merge!({ :fields => 'reputation' })
|
86
|
+
|
87
|
+
character_profile(realm, character_name, options)
|
88
|
+
end
|
89
|
+
def character_stats(realm, character_name, options = {})
|
90
|
+
options[:query] ||= {}
|
91
|
+
options[:query].merge!({ :fields => 'stats' })
|
92
|
+
|
93
|
+
character_profile(realm, character_name, options)
|
94
|
+
end
|
95
|
+
def character_talents(realm, character_name, options = {})
|
96
|
+
options[:query] ||= {}
|
97
|
+
options[:query].merge!({ :fields => 'talents' })
|
98
|
+
|
99
|
+
character_profile(realm, character_name, options)
|
100
|
+
end
|
101
|
+
def character_titles(realm, character_name, options = {})
|
102
|
+
options[:query] ||= {}
|
103
|
+
options[:query].merge!({ :fields => 'titles' })
|
104
|
+
|
105
|
+
character_profile(realm, character_name, options)
|
106
|
+
end
|
107
|
+
def character_audit(realm, character_name, options = {})
|
108
|
+
options[:query] ||= {}
|
109
|
+
options[:query].merge!({ :fields => 'audit' })
|
110
|
+
|
111
|
+
character_profile(realm, character_name, options)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module WOW
|
5
|
+
def data_battlegroups(options = {})
|
6
|
+
get "/data/battlegroups", options
|
7
|
+
end
|
8
|
+
def data_character_races(options = {})
|
9
|
+
get "/data/character/races", options
|
10
|
+
end
|
11
|
+
def data_character_classes(options = {})
|
12
|
+
get "/data/character/classes", options
|
13
|
+
end
|
14
|
+
def data_character_achievements(options = {})
|
15
|
+
get "/data/character/achievements", options
|
16
|
+
end
|
17
|
+
def data_guild_rewards(options = {})
|
18
|
+
get "/data/guild/rewards", options
|
19
|
+
end
|
20
|
+
def data_guild_perks(options = {})
|
21
|
+
get "/data/guild/perks", options
|
22
|
+
end
|
23
|
+
def data_guild_achievements(options = {})
|
24
|
+
get "/data/guild/achievements", options
|
25
|
+
end
|
26
|
+
def data_item_classes(options = {})
|
27
|
+
get "/data/item/classes", options
|
28
|
+
end
|
29
|
+
def data_talents(options = {})
|
30
|
+
get "/data/talents", options
|
31
|
+
end
|
32
|
+
def data_pet_types(options = {})
|
33
|
+
get "/data/pet/types", options
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module WOW
|
5
|
+
|
6
|
+
#TODO: guild_profile needs to be more robust
|
7
|
+
def guild_profile(realm, guild_name, options = {})
|
8
|
+
realm = URI.escape realm
|
9
|
+
guild_name = URI.escape guild_name
|
10
|
+
|
11
|
+
get "/guild/#{realm}/#{guild_name}", options
|
12
|
+
end
|
13
|
+
|
14
|
+
def guild_members(realm, guild_name, options = {})
|
15
|
+
realm = URI.escape realm
|
16
|
+
guild_name = URI.escape guild_name
|
17
|
+
|
18
|
+
options[:query] ||= {}
|
19
|
+
options[:query].merge!({ :fields => 'members' })
|
20
|
+
|
21
|
+
get "/guild/#{realm}/#{guild_name}", options
|
22
|
+
end
|
23
|
+
|
24
|
+
def guild_achievements(realm, guild_name, options = {})
|
25
|
+
realm = URI.escape realm
|
26
|
+
guild_name = URI.escape guild_name
|
27
|
+
|
28
|
+
options[:query] ||= {}
|
29
|
+
options[:query].merge!({ :fields => 'achievements' })
|
30
|
+
|
31
|
+
get "/guild/#{realm}/#{guild_name}", options
|
32
|
+
end
|
33
|
+
|
34
|
+
def guild_news(realm, guild_name, options = {})
|
35
|
+
realm = URI.escape realm
|
36
|
+
guild_name = URI.escape guild_name
|
37
|
+
|
38
|
+
options[:query] ||= {}
|
39
|
+
options[:query].merge!({ :fields => 'news' })
|
40
|
+
|
41
|
+
get "/guild/#{realm}/#{guild_name}", options
|
42
|
+
end
|
43
|
+
|
44
|
+
def guild_challenge(realm, guild_name, options = {})
|
45
|
+
realm = URI.escape realm
|
46
|
+
guild_name = URI.escape guild_name
|
47
|
+
|
48
|
+
options[:query] ||= {}
|
49
|
+
options[:query].merge!({ :fields => 'challenge' })
|
50
|
+
|
51
|
+
get "/guild/#{realm}/#{guild_name}", options
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Battlenet
|
4
|
+
module WOW
|
5
|
+
def item(item_id, options = {})
|
6
|
+
item_id = URI.escape item_id
|
7
|
+
|
8
|
+
get "/item/#{item_id}", options
|
9
|
+
end
|
10
|
+
|
11
|
+
def item_set(set_id, options = {})
|
12
|
+
set_id = URI.escape set_id
|
13
|
+
|
14
|
+
get "/item/set/#{set_id}", options
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: battlenet-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- goodcodeguy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: API Wrapper for the Battlenet API
|
84
|
+
email:
|
85
|
+
- goodcodeguy@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- battlenet-api.gemspec
|
96
|
+
- examples/example_oauth.rb
|
97
|
+
- lib/battlenet/api.rb
|
98
|
+
- lib/battlenet/api/client.rb
|
99
|
+
- lib/battlenet/api/d3_client.rb
|
100
|
+
- lib/battlenet/api/sc2_client.rb
|
101
|
+
- lib/battlenet/api/version.rb
|
102
|
+
- lib/battlenet/api/wow_client.rb
|
103
|
+
- lib/battlenet/modules/d3/data.rb
|
104
|
+
- lib/battlenet/modules/d3/profile.rb
|
105
|
+
- lib/battlenet/modules/sc2/data.rb
|
106
|
+
- lib/battlenet/modules/sc2/ladder.rb
|
107
|
+
- lib/battlenet/modules/sc2/profile.rb
|
108
|
+
- lib/battlenet/modules/wow/achievement.rb
|
109
|
+
- lib/battlenet/modules/wow/auction_data_status.rb
|
110
|
+
- lib/battlenet/modules/wow/battlepet.rb
|
111
|
+
- lib/battlenet/modules/wow/challenge_mode.rb
|
112
|
+
- lib/battlenet/modules/wow/character_profile.rb
|
113
|
+
- lib/battlenet/modules/wow/data.rb
|
114
|
+
- lib/battlenet/modules/wow/guild.rb
|
115
|
+
- lib/battlenet/modules/wow/item.rb
|
116
|
+
- lib/battlenet/modules/wow/pvp.rb
|
117
|
+
- lib/battlenet/modules/wow/quest.rb
|
118
|
+
- lib/battlenet/modules/wow/realm.rb
|
119
|
+
- lib/battlenet/modules/wow/recipe.rb
|
120
|
+
- lib/battlenet/modules/wow/spell.rb
|
121
|
+
- spec/battlenetapi_spec.rb
|
122
|
+
homepage: https://github.com/goodcodeguy/battlenet-api
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.2.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Battlenet Client API
|
146
|
+
test_files:
|
147
|
+
- spec/battlenetapi_spec.rb
|