steam-api 1.0.1 → 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 +4 -4
- data/lib/steam-api/steam.rb +7 -1
- data/lib/steam-api/version.rb +1 -1
- data/spec/steam/apps_spec.rb +24 -18
- data/spec/steam/economy_spec.rb +16 -16
- data/spec/steam/news_spec.rb +3 -3
- data/spec/steam/player_spec.rb +30 -30
- data/spec/steam/users-stats_spec.rb +32 -28
- data/spec/steam/users_spec.rb +27 -28
- data/spec/steam_spec.rb +15 -5
- data/steam-api.gemspec +7 -7
- metadata +28 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0baaf180a77930f5d4f6c330611a73ce8fe980e
|
4
|
+
data.tar.gz: 2de31d7ddbcbf8cc5656648515b015b14bb2753e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcffe8cc1ee1b03737d4b3fa59f8a224004a2d5cde6cb65cc181eaf86f338618b21ffba2e3ac1e92237dc1e84c44a8939dd9144d7f682a9cf819a4cd212ea3dc
|
7
|
+
data.tar.gz: 1b25675f516359a5df9f346a12c486ec4106a3114911a7e175822114c84fda0683643121013f06f86788eab67c56b05412ac8c65986000dfdd4972fac030b81e
|
data/lib/steam-api/steam.rb
CHANGED
@@ -4,7 +4,13 @@ module Steam
|
|
4
4
|
@apikey = ENV['STEAM_API_KEY']
|
5
5
|
|
6
6
|
def self.apikey
|
7
|
-
|
7
|
+
if @apikey.nil?
|
8
|
+
if ENV.key?('STEAM_API_KEY')
|
9
|
+
@apikey = ENV['STEAM_API_KEY']
|
10
|
+
else
|
11
|
+
fail ArgumentError, 'Please set your Steam API key.'
|
12
|
+
end
|
13
|
+
end
|
8
14
|
@apikey
|
9
15
|
end
|
10
16
|
|
data/lib/steam-api/version.rb
CHANGED
data/spec/steam/apps_spec.rb
CHANGED
@@ -3,53 +3,59 @@ require 'spec_helper'
|
|
3
3
|
describe Steam::Apps do
|
4
4
|
describe '.get_all' do
|
5
5
|
it 'should allow users to look up a list of all apps' do
|
6
|
-
Steam::Apps.get_all
|
7
|
-
.
|
6
|
+
expect(Steam::Apps.get_all)
|
7
|
+
.to_not be_nil
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should allow users to look up a list of all apps' do
|
11
11
|
game = Steam::Apps.get_all.first
|
12
|
-
game.
|
13
|
-
game.
|
12
|
+
expect(game).to have_key 'appid'
|
13
|
+
expect(game).to have_key 'name'
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '.get_servers' do
|
18
18
|
it 'should allow users to look up a list of servers at an ip' do
|
19
|
-
Steam::Apps.get_servers(addr: '192.168.1.1')
|
20
|
-
.
|
19
|
+
expect(Steam::Apps.get_servers(addr: '192.168.1.1'))
|
20
|
+
.to_not be_nil
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should allow users to look up a list of servers at an ip' do
|
24
|
-
Steam::Apps.get_servers(addr: '192.168.1.1')
|
25
|
-
.
|
24
|
+
expect(Steam::Apps.get_servers(addr: '192.168.1.1'))
|
25
|
+
.to eq([])
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe '.up_to_date' do
|
30
30
|
it 'should allow users to look up version info' do
|
31
|
-
Steam::Apps.up_to_date(appid: 440, version: 10)
|
32
|
-
.
|
31
|
+
expect(Steam::Apps.up_to_date(appid: 440, version: 10))
|
32
|
+
.to_not be_nil
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should return a false up to date value if the verion is out of date' do
|
36
36
|
check = Steam::Apps.up_to_date(appid: 440, version: 10)
|
37
|
-
check['up_to_date']
|
38
|
-
|
39
|
-
check
|
40
|
-
|
37
|
+
expect(check['up_to_date'])
|
38
|
+
.to be_falsey
|
39
|
+
expect(check['version_is_listable'])
|
40
|
+
.to be_falsey
|
41
|
+
expect(check)
|
42
|
+
.to have_key('required_version')
|
43
|
+
expect(check['message'])
|
44
|
+
.to eq('Your server is out of date, please upgrade')
|
41
45
|
end
|
42
46
|
|
43
47
|
it 'should return a positive up to date value if the version is correct' do
|
44
48
|
current = Steam::Apps.up_to_date(appid: 440, version: 10)['required_version']
|
45
49
|
check = Steam::Apps.up_to_date(appid: 440, version: current)
|
46
|
-
check['up_to_date']
|
47
|
-
|
50
|
+
expect(check['up_to_date'])
|
51
|
+
.to be_truthy
|
52
|
+
expect(check['version_is_listable'])
|
53
|
+
.to be_truthy
|
48
54
|
end
|
49
55
|
|
50
56
|
it 'should capture json errors' do
|
51
|
-
lambda { Steam::Apps.up_to_date(appid: nil, version: 'foo') }
|
52
|
-
.
|
57
|
+
expect(lambda { Steam::Apps.up_to_date(appid: nil, version: 'foo') })
|
58
|
+
.to raise_error
|
53
59
|
end
|
54
60
|
end
|
55
61
|
end
|
data/spec/steam/economy_spec.rb
CHANGED
@@ -3,45 +3,45 @@ require 'spec_helper'
|
|
3
3
|
describe Steam::Economy do
|
4
4
|
describe '.asset_info' do
|
5
5
|
it 'should allow users to look up a list of all apps' do
|
6
|
-
Steam::Economy.asset_info(440, params: { class_count: 2,
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
asset = Steam::Economy.asset_info(440, params: { class_count: 2,
|
7
|
+
classid0: 195151,
|
8
|
+
classid1: 16891096 })
|
9
|
+
expect(asset).to_not be_nil
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should require class params' do
|
13
|
-
lambda { Steam::Economy.asset_info(440) }
|
14
|
-
.
|
13
|
+
expect(lambda { Steam::Economy.asset_info(440) })
|
14
|
+
.to raise_error
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should allow users to query asset info' do
|
18
18
|
result = Steam::Economy.asset_info(440, params: { class_count: 2,
|
19
19
|
classid0: 195151,
|
20
20
|
classid1: 16891096 })
|
21
|
-
result.
|
22
|
-
result.
|
21
|
+
expect(result).to have_key('195151')
|
22
|
+
expect(result).to have_key('16891096')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '.asset_prices' do
|
27
27
|
it 'should allow users to look up a list asset prices' do
|
28
|
-
Steam::Economy.asset_prices(440)
|
29
|
-
.
|
28
|
+
expect(Steam::Economy.asset_prices(440))
|
29
|
+
.to_not be_nil
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should allow return a list of assets' do
|
33
|
-
Steam::Economy.asset_prices(440)
|
34
|
-
.
|
33
|
+
expect(Steam::Economy.asset_prices(440))
|
34
|
+
.to have_key('assets')
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should allow return a list of asset tags' do
|
38
|
-
Steam::Economy.asset_prices(440)
|
39
|
-
.
|
38
|
+
expect(Steam::Economy.asset_prices(440))
|
39
|
+
.to have_key('tags')
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'should allow return a list of asset tag ids' do
|
43
|
-
Steam::Economy.asset_prices(440)
|
44
|
-
.
|
43
|
+
expect(Steam::Economy.asset_prices(440))
|
44
|
+
.to have_key('tag_ids')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/spec/steam/news_spec.rb
CHANGED
@@ -3,13 +3,13 @@ require 'spec_helper'
|
|
3
3
|
describe Steam::News do
|
4
4
|
describe '.get' do
|
5
5
|
it 'should allow users to look up a list news for an app' do
|
6
|
-
Steam::News.get(440)
|
7
|
-
.
|
6
|
+
expect(Steam::News.get(440))
|
7
|
+
.to_not be_nil
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should allow users to look up a list news for an app' do
|
11
11
|
news = Steam::News.get(440)
|
12
|
-
news.count.
|
12
|
+
expect(news.count).to eq(20)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/spec/steam/player_spec.rb
CHANGED
@@ -7,87 +7,87 @@ describe Steam::Player do
|
|
7
7
|
|
8
8
|
describe '.owned_games' do
|
9
9
|
it 'should allow users to retrieve a list of games' do
|
10
|
-
Steam::Player.owned_games(@playerid)
|
11
|
-
.
|
10
|
+
expect(Steam::Player.owned_games(@playerid))
|
11
|
+
.to_not be_nil
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should allow users to retrieve a list of games' do
|
15
|
-
Steam::Player.owned_games(@playerid)
|
16
|
-
.
|
15
|
+
expect(Steam::Player.owned_games(@playerid))
|
16
|
+
.to have_key('game_count')
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should allow users to retrieve a list of games' do
|
20
|
-
Steam::Player.owned_games(@playerid)
|
21
|
-
.
|
20
|
+
expect(Steam::Player.owned_games(@playerid))
|
21
|
+
.to have_key('games')
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '.recently_played_games' do
|
26
26
|
it 'should allow users to list a players recent games' do
|
27
|
-
Steam::Player.recently_played_games(@playerid)
|
28
|
-
.
|
27
|
+
expect(Steam::Player.recently_played_games(@playerid))
|
28
|
+
.to_not be_nil
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should allow users to list a players recent games' do
|
32
|
-
Steam::Player.recently_played_games(@playerid)
|
33
|
-
.
|
32
|
+
expect(Steam::Player.recently_played_games(@playerid))
|
33
|
+
.to have_key 'total_count'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe '.steam_level' do
|
38
38
|
it 'should allow users to retrieve a users steam level' do
|
39
|
-
Steam::Player.steam_level(@playerid)
|
40
|
-
.
|
39
|
+
expect(Steam::Player.steam_level(@playerid))
|
40
|
+
.to_not be_nil
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should allow users to retrieve a users steam level' do
|
44
|
-
Steam::Player.steam_level(@playerid)
|
45
|
-
.
|
44
|
+
expect(Steam::Player.steam_level(@playerid))
|
45
|
+
.to be_a(Fixnum)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe '.badges' do
|
50
50
|
it 'should allow a user to retrieve badges for a player' do
|
51
|
-
Steam::Player.badges(@playerid)
|
52
|
-
.
|
51
|
+
expect(Steam::Player.badges(@playerid))
|
52
|
+
.to_not be_nil
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should allow a user to retrieve badges for a player' do
|
56
|
-
Steam::Player.badges(@playerid)
|
57
|
-
.
|
56
|
+
expect(Steam::Player.badges(@playerid))
|
57
|
+
.to have_key 'badges'
|
58
58
|
end
|
59
59
|
|
60
60
|
it 'should allow a user to retrieve badges for a player' do
|
61
|
-
Steam::Player.badges(@playerid)
|
62
|
-
.
|
61
|
+
expect(Steam::Player.badges(@playerid))
|
62
|
+
.to have_key 'player_level'
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'should allow a user to retrieve badges for a player' do
|
66
|
-
Steam::Player.badges(@playerid)
|
67
|
-
.
|
66
|
+
expect(Steam::Player.badges(@playerid))
|
67
|
+
.to have_key 'player_xp'
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should allow a user to retrieve badges for a player' do
|
71
|
-
Steam::Player.badges(@playerid)
|
72
|
-
.
|
71
|
+
expect(Steam::Player.badges(@playerid))
|
72
|
+
.to have_key 'player_xp_needed_current_level'
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'should allow a user to retrieve badges for a player' do
|
76
|
-
Steam::Player.badges(@playerid)
|
77
|
-
.
|
76
|
+
expect(Steam::Player.badges(@playerid))
|
77
|
+
.to have_key 'player_xp_needed_to_level_up'
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe '.community_badge_progress' do
|
82
82
|
it 'should allow a user to retrieve community badge info for a player' do
|
83
|
-
Steam::Player.community_badge_progress(@playerid)
|
84
|
-
.
|
83
|
+
expect(Steam::Player.community_badge_progress(@playerid))
|
84
|
+
.to_not be_nil
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'should allow a user to retrieve community badge info for a player' do
|
88
88
|
quest = Steam::Player.community_badge_progress(@playerid).first
|
89
|
-
quest.
|
90
|
-
quest.
|
89
|
+
expect(quest).to have_key 'questid'
|
90
|
+
expect(quest).to have_key 'completed'
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -3,83 +3,87 @@ require 'spec_helper'
|
|
3
3
|
describe Steam::UserStats do
|
4
4
|
describe '.achievement_percentages' do
|
5
5
|
it 'should return achievement information' do
|
6
|
-
Steam::UserStats.achievement_percentages(440)
|
7
|
-
.
|
6
|
+
expect(Steam::UserStats.achievement_percentages(440))
|
7
|
+
.to_not be_nil
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should return all achievements for a game' do
|
11
11
|
achs = Steam::UserStats.achievement_percentages(440)
|
12
|
-
achs.first.
|
13
|
-
achs.first.
|
12
|
+
expect(achs.first).to have_key('name')
|
13
|
+
expect(achs.first).to have_key('percent')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '.game_schema' do
|
18
18
|
it 'should return global game stats' do
|
19
|
-
Steam::UserStats.game_schema(440)
|
20
|
-
.
|
19
|
+
expect(Steam::UserStats.game_schema(440))
|
20
|
+
.to_not be_nil
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should return global game stats with proper schema' do
|
24
|
-
Steam::UserStats.game_schema(440)
|
25
|
-
.
|
24
|
+
expect(Steam::UserStats.game_schema(440))
|
25
|
+
.to have_key('gameName')
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should return global game stats with proper schema' do
|
29
|
-
Steam::UserStats.game_schema(440)
|
30
|
-
.
|
29
|
+
expect(Steam::UserStats.game_schema(440))
|
30
|
+
.to have_key('gameName')
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should return global game stats with proper schema' do
|
34
|
-
Steam::UserStats.game_schema(440)
|
35
|
-
.
|
34
|
+
expect(Steam::UserStats.game_schema(440))
|
35
|
+
.to have_key('gameVersion')
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'should return global game stats with proper schema' do
|
39
|
-
Steam::UserStats.game_schema(440)
|
40
|
-
.
|
39
|
+
expect(Steam::UserStats.game_schema(440))
|
40
|
+
.to have_key('availableGameStats')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe '.global_for_game' do
|
45
45
|
it 'should return global game stats' do
|
46
|
-
Steam::UserStats.global_for_game(201830,
|
46
|
+
expect(Steam::UserStats.global_for_game(201830,
|
47
47
|
params: { 'name[0]' => 'totalDeaths',
|
48
|
-
count: 10 })
|
48
|
+
count: 10 }))
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
describe '.player_count' do
|
53
53
|
it 'should return a player count' do
|
54
|
-
Steam::UserStats.player_count(440)
|
55
|
-
.
|
54
|
+
expect(Steam::UserStats.player_count(440))
|
55
|
+
.to be_a(Fixnum)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
describe '.get_player_achievements' do
|
60
|
+
before(:each) do
|
61
|
+
@achs = Steam::UserStats.player_achievements(440, 76561197969622382)
|
62
|
+
end
|
63
|
+
|
60
64
|
it 'should return player achievements' do
|
61
|
-
|
62
|
-
.
|
65
|
+
expect(@achs)
|
66
|
+
.to have_key('achievements')
|
63
67
|
end
|
64
68
|
|
65
69
|
it 'should return player achievements' do
|
66
|
-
|
67
|
-
.
|
70
|
+
expect(@achs)
|
71
|
+
.to have_key('gameName')
|
68
72
|
end
|
69
73
|
|
70
74
|
it 'should return player achievements' do
|
71
|
-
|
72
|
-
.
|
75
|
+
expect(@achs['gameName'])
|
76
|
+
.to eq('Team Fortress 2')
|
73
77
|
end
|
74
78
|
|
75
79
|
it 'should return player achievements' do
|
76
|
-
Steam::UserStats.player_achievements(440, 76561197969622382)
|
77
|
-
.
|
80
|
+
expect(Steam::UserStats.player_achievements(440, 76561197969622382))
|
81
|
+
.to have_key('steamID')
|
78
82
|
end
|
79
83
|
|
80
84
|
it 'should return player achievements' do
|
81
|
-
Steam::UserStats.player_achievements(440, 76561197969622382)['steamID']
|
82
|
-
.
|
85
|
+
expect(Steam::UserStats.player_achievements(440, 76561197969622382)['steamID'])
|
86
|
+
.to eq('76561197969622382')
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
data/spec/steam/users_spec.rb
CHANGED
@@ -9,82 +9,81 @@ describe Steam::User do
|
|
9
9
|
describe '.friends' do
|
10
10
|
it 'should allow users to check a friends for a user' do
|
11
11
|
response = Steam::User.friends(@playerid)
|
12
|
-
response.
|
12
|
+
expect(response).to_not be_nil
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should allow users to check a friends for a user' do
|
16
|
-
Steam::User.friends(@playerid)
|
17
|
-
.
|
18
|
-
.should include(@playerid2.to_s)
|
16
|
+
expect(Steam::User.friends(@playerid).map { |friend| friend.first.last })
|
17
|
+
.to include(@playerid2.to_s)
|
19
18
|
end
|
20
19
|
|
21
20
|
it 'should return an error on a bad friend id' do
|
22
|
-
lambda { Steam::User.friends('765611') }
|
23
|
-
.
|
21
|
+
expect(lambda { Steam::User.friends('765611') })
|
22
|
+
.to raise_error
|
24
23
|
end
|
25
24
|
|
26
25
|
it 'should return the same content for :friends and :all' do
|
27
|
-
Steam::User.friends(@playerid2, relationship: :friend)
|
28
|
-
.
|
26
|
+
expect(Steam::User.friends(@playerid2, relationship: :friend))
|
27
|
+
.to eq(Steam::User.friends(@playerid2, relationship: :all))
|
29
28
|
end
|
30
29
|
|
31
30
|
it 'should return an error on a bad friend id' do
|
32
|
-
lambda { Steam::User.friends(@playerid2, relationship: :sadsad) }
|
33
|
-
.
|
31
|
+
expect(lambda { Steam::User.friends(@playerid2, relationship: :sadsad) })
|
32
|
+
.to raise_error(Steam::JSONError)
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
36
|
describe '.bans' do
|
38
37
|
it 'should allow users to check bans for a user' do
|
39
|
-
Steam::User.bans(@playerid)
|
40
|
-
.
|
38
|
+
expect(Steam::User.bans(@playerid))
|
39
|
+
.to_not be_nil
|
41
40
|
end
|
42
41
|
|
43
42
|
it 'should return a blank list for bad ids' do
|
44
|
-
Steam::User.bans(7993276293)
|
45
|
-
.
|
43
|
+
expect(Steam::User.bans(7993276293))
|
44
|
+
.to eq({ 'players' => [] })
|
46
45
|
end
|
47
46
|
|
48
47
|
it 'should allow users to check a bans for multiple steamids' do
|
49
|
-
Steam::User.bans([@player, @player2])
|
50
|
-
.
|
48
|
+
expect(Steam::User.bans([@player, @player2]))
|
49
|
+
.to_not be_nil
|
51
50
|
end
|
52
51
|
end
|
53
52
|
|
54
53
|
describe '.summary' do
|
55
54
|
it 'should allow users to get a summary for a user' do
|
56
|
-
Steam::User.summary(@playerid)
|
57
|
-
.
|
55
|
+
expect(Steam::User.summary(@playerid))
|
56
|
+
.to_not be_nil
|
58
57
|
end
|
59
58
|
|
60
59
|
it 'should allow users to check summaries for multiple accounts' do
|
61
|
-
Steam::User.summaries([@player, @player2])
|
62
|
-
.
|
60
|
+
expect(Steam::User.summaries([@player, @player2]))
|
61
|
+
.to_not be_nil
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
66
65
|
describe '.vanity_to_steamid' do
|
67
66
|
it 'should return values when they look up vanity urls' do
|
68
|
-
Steam::User.vanity_to_steamid('asmeroth')
|
69
|
-
.
|
67
|
+
expect(Steam::User.vanity_to_steamid('asmeroth'))
|
68
|
+
.to_not be_nil
|
70
69
|
end
|
71
70
|
|
72
71
|
it 'should return the correct id when users look up vanity urls' do
|
73
|
-
Steam::User.vanity_to_steamid('asmeroth')
|
74
|
-
.
|
72
|
+
expect(Steam::User.vanity_to_steamid('asmeroth'))
|
73
|
+
.to eq(@playerid.to_s)
|
75
74
|
end
|
76
75
|
end
|
77
76
|
|
78
77
|
describe '.groups' do
|
79
78
|
it 'should allow users to look groups a player is a member of' do
|
80
|
-
Steam::User.groups(@playerid)
|
81
|
-
.
|
79
|
+
expect(Steam::User.groups(@playerid))
|
80
|
+
.to_not be_nil
|
82
81
|
end
|
83
82
|
|
84
83
|
it 'should return an accurate list of groups a player is a member of' do
|
85
84
|
response = Steam::User.groups(@playerid)
|
86
|
-
response.map { |g| g.values.first }
|
87
|
-
.
|
85
|
+
expect(response.map { |g| g.values.first })
|
86
|
+
.to include '3640974'
|
88
87
|
end
|
89
88
|
end
|
90
89
|
end
|
data/spec/steam_spec.rb
CHANGED
@@ -10,19 +10,29 @@ describe Steam do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should return a Steam API key if one is defined' do
|
13
|
-
Steam.apikey.
|
13
|
+
expect(Steam.apikey).to_not be_nil
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should return an error if the Steam Key is missing' do
|
17
17
|
Steam.apikey = nil
|
18
|
-
|
19
|
-
|
18
|
+
ENV['STEAM_API_KEY'] = nil
|
19
|
+
expect(lambda { Steam.apikey })
|
20
|
+
.to raise_error(ArgumentError, /Please set your Steam API key/)
|
20
21
|
end
|
21
22
|
|
22
23
|
it 'should return a new value if set to a different API key' do
|
23
24
|
old = Steam.apikey
|
24
25
|
Steam.apikey = 'blah'
|
25
|
-
Steam.apikey.
|
26
|
-
Steam.apikey.
|
26
|
+
expect(Steam.apikey).to_not eq(old)
|
27
|
+
expect(Steam.apikey).to eq('blah')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should allow users to set the apikey post init using ENV' do
|
31
|
+
Steam.apikey = nil
|
32
|
+
ENV['STEAM_API_KEY'] = nil
|
33
|
+
expect(lambda { Steam.apikey })
|
34
|
+
.to raise_error(ArgumentError, /Please set your Steam API key/)
|
35
|
+
ENV['STEAM_API_KEY'] = @apikey
|
36
|
+
expect(Steam.apikey).to eq(@apikey)
|
27
37
|
end
|
28
38
|
end
|
data/steam-api.gemspec
CHANGED
@@ -11,17 +11,17 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.description = %q{Simple Steam Gem}
|
12
12
|
gem.summary = %q{Simple Gem to interact witht the Steam Web API}
|
13
13
|
gem.homepage = 'https://github.com/bhaberer/steam-api'
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
19
|
gem.require_paths = ['lib']
|
19
20
|
|
20
|
-
gem.add_development_dependency 'rake'
|
21
|
-
gem.add_development_dependency 'rspec'
|
22
|
-
gem.add_development_dependency 'coveralls'
|
23
|
-
|
24
|
-
gem.add_dependency
|
25
|
-
gem.add_dependency
|
26
|
-
gem.add_dependency 'json', '>= 1.7.7'
|
21
|
+
gem.add_development_dependency 'rake', '~> 10'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 3'
|
23
|
+
gem.add_development_dependency 'coveralls', '~> 0.7'
|
24
|
+
gem.add_dependency 'faraday', '0.9.0'
|
25
|
+
gem.add_dependency 'multi_json', '~> 1.7', '>= 1.7.7'
|
26
|
+
gem.add_dependency 'json', '~> 1.7', '>= 1.7.7'
|
27
27
|
end
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steam-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Haberer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coveralls
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '0.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faraday
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,6 +70,9 @@ dependencies:
|
|
70
70
|
name: multi_json
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.7'
|
73
76
|
- - ! '>='
|
74
77
|
- !ruby/object:Gem::Version
|
75
78
|
version: 1.7.7
|
@@ -77,6 +80,9 @@ dependencies:
|
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.7'
|
80
86
|
- - ! '>='
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: 1.7.7
|
@@ -84,6 +90,9 @@ dependencies:
|
|
84
90
|
name: json
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
93
|
+
- - ~>
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.7'
|
87
96
|
- - ! '>='
|
88
97
|
- !ruby/object:Gem::Version
|
89
98
|
version: 1.7.7
|
@@ -91,6 +100,9 @@ dependencies:
|
|
91
100
|
prerelease: false
|
92
101
|
version_requirements: !ruby/object:Gem::Requirement
|
93
102
|
requirements:
|
103
|
+
- - ~>
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.7'
|
94
106
|
- - ! '>='
|
95
107
|
- !ruby/object:Gem::Version
|
96
108
|
version: 1.7.7
|
@@ -133,7 +145,8 @@ files:
|
|
133
145
|
- spec/steam_spec.rb
|
134
146
|
- steam-api.gemspec
|
135
147
|
homepage: https://github.com/bhaberer/steam-api
|
136
|
-
licenses:
|
148
|
+
licenses:
|
149
|
+
- MIT
|
137
150
|
metadata: {}
|
138
151
|
post_install_message:
|
139
152
|
rdoc_options: []
|