battlenet-api 0.2.1 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ecdb5774de9edcb34ab00edd30e7860e6a39aa5
4
- data.tar.gz: a195dd18da70851049ac3b383d9d0aa85fc15d39
3
+ metadata.gz: 8a316e32b012140e2b53da8b7e7608cf794d08ed
4
+ data.tar.gz: dc4ecf71a16d9c6c7c9553f9b2d0814aff508656
5
5
  SHA512:
6
- metadata.gz: 7211cd747464e9629b52afa718c563bd14633244bd41cec7eb2c7d789adc3bdec4e41c5e397bc3f950d69bb5338ec060a8b196cd15c1451c9b384e205e12dee2
7
- data.tar.gz: 42b651525a21eba9d339abc56337f44a8adb0103fd2e90937822aa72e629db6b47ecc08e2bb7cc299e1aead06950bd59d35873493357dbe5ee9fa8d32f116325
6
+ metadata.gz: b65070319198a863fd5e8110f42d6ca1e9de6d6b73f8c06cb3d9391eb7a791fc61bd752a69bf638073593fd68bdacf006b338576f1ca4b9df866a40c9a426331
7
+ data.tar.gz: 5029706a8cbab86b241a855100f96032b8c19a1146bd1fc0b8c10b73e6a29cf3b3505d9b4824151b6fac2471f22c2063f3d8537f4fc7f7b684d755a8d482e918
data/README.md CHANGED
@@ -21,65 +21,37 @@ end
21
21
  ````ruby
22
22
  client = Battlenet.WOWClient
23
23
 
24
- # Available Methods
25
- client.achievement(id)
26
- client.auction_data_status(realm)
27
-
28
- client.battlepet_ability(ability_id)
29
- client.battlepet_species(species_id)
30
- client.battlepet_stats(species_id)
31
-
32
- client.challengemode_realm_leaderboard(realm)
33
- client.challengemode_region_leaderboard
34
-
35
- client.character_profile(realm, character_name)
36
- client.character_achievements(realm, character_name)
37
- client.character_appearance(realm, character_name)
38
- client.character_feed(realm, character_name)
39
- client.character_guild(realm, character_name)
40
- client.character_hunter_pets(realm, character_name)
41
- client.character_items(realm, character_name)
42
- client.character_mounts(realm, character_name)
43
- client.character_pets(realm, character_name)
44
- client.character_pet_slots(realm, character_name)
45
- client.character_progression(realm, character_name)
46
- client.character_pvp(realm, character_name)
47
- client.character_quests(realm, character_name)
48
- client.character_reputation(realm, character_name)
49
- client.character_stats(realm, character_name)
50
- client.character_talents(realm, character_name)
51
- client.character_titles(realm, character_name)
52
- client.character_audit(realm, character_name)
53
-
54
- client.data_battlegroups
55
- client.data_character_races
56
- client.data_character_classes
57
- client.data_character_achievements
58
- client.data_guild_rewards
59
- client.data_guild_perks
60
- client.data_guild_achievements
61
- client.data_item_classes
62
- client.data_talents
63
- client.data_pet_types
64
-
65
- client.guild_profile(realm, guild_name)
66
- client.guild_members(realm, guild_name)
67
- client.guild_achievements(realm, guild_name)
68
- client.guild_news(realm, guild_name)
69
- client.guild_challenge(realm, guild_name)
70
-
71
- client.item(item_id)
72
- client.item_set(set_id)
73
-
74
- client.pvp_leaderboards(bracket)
75
-
76
- client.quest(quest_id)
77
-
78
- client.realm_status
79
-
80
- client.recipe(recipe_id)
81
-
82
- client.spell(spell_id)
24
+ achievement = client.achievement({:achievement => 'achievement_id'})
25
+ auction_data = client.auction({:realm => 'realm'})
26
+ character = client.character_profile({:realm => 'realm', :character_name => 'character_name'})
27
+
28
+ # TODO: character methods
29
+
30
+ guild = client.guild_profile({:realm => 'realm', :guild_name => 'guild_name'})
31
+
32
+ # TODO: guild methods
33
+
34
+ data = client.data
35
+
36
+ # TODO: data methods
37
+
38
+ item = client.item({:item => 'item_id'})
39
+ puts item.details
40
+
41
+ item = client.item_set({:item_set => 'item_set_id'})
42
+ puts item.details
43
+
44
+ pvp_leaderboards = client.pvp_leaderboards({:bracket => 'bracket'})
45
+ puts pvp_leaderboards.details
46
+
47
+ quest = client.quest({:quest => 'quest_id'})
48
+ puts quest.details
49
+
50
+ recipe = client.recipe({:recipe => 'recipe_id'})
51
+ puts recipe.details
52
+
53
+ spell = client.spell({:spell => 'spell_id'})
54
+ puts spell.details
83
55
 
84
56
  ````
85
57
 
@@ -0,0 +1,14 @@
1
+ require 'battlenet/api'
2
+
3
+ Battlenet.configure do |config|
4
+ config.api_key = '5g856v32mx5bwx3rwxzkt9z9yrehtuq2'
5
+ config.region = :us
6
+ end
7
+
8
+ wow_client = Battlenet.WOWClient
9
+
10
+ guild = wow_client.guild_profile({:realm => "sargeras", :guild_name => "midwinter"})
11
+ puts guild.profile
12
+
13
+ character = wow_client.character_profile({:realm => 'sargeras', :character_name => 'Silverwinter'})
14
+ puts character.profile
@@ -1,22 +1,16 @@
1
1
  module Battlenet
2
2
  class APIResponse
3
3
 
4
+ attr_accessor :data
5
+
4
6
  def initialize(options={})
5
7
  @data = []
6
8
  @client = options[:client]
7
9
  end
8
10
 
9
- def get_data
11
+ def get_data(path, options)
10
12
  unless @client.nil?
11
- @data = @client.get "/character/#{@realm}/#{@character_name}"
12
- end
13
- end
14
-
15
- def method_missing *args
16
- if @data.has_key? args[0].to_s
17
- @data[args[0].to_s]
18
- else
19
- super
13
+ @data = @client.get(path, options)
20
14
  end
21
15
  end
22
16
 
@@ -1,5 +1,5 @@
1
1
  module Battlenet
2
2
  module Api
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -1,31 +1,91 @@
1
1
  require 'battlenet/api/client'
2
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
3
  require 'battlenet/modules/wow/character_profile'
8
- require 'battlenet/modules/wow/guild'
4
+ require 'battlenet/modules/wow/guild_profile'
9
5
  require 'battlenet/modules/wow/item'
10
- require 'battlenet/modules/wow/pvp'
6
+ require 'battlenet/modules/wow/item_set'
7
+ require 'battlenet/modules/wow/achievement'
8
+ require 'battlenet/modules/wow/auction'
9
+ require 'battlenet/modules/wow/pvp_leaderboard'
11
10
  require 'battlenet/modules/wow/quest'
12
11
  require 'battlenet/modules/wow/realm'
13
12
  require 'battlenet/modules/wow/recipe'
14
13
  require 'battlenet/modules/wow/spell'
15
14
  require 'battlenet/modules/wow/data'
16
15
 
16
+ #Dir[File.expand_path('../modules/wow/*.rb', __FILE__)].each{|f| require f}
17
+
17
18
  module Battlenet
18
19
 
19
20
  class WOWClient < Client
20
- include Battlenet::WOW
21
21
 
22
22
  def initialize(options = {})
23
23
  client_settings = { :endpoint => '/wow' }
24
24
  client_settings = client_settings.merge(options)
25
-
25
+
26
26
  super(client_settings)
27
27
  end
28
28
 
29
+ def character_profile(options = {})
30
+ opts = options.merge({:client => self})
31
+ Battlenet::WOW::CharacterProfile.new(opts)
32
+ end
33
+
34
+ def guild_profile(options = {})
35
+ opts = options.merge({:client => self})
36
+ Battlenet::WOW::GuildProfile.new(opts)
37
+ end
38
+
39
+ def item(options = {})
40
+ opts = options.merge({:client => self})
41
+ Battlenet::WOW::Item.new(opts)
42
+ end
43
+
44
+ def item_set(options = {})
45
+ opts = options.merge({:client => self})
46
+ Battlenet::WOW::ItemSet.new(opts)
47
+ end
48
+
49
+ def achievement(options = {})
50
+ opts = options.merge({:client => self})
51
+ Battlenet::WOW::Achievement.new(opts)
52
+ end
53
+
54
+ def auction(options = {})
55
+ opts = options.merge({:client => self})
56
+ Battlenet::WOW::Auction.new(opts)
57
+ end
58
+
59
+ def pvp_leaderboard(options = {})
60
+ opts = options.merge({:client => self})
61
+ Battlenet::WOW::PVPLeaderboard.new(opts)
62
+ end
63
+
64
+ def quest(options = {})
65
+ opts = options.merge({:client => self})
66
+ Battlenet::WOW::Quest.new(opts)
67
+ end
68
+
69
+ def realm(options = {})
70
+ opts = options.merge({:client => self})
71
+ Battlenet::WOW::Realm.new(opts)
72
+ end
73
+
74
+ def recipe(options = {})
75
+ opts = options.merge({:client => self})
76
+ Battlenet::WOW::Recipe.new(opts)
77
+ end
78
+
79
+ def spell(options = {})
80
+ opts = options.merge({:client => self})
81
+ Battlenet::WOW::Spell.new(opts)
82
+ end
83
+
84
+ def data(options = {})
85
+ opts = options.merge({:client => self})
86
+ Battlenet::WOW::Data.new(opts)
87
+ end
88
+
29
89
  end
30
90
 
31
91
  end
data/lib/battlenet/api.rb CHANGED
@@ -23,4 +23,4 @@ module Battlenet
23
23
  Battlenet::D3Client.new(options)
24
24
  end
25
25
 
26
- end
26
+ end
@@ -1,11 +1,19 @@
1
- require 'uri'
2
-
3
1
  module Battlenet
4
2
  module WOW
5
- def achievement(id, options = {})
6
- id = URI.escape id
3
+ class Achievement < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:achievement)
7
+
8
+ @endpoint = "/achievement/#{@achievement}"
9
+
10
+ super(options)
11
+ end
12
+
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
7
16
 
8
- get "/achievement/#{id}", options
9
17
  end
10
18
  end
11
19
  end
@@ -0,0 +1,19 @@
1
+ module Battlenet
2
+ module WOW
3
+ class Auction < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:realm)
7
+
8
+ @endpoint = "/auction/data/#{@realm}"
9
+
10
+ super(options)
11
+ end
12
+
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -1,116 +1,88 @@
1
- require 'uri'
2
-
3
- Dir[File.expand_path('../character/*.rb', __FILE__)].each{|f| require f}
4
-
5
1
  module Battlenet
6
2
  module WOW
7
- def character_profile(realm, character_name, options = {})
8
- realm = URI.escape realm
9
- character_name = URI.escape character_name
3
+ class CharacterProfile < Battlenet::APIResponse
10
4
 
11
- get "/character/#{realm}/#{character_name}", options
12
- end
13
- def character_achievements(realm, character_name, options = {})
14
- options[:query] ||= {}
15
- options[:query].merge!({ :fields => 'achievements' })
5
+ def initialize(options={})
6
+ @realm = options.delete(:realm)
7
+ @character_name = options.delete(:character_name)
16
8
 
17
- character_profile(realm, character_name, options)
18
- end
19
- def character_appearance(realm, character_name, options = {})
20
- options[:query] ||= {}
21
- options[:query].merge!({ :fields => 'appearance' })
9
+ @endpoint = "/character/#{@realm}/#{@character_name}"
22
10
 
23
- character_profile(realm, character_name, options)
24
- end
25
- def character_feed(realm, character_name, options = {})
26
- options[:query] ||= {}
27
- options[:query].merge!({ :fields => 'feed' })
11
+ super(options)
12
+ end
28
13
 
29
- character_profile(realm, character_name, options)
30
- end
31
- def character_guild(realm, character_name, options = {})
32
- options[:query] ||= {}
33
- options[:query].merge!({ :fields => 'guild' })
14
+ def profile
15
+ get_data(@endpoint, {})
16
+ end
34
17
 
35
- character_profile(realm, character_name, options)
36
- end
37
- def character_hunter_pets(realm, character_name, options = {})
38
- options[:query] ||= {}
39
- options[:query].merge!({ :fields => 'hunter_pets' })
18
+ def achievements
19
+ get_data(@endpoint, {:fields => 'achievements'})
20
+ end
40
21
 
41
- character_profile(realm, character_name, options)
42
- end
43
- def character_items(realm, character_name, options = {})
44
- options[:query] ||= {}
45
- options[:query].merge!({ :fields => 'items' })
22
+ def appearance
23
+ get_data(@endpoint, {:fields => 'appearance'})
24
+ end
46
25
 
47
- character_profile(realm, character_name, options)
48
- end
49
- def character_mounts(realm, character_name, options = {})
50
- options[:query] ||= {}
51
- options[:query].merge!({ :fields => 'mounts' })
26
+ def feed
27
+ get_data(@endpoint, {:fields => 'feed'})
28
+ end
52
29
 
53
- character_profile(realm, character_name, options)
54
- end
55
- def character_pets(realm, character_name, options = {})
56
- options[:query] ||= {}
57
- options[:query].merge!({ :fields => 'pets' })
30
+ def guild
31
+ get_data(@endpoint, {:fields => 'guild'})
32
+ end
58
33
 
59
- character_profile(realm, character_name, options)
60
- end
61
- def character_pet_slots(realm, character_name, options = {})
62
- options[:query] ||= {}
63
- options[:query].merge!({ :fields => 'pet_slots' })
34
+ def hunter_pets
35
+ get_data(@endpoint, {:fields => 'hunterPets'})
36
+ end
64
37
 
65
- character_profile(realm, character_name, options)
66
- end
67
- def character_progression(realm, character_name, options = {})
68
- options[:query] ||= {}
69
- options[:query].merge!({ :fields => 'progression' })
38
+ def pets
39
+ get_data(@endpoint, {:fields => 'pets'})
40
+ end
70
41
 
71
- character_profile(realm, character_name, options)
72
- end
73
- def character_pvp(realm, character_name, options = {})
74
- options[:query] ||= {}
75
- options[:query].merge!({ :fields => 'pvp' })
42
+ def items
43
+ get_data(@endpoint, {:fields => 'items'})
44
+ end
76
45
 
77
- character_profile(realm, character_name, options)
78
- end
79
- def character_quests(realm, character_name, options = {})
80
- options[:query] ||= {}
81
- options[:query].merge!({ :fields => 'quests' })
46
+ def mounts
47
+ get_data(@endpoint, {:fields => 'mounts'})
48
+ end
82
49
 
83
- character_profile(realm, character_name, options)
84
- end
85
- def character_reputation(realm, character_name, options = {})
86
- options[:query] ||= {}
87
- options[:query].merge!({ :fields => 'reputation' })
50
+ def pet_slots
51
+ get_data(@endpoint, {:fields => 'petSlots'})
52
+ end
88
53
 
89
- character_profile(realm, character_name, options)
90
- end
91
- def character_stats(realm, character_name, options = {})
92
- options[:query] ||= {}
93
- options[:query].merge!({ :fields => 'stats' })
54
+ def progression
55
+ get_data(@endpoint, {:fields => 'progression'})
56
+ end
94
57
 
95
- character_profile(realm, character_name, options)
96
- end
97
- def character_talents(realm, character_name, options = {})
98
- options[:query] ||= {}
99
- options[:query].merge!({ :fields => 'talents' })
58
+ def pvp
59
+ get_data(@endpoint, {:fields => 'pvp'})
60
+ end
100
61
 
101
- character_profile(realm, character_name, options)
102
- end
103
- def character_titles(realm, character_name, options = {})
104
- options[:query] ||= {}
105
- options[:query].merge!({ :fields => 'titles' })
62
+ def quests
63
+ get_data(@endpoint, {:fields => 'quests'})
64
+ end
106
65
 
107
- character_profile(realm, character_name, options)
108
- end
109
- def character_audit(realm, character_name, options = {})
110
- options[:query] ||= {}
111
- options[:query].merge!({ :fields => 'audit' })
66
+ def reputation
67
+ get_data(@endpoint, {:fields => 'reputation'})
68
+ end
69
+
70
+ def stats
71
+ get_data(@endpoint, {:fields => 'stats'})
72
+ end
73
+
74
+ def talents
75
+ get_data(@endpoint, {:fields => 'talents'})
76
+ end
77
+
78
+ def titles
79
+ get_data(@endpoint, {:fields => 'titles'})
80
+ end
81
+
82
+ def audit
83
+ get_data(@endpoint, {:fields => 'audit'})
84
+ end
112
85
 
113
- character_profile(realm, character_name, options)
114
86
  end
115
87
  end
116
88
  end
@@ -1,36 +1,51 @@
1
- require 'uri'
2
-
3
1
  module Battlenet
4
2
  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
3
+ class Data < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ super(options)
7
+ end
8
+
9
+ def battlegroups
10
+ get_data("/data/battlegroups", {})
11
+ end
12
+
13
+ def character_races
14
+ get_data("/data/character/races", {})
15
+ end
16
+
17
+ def character_classes
18
+ get_data("/data/character/classes", {})
19
+ end
20
+
21
+ def character_achievements
22
+ get_data("/data/character/achievements", {})
23
+ end
24
+
25
+ def guild_rewards
26
+ get_data("/data/guild/rewards", {})
27
+ end
28
+
29
+ def guild_perks
30
+ get_data("/data/guild/perks", {})
31
+ end
32
+
33
+ def guild_achievements
34
+ get_data("/data/guild/achievements", {})
35
+ end
36
+
37
+ def item_classes
38
+ get_data("/data/item/clases", {})
39
+ end
40
+
41
+ def talents
42
+ get_data("/dava/talents", {})
43
+ end
44
+
45
+ def pet_types
46
+ get_data("/data/pet/types", {})
47
+ end
48
+
34
49
  end
35
50
  end
36
- end
51
+ end
@@ -0,0 +1,35 @@
1
+ module Battlenet
2
+ module WOW
3
+ class GuildProfile < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:realm)
7
+ @guild_name = options.delete(:guild_name)
8
+
9
+ @endpoint = "/guild/#{@realm}/#{@guild_name}"
10
+
11
+ super(options)
12
+ end
13
+
14
+ def profile
15
+ get_data(@endpoint, {})
16
+ end
17
+
18
+ def members
19
+ get_data(@endpoint, {:fields => 'members'})
20
+ end
21
+
22
+ def achievements
23
+ get_data(@endpoint, {:fields => 'achievements'})
24
+ end
25
+
26
+ def news
27
+ get_data(@endpoint, {:fields => 'news'})
28
+ end
29
+
30
+ def challenge
31
+ get_data(@endpoint, {:fields => 'challenge'})
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,17 +1,19 @@
1
- require 'uri'
2
-
3
1
  module Battlenet
4
2
  module WOW
5
- def item(item_id, options = {})
6
- item_id = URI.escape item_id
3
+ class Item < Battlenet::APIResponse
7
4
 
8
- get "/item/#{item_id}", options
9
- end
5
+ def initialize(options={})
6
+ @realm = options.delete(:item)
7
+
8
+ @endpoint = "/item/#{@item}"
9
+
10
+ super(options)
11
+ end
10
12
 
11
- def item_set(set_id, options = {})
12
- set_id = URI.escape set_id
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
13
16
 
14
- get "/item/set/#{set_id}", options
15
17
  end
16
18
  end
17
- end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Battlenet
2
+ module WOW
3
+ class ItemSet < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:item_set)
7
+
8
+ @endpoint = "/item/set/#{@item_set}"
9
+
10
+ super(options)
11
+ end
12
+
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Battlenet
2
+ module WOW
3
+ class PVPLeaderboard < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:bracket)
7
+
8
+ @endpoint = "/leaderboard/#{@bracket}"
9
+
10
+ super(options)
11
+ end
12
+
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -1,11 +1,19 @@
1
- require 'uri'
2
-
3
1
  module Battlenet
4
2
  module WOW
5
- def quest(quest_id, options = {})
6
- quest_id = URI.escape quest_id
3
+ class Quest < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:quest)
7
+
8
+ @endpoint = "/quest/#{@quest}"
9
+
10
+ super(options)
11
+ end
12
+
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
7
16
 
8
- get "/quest/#{quest_id}", options
9
- end
17
+ end
10
18
  end
11
- end
19
+ end
@@ -1,10 +1,17 @@
1
- require 'uri'
2
-
3
1
  module Battlenet
4
2
  module WOW
5
- #TODO: Add Option realms parameter
6
- def realm_status(options = {})
7
- get "/realm/status", options
3
+ class Realm < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @endpoint = "/realm/status"
7
+
8
+ super(options)
9
+ end
10
+
11
+ def details
12
+ get_data(@endpoint, {})
13
+ end
14
+
8
15
  end
9
16
  end
10
- end
17
+ end
@@ -1,11 +1,19 @@
1
- require 'uri'
2
-
3
1
  module Battlenet
4
2
  module WOW
5
- def recipe(recipe_id, options = {})
6
- recipe_id = URI.escape recipe_id
3
+ class Recipe < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:recipe)
7
+
8
+ @endpoint = "/recipe/#{@recipe}"
9
+
10
+ super(options)
11
+ end
12
+
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
7
16
 
8
- get "/recipe/#{recipe_id}", options
9
17
  end
10
18
  end
11
- end
19
+ end
@@ -1,11 +1,19 @@
1
- require 'uri'
2
-
3
1
  module Battlenet
4
2
  module WOW
5
- def spell(spell_id, options = {})
6
- spell_id = URI.escape spell_id
3
+ class Spell < Battlenet::APIResponse
4
+
5
+ def initialize(options={})
6
+ @realm = options.delete(:spell)
7
+
8
+ @endpoint = "/item/#{@spell}"
9
+
10
+ super(options)
11
+ end
12
+
13
+ def details
14
+ get_data(@endpoint, {})
15
+ end
7
16
 
8
- get "/spell/#{spell_id}", options
9
17
  end
10
18
  end
11
- end
19
+ end
@@ -0,0 +1,24 @@
1
+ require 'battlenet/api'
2
+
3
+ describe Battlenet::WOW::CharacterProfile do
4
+
5
+ it { should respond_to(:profile) }
6
+ it { should respond_to(:achievements) }
7
+ it { should respond_to(:feed) }
8
+ it { should respond_to(:appearance) }
9
+ it { should respond_to(:guild) }
10
+ it { should respond_to(:hunter_pets) }
11
+ it { should respond_to(:pets) }
12
+ it { should respond_to(:items) }
13
+ it { should respond_to(:mounts) }
14
+ it { should respond_to(:pet_slots) }
15
+ it { should respond_to(:progression) }
16
+ it { should respond_to(:pvp) }
17
+ it { should respond_to(:quests) }
18
+ it { should respond_to(:reputation) }
19
+ it { should respond_to(:stats) }
20
+ it { should respond_to(:talents) }
21
+ it { should respond_to(:titles) }
22
+ it { should respond_to(:audit) }
23
+
24
+ end
@@ -0,0 +1,11 @@
1
+ require 'battlenet/api'
2
+
3
+ describe Battlenet::WOW::GuildProfile do
4
+
5
+ it { should respond_to(:profile) }
6
+ it { should respond_to(:achievements) }
7
+ it { should respond_to(:members) }
8
+ it { should respond_to(:news) }
9
+ it { should respond_to(:challenge) }
10
+
11
+ end
@@ -3,73 +3,27 @@ require 'battlenet/api'
3
3
  describe Battlenet::WOWClient do
4
4
  before(:all) do
5
5
  Battlenet.configure do |config|
6
- config.api_key = 'test-wow-api-key'
6
+ config.api_key = 'test-wow-client'
7
7
  config.region = :us
8
8
  end
9
9
  end
10
10
 
11
11
  it "should pass the api key to the wow client" do
12
12
  c = Battlenet.WOWClient
13
- expect(c.api_key).to eq('test-wow-api-key')
13
+ expect(c.api_key).to eq('test-wow-client')
14
14
  end
15
15
 
16
- it { should respond_to(:achievement) }
17
- it { should respond_to(:auction_data_status) }
18
-
19
- it { should respond_to(:battlepet_ability) }
20
- it { should respond_to(:battlepet_species) }
21
- it { should respond_to(:battlepet_stats) }
22
-
23
- it { should respond_to(:challengemode_realm_leaderboard) }
24
- it { should respond_to(:challengemode_region_leaderboard) }
25
-
26
16
  it { should respond_to(:character_profile) }
27
- it { should respond_to(:character_achievements) }
28
- it { should respond_to(:character_appearance) }
29
- it { should respond_to(:character_feed) }
30
- it { should respond_to(:character_guild) }
31
- it { should respond_to(:character_hunter_pets) }
32
- it { should respond_to(:character_items) }
33
- it { should respond_to(:character_mounts) }
34
- it { should respond_to(:character_pets) }
35
- it { should respond_to(:character_pet_slots) }
36
- it { should respond_to(:character_progression) }
37
- it { should respond_to(:character_pvp) }
38
- it { should respond_to(:character_quests) }
39
- it { should respond_to(:character_reputation) }
40
- it { should respond_to(:character_stats) }
41
- it { should respond_to(:character_talents) }
42
- it { should respond_to(:character_titles) }
43
- it { should respond_to(:character_audit) }
44
-
45
- it { should respond_to(:data_battlegroups) }
46
- it { should respond_to(:data_character_races) }
47
- it { should respond_to(:data_character_classes) }
48
- it { should respond_to(:data_character_achievements) }
49
- it { should respond_to(:data_guild_rewards) }
50
- it { should respond_to(:data_guild_perks) }
51
- it { should respond_to(:data_guild_achievements) }
52
- it { should respond_to(:data_item_classes) }
53
- it { should respond_to(:data_talents) }
54
- it { should respond_to(:data_pet_types) }
55
-
56
17
  it { should respond_to(:guild_profile) }
57
- it { should respond_to(:guild_members) }
58
- it { should respond_to(:guild_achievements) }
59
- it { should respond_to(:guild_news) }
60
- it { should respond_to(:guild_challenge) }
61
-
62
18
  it { should respond_to(:item) }
63
19
  it { should respond_to(:item_set) }
64
-
65
- it { should respond_to(:pvp_leaderboards)}
66
-
20
+ it { should respond_to(:achievement) }
21
+ it { should respond_to(:auction) }
22
+ it { should respond_to(:pvp_leaderboard) }
67
23
  it { should respond_to(:quest) }
68
-
69
- it { should respond_to(:realm_status) }
70
-
24
+ it { should respond_to(:realm) }
71
25
  it { should respond_to(:recipe) }
72
-
73
26
  it { should respond_to(:spell) }
27
+ it { should respond_to(:data) }
74
28
 
75
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: battlenet-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - goodcodeguy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -94,6 +94,7 @@ files:
94
94
  - Rakefile
95
95
  - battlenet-api.gemspec
96
96
  - examples/example_oauth.rb
97
+ - examples/sandbox.rb
97
98
  - lib/battlenet/api.rb
98
99
  - lib/battlenet/api/api_response.rb
99
100
  - lib/battlenet/api/client.rb
@@ -108,15 +109,13 @@ files:
108
109
  - lib/battlenet/modules/sc2/ladder.rb
109
110
  - lib/battlenet/modules/sc2/profile.rb
110
111
  - lib/battlenet/modules/wow/achievement.rb
111
- - lib/battlenet/modules/wow/auction_data_status.rb
112
- - lib/battlenet/modules/wow/battlepet.rb
113
- - lib/battlenet/modules/wow/challenge_mode.rb
114
- - lib/battlenet/modules/wow/character/character_profile.rb
112
+ - lib/battlenet/modules/wow/auction.rb
115
113
  - lib/battlenet/modules/wow/character_profile.rb
116
114
  - lib/battlenet/modules/wow/data.rb
117
- - lib/battlenet/modules/wow/guild.rb
115
+ - lib/battlenet/modules/wow/guild_profile.rb
118
116
  - lib/battlenet/modules/wow/item.rb
119
- - lib/battlenet/modules/wow/pvp.rb
117
+ - lib/battlenet/modules/wow/item_set.rb
118
+ - lib/battlenet/modules/wow/pvp_leaderboard.rb
120
119
  - lib/battlenet/modules/wow/quest.rb
121
120
  - lib/battlenet/modules/wow/realm.rb
122
121
  - lib/battlenet/modules/wow/recipe.rb
@@ -124,6 +123,8 @@ files:
124
123
  - spec/battlenetapi_spec.rb
125
124
  - spec/d3client_spec.rb
126
125
  - spec/sc2client_spec.rb
126
+ - spec/wow/characterprofile_spec.rb
127
+ - spec/wow/guildprofile_spec.rb
127
128
  - spec/wowclient_spec.rb
128
129
  homepage: https://github.com/goodcodeguy/battlenet-api
129
130
  licenses:
@@ -153,4 +154,6 @@ test_files:
153
154
  - spec/battlenetapi_spec.rb
154
155
  - spec/d3client_spec.rb
155
156
  - spec/sc2client_spec.rb
157
+ - spec/wow/characterprofile_spec.rb
158
+ - spec/wow/guildprofile_spec.rb
156
159
  - spec/wowclient_spec.rb
@@ -1,11 +0,0 @@
1
- require 'uri'
2
-
3
- module Battlenet
4
- module WOW
5
- def auction_data_status(realm, options = {})
6
- realm = URI.escape realm
7
-
8
- get "/auction/data/#{realm}", options
9
- end
10
- end
11
- end
@@ -1,21 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,18 +0,0 @@
1
- module Battlenet
2
- module WOW
3
- class CharacterProfile < Battlenet::APIResponse
4
-
5
- attr_accessor :name, :realm, :battlegroup, :klass, :race,
6
- :gender, :level, :achievementPoints, :thumbnail,
7
- :calcClass, :totalHonorableKills
8
-
9
- def initialize(options={})
10
- @realm = options.delete(:realm)
11
- @character_name = options.delete(:character_name)
12
-
13
- super(options)
14
- end
15
-
16
- end
17
- end
18
- end
@@ -1,55 +0,0 @@
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
@@ -1,11 +0,0 @@
1
- require 'uri'
2
-
3
- module Battlenet
4
- module WOW
5
- def pvp_leaderboards(bracket, options = {})
6
- bracket = URI.escape bracket
7
-
8
- get "/leaderboard/#{bracket}", options
9
- end
10
- end
11
- end