bnet_api 0.1.5 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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('q3dqppcugfk7phjxbrtwuux3')
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('q3dqppcugfk7phjxbrtwuux3')
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('q3dqppcugfk7phjxbrtwuux3')
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('q3dqppcugfk7phjxbrtwuux3')
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
@@ -40,7 +40,7 @@ describe BnetApi::SC2 do
40
40
  end
41
41
 
42
42
  it "gets a ladder from the API" do
43
- ladder = BnetApi::SC2.ladder('grandmaster')
43
+ ladder = BnetApi::SC2.ladder(185245)
44
44
 
45
45
  expect(ladder['ladderMembers']).not_to be_nil
46
46
  end
@@ -1,26 +1,18 @@
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 an achievement from the API" do
13
- achievement = BnetApi::WoW.achievement(2144)
14
-
15
- expect(achievement['id']).to eq 2144
16
- expect(achievement['title']).to eq 'What a Long, Strange Trip It\'s Been'
17
- expect(achievement['points']).to eq 50
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