steam-api 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -1
- data/.travis.yml +16 -14
- data/README.md +2 -2
- data/Rakefile +4 -4
- data/lib/steam-api.rb +14 -14
- data/lib/steam-api/client.rb +7 -1
- data/lib/steam-api/exceptions.rb +8 -0
- data/lib/steam-api/helpers.rb +3 -0
- data/lib/steam-api/response.rb +5 -3
- data/lib/steam-api/ruby/hash.rb +3 -2
- data/lib/steam-api/steam.rb +4 -4
- data/lib/steam-api/steam/apps.rb +7 -10
- data/lib/steam-api/steam/economy.rb +0 -3
- data/lib/steam-api/steam/news.rb +2 -5
- data/lib/steam-api/steam/player.rb +2 -5
- data/lib/steam-api/steam/remote_storage.rb +0 -3
- data/lib/steam-api/steam/store.rb +20 -0
- data/lib/steam-api/steam/user.rb +2 -4
- data/lib/steam-api/steam/user_stats.rb +2 -5
- data/lib/steam-api/version.rb +1 -2
- data/spec/spec_helper.rb +0 -6
- data/spec/steam/apps_spec.rb +1 -1
- data/spec/steam/economy_spec.rb +1 -1
- data/spec/steam/player_spec.rb +2 -2
- data/spec/steam/store_spec.rb +18 -0
- data/spec/steam/users-stats_spec.rb +5 -5
- data/spec/steam/users_spec.rb +2 -2
- data/steam-api.gemspec +10 -12
- metadata +18 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 96cb46113ba573dc3989af65e06477ca2692d66a511bbcf2071058282a12d6ee
|
4
|
+
data.tar.gz: ac26ffb8ba9b4644ffd8ada6b0ad16f017394356e23467ff422a956cff6189f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b7bb32f8b52c0b24c6328f7162f132d6b101e72062c47e2b7bdabb981578306dbbb52fb879076361198ca48a15b29f54ed64eac506a0582eeada4de71ff8d09
|
7
|
+
data.tar.gz: 936ad9ba4bae360237d2f3f3ec1847ad56b38fac1684f8f01d6cd09483b1b9d1d24e99456ea82a9201f5fa2b353034c5dd832436b8601354974d4ff5b6dd478c
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
-f d -c
|
1
|
+
-f d -c --warning
|
data/.travis.yml
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
+
addons:
|
2
|
+
code_climate:
|
3
|
+
repo_token: 5eb1ad424f83b5332cdb915736dc46e23cb24f7b335a063243f928be79d7a75b
|
1
4
|
language: ruby
|
5
|
+
before_install:
|
6
|
+
- gem update --system
|
7
|
+
- gem update bundler
|
8
|
+
env:
|
9
|
+
global:
|
10
|
+
secure: P5IpEGYYbF0HcP9Mj9/zZAUXpUjkA2YkGLClvbVGsOD5zI9Jj1RZAlCC/fBKtfPUlfjlADp1hIN++n7qnqqmXPw4X/BC2V8Ios91NoFQeKfjQENSmjYykFTCp1CkBmCjq+lb/yE/JPQnVOoI/eEm5uaNSRc/XLjHwuSdKEFPv8M=
|
11
|
+
after_success:
|
12
|
+
bundle exec codeclimate-test-reporter
|
2
13
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
-
|
7
|
-
- 1.9.2
|
8
|
-
- 1.8.7
|
9
|
-
- jruby-18mode
|
14
|
+
- 2.4
|
15
|
+
- 2.5
|
16
|
+
- 2.6
|
17
|
+
- 2.7
|
10
18
|
- jruby-19mode
|
11
19
|
- ruby-head
|
12
20
|
- jruby-head
|
13
21
|
- ree
|
14
22
|
matrix:
|
15
23
|
allow_failures:
|
16
|
-
- rvm: 1.9.3
|
17
|
-
- rvm: 1.9.2
|
18
|
-
- rvm: 1.8.7
|
19
24
|
- rvm: ree
|
20
|
-
- rvm: jruby-18mode
|
21
25
|
- rvm: jruby-19mode
|
22
26
|
- rvm: jruby-head
|
27
|
+
- rvm: ruby-head
|
23
28
|
fast_finish: true
|
24
|
-
env:
|
25
|
-
global:
|
26
|
-
secure: P5IpEGYYbF0HcP9Mj9/zZAUXpUjkA2YkGLClvbVGsOD5zI9Jj1RZAlCC/fBKtfPUlfjlADp1hIN++n7qnqqmXPw4X/BC2V8Ios91NoFQeKfjQENSmjYykFTCp1CkBmCjq+lb/yE/JPQnVOoI/eEm5uaNSRc/XLjHwuSdKEFPv8M=
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/steam-api.png)](http://badge.fury.io/rb/steam-api)
|
4
4
|
[![Dependency Status](https://gemnasium.com/bhaberer/steam-api.png)](https://gemnasium.com/bhaberer/steam-api)
|
5
5
|
[![Build Status](https://travis-ci.org/bhaberer/steam-api.png?branch=master)](https://travis-ci.org/bhaberer/steam-api)
|
6
|
-
[![
|
7
|
-
[![
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/e3100c4ed420e839a6cc/maintainability)](https://codeclimate.com/github/bhaberer/steam-api/maintainability)
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/e3100c4ed420e839a6cc/test_coverage)](https://codeclimate.com/github/bhaberer/steam-api/test_coverage)
|
8
8
|
|
9
9
|
`steam-api` is a simple gem to expose the Steam WebApi directly.
|
10
10
|
|
data/Rakefile
CHANGED
data/lib/steam-api.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
require 'faraday'
|
3
2
|
require 'json'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
4
|
+
require_relative 'steam-api/version'
|
5
|
+
require_relative 'steam-api/steam'
|
6
|
+
require_relative 'steam-api/client'
|
7
|
+
require_relative 'steam-api/exceptions'
|
8
|
+
require_relative 'steam-api/response'
|
9
|
+
require_relative 'steam-api/helpers'
|
10
|
+
require_relative 'steam-api/steam/apps'
|
11
|
+
require_relative 'steam-api/steam/economy'
|
12
|
+
require_relative 'steam-api/steam/news'
|
13
|
+
require_relative 'steam-api/steam/player'
|
14
|
+
require_relative 'steam-api/steam/remote_storage'
|
15
|
+
require_relative 'steam-api/steam/store'
|
16
|
+
require_relative 'steam-api/steam/user'
|
17
|
+
require_relative 'steam-api/steam/user_stats'
|
18
18
|
|
19
19
|
include Steam::Helpers
|
data/lib/steam-api/client.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
module Steam
|
3
2
|
# Client object used to communicate with the steam webapi
|
4
3
|
class Client
|
@@ -14,7 +13,14 @@ module Steam
|
|
14
13
|
params[:key] = key
|
15
14
|
response = @conn.get resource, params
|
16
15
|
JSON.parse(response.body)
|
16
|
+
# response
|
17
17
|
rescue JSON::ParserError
|
18
|
+
puts response.body
|
19
|
+
# If the steam web api returns an error it's virtually never in json, so
|
20
|
+
# lets pretend that we're getting some sort of consistant response
|
21
|
+
# for errors.
|
22
|
+
raise Steam::UnavailableError if response.status == '503'
|
23
|
+
|
18
24
|
{ error: '500 Internal Server Error' }
|
19
25
|
end
|
20
26
|
end
|
data/lib/steam-api/exceptions.rb
CHANGED
@@ -6,6 +6,14 @@ module Steam
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
# Error returning the requested object from the Steam API
|
10
|
+
class UnavailableError < StandardError
|
11
|
+
def initialize(error = 'The server is temporarily unable to service \
|
12
|
+
your request. Please try again later.')
|
13
|
+
super(error)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
9
17
|
# Error returning the requested object from the Steam API
|
10
18
|
class JSONError < StandardError
|
11
19
|
def initialize(error = 'The API returned an unexpected JSON response')
|
data/lib/steam-api/helpers.rb
CHANGED
data/lib/steam-api/response.rb
CHANGED
@@ -15,7 +15,8 @@ class Hash
|
|
15
15
|
# nesting their json a few levels on every request.
|
16
16
|
# @param [String] key The key to extract from the hash
|
17
17
|
def parse_key(key)
|
18
|
-
|
18
|
+
raise Steam::JSONError unless key?(key)
|
19
|
+
|
19
20
|
self[key]
|
20
21
|
end
|
21
22
|
|
@@ -24,8 +25,9 @@ class Hash
|
|
24
25
|
# @param [String] success_condition what the success condition should be
|
25
26
|
# @return [Boolean] Returns true or raises an exception.
|
26
27
|
def check_success(success_condition: true)
|
27
|
-
success =
|
28
|
-
|
28
|
+
success = parse_key('success')
|
29
|
+
raise Steam::SteamError unless success == success_condition
|
30
|
+
|
29
31
|
true
|
30
32
|
end
|
31
33
|
end
|
data/lib/steam-api/ruby/hash.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# Takes a hash and converts it into a URL encoded parameter string.
|
2
|
-
# NOTE: this does not do any uri escaping at this point, since all args
|
2
|
+
# NOTE: this does not do any uri escaping at this point, since all args
|
3
|
+
# should be numeric.
|
3
4
|
# @param [Hash] params Hash of params you want broken up into a query string,
|
4
5
|
# escaped, and returned to you.
|
5
6
|
# @return [String] Escaped parameter string to append to a url.
|
6
7
|
class Hash
|
7
8
|
def to_params(params = {})
|
8
9
|
params[:format] = :json
|
9
|
-
|
10
|
+
"?#{params.each.map { |x| x.join('=') }.join('&')}"
|
10
11
|
end
|
11
12
|
end
|
data/lib/steam-api/steam.rb
CHANGED
@@ -4,11 +4,11 @@ module Steam
|
|
4
4
|
|
5
5
|
def self.apikey
|
6
6
|
if @apikey.nil?
|
7
|
-
|
8
|
-
|
9
|
-
else
|
10
|
-
fail ArgumentError, 'Please set your Steam API key.'
|
7
|
+
unless ENV.key?('STEAM_API_KEY')
|
8
|
+
raise ArgumentError, 'Please set your Steam API key.'
|
11
9
|
end
|
10
|
+
|
11
|
+
@apikey = ENV['STEAM_API_KEY']
|
12
12
|
end
|
13
13
|
@apikey
|
14
14
|
end
|
data/lib/steam-api/steam/apps.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
module Steam
|
3
2
|
# A Ruby DSL for communicating with the Apps portion of the Steam Web API.
|
4
3
|
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API
|
@@ -10,8 +9,8 @@ module Steam
|
|
10
9
|
# @see http://wiki.teamfortress.com/wiki/WebAPI/GetAppList
|
11
10
|
def self.get_all
|
12
11
|
response = client.get('GetApplist/v2')
|
13
|
-
|
14
|
-
|
12
|
+
.parse_key('applist')
|
13
|
+
.parse_key('apps')
|
15
14
|
response
|
16
15
|
end
|
17
16
|
|
@@ -19,9 +18,9 @@ module Steam
|
|
19
18
|
# @param [String] addr IP or IP:queryport to list
|
20
19
|
# @return [Hash] A hash containing the API response
|
21
20
|
# @see http://wiki.teamfortress.com/wiki/WebAPI/GetServersAtAddress
|
22
|
-
def self.get_servers(addr: nil)
|
23
|
-
response = client.get
|
24
|
-
params: { addr:
|
21
|
+
def self.get_servers(addr: nil, api_version: 'v1')
|
22
|
+
response = client.get "GetServersAtAddress/#{api_version}",
|
23
|
+
params: { addr: ERB::Util.url_encode(addr) }
|
25
24
|
response = response.parse_key('response')
|
26
25
|
response.check_success
|
27
26
|
response.parse_key('servers')
|
@@ -32,8 +31,8 @@ module Steam
|
|
32
31
|
# @param [Fixnum] version The installed version of the game
|
33
32
|
# @return [Hash] A hash containing the API response
|
34
33
|
# @see http://wiki.teamfortress.com/wiki/WebAPI/UpToDateCheck
|
35
|
-
def self.up_to_date(appid: nil, version:
|
36
|
-
response = client.get
|
34
|
+
def self.up_to_date(appid: nil, version: 'v1', api_version: 'v1')
|
35
|
+
response = client.get "UpToDateCheck/#{api_version}",
|
37
36
|
params: { appid: appid, version: version }
|
38
37
|
response = response.parse_key('response')
|
39
38
|
response.check_success
|
@@ -41,8 +40,6 @@ module Steam
|
|
41
40
|
response
|
42
41
|
end
|
43
42
|
|
44
|
-
private
|
45
|
-
|
46
43
|
def self.client
|
47
44
|
build_client 'ISteamApps'
|
48
45
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
module Steam
|
3
2
|
# A Ruby DSL for communicating with the Steam Web API.
|
4
3
|
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API
|
@@ -47,8 +46,6 @@ module Steam
|
|
47
46
|
parse_response(response)
|
48
47
|
end
|
49
48
|
|
50
|
-
private
|
51
|
-
|
52
49
|
def self.client
|
53
50
|
build_client 'ISteamEconomy'
|
54
51
|
end
|
data/lib/steam-api/steam/news.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
module Steam
|
3
2
|
# A Ruby DSL for communicating with the Steam Web API.
|
4
3
|
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API
|
@@ -22,12 +21,10 @@ module Steam
|
|
22
21
|
def self.get(appid, params: {})
|
23
22
|
params[:appid] = appid
|
24
23
|
client.get('GetNewsForApp/v2', params: params)
|
25
|
-
|
26
|
-
|
24
|
+
.parse_key('appnews')
|
25
|
+
.parse_key('newsitems')
|
27
26
|
end
|
28
27
|
|
29
|
-
private
|
30
|
-
|
31
28
|
def self.client
|
32
29
|
build_client 'ISteamNews'
|
33
30
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
module Steam
|
3
2
|
# A Ruby DSL for communicating with the Steam Web API.
|
4
3
|
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API
|
@@ -45,7 +44,7 @@ module Steam
|
|
45
44
|
response = client.get 'GetSteamLevel/v1',
|
46
45
|
params: { steamid: steamid }
|
47
46
|
response.parse_key('response')
|
48
|
-
|
47
|
+
.parse_key('player_level')
|
49
48
|
end
|
50
49
|
|
51
50
|
# Get a player's Steam badges
|
@@ -64,11 +63,9 @@ module Steam
|
|
64
63
|
response = client.get 'GetCommunityBadgeProgress/v1',
|
65
64
|
params: { steamid: steamid }
|
66
65
|
response.parse_key('response')
|
67
|
-
|
66
|
+
.parse_key('quests')
|
68
67
|
end
|
69
68
|
|
70
|
-
private
|
71
|
-
|
72
69
|
def self.client
|
73
70
|
build_client 'IPlayerService'
|
74
71
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
module Steam
|
3
2
|
# A Ruby DSL for communicating with the Steam Web API.
|
4
3
|
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API
|
@@ -29,8 +28,6 @@ module Steam
|
|
29
28
|
response
|
30
29
|
end
|
31
30
|
|
32
|
-
private
|
33
|
-
|
34
31
|
def self.client
|
35
32
|
build_client 'ISteamRemoteStorage'
|
36
33
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Steam
|
2
|
+
# A Ruby DSL for communicating with the Steam Web API.
|
3
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API
|
4
|
+
# @since 1.0.0
|
5
|
+
module Store
|
6
|
+
# Get App Details
|
7
|
+
# @param String appid The UUID of the Steam Application
|
8
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
9
|
+
def self.app_details(appid)
|
10
|
+
response = client.get 'appdetails', params: { appids: appid }
|
11
|
+
response
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def self.client
|
17
|
+
build_client '', base_url: Steam::Helpers::STORE_API_BASE_URL
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/steam-api/steam/user.rb
CHANGED
@@ -17,7 +17,7 @@ module Steam
|
|
17
17
|
params: { steamid: steamid,
|
18
18
|
relationship: relationship }
|
19
19
|
response = response.parse_key('friendslist')
|
20
|
-
|
20
|
+
.parse_key('friends')
|
21
21
|
response
|
22
22
|
end
|
23
23
|
|
@@ -54,7 +54,7 @@ module Steam
|
|
54
54
|
response = client.get 'GetPlayerSummaries/v2/',
|
55
55
|
params: { steamids: steamids.join(',') }
|
56
56
|
response.parse_key('response')
|
57
|
-
|
57
|
+
.parse_key('players')
|
58
58
|
end
|
59
59
|
|
60
60
|
# Get User Groups
|
@@ -81,8 +81,6 @@ module Steam
|
|
81
81
|
response.parse_key('steamid')
|
82
82
|
end
|
83
83
|
|
84
|
-
private
|
85
|
-
|
86
84
|
def self.client
|
87
85
|
build_client 'ISteamUser'
|
88
86
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
module Steam
|
3
2
|
# A Ruby DSL for communicating with the Steam Web API.
|
4
3
|
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API
|
@@ -13,7 +12,7 @@ module Steam
|
|
13
12
|
response = client.get 'GetGlobalAchievementPercentagesForApp/v2',
|
14
13
|
params: { gameid: appid }
|
15
14
|
response = response.parse_key('achievementpercentages')
|
16
|
-
|
15
|
+
.parse_key('achievements')
|
17
16
|
response
|
18
17
|
end
|
19
18
|
|
@@ -57,7 +56,7 @@ module Steam
|
|
57
56
|
response = client.get 'GetNumberOfCurrentPlayers/v1',
|
58
57
|
params: { appid: appid }
|
59
58
|
response.parse_key('response')
|
60
|
-
|
59
|
+
.parse_key('player_count')
|
61
60
|
end
|
62
61
|
|
63
62
|
# Get Player Achievements
|
@@ -88,8 +87,6 @@ module Steam
|
|
88
87
|
response.parse_key('playerstats')
|
89
88
|
end
|
90
89
|
|
91
|
-
private
|
92
|
-
|
93
90
|
def self.client
|
94
91
|
build_client('ISteamUserStats')
|
95
92
|
end
|
data/lib/steam-api/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
require 'coveralls'
|
2
1
|
require 'simplecov'
|
3
|
-
|
4
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
-
SimpleCov::Formatter::HTMLFormatter,
|
6
|
-
Coveralls::SimpleCov::Formatter
|
7
|
-
]
|
8
2
|
SimpleCov.start
|
9
3
|
|
10
4
|
if File::exist? File.join(File.dirname(__FILE__), "secret.rb")
|
data/spec/steam/apps_spec.rb
CHANGED
@@ -68,7 +68,7 @@ describe Steam::Apps do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'should capture json errors' do
|
71
|
-
expect { Steam::Apps.up_to_date(appid: nil, version: 'foo') }.to raise_error
|
71
|
+
expect { Steam::Apps.up_to_date(appid: nil, version: 'foo') }.to raise_error(Steam::JSONError)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/spec/steam/economy_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Steam::Economy do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'requires class params' do
|
15
|
-
expect { Steam::Economy.asset_info(440) }.to raise_error
|
15
|
+
expect { Steam::Economy.asset_info(440) }.to raise_error(Steam::JSONError)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'allows users to query asset info' do
|
data/spec/steam/player_spec.rb
CHANGED
@@ -51,7 +51,7 @@ describe Steam::Player do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'returns the level number' do
|
54
|
-
expect(result).to be_a(
|
54
|
+
expect(result).to be_a(Integer)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -71,7 +71,7 @@ describe Steam::Player do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'returns the player level as a number' do
|
74
|
-
expect(result['player_level']).to be_a(
|
74
|
+
expect(result['player_level']).to be_a(Integer)
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'returns the players current xp' do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe Steam::Store do
|
5
|
+
let(:appid) { 976730 }
|
6
|
+
|
7
|
+
describe '.app_details' do
|
8
|
+
let (:result) { Steam::Store.app_details(appid) }
|
9
|
+
|
10
|
+
it 'returns the details of an application' do
|
11
|
+
expect(result).to_not be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns a JSON structure containing details of the returned app' do
|
15
|
+
expect(result).to include("976730")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -42,12 +42,12 @@ describe Steam::UserStats do
|
|
42
42
|
|
43
43
|
describe '.player_count' do
|
44
44
|
it 'returns a player count' do
|
45
|
-
expect(Steam::UserStats.player_count(440)).to be_a(
|
45
|
+
expect(Steam::UserStats.player_count(440)).to be_a(Integer)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe '.get_player_achievements' do
|
50
|
-
let(:achs) { Steam::UserStats.player_achievements(440,
|
50
|
+
let(:achs) { Steam::UserStats.player_achievements(440, 76561197993276293) }
|
51
51
|
|
52
52
|
it 'returns a list of player achievements' do
|
53
53
|
expect(achs).to have_key('achievements')
|
@@ -66,12 +66,12 @@ describe Steam::UserStats do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'returns the correct steamID' do
|
69
|
-
expect(achs['steamID']).to eq('
|
69
|
+
expect(achs['steamID']).to eq('76561197993276293')
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
describe '.player_stats' do
|
74
|
-
let(:stats) { Steam::UserStats.player_stats(440,
|
74
|
+
let(:stats) { Steam::UserStats.player_stats(440, 76561197993276293) }
|
75
75
|
|
76
76
|
it 'returns player stats' do
|
77
77
|
expect(stats).to have_key('stats')
|
@@ -90,7 +90,7 @@ describe Steam::UserStats do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'returns a correct steamID' do
|
93
|
-
expect(stats['steamID']).to eq('
|
93
|
+
expect(stats['steamID']).to eq('76561197993276293')
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
data/spec/steam/users_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe Steam::User do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'raises an error on a bad friend id' do
|
19
|
-
expect { Steam::User.friends('765611') }.to raise_error
|
19
|
+
expect { Steam::User.friends('765611') }.to raise_error(Steam::JSONError)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns the same content for :friends and :all' do
|
@@ -55,7 +55,7 @@ describe Steam::User do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
describe '.vanity_to_steamid' do
|
58
|
-
let(:result) { Steam::User.vanity_to_steamid('
|
58
|
+
let(:result) { Steam::User.vanity_to_steamid('theasmer') }
|
59
59
|
|
60
60
|
it 'return values when they look up vanity urls' do
|
61
61
|
expect(result).to_not be_nil
|
data/steam-api.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'steam-api/version'
|
5
4
|
|
@@ -8,20 +7,19 @@ Gem::Specification.new do |gem|
|
|
8
7
|
gem.version = Steam::VERSION
|
9
8
|
gem.authors = ['Brian Haberer']
|
10
9
|
gem.email = ['bhaberer@gmail.com']
|
11
|
-
gem.description =
|
12
|
-
gem.summary =
|
10
|
+
gem.description = 'Simple Steam Gem'
|
11
|
+
gem.summary = 'Simple Gem to interact with the Steam Web API'
|
13
12
|
gem.homepage = 'https://github.com/bhaberer/steam-api'
|
14
13
|
gem.license = 'MIT'
|
15
14
|
|
16
|
-
gem.files = `git ls-files`.split(
|
17
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.files = `git ls-files`.split($RS)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
18
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
18
|
gem.require_paths = ['lib']
|
20
19
|
|
21
|
-
gem.add_development_dependency '
|
22
|
-
gem.add_development_dependency '
|
23
|
-
gem.add_development_dependency '
|
24
|
-
|
25
|
-
gem.add_dependency '
|
26
|
-
gem.add_dependency 'json', '~> 1.7', '>= 1.7.7'
|
20
|
+
gem.add_development_dependency 'codeclimate-test-reporter', '~> 1.0'
|
21
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 3.9'
|
23
|
+
|
24
|
+
gem.add_dependency 'faraday', '~> 1.0'
|
27
25
|
end
|
metadata
CHANGED
@@ -1,111 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steam-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Haberer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: codeclimate-test-reporter
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.0'
|
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: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
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: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.9'
|
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: '
|
54
|
+
version: '3.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faraday
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.9'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: multi_json
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.7'
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 1.7.7
|
61
|
+
version: '1.0'
|
79
62
|
type: :runtime
|
80
63
|
prerelease: false
|
81
64
|
version_requirements: !ruby/object:Gem::Requirement
|
82
65
|
requirements:
|
83
66
|
- - "~>"
|
84
67
|
- !ruby/object:Gem::Version
|
85
|
-
version: '1.
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 1.7.7
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: json
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '1.7'
|
96
|
-
- - ">="
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: 1.7.7
|
99
|
-
type: :runtime
|
100
|
-
prerelease: false
|
101
|
-
version_requirements: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - "~>"
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '1.7'
|
106
|
-
- - ">="
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: 1.7.7
|
68
|
+
version: '1.0'
|
109
69
|
description: Simple Steam Gem
|
110
70
|
email:
|
111
71
|
- bhaberer@gmail.com
|
@@ -132,6 +92,7 @@ files:
|
|
132
92
|
- lib/steam-api/steam/news.rb
|
133
93
|
- lib/steam-api/steam/player.rb
|
134
94
|
- lib/steam-api/steam/remote_storage.rb
|
95
|
+
- lib/steam-api/steam/store.rb
|
135
96
|
- lib/steam-api/steam/user.rb
|
136
97
|
- lib/steam-api/steam/user_stats.rb
|
137
98
|
- lib/steam-api/version.rb
|
@@ -141,6 +102,7 @@ files:
|
|
141
102
|
- spec/steam/news_spec.rb
|
142
103
|
- spec/steam/player_spec.rb
|
143
104
|
- spec/steam/remote-storage_spec.rb
|
105
|
+
- spec/steam/store_spec.rb
|
144
106
|
- spec/steam/users-stats_spec.rb
|
145
107
|
- spec/steam/users_spec.rb
|
146
108
|
- spec/steam_spec.rb
|
@@ -165,10 +127,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
127
|
version: '0'
|
166
128
|
requirements: []
|
167
129
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.7.7
|
169
131
|
signing_key:
|
170
132
|
specification_version: 4
|
171
|
-
summary: Simple Gem to interact
|
133
|
+
summary: Simple Gem to interact with the Steam Web API
|
172
134
|
test_files:
|
173
135
|
- spec/spec_helper.rb
|
174
136
|
- spec/steam/apps_spec.rb
|
@@ -176,7 +138,7 @@ test_files:
|
|
176
138
|
- spec/steam/news_spec.rb
|
177
139
|
- spec/steam/player_spec.rb
|
178
140
|
- spec/steam/remote-storage_spec.rb
|
141
|
+
- spec/steam/store_spec.rb
|
179
142
|
- spec/steam/users-stats_spec.rb
|
180
143
|
- spec/steam/users_spec.rb
|
181
144
|
- spec/steam_spec.rb
|
182
|
-
has_rdoc:
|