bnet_api 0.1.5 → 1.0.2
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 +5 -13
- data/.travis.yml +0 -2
- data/CHANGELOG.md +13 -0
- data/Gemfile +1 -1
- data/LICENSE.md +20 -20
- data/README.md +4 -0
- data/Rakefile +5 -5
- data/bnet_api.gemspec +23 -24
- data/lib/bnet_api/version.rb +1 -1
- data/lib/bnet_api/wow.rb +44 -37
- data/spec/bnet_api/bnet_api_spec.rb +17 -17
- data/spec/bnet_api/d3_spec.rb +91 -91
- data/spec/bnet_api/oauth_spec.rb +34 -34
- data/spec/bnet_api/sc2_spec.rb +1 -1
- data/spec/bnet_api/wow/wow_achievement_spec.rb +17 -25
- data/spec/bnet_api/wow/wow_auction_data_spec.rb +18 -18
- data/spec/bnet_api/wow/wow_challenge_mode_spec.rb +22 -22
- data/spec/bnet_api/wow/wow_data_spec.rb +80 -80
- data/spec/bnet_api/wow/wow_guild_spec.rb +56 -56
- data/spec/bnet_api/wow/wow_item_spec.rb +28 -28
- data/spec/bnet_api/wow/{wow_battlepet_spec.rb → wow_pet_spec.rb} +55 -49
- data/spec/bnet_api/wow/wow_pvp_spec.rb +16 -16
- data/spec/bnet_api/wow/wow_quest_spec.rb +21 -21
- data/spec/bnet_api/wow/wow_realm_status_spec.rb +24 -24
- data/spec/bnet_api/wow/wow_recipe_spec.rb +19 -19
- data/spec/bnet_api/wow/wow_spell_spec.rb +23 -23
- metadata +13 -43
- data/.rspec +0 -2
data/spec/bnet_api/oauth_spec.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe BnetApi::OAuth do
|
4
|
-
|
5
|
-
before :each do
|
6
|
-
BnetApi.configure do |config|
|
7
|
-
config.api_key = ENV['BNET_API_KEY']
|
8
|
-
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it "gets an account ID from the API" do
|
13
|
-
account = BnetApi::OAuth.account_id('
|
14
|
-
|
15
|
-
expect(account['id']).to eq 50804047
|
16
|
-
end
|
17
|
-
|
18
|
-
it "gets a battletag from the API" do
|
19
|
-
account = BnetApi::OAuth.battletag('
|
20
|
-
|
21
|
-
expect(account['battletag']).to eq 'Ragwolf#2851'
|
22
|
-
end
|
23
|
-
|
24
|
-
it "gets a Starcraft II profile from the API" do
|
25
|
-
profile = BnetApi::OAuth.sc2_profile('
|
26
|
-
|
27
|
-
expect(profile['characters']).not_to be_nil
|
28
|
-
end
|
29
|
-
|
30
|
-
it "gets a World of Warcraft profile from the API" do
|
31
|
-
profile = BnetApi::OAuth.wow_profile('
|
32
|
-
|
33
|
-
expect(profile['characters']).not_to be_nil
|
34
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetApi::OAuth do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
BnetApi.configure do |config|
|
7
|
+
config.api_key = ENV['BNET_API_KEY']
|
8
|
+
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "gets an account ID from the API" do
|
13
|
+
account = BnetApi::OAuth.account_id(ENV['BNET_API_OAUTH_ACCESS_TOKEN'])
|
14
|
+
|
15
|
+
expect(account['id']).to eq 50804047
|
16
|
+
end
|
17
|
+
|
18
|
+
it "gets a battletag from the API" do
|
19
|
+
account = BnetApi::OAuth.battletag(ENV['BNET_API_OAUTH_ACCESS_TOKEN'])
|
20
|
+
|
21
|
+
expect(account['battletag']).to eq 'Ragwolf#2851'
|
22
|
+
end
|
23
|
+
|
24
|
+
it "gets a Starcraft II profile from the API" do
|
25
|
+
profile = BnetApi::OAuth.sc2_profile(ENV['BNET_API_OAUTH_ACCESS_TOKEN'])
|
26
|
+
|
27
|
+
expect(profile['characters']).not_to be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it "gets a World of Warcraft profile from the API" do
|
31
|
+
profile = BnetApi::OAuth.wow_profile(ENV['BNET_API_OAUTH_ACCESS_TOKEN'])
|
32
|
+
|
33
|
+
expect(profile['characters']).not_to be_nil
|
34
|
+
end
|
35
35
|
end
|
data/spec/bnet_api/sc2_spec.rb
CHANGED
@@ -1,26 +1,18 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe BnetApi::WoW do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
achievement
|
14
|
-
|
15
|
-
expect(achievement['
|
16
|
-
expect(achievement['
|
17
|
-
|
18
|
-
expect(achievement['description']).not_to be_nil
|
19
|
-
expect(achievement['reward']).to eq 'Rewards: Violet Proto-Drake'
|
20
|
-
expect(achievement['rewardItems']).not_to be_nil
|
21
|
-
expect(achievement['icon']).to eq 'achievement_bg_masterofallbgs'
|
22
|
-
expect(achievement['criteria']).not_to be_nil
|
23
|
-
expect(achievement['accountWide']).to eq true
|
24
|
-
expect(achievement['factionId']).to eq 2
|
25
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetApi::WoW do
|
4
|
+
it "gets an achievement from the API" do
|
5
|
+
achievement = BnetApi::WoW.achievement(2144)
|
6
|
+
|
7
|
+
expect(achievement['id']).to eq 2144
|
8
|
+
expect(achievement['title']).to eq 'What a Long, Strange Trip It\'s Been'
|
9
|
+
expect(achievement['points']).to eq 50
|
10
|
+
expect(achievement['description']).not_to be_nil
|
11
|
+
expect(achievement['reward']).to eq 'Rewards: Violet Proto-Drake'
|
12
|
+
expect(achievement['rewardItems']).not_to be_nil
|
13
|
+
expect(achievement['icon']).to eq 'achievement_bg_masterofallbgs'
|
14
|
+
expect(achievement['criteria']).not_to be_nil
|
15
|
+
expect(achievement['accountWide']).to eq true
|
16
|
+
expect(achievement['factionId']).to eq 2
|
17
|
+
end
|
26
18
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe BnetApi::WoW do
|
4
|
-
|
5
|
-
before :each do
|
6
|
-
BnetApi.configure do |config|
|
7
|
-
config.api_key = ENV['BNET_API_KEY']
|
8
|
-
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it "gets the URL of an auction data dump from the API" do
|
13
|
-
auction_data = BnetApi::WoW.auction_data('Thunderhorn')
|
14
|
-
|
15
|
-
expect(auction_data['files']).not_to be_nil
|
16
|
-
expect(auction_data['files'][0]['url']).not_to be_nil
|
17
|
-
expect(auction_data['files'][0]['lastModified']).not_to be_nil
|
18
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetApi::WoW do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
BnetApi.configure do |config|
|
7
|
+
config.api_key = ENV['BNET_API_KEY']
|
8
|
+
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "gets the URL of an auction data dump from the API" do
|
13
|
+
auction_data = BnetApi::WoW.auction_data('Thunderhorn')
|
14
|
+
|
15
|
+
expect(auction_data['files']).not_to be_nil
|
16
|
+
expect(auction_data['files'][0]['url']).not_to be_nil
|
17
|
+
expect(auction_data['files'][0]['lastModified']).not_to be_nil
|
18
|
+
end
|
19
19
|
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe BnetApi::WoW do
|
4
|
-
|
5
|
-
before :each do
|
6
|
-
BnetApi.configure do |config|
|
7
|
-
config.api_key = ENV['BNET_API_KEY']
|
8
|
-
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it "gets a challenge mode realm leaderboard from the API" do
|
13
|
-
leaderboard = BnetApi::WoW.challenge_mode_realm('Thunderhorn')
|
14
|
-
|
15
|
-
expect(leaderboard['challenge']).not_to be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
it "gets a challenge mode region leaderboard from the API" do
|
19
|
-
leaderboard = BnetApi::WoW.challenge_mode_region
|
20
|
-
|
21
|
-
expect(leaderboard['challenge']).not_to be_nil
|
22
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetApi::WoW do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
BnetApi.configure do |config|
|
7
|
+
config.api_key = ENV['BNET_API_KEY']
|
8
|
+
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "gets a challenge mode realm leaderboard from the API" do
|
13
|
+
leaderboard = BnetApi::WoW.challenge_mode_realm('Thunderhorn')
|
14
|
+
|
15
|
+
expect(leaderboard['challenge']).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it "gets a challenge mode region leaderboard from the API" do
|
19
|
+
leaderboard = BnetApi::WoW.challenge_mode_region
|
20
|
+
|
21
|
+
expect(leaderboard['challenge']).not_to be_nil
|
22
|
+
end
|
23
23
|
end
|
@@ -1,81 +1,81 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe BnetApi::WoW do
|
4
|
-
|
5
|
-
before :each do
|
6
|
-
BnetApi.configure do |config|
|
7
|
-
config.api_key = ENV['BNET_API_KEY']
|
8
|
-
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it "gets a list of battlegroups from the API" do
|
13
|
-
battlegroups = BnetApi::WoW::Data.battlegroups
|
14
|
-
|
15
|
-
expect(battlegroups['battlegroups']).not_to be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
it "gets a list of character races from the API" do
|
19
|
-
races = BnetApi::WoW::Data.character_races
|
20
|
-
|
21
|
-
expect(races['races']).not_to be_nil
|
22
|
-
end
|
23
|
-
|
24
|
-
it "gets a list of character classes from the API" do
|
25
|
-
classes = BnetApi::WoW::Data.character_classes
|
26
|
-
|
27
|
-
expect(classes['classes']).not_to be_nil
|
28
|
-
end
|
29
|
-
|
30
|
-
it "gets a list of character achievements from the API" do
|
31
|
-
achievements = BnetApi::WoW::Data.character_achievements
|
32
|
-
|
33
|
-
expect(achievements['achievements']).not_to be_nil
|
34
|
-
end
|
35
|
-
|
36
|
-
it "gets a list of guild rewards from the API" do
|
37
|
-
rewards = BnetApi::WoW::Data.guild_rewards
|
38
|
-
|
39
|
-
expect(rewards['rewards']).not_to be_nil
|
40
|
-
end
|
41
|
-
|
42
|
-
it "gets a list of guild perks from the API" do
|
43
|
-
perks = BnetApi::WoW::Data.guild_perks
|
44
|
-
|
45
|
-
expect(perks['perks']).not_to be_nil
|
46
|
-
end
|
47
|
-
|
48
|
-
it "gets a list of guild achievements from the API" do
|
49
|
-
achievements = BnetApi::WoW::Data.guild_achievements
|
50
|
-
|
51
|
-
expect(achievements['achievements']).not_to be_nil
|
52
|
-
end
|
53
|
-
|
54
|
-
it "gets a list of item classes from the API" do
|
55
|
-
classes = BnetApi::WoW::Data.item_classes
|
56
|
-
|
57
|
-
expect(classes['classes']).not_to be_nil
|
58
|
-
end
|
59
|
-
|
60
|
-
it "gets a list of talents from the API" do
|
61
|
-
talents = BnetApi::WoW::Data.talents
|
62
|
-
|
63
|
-
expect(talents['1']).not_to be_nil
|
64
|
-
expect(talents['2']).not_to be_nil
|
65
|
-
expect(talents['3']).not_to be_nil
|
66
|
-
expect(talents['4']).not_to be_nil
|
67
|
-
expect(talents['5']).not_to be_nil
|
68
|
-
expect(talents['6']).not_to be_nil
|
69
|
-
expect(talents['7']).not_to be_nil
|
70
|
-
expect(talents['8']).not_to be_nil
|
71
|
-
expect(talents['9']).not_to be_nil
|
72
|
-
expect(talents['10']).not_to be_nil
|
73
|
-
expect(talents['11']).not_to be_nil
|
74
|
-
end
|
75
|
-
|
76
|
-
it "gets a list of pet types from the API" do
|
77
|
-
petTypes = BnetApi::WoW::Data.pet_types
|
78
|
-
|
79
|
-
expect(petTypes['petTypes']).not_to be_nil
|
80
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetApi::WoW do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
BnetApi.configure do |config|
|
7
|
+
config.api_key = ENV['BNET_API_KEY']
|
8
|
+
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "gets a list of battlegroups from the API" do
|
13
|
+
battlegroups = BnetApi::WoW::Data.battlegroups
|
14
|
+
|
15
|
+
expect(battlegroups['battlegroups']).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it "gets a list of character races from the API" do
|
19
|
+
races = BnetApi::WoW::Data.character_races
|
20
|
+
|
21
|
+
expect(races['races']).not_to be_nil
|
22
|
+
end
|
23
|
+
|
24
|
+
it "gets a list of character classes from the API" do
|
25
|
+
classes = BnetApi::WoW::Data.character_classes
|
26
|
+
|
27
|
+
expect(classes['classes']).not_to be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it "gets a list of character achievements from the API" do
|
31
|
+
achievements = BnetApi::WoW::Data.character_achievements
|
32
|
+
|
33
|
+
expect(achievements['achievements']).not_to be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it "gets a list of guild rewards from the API" do
|
37
|
+
rewards = BnetApi::WoW::Data.guild_rewards
|
38
|
+
|
39
|
+
expect(rewards['rewards']).not_to be_nil
|
40
|
+
end
|
41
|
+
|
42
|
+
it "gets a list of guild perks from the API" do
|
43
|
+
perks = BnetApi::WoW::Data.guild_perks
|
44
|
+
|
45
|
+
expect(perks['perks']).not_to be_nil
|
46
|
+
end
|
47
|
+
|
48
|
+
it "gets a list of guild achievements from the API" do
|
49
|
+
achievements = BnetApi::WoW::Data.guild_achievements
|
50
|
+
|
51
|
+
expect(achievements['achievements']).not_to be_nil
|
52
|
+
end
|
53
|
+
|
54
|
+
it "gets a list of item classes from the API" do
|
55
|
+
classes = BnetApi::WoW::Data.item_classes
|
56
|
+
|
57
|
+
expect(classes['classes']).not_to be_nil
|
58
|
+
end
|
59
|
+
|
60
|
+
it "gets a list of talents from the API" do
|
61
|
+
talents = BnetApi::WoW::Data.talents
|
62
|
+
|
63
|
+
expect(talents['1']).not_to be_nil
|
64
|
+
expect(talents['2']).not_to be_nil
|
65
|
+
expect(talents['3']).not_to be_nil
|
66
|
+
expect(talents['4']).not_to be_nil
|
67
|
+
expect(talents['5']).not_to be_nil
|
68
|
+
expect(talents['6']).not_to be_nil
|
69
|
+
expect(talents['7']).not_to be_nil
|
70
|
+
expect(talents['8']).not_to be_nil
|
71
|
+
expect(talents['9']).not_to be_nil
|
72
|
+
expect(talents['10']).not_to be_nil
|
73
|
+
expect(talents['11']).not_to be_nil
|
74
|
+
end
|
75
|
+
|
76
|
+
it "gets a list of pet types from the API" do
|
77
|
+
petTypes = BnetApi::WoW::Data.pet_types
|
78
|
+
|
79
|
+
expect(petTypes['petTypes']).not_to be_nil
|
80
|
+
end
|
81
81
|
end
|
@@ -1,57 +1,57 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe BnetApi::WoW do
|
4
|
-
|
5
|
-
before :each do
|
6
|
-
BnetApi.configure do |config|
|
7
|
-
config.api_key = ENV['BNET_API_KEY']
|
8
|
-
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
it "gets a guild from the API" do
|
13
|
-
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution')
|
14
|
-
|
15
|
-
expect(guild['lastModified']).not_to be_nil
|
16
|
-
expect(guild['name']).to eq('Banana Revolution')
|
17
|
-
expect(guild['realm']).to eq('Thunderhorn')
|
18
|
-
expect(guild['battlegroup']).to eq('Misery')
|
19
|
-
expect(guild['level']).to eq(25)
|
20
|
-
expect(guild['side']).to eq(1)
|
21
|
-
expect(guild['achievementPoints']).not_to be_nil
|
22
|
-
expect(guild['emblem']).not_to be_nil
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets a guild from the API with members data" do
|
26
|
-
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :members)
|
27
|
-
|
28
|
-
expect(guild['members']).not_to be_nil
|
29
|
-
end
|
30
|
-
|
31
|
-
it "gets a guild from the API with achievements data" do
|
32
|
-
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :achievements)
|
33
|
-
|
34
|
-
expect(guild['achievements']).not_to be_nil
|
35
|
-
end
|
36
|
-
|
37
|
-
it "gets a guild from the API with news data" do
|
38
|
-
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :news)
|
39
|
-
|
40
|
-
expect(guild['news']).not_to be_nil
|
41
|
-
end
|
42
|
-
|
43
|
-
it "gets a guild from the API with challenge data" do
|
44
|
-
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :challenge)
|
45
|
-
|
46
|
-
expect(guild['challenge']).not_to be_nil
|
47
|
-
end
|
48
|
-
|
49
|
-
it "gets a guild from the API with all additional data" do
|
50
|
-
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :all)
|
51
|
-
|
52
|
-
expect(guild['members']).not_to be_nil
|
53
|
-
expect(guild['achievements']).not_to be_nil
|
54
|
-
expect(guild['news']).not_to be_nil
|
55
|
-
expect(guild['challenge']).not_to be_nil
|
56
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BnetApi::WoW do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
BnetApi.configure do |config|
|
7
|
+
config.api_key = ENV['BNET_API_KEY']
|
8
|
+
config.api_secret = ENV['BNET_API_SECRET']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "gets a guild from the API" do
|
13
|
+
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution')
|
14
|
+
|
15
|
+
expect(guild['lastModified']).not_to be_nil
|
16
|
+
expect(guild['name']).to eq('Banana Revolution')
|
17
|
+
expect(guild['realm']).to eq('Thunderhorn')
|
18
|
+
expect(guild['battlegroup']).to eq('Misery')
|
19
|
+
expect(guild['level']).to eq(25)
|
20
|
+
expect(guild['side']).to eq(1)
|
21
|
+
expect(guild['achievementPoints']).not_to be_nil
|
22
|
+
expect(guild['emblem']).not_to be_nil
|
23
|
+
end
|
24
|
+
|
25
|
+
it "gets a guild from the API with members data" do
|
26
|
+
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :members)
|
27
|
+
|
28
|
+
expect(guild['members']).not_to be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
it "gets a guild from the API with achievements data" do
|
32
|
+
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :achievements)
|
33
|
+
|
34
|
+
expect(guild['achievements']).not_to be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it "gets a guild from the API with news data" do
|
38
|
+
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :news)
|
39
|
+
|
40
|
+
expect(guild['news']).not_to be_nil
|
41
|
+
end
|
42
|
+
|
43
|
+
it "gets a guild from the API with challenge data" do
|
44
|
+
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :challenge)
|
45
|
+
|
46
|
+
expect(guild['challenge']).not_to be_nil
|
47
|
+
end
|
48
|
+
|
49
|
+
it "gets a guild from the API with all additional data" do
|
50
|
+
guild = BnetApi::WoW.guild('Thunderhorn', 'Banana Revolution', :all)
|
51
|
+
|
52
|
+
expect(guild['members']).not_to be_nil
|
53
|
+
expect(guild['achievements']).not_to be_nil
|
54
|
+
expect(guild['news']).not_to be_nil
|
55
|
+
expect(guild['challenge']).not_to be_nil
|
56
|
+
end
|
57
57
|
end
|