steam_api_client 0.10.0 → 1.0.0
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/CHANGELOG.md +66 -8
- data/README.md +13 -47
- data/docs/USAGE.md +326 -0
- data/lib/steam_api_client/client.rb +58 -35
- data/lib/steam_api_client/configuration.rb +55 -0
- data/lib/steam_api_client/endpoint/param.rb +83 -0
- data/lib/steam_api_client/endpoint.rb +90 -0
- data/lib/steam_api_client/endpoints.rb +122 -0
- data/lib/steam_api_client/errors/api_error.rb +10 -8
- data/lib/steam_api_client/errors/connection_error.rb +7 -0
- data/lib/steam_api_client/errors/response_parse_error.rb +6 -6
- data/lib/steam_api_client/failure_handler.rb +1 -6
- data/lib/steam_api_client/model/field.rb +42 -0
- data/lib/steam_api_client/model/scalars.rb +59 -0
- data/lib/steam_api_client/model.rb +102 -0
- data/lib/steam_api_client/models/app_details.rb +118 -0
- data/lib/steam_api_client/models/friend.rb +11 -0
- data/lib/steam_api_client/models/game.rb +35 -0
- data/lib/steam_api_client/models/global_achievement.rb +10 -0
- data/lib/steam_api_client/models/news_item.rb +20 -0
- data/lib/steam_api_client/models/player_achievements.rb +19 -0
- data/lib/steam_api_client/models/player_game_stats.rb +25 -0
- data/lib/steam_api_client/models/player_summary.rb +37 -0
- data/lib/steam_api_client/request.rb +53 -59
- data/lib/steam_api_client/requestor.rb +42 -0
- data/lib/steam_api_client/response.rb +30 -22
- data/lib/steam_api_client/version.rb +1 -1
- data/lib/steam_api_client.rb +18 -57
- metadata +32 -86
- data/lib/steam_api_client/errors/url_error.rb +0 -5
- data/lib/steam_api_client/requestors/app_details.rb +0 -27
- data/lib/steam_api_client/requestors/app_global_achievements.rb +0 -19
- data/lib/steam_api_client/requestors/app_news.rb +0 -23
- data/lib/steam_api_client/requestors/base.rb +0 -32
- data/lib/steam_api_client/requestors/game_current_players.rb +0 -19
- data/lib/steam_api_client/requestors/player_achievements.rb +0 -21
- data/lib/steam_api_client/requestors/player_friends.rb +0 -21
- data/lib/steam_api_client/requestors/player_game_stats.rb +0 -21
- data/lib/steam_api_client/requestors/player_level.rb +0 -18
- data/lib/steam_api_client/requestors/player_owned_games.rb +0 -23
- data/lib/steam_api_client/requestors/player_recent_games.rb +0 -21
- data/lib/steam_api_client/requestors/player_steamid.rb +0 -19
- data/lib/steam_api_client/requestors/player_summaries.rb +0 -19
- data/lib/steam_api_client/structs/app_details/achievement.rb +0 -12
- data/lib/steam_api_client/structs/app_details/category.rb +0 -12
- data/lib/steam_api_client/structs/app_details/details.rb +0 -82
- data/lib/steam_api_client/structs/app_details/genre.rb +0 -12
- data/lib/steam_api_client/structs/app_details/movie.rb +0 -25
- data/lib/steam_api_client/structs/app_details/package_group.rb +0 -18
- data/lib/steam_api_client/structs/app_details/requirements.rb +0 -12
- data/lib/steam_api_client/structs/app_details/screenshot.rb +0 -13
- data/lib/steam_api_client/structs/app_details/sub.rb +0 -18
- data/lib/steam_api_client/structs/app_global_achievements.rb +0 -18
- data/lib/steam_api_client/structs/app_new.rb +0 -20
- data/lib/steam_api_client/structs/app_news.rb +0 -13
- data/lib/steam_api_client/structs/base.rb +0 -15
- data/lib/steam_api_client/structs/game_current_players.rb +0 -12
- data/lib/steam_api_client/structs/player_achievements.rb +0 -23
- data/lib/steam_api_client/structs/player_friends.rb +0 -17
- data/lib/steam_api_client/structs/player_game_stats.rb +0 -28
- data/lib/steam_api_client/structs/player_level.rb +0 -11
- data/lib/steam_api_client/structs/player_owned_games.rb +0 -31
- data/lib/steam_api_client/structs/player_recent_games.rb +0 -22
- data/lib/steam_api_client/structs/player_steamid.rb +0 -16
- data/lib/steam_api_client/structs/player_summaries.rb +0 -11
- data/lib/steam_api_client/structs/player_summary.rb +0 -46
- data/lib/steam_api_client/structs/requests/abstract.rb +0 -59
- data/lib/steam_api_client/structs/requests/get_app_details.rb +0 -48
- data/lib/steam_api_client/structs/requests/get_app_global_achievements.rb +0 -48
- data/lib/steam_api_client/structs/requests/get_app_news.rb +0 -56
- data/lib/steam_api_client/structs/requests/get_game_current_players.rb +0 -48
- data/lib/steam_api_client/structs/requests/get_player_achievements.rb +0 -48
- data/lib/steam_api_client/structs/requests/get_player_friends.rb +0 -51
- data/lib/steam_api_client/structs/requests/get_player_game_stats.rb +0 -48
- data/lib/steam_api_client/structs/requests/get_player_level.rb +0 -42
- data/lib/steam_api_client/structs/requests/get_player_owned_games.rb +0 -50
- data/lib/steam_api_client/structs/requests/get_player_recent_games.rb +0 -48
- data/lib/steam_api_client/structs/requests/get_player_steamid.rb +0 -42
- data/lib/steam_api_client/structs/requests/get_player_summaries.rb +0 -46
- data/lib/steam_api_client/structs/requests/storefront_abstract.rb +0 -58
- data/lib/steam_api_client/structs/types.rb +0 -23
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetAppGlobalAchievements < Abstract
|
|
5
|
-
attribute :gameid, Types::Integer
|
|
6
|
-
|
|
7
|
-
# Build the struct through the received params.
|
|
8
|
-
# @params [Hash] params The hash params.
|
|
9
|
-
# @return an instance of the Struct
|
|
10
|
-
def self.build_from_params(params)
|
|
11
|
-
raise ArgumentError, ":gameid is missing" unless params.key?(:gameid)
|
|
12
|
-
|
|
13
|
-
new(params)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Returns the version value to create the request path
|
|
17
|
-
# @return [String] the version of the request path
|
|
18
|
-
def version
|
|
19
|
-
"v0002/"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Returns the interface value to create the request path
|
|
23
|
-
# @return [String] the interface of the request path
|
|
24
|
-
def interface
|
|
25
|
-
"ISteamUserStats/"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Returns the API path value to create the request path
|
|
29
|
-
# @return [String] the API path of the request path
|
|
30
|
-
def path
|
|
31
|
-
"GetGlobalAchievementPercentagesForApp/"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Returns the query params needed for the HTTP request
|
|
35
|
-
# @return [Hash]
|
|
36
|
-
def query_params
|
|
37
|
-
{gameid: gameid}
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Tells if the request require the api_token in the query params
|
|
41
|
-
# @return [Boolean]
|
|
42
|
-
def needs_authorization?
|
|
43
|
-
false
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetAppNews < Abstract
|
|
5
|
-
attribute :appid, Types::Integer
|
|
6
|
-
attribute :count, Types::Integer
|
|
7
|
-
attribute :maxlength, Types::Integer
|
|
8
|
-
|
|
9
|
-
# Build the struct through the received params.
|
|
10
|
-
# @params [Hash] params The hash params.
|
|
11
|
-
# @return an instance of the Struct
|
|
12
|
-
def self.build_from_params(params)
|
|
13
|
-
%i[appid count maxlength].each do |attrib|
|
|
14
|
-
raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
new(params)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Returns the version value to create the request path
|
|
21
|
-
# @return [String] the version of the request path
|
|
22
|
-
def version
|
|
23
|
-
"v0002/"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Returns the interface value to create the request path
|
|
27
|
-
# @return [String] the interface of the request path
|
|
28
|
-
def interface
|
|
29
|
-
"ISteamNews/"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Returns the API path value to create the request path
|
|
33
|
-
# @return [String] the API path of the request path
|
|
34
|
-
def path
|
|
35
|
-
"GetNewsForApp/"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Returns the query params needed for the HTTP request
|
|
39
|
-
# @return [Hash]
|
|
40
|
-
def query_params
|
|
41
|
-
{
|
|
42
|
-
appid: appid,
|
|
43
|
-
count: count,
|
|
44
|
-
maxlength: maxlength
|
|
45
|
-
}
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Tells if the request require the api_token in the query params
|
|
49
|
-
# @return [Boolean]
|
|
50
|
-
def needs_authorization?
|
|
51
|
-
false
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetGameCurrentPlayers < Abstract
|
|
5
|
-
attribute :appid, Types::Integer
|
|
6
|
-
|
|
7
|
-
# Build the struct through the received params.
|
|
8
|
-
# @params [Hash] params The hash params.
|
|
9
|
-
# @return an instance of the Struct
|
|
10
|
-
def self.build_from_params(params)
|
|
11
|
-
raise ArgumentError, ":appid is missing" unless params.key?(:appid)
|
|
12
|
-
|
|
13
|
-
new(params)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Returns the version value to create the request path
|
|
17
|
-
# @return [String] the version of the request path
|
|
18
|
-
def version
|
|
19
|
-
"v0001/"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Returns the interface value to create the request path
|
|
23
|
-
# @return [String] the interface of the request path
|
|
24
|
-
def interface
|
|
25
|
-
"ISteamUserStats/"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Returns the API path value to create the request path
|
|
29
|
-
# @return [String] the API path of the request path
|
|
30
|
-
def path
|
|
31
|
-
"GetNumberOfCurrentPlayers/"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Returns the query params needed for the HTTP request
|
|
35
|
-
# @return [Hash]
|
|
36
|
-
def query_params
|
|
37
|
-
{appid: appid}
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Tells if the request require the api_token in the query params
|
|
41
|
-
# @return [Boolean]
|
|
42
|
-
def needs_authorization?
|
|
43
|
-
false
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerAchievements < Abstract
|
|
5
|
-
attribute :appid, Types::Integer
|
|
6
|
-
attribute :steamid, Types::Integer
|
|
7
|
-
|
|
8
|
-
# Build the struct through the received params.
|
|
9
|
-
# @params [Hash] params The hash params.
|
|
10
|
-
# @return an instance of the Struct
|
|
11
|
-
def self.build_from_params(params)
|
|
12
|
-
%i[appid steamid].each do |attrib|
|
|
13
|
-
raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
new(params)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Returns the version value to create the request path
|
|
20
|
-
# @return [String] the version of the request path
|
|
21
|
-
def version
|
|
22
|
-
"v0001/"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Returns the interface value to create the request path
|
|
26
|
-
# @return [String] the interface of the request path
|
|
27
|
-
def interface
|
|
28
|
-
"ISteamUserStats/"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Returns the API path value to create the request path
|
|
32
|
-
# @return [String] the API path of the request path
|
|
33
|
-
def path
|
|
34
|
-
"GetPlayerAchievements/"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Returns the query params needed for the HTTP request
|
|
38
|
-
# @return [Hash]
|
|
39
|
-
def query_params
|
|
40
|
-
{
|
|
41
|
-
appid: appid,
|
|
42
|
-
steamid: steamid
|
|
43
|
-
}
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerFriends < Abstract
|
|
5
|
-
attribute :steamid, Types::Integer
|
|
6
|
-
attribute :relationship, Types::String
|
|
7
|
-
|
|
8
|
-
# Build the struct through the received params.
|
|
9
|
-
# @params [Hash] params The hash params.
|
|
10
|
-
# @return an instance of the Struct
|
|
11
|
-
def self.build_from_params(params)
|
|
12
|
-
%i[steamid relationship].each do |attrib|
|
|
13
|
-
raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# The only possible values are: all, friend.
|
|
17
|
-
raise ArgumentError, ":relationship value not allowed" unless %w[all friend].include? params[:relationship]
|
|
18
|
-
|
|
19
|
-
new(params)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Returns the version value to create the request path
|
|
23
|
-
# @return [String] the version of the request path
|
|
24
|
-
def version
|
|
25
|
-
"v0001/"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Returns the interface value to create the request path
|
|
29
|
-
# @return [String] the interface of the request path
|
|
30
|
-
def interface
|
|
31
|
-
"ISteamUser/"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Returns the API path value to create the request path
|
|
35
|
-
# @return [String] the API path of the request path
|
|
36
|
-
def path
|
|
37
|
-
"GetFriendList/"
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Returns the query params needed for the HTTP request
|
|
41
|
-
# @return [Hash]
|
|
42
|
-
def query_params
|
|
43
|
-
{
|
|
44
|
-
steamid: steamid,
|
|
45
|
-
relationship: relationship
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerGameStats < Abstract
|
|
5
|
-
attribute :appid, Types::Integer
|
|
6
|
-
attribute :steamid, Types::Integer
|
|
7
|
-
|
|
8
|
-
# Build the struct through the received params.
|
|
9
|
-
# @params [Hash] params The hash params.
|
|
10
|
-
# @return an instance of the Struct
|
|
11
|
-
def self.build_from_params(params)
|
|
12
|
-
%i[appid steamid].each do |attrib|
|
|
13
|
-
raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
new(params)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Returns the version value to create the request path
|
|
20
|
-
# @return [String] the version of the request path
|
|
21
|
-
def version
|
|
22
|
-
"v0002/"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Returns the interface value to create the request path
|
|
26
|
-
# @return [String] the interface of the request path
|
|
27
|
-
def interface
|
|
28
|
-
"ISteamUserStats/"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Returns the API path value to create the request path
|
|
32
|
-
# @return [String] the API path of the request path
|
|
33
|
-
def path
|
|
34
|
-
"GetUserStatsForGame/"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Returns the query params needed for the HTTP request
|
|
38
|
-
# @return [Hash]
|
|
39
|
-
def query_params
|
|
40
|
-
{
|
|
41
|
-
appid: appid,
|
|
42
|
-
steamid: steamid
|
|
43
|
-
}
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerLevel < Abstract
|
|
5
|
-
attribute :steamid, Types::Integer
|
|
6
|
-
|
|
7
|
-
# Build the struct through the received params.
|
|
8
|
-
# @params [Hash] params The hash params.
|
|
9
|
-
# @return an instance of the Struct
|
|
10
|
-
def self.build_from_params(params)
|
|
11
|
-
raise ArgumentError, ":steamid is missing" unless params.key?(:steamid)
|
|
12
|
-
|
|
13
|
-
new(params)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Returns the version value to create the request path
|
|
17
|
-
# @return [String] the version of the request path
|
|
18
|
-
def version
|
|
19
|
-
"v0001/"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Returns the interface value to create the request path
|
|
23
|
-
# @return [String] the interface of the request path
|
|
24
|
-
def interface
|
|
25
|
-
"IPlayerService/"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Returns the API path value to create the request path
|
|
29
|
-
# @return [String] the API path of the request path
|
|
30
|
-
def path
|
|
31
|
-
"GetSteamLevel/"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Returns the query params needed for the HTTP request
|
|
35
|
-
# @return [Hash]
|
|
36
|
-
def query_params
|
|
37
|
-
{steamid: steamid}
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerOwnedGames < Abstract
|
|
5
|
-
attribute :steamid, Types::Integer
|
|
6
|
-
attribute :include_appinfo, Types::Bool
|
|
7
|
-
attribute :include_played_free_games, Types::Bool
|
|
8
|
-
|
|
9
|
-
# Build the struct through the received params.
|
|
10
|
-
# @params [Hash] params The hash params.
|
|
11
|
-
# @return an instance of the Struct
|
|
12
|
-
def self.build_from_params(params)
|
|
13
|
-
%i[steamid include_appinfo include_played_free_games].each do |attrib|
|
|
14
|
-
raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
new(params)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Returns the version value to create the request path
|
|
21
|
-
# @return [String] the version of the request path
|
|
22
|
-
def version
|
|
23
|
-
"v0001/"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Returns the interface value to create the request path
|
|
27
|
-
# @return [String] the interface of the request path
|
|
28
|
-
def interface
|
|
29
|
-
"IPlayerService/"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Returns the API path value to create the request path
|
|
33
|
-
# @return [String] the API path of the request path
|
|
34
|
-
def path
|
|
35
|
-
"GetOwnedGames/"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Returns the query params needed for the HTTP request
|
|
39
|
-
# @return [Hash]
|
|
40
|
-
def query_params
|
|
41
|
-
{
|
|
42
|
-
steamid: steamid,
|
|
43
|
-
include_appinfo: include_appinfo,
|
|
44
|
-
include_played_free_games: include_played_free_games
|
|
45
|
-
}
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerRecentGames < Abstract
|
|
5
|
-
attribute :steamid, Types::Integer
|
|
6
|
-
attribute :count, Types::Integer
|
|
7
|
-
|
|
8
|
-
# Build the struct through the received params.
|
|
9
|
-
# @params [Hash] params The hash params.
|
|
10
|
-
# @return an instance of the Struct
|
|
11
|
-
def self.build_from_params(params)
|
|
12
|
-
%i[steamid count].each do |attrib|
|
|
13
|
-
raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
new(params)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Returns the version value to create the request path
|
|
20
|
-
# @return [String] the version of the request path
|
|
21
|
-
def version
|
|
22
|
-
"v0001/"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Returns the interface value to create the request path
|
|
26
|
-
# @return [String] the interface of the request path
|
|
27
|
-
def interface
|
|
28
|
-
"IPlayerService/"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Returns the API path value to create the request path
|
|
32
|
-
# @return [String] the API path of the request path
|
|
33
|
-
def path
|
|
34
|
-
"GetRecentlyPlayedGames/"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Returns the query params needed for the HTTP request
|
|
38
|
-
# @return [Hash]
|
|
39
|
-
def query_params
|
|
40
|
-
{
|
|
41
|
-
steamid: steamid,
|
|
42
|
-
count: count
|
|
43
|
-
}
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerSteamId < Abstract
|
|
5
|
-
attribute :vanityurl, Types::String
|
|
6
|
-
|
|
7
|
-
# Build the struct through the received params.
|
|
8
|
-
# @params [Hash] params The hash params.
|
|
9
|
-
# @return an instance of the Struct
|
|
10
|
-
def self.build_from_params(params)
|
|
11
|
-
raise ArgumentError, ":vanityurl is missing" unless params.key?(:vanityurl)
|
|
12
|
-
|
|
13
|
-
new(params)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Returns the version value to create the request path
|
|
17
|
-
# @return [String] the version of the request path
|
|
18
|
-
def version
|
|
19
|
-
"v0001/"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Returns the interface value to create the request path
|
|
23
|
-
# @return [String] the interface of the request path
|
|
24
|
-
def interface
|
|
25
|
-
"ISteamUser/"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Returns the API path value to create the request path
|
|
29
|
-
# @return [String] the API path of the request path
|
|
30
|
-
def path
|
|
31
|
-
"ResolveVanityURL/"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Returns the query params needed for the HTTP request
|
|
35
|
-
# @return [Hash]
|
|
36
|
-
def query_params
|
|
37
|
-
{vanityurl: vanityurl}
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
class GetPlayerSummaries < Abstract
|
|
5
|
-
attribute :steamids, Types::Array.of(Types::Coercible::Integer)
|
|
6
|
-
|
|
7
|
-
# Build the struct through the received params.
|
|
8
|
-
# @params [Hash] params The hash params.
|
|
9
|
-
# @return an instance of the Struct
|
|
10
|
-
def self.build_from_params(params)
|
|
11
|
-
raise ArgumentError, ":steamids are missing" unless params.key?(:steamids)
|
|
12
|
-
|
|
13
|
-
new(params)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Returns the version value to create the request path
|
|
17
|
-
# @return [String] the version of the request path
|
|
18
|
-
def version
|
|
19
|
-
"v0002/"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Returns the interface value to create the request path
|
|
23
|
-
# @return [String] the interface of the request path
|
|
24
|
-
def interface
|
|
25
|
-
"ISteamUser/"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Returns the API path value to create the request path
|
|
29
|
-
# @return [String] the API path of the request path
|
|
30
|
-
def path
|
|
31
|
-
"GetPlayerSummaries/"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Returns the query params needed for the HTTP request
|
|
35
|
-
# @return [Hash]
|
|
36
|
-
def query_params
|
|
37
|
-
# I need to join the steamids because they wont accept
|
|
38
|
-
# multiple equal keys with different values on query params
|
|
39
|
-
{
|
|
40
|
-
steamids: steamids.join(",")
|
|
41
|
-
}
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
module Requests
|
|
4
|
-
# @abstract class for a Storefront Request's struct
|
|
5
|
-
class StorefrontAbstract < SteamApiClient::Structs::Base
|
|
6
|
-
# Returns the API path value to create the request path
|
|
7
|
-
# @abstract
|
|
8
|
-
# @return [String] the API path of the request path
|
|
9
|
-
def path
|
|
10
|
-
raise NoMethodError, "Override this method"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Returns the HTTP method used by the request.
|
|
14
|
-
# @return [Symbol]
|
|
15
|
-
def method
|
|
16
|
-
:get
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Returns the query params needed for the HTTP request.
|
|
20
|
-
# Here's a list taken from the steam website:
|
|
21
|
-
# cc (Optional)
|
|
22
|
-
# Country code for method to return appropriate currency values.
|
|
23
|
-
# l (Optional)
|
|
24
|
-
# For localized strings; takes English name of language (none of those fancy ISO distractions).
|
|
25
|
-
# v (Optional)
|
|
26
|
-
# Unknown.
|
|
27
|
-
# Given that information, I'm going to default the currency to 'USD' and locale to 'en'.
|
|
28
|
-
#
|
|
29
|
-
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#Global_parameters
|
|
30
|
-
# @return [Hash]
|
|
31
|
-
def query_params
|
|
32
|
-
{
|
|
33
|
-
cc: "US",
|
|
34
|
-
l: "en"
|
|
35
|
-
}
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Return the class attributes as a Hash
|
|
39
|
-
# @return [Hash]
|
|
40
|
-
def body
|
|
41
|
-
to_h
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# Tells if the request require the api_token in the query params
|
|
45
|
-
# @return [Boolean]
|
|
46
|
-
def needs_authorization?
|
|
47
|
-
true
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Tells the URL builder which format to choose from
|
|
51
|
-
# @return [Symbol]
|
|
52
|
-
def endpoint_kind
|
|
53
|
-
:storefront_endpoint
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module SteamApiClient
|
|
2
|
-
module Structs
|
|
3
|
-
# Types used by the structs. Steam's JSON often sends numbers as strings
|
|
4
|
-
# (e.g. achievement percentages, ages), so scalar types coerce values, and
|
|
5
|
-
# anything that can't be coerced raises instead of passing through.
|
|
6
|
-
# Steam also sends null for values it doesn't have (e.g. an app's website),
|
|
7
|
-
# so nil passes through every scalar type unchanged.
|
|
8
|
-
module Types
|
|
9
|
-
include ::Dry.Types(default: :nominal)
|
|
10
|
-
|
|
11
|
-
Integer = Coercible::Integer.optional
|
|
12
|
-
Float = Coercible::Float.optional
|
|
13
|
-
# Numbers become strings
|
|
14
|
-
String = Strict::String.constructor { |value| value.is_a?(::Numeric) ? value.to_s : value }.optional
|
|
15
|
-
Bool = Strict::Bool.optional
|
|
16
|
-
|
|
17
|
-
module Optional
|
|
18
|
-
String = Types::String.optional.default(nil)
|
|
19
|
-
Integer = Types::Integer.optional.default(nil)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|