steam-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Steam::RemoteStorage do
4
+ describe '.published_file' do
5
+ end
6
+
7
+ describe '.ugc_file' do
8
+ end
9
+ end
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ describe Steam::UserStats do
4
+ describe '.achievement_percentages' do
5
+ it 'should return achievement information' do
6
+ Steam::UserStats.achievement_percentages(440)
7
+ .should_not be_nil
8
+ end
9
+
10
+ it 'should return all achievements for a game' do
11
+ achs = Steam::UserStats.achievement_percentages(440)
12
+ achs.first.should have_key('name')
13
+ achs.first.should have_key('percent')
14
+ end
15
+ end
16
+
17
+ describe '.game_schema' do
18
+ it 'should return global game stats' do
19
+ Steam::UserStats.game_schema(440)
20
+ .should_not be_nil
21
+ end
22
+
23
+ it 'should return global game stats with proper schema' do
24
+ Steam::UserStats.game_schema(440)
25
+ .should have_key('gameName')
26
+ end
27
+
28
+ it 'should return global game stats with proper schema' do
29
+ Steam::UserStats.game_schema(440)
30
+ .should have_key('gameName')
31
+ end
32
+
33
+ it 'should return global game stats with proper schema' do
34
+ Steam::UserStats.game_schema(440)
35
+ .should have_key('gameVersion')
36
+ end
37
+
38
+ it 'should return global game stats with proper schema' do
39
+ Steam::UserStats.game_schema(440)
40
+ .should have_key('availableGameStats')
41
+ end
42
+ end
43
+
44
+ describe '.global_for_game' do
45
+ it 'should return global game stats' do
46
+ Steam::UserStats.global_for_game(201830,
47
+ params: { 'name[0]' => 'totalDeaths',
48
+ count: 10 })
49
+ end
50
+ end
51
+
52
+ describe '.player_count' do
53
+ it 'should return a player count' do
54
+ Steam::UserStats.player_count(440)
55
+ .should be_a(Fixnum)
56
+ end
57
+ end
58
+
59
+ describe '.get_player_achievements' do
60
+ it 'should return player achievements' do
61
+ Steam::UserStats.player_achievements(440, 76561197969622382)
62
+ .should have_key('achievements')
63
+ end
64
+
65
+ it 'should return player achievements' do
66
+ Steam::UserStats.player_achievements(440, 76561197969622382)
67
+ .should have_key('gameName')
68
+ end
69
+
70
+ it 'should return player achievements' do
71
+ Steam::UserStats.player_achievements(440, 76561197969622382)['gameName']
72
+ .should == 'Team Fortress 2'
73
+ end
74
+
75
+ it 'should return player achievements' do
76
+ Steam::UserStats.player_achievements(440, 76561197969622382)
77
+ .should have_key('steamID')
78
+ end
79
+
80
+ it 'should return player achievements' do
81
+ Steam::UserStats.player_achievements(440, 76561197969622382)['steamID']
82
+ .should == '76561197969622382'
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,86 @@
1
+ require 'spec_helper'
2
+
3
+ describe Steam::User do
4
+
5
+ describe '.friends' do
6
+ it 'should allow users to check a friends for a user' do
7
+ response = Steam::User.friends(76561197993276293)
8
+ response.should_not be_nil
9
+ end
10
+
11
+ it 'should allow users to check a friends for a user' do
12
+ Steam::User.friends(76561197993276293)
13
+ .map {|f| f.first.last }
14
+ .should include('76561197969622382')
15
+ end
16
+
17
+ it 'should return an error on a bad friend id' do
18
+ lambda { Steam::User.friends('765611') }
19
+ .should raise_error
20
+ end
21
+
22
+ it 'should return the same content for :friends and :all' do
23
+ Steam::User.friends('76561197969622382', relationship: :friend)
24
+ .should == Steam::User.friends('76561197969622382', relationship: :all)
25
+ end
26
+
27
+ it 'should return an error on a bad friend id' do
28
+ lambda { Steam::User.friends('76561197969622382', relationship: :sadsad) }
29
+ .should raise_error(Steam::JSONError)
30
+ end
31
+ end
32
+
33
+ describe '.bans' do
34
+ it 'should allow users to check bans for a user' do
35
+ Steam::User.bans(76561197993276293)
36
+ .should_not be_nil
37
+ end
38
+
39
+ it 'should return a blank list for bad ids' do
40
+ Steam::User.bans(7993276293)
41
+ .should == { 'players' => [] }
42
+ end
43
+
44
+ it 'should allow users to check a bans for multiple steamids' do
45
+ Steam::User.bans([76561197993276293, 76561197966796383])
46
+ .should_not be_nil
47
+ end
48
+ end
49
+
50
+ describe '.summary' do
51
+ it 'should allow users to get a summary for a user' do
52
+ Steam::User.summary(76561197993276293)
53
+ .should_not be_nil
54
+ end
55
+
56
+ it 'should allow users to check summaries for multiple accounts' do
57
+ Steam::User.summaries([76561197993276293, 76561197966796383])
58
+ .should_not be_nil
59
+ end
60
+ end
61
+
62
+ describe '.vanity_to_steamid' do
63
+ it 'should return values when they look up vanity urls' do
64
+ Steam::User.vanity_to_steamid('asmeroth')
65
+ .should_not be_nil
66
+ end
67
+
68
+ it 'should return the correct id when users look up vanity urls' do
69
+ Steam::User.vanity_to_steamid('asmeroth')
70
+ .should == '76561197993276293'
71
+ end
72
+ end
73
+
74
+ describe '.groups' do
75
+ it 'should allow users to look groups a player is a member of' do
76
+ Steam::User.groups(76561197993276293)
77
+ .should_not be_nil
78
+ end
79
+
80
+ it 'should return an accurate list of groups a player is a member of' do
81
+ response = Steam::User.groups(76561197993276293)
82
+ response.map { |g| g.values.first }
83
+ .should include '3640974'
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe Steam do
4
+ before(:all) do
5
+ @apikey = Steam.apikey
6
+ end
7
+
8
+ after(:each) do
9
+ Steam.apikey = @apikey
10
+ end
11
+
12
+ it 'should return a Steam API key if one is defined' do
13
+ Steam.apikey.should_not be_nil
14
+ end
15
+
16
+ it 'should return an error if the Steam Key is missing' do
17
+ Steam.apikey = nil
18
+ lambda { Steam.apikey }
19
+ .should raise_error(ArgumentError, /Please set your Steam API key/)
20
+ end
21
+
22
+ it 'should return a new value if set to a different API key' do
23
+ old = Steam.apikey
24
+ Steam.apikey = 'blah'
25
+ Steam.apikey.should_not == old
26
+ Steam.apikey.should == 'blah'
27
+ end
28
+
29
+ it 'should update the ENV variable if set' do
30
+ Steam.apikey = 'test'
31
+ ENV['STEAM_API_KEY'].should == 'test'
32
+ end
33
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'steam-api/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'steam-api'
8
+ gem.version = Steam::VERSION
9
+ gem.authors = ['Brian Haberer']
10
+ gem.email = ['bhaberer@gmail.com']
11
+ gem.description = %q{Simple Steam Gem}
12
+ gem.summary = %q{Simple Gem to interact witht the Steam Web API}
13
+ gem.homepage = 'https://github.com/bhaberer/steam-api'
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ['lib']
19
+
20
+ gem.required_ruby_version = '>= 2.0.0'
21
+
22
+ gem.add_development_dependency 'rake'
23
+ gem.add_development_dependency 'rspec'
24
+ gem.add_development_dependency 'coveralls'
25
+
26
+ gem.add_dependency 'weary', '1.1.3'
27
+ gem.add_dependency 'faraday'
28
+ gem.add_dependency 'multi_json', '1.7.7'
29
+ gem.add_dependency 'json', '~> 1.7.7'
30
+ end
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: steam-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Haberer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
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: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: weary
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.3
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: faraday
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: multi_json
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 1.7.7
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.7.7
97
+ - !ruby/object:Gem::Dependency
98
+ name: json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.7.7
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.7.7
111
+ description: Simple Steam Gem
112
+ email:
113
+ - bhaberer@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .travis.yml
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - lib/steam-api.rb
125
+ - lib/steam-api/client.rb
126
+ - lib/steam-api/exceptions.rb
127
+ - lib/steam-api/helpers.rb
128
+ - lib/steam-api/response.rb
129
+ - lib/steam-api/ruby/hash.rb
130
+ - lib/steam-api/steam.rb
131
+ - lib/steam-api/steam/apps.rb
132
+ - lib/steam-api/steam/economy.rb
133
+ - lib/steam-api/steam/news.rb
134
+ - lib/steam-api/steam/player.rb
135
+ - lib/steam-api/steam/remote_storage.rb
136
+ - lib/steam-api/steam/user.rb
137
+ - lib/steam-api/steam/user_stats.rb
138
+ - lib/steam-api/version.rb
139
+ - spec/spec_helper.rb
140
+ - spec/steam/apps_spec.rb
141
+ - spec/steam/economy_spec.rb
142
+ - spec/steam/news_spec.rb
143
+ - spec/steam/player_spec.rb
144
+ - spec/steam/remote-storage_spec.rb
145
+ - spec/steam/users-stats_spec.rb
146
+ - spec/steam/users_spec.rb
147
+ - spec/steam_spec.rb
148
+ - steam-api.gemspec
149
+ homepage: https://github.com/bhaberer/steam-api
150
+ licenses: []
151
+ metadata: {}
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - '>='
159
+ - !ruby/object:Gem::Version
160
+ version: 2.0.0
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 2.0.3
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: Simple Gem to interact witht the Steam Web API
172
+ test_files:
173
+ - spec/spec_helper.rb
174
+ - spec/steam/apps_spec.rb
175
+ - spec/steam/economy_spec.rb
176
+ - spec/steam/news_spec.rb
177
+ - spec/steam/player_spec.rb
178
+ - spec/steam/remote-storage_spec.rb
179
+ - spec/steam/users-stats_spec.rb
180
+ - spec/steam/users_spec.rb
181
+ - spec/steam_spec.rb
182
+ has_rdoc: