steam_api_client 0.9.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 +7 -0
- data/.dockerignore +21 -0
- data/.pronto.yml +12 -0
- data/.reek.yml +25 -0
- data/.rspec +4 -0
- data/.ruby-version +1 -0
- data/.standard.yml +3 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +9 -0
- data/CLAUDE.md +52 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +34 -0
- data/Gemfile.lock +220 -0
- data/LICENSE +21 -0
- data/README.md +158 -0
- data/lib/steam_api_client/client.rb +112 -0
- data/lib/steam_api_client/errors/api_error.rb +48 -0
- data/lib/steam_api_client/errors/response_parse_error.rb +19 -0
- data/lib/steam_api_client/errors/url_error.rb +5 -0
- data/lib/steam_api_client/failure_handler.rb +46 -0
- data/lib/steam_api_client/request.rb +86 -0
- data/lib/steam_api_client/requestors/app_details.rb +27 -0
- data/lib/steam_api_client/requestors/app_global_achievements.rb +19 -0
- data/lib/steam_api_client/requestors/app_news.rb +23 -0
- data/lib/steam_api_client/requestors/base.rb +32 -0
- data/lib/steam_api_client/requestors/game_current_players.rb +19 -0
- data/lib/steam_api_client/requestors/player_achievements.rb +21 -0
- data/lib/steam_api_client/requestors/player_friends.rb +21 -0
- data/lib/steam_api_client/requestors/player_game_stats.rb +21 -0
- data/lib/steam_api_client/requestors/player_level.rb +18 -0
- data/lib/steam_api_client/requestors/player_owned_games.rb +23 -0
- data/lib/steam_api_client/requestors/player_recent_games.rb +21 -0
- data/lib/steam_api_client/requestors/player_steamid.rb +19 -0
- data/lib/steam_api_client/requestors/player_summaries.rb +19 -0
- data/lib/steam_api_client/response.rb +64 -0
- data/lib/steam_api_client/structs/app_details/achievement.rb +12 -0
- data/lib/steam_api_client/structs/app_details/category.rb +12 -0
- data/lib/steam_api_client/structs/app_details/details.rb +82 -0
- data/lib/steam_api_client/structs/app_details/genre.rb +12 -0
- data/lib/steam_api_client/structs/app_details/movie.rb +25 -0
- data/lib/steam_api_client/structs/app_details/package_group.rb +18 -0
- data/lib/steam_api_client/structs/app_details/requirements.rb +12 -0
- data/lib/steam_api_client/structs/app_details/screenshot.rb +13 -0
- data/lib/steam_api_client/structs/app_details/sub.rb +18 -0
- data/lib/steam_api_client/structs/app_global_achievements.rb +18 -0
- data/lib/steam_api_client/structs/app_new.rb +20 -0
- data/lib/steam_api_client/structs/app_news.rb +13 -0
- data/lib/steam_api_client/structs/base.rb +15 -0
- data/lib/steam_api_client/structs/game_current_players.rb +12 -0
- data/lib/steam_api_client/structs/player_achievements.rb +23 -0
- data/lib/steam_api_client/structs/player_friends.rb +17 -0
- data/lib/steam_api_client/structs/player_game_stats.rb +20 -0
- data/lib/steam_api_client/structs/player_level.rb +11 -0
- data/lib/steam_api_client/structs/player_owned_games.rb +25 -0
- data/lib/steam_api_client/structs/player_recent_games.rb +22 -0
- data/lib/steam_api_client/structs/player_steamid.rb +16 -0
- data/lib/steam_api_client/structs/player_summaries.rb +11 -0
- data/lib/steam_api_client/structs/player_summary.rb +34 -0
- data/lib/steam_api_client/structs/requests/abstract.rb +59 -0
- data/lib/steam_api_client/structs/requests/get_app_details.rb +54 -0
- data/lib/steam_api_client/structs/requests/get_app_global_achievements.rb +54 -0
- data/lib/steam_api_client/structs/requests/get_app_news.rb +62 -0
- data/lib/steam_api_client/structs/requests/get_game_current_players.rb +54 -0
- data/lib/steam_api_client/structs/requests/get_player_achievements.rb +54 -0
- data/lib/steam_api_client/structs/requests/get_player_friends.rb +57 -0
- data/lib/steam_api_client/structs/requests/get_player_game_stats.rb +54 -0
- data/lib/steam_api_client/structs/requests/get_player_level.rb +48 -0
- data/lib/steam_api_client/structs/requests/get_player_owned_games.rb +56 -0
- data/lib/steam_api_client/structs/requests/get_player_recent_games.rb +54 -0
- data/lib/steam_api_client/structs/requests/get_player_steamid.rb +48 -0
- data/lib/steam_api_client/structs/requests/get_player_summaries.rb +52 -0
- data/lib/steam_api_client/structs/requests/storefront_abstract.rb +58 -0
- data/lib/steam_api_client/structs/types.rb +14 -0
- data/lib/steam_api_client/version.rb +5 -0
- data/lib/steam_api_client.rb +75 -0
- metadata +161 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game achievement highlighted information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Achievement < Base
|
|
7
|
+
attribute :name, Types::String
|
|
8
|
+
attribute :path, Types::String
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game category information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Category < Base
|
|
7
|
+
attribute :id, Types::Coercible::Integer
|
|
8
|
+
attribute :description, Types::String
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game details information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Details < Base
|
|
7
|
+
attribute :appid, Types::Coercible::Integer
|
|
8
|
+
attribute :response do
|
|
9
|
+
attribute :success, Types::Bool
|
|
10
|
+
# Steam omits data when the app is unavailable (success: false)
|
|
11
|
+
attribute? :data do
|
|
12
|
+
attribute? :type, Types::String
|
|
13
|
+
attribute? :name, Types::String
|
|
14
|
+
attribute? :required_age, Types::Coercible::Integer
|
|
15
|
+
attribute? :is_free, Types::Bool
|
|
16
|
+
attribute? :dlc, Types::Array.of(Types::Coercible::Integer)
|
|
17
|
+
attribute? :detailed_description, Types::String
|
|
18
|
+
attribute? :about_the_game, Types::String
|
|
19
|
+
attribute? :short_description, Types::String
|
|
20
|
+
attribute? :supported_languages, Types::String
|
|
21
|
+
attribute? :header_image, Types::String
|
|
22
|
+
attribute? :website, Types::String
|
|
23
|
+
attribute? :pc_requirements, SteamApiClient::Structs::AppDetails::Requirements
|
|
24
|
+
attribute? :mac_requirements, SteamApiClient::Structs::AppDetails::Requirements
|
|
25
|
+
attribute? :linux_requirements, SteamApiClient::Structs::AppDetails::Requirements
|
|
26
|
+
attribute? :developers, Types::Array.of(Types::Coercible::String)
|
|
27
|
+
attribute? :publishers, Types::Array.of(Types::Coercible::String)
|
|
28
|
+
attribute? :price_overview do
|
|
29
|
+
attribute :currency, Types::String
|
|
30
|
+
attribute :initial, Types::Coercible::Integer
|
|
31
|
+
attribute :final, Types::Coercible::Integer
|
|
32
|
+
attribute :discount_percent, Types::Coercible::Integer
|
|
33
|
+
attribute :initial_formatted, Types::String
|
|
34
|
+
attribute :final_formatted, Types::String
|
|
35
|
+
end
|
|
36
|
+
attribute? :packages, Types::Array.of(Types::Coercible::Integer)
|
|
37
|
+
attribute? :package_groups, Types::Array.of(SteamApiClient::Structs::AppDetails::PackageGroup)
|
|
38
|
+
attribute? :platforms do
|
|
39
|
+
attribute :windows, Types::Bool
|
|
40
|
+
attribute :mac, Types::Bool
|
|
41
|
+
attribute :linux, Types::Bool
|
|
42
|
+
end
|
|
43
|
+
attribute? :metacritic do
|
|
44
|
+
attribute :score, Types::Coercible::Integer
|
|
45
|
+
attribute :url, Types::String
|
|
46
|
+
end
|
|
47
|
+
attribute? :categories, Types::Array.of(SteamApiClient::Structs::AppDetails::Category)
|
|
48
|
+
attribute? :genres, Types::Array.of(SteamApiClient::Structs::AppDetails::Genre)
|
|
49
|
+
attribute? :screenshots, Types::Array.of(SteamApiClient::Structs::AppDetails::Screenshot)
|
|
50
|
+
attribute? :movies, Types::Array.of(SteamApiClient::Structs::AppDetails::Movie)
|
|
51
|
+
attribute? :recommendations do
|
|
52
|
+
attribute :total, Types::Coercible::Integer
|
|
53
|
+
end
|
|
54
|
+
attribute? :achievements do
|
|
55
|
+
attribute :total, Types::Coercible::Integer
|
|
56
|
+
attribute :highlighted, Types::Array.of(SteamApiClient::Structs::AppDetails::Achievement)
|
|
57
|
+
end
|
|
58
|
+
attribute? :release_date do
|
|
59
|
+
attribute :coming_soon, Types::Bool
|
|
60
|
+
attribute :date, Types::String
|
|
61
|
+
end
|
|
62
|
+
attribute? :support_info do
|
|
63
|
+
attribute :url, Types::String
|
|
64
|
+
attribute :email, Types::String
|
|
65
|
+
end
|
|
66
|
+
attribute? :background, Types::String
|
|
67
|
+
attribute? :background_raw, Types::String
|
|
68
|
+
attribute? :content_descriptors do
|
|
69
|
+
attribute :ids, Types::Array.of(Types::Coercible::Integer)
|
|
70
|
+
attribute :notes, Types::String
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def self.build_from_response(json_response)
|
|
76
|
+
outer_key = json_response.keys.first
|
|
77
|
+
new(appid: outer_key.to_s, response: json_response[outer_key])
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game genre information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Genre < Base
|
|
7
|
+
attribute :id, Types::Coercible::Integer
|
|
8
|
+
attribute :description, Types::String
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game video (movies, trailers etc) information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Movie < Base
|
|
7
|
+
attribute :id, Types::Coercible::Integer
|
|
8
|
+
attribute :name, Types::String
|
|
9
|
+
attribute :thumbnail, Types::String
|
|
10
|
+
# Streaming manifests (MPEG-DASH and HLS) returned by the current Storefront API
|
|
11
|
+
attribute? :dash_av1, Types::String
|
|
12
|
+
attribute? :dash_h264, Types::String
|
|
13
|
+
attribute? :hls_h264, Types::String
|
|
14
|
+
# Legacy direct video files, no longer returned by Steam
|
|
15
|
+
attribute? :webm do
|
|
16
|
+
attribute :max, Types::String
|
|
17
|
+
end
|
|
18
|
+
attribute? :mp4 do
|
|
19
|
+
attribute :max, Types::String
|
|
20
|
+
end
|
|
21
|
+
attribute :highlight, Types::Bool
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game package group information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class PackageGroup < Base
|
|
7
|
+
attribute :name, Types::String
|
|
8
|
+
attribute :title, Types::String
|
|
9
|
+
attribute :description, Types::String
|
|
10
|
+
attribute :selection_text, Types::String
|
|
11
|
+
attribute :save_text, Types::String
|
|
12
|
+
attribute :display_type, Types::Coercible::Integer
|
|
13
|
+
attribute :is_recurring_subscription, Types::String
|
|
14
|
+
attribute :subs, Types::Array.of(SteamApiClient::Structs::AppDetails::Sub)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game requirement information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Requirements < Base
|
|
7
|
+
attribute :minimum?, Types::String
|
|
8
|
+
attribute :recommended?, Types::String
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game screenshot information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Screenshot < Base
|
|
7
|
+
attribute :id, Types::Coercible::Integer
|
|
8
|
+
attribute :path_thumbnail, Types::String
|
|
9
|
+
attribute :path_full, Types::String
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module AppDetails
|
|
4
|
+
# Struct that holds the App/Game package group sub information
|
|
5
|
+
# @see https://wiki.teamfortress.com/wiki/User:RJackson/StorefrontAPI#appdetails
|
|
6
|
+
class Sub < Base
|
|
7
|
+
attribute :packageid, Types::Coercible::Integer
|
|
8
|
+
attribute :percent_savings_text, Types::String
|
|
9
|
+
attribute :percent_savings, Types::Coercible::Integer
|
|
10
|
+
attribute :option_text, Types::String
|
|
11
|
+
attribute :option_description, Types::String
|
|
12
|
+
attribute :can_get_free_license, Types::String
|
|
13
|
+
attribute :is_free_license, Types::Bool
|
|
14
|
+
attribute :price_in_cents_with_discount, Types::Coercible::Integer
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds all App Global Achievements information
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetGlobalAchievementPercentagesForApp_.28v0002.29
|
|
5
|
+
class AppGlobalAchievements < Base
|
|
6
|
+
class InternalAppAchievementsAttributes < Dry::Struct
|
|
7
|
+
attribute :name, Types::String
|
|
8
|
+
attribute :percent, Types::Decimal
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
attribute :achievementpercentages do
|
|
12
|
+
attribute :achievements?, Types::Strict::Array.of(
|
|
13
|
+
InternalAppAchievementsAttributes
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds an App news information
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetNewsForApp_.28v0002.29
|
|
5
|
+
class AppNew < Dry::Struct
|
|
6
|
+
attribute :gid, Types::String
|
|
7
|
+
attribute :title, Types::String
|
|
8
|
+
attribute :url, Types::String
|
|
9
|
+
attribute :is_external_url, Types::Bool
|
|
10
|
+
attribute :author, Types::String
|
|
11
|
+
attribute :contents, Types::String
|
|
12
|
+
attribute :feedlabel, Types::String
|
|
13
|
+
attribute :date, Types::Integer
|
|
14
|
+
attribute :feedname, Types::String
|
|
15
|
+
attribute :feed_type, Types::Integer
|
|
16
|
+
attribute :appid, Types::Integer
|
|
17
|
+
attribute :tags?, Types::Strict::Array.of(Types::String).optional
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds all App news information
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetNewsForApp_.28v0002.29
|
|
5
|
+
class AppNews < Base
|
|
6
|
+
attribute :appnews do
|
|
7
|
+
attribute :appid?, Types::Integer
|
|
8
|
+
attribute :count?, Types::Integer
|
|
9
|
+
attribute :newsitems?, Types::Strict::Array.of(AppNew)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Base struct used by the others client's structs.
|
|
4
|
+
class Base < ::Dry::Struct
|
|
5
|
+
transform_keys(&:to_sym)
|
|
6
|
+
|
|
7
|
+
# Build the struct through the response from api.
|
|
8
|
+
# @param [Hash] json_response - The json response received from api.
|
|
9
|
+
# @return an instance of the Struct
|
|
10
|
+
def self.build_from_response(json_response)
|
|
11
|
+
new(**json_response)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds the number of current players for a game/appid
|
|
4
|
+
# @see https://wiki.teamfortress.com/wiki/WebAPI/GetNumberOfCurrentPlayers
|
|
5
|
+
class GameCurrentPlayers < Base
|
|
6
|
+
attribute :response do
|
|
7
|
+
attribute :player_count?, Types::Coercible::Integer
|
|
8
|
+
attribute :result, Types::Coercible::Integer
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds all Player Achievements of an app information
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerAchievements_.28v0001.29
|
|
5
|
+
class PlayerAchievements < Base
|
|
6
|
+
class InternalPlayerAchievementsAttributes < Dry::Struct
|
|
7
|
+
attribute :apiname?, Types::String
|
|
8
|
+
attribute :achieved?, Types::Integer
|
|
9
|
+
attribute :unlocktime?, Types::Integer
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attribute :playerstats do
|
|
13
|
+
attribute :steamID?, Types::Coercible::Integer.optional.default(nil)
|
|
14
|
+
attribute :error?, Types::String
|
|
15
|
+
attribute :gameName?, Types::String
|
|
16
|
+
attribute :achievements?, Types::Strict::Array.of(
|
|
17
|
+
InternalPlayerAchievementsAttributes
|
|
18
|
+
)
|
|
19
|
+
attribute :success, Types::Bool
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds information of all friends the player has
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_.28v0001.29
|
|
5
|
+
class InternalPlayerFriends < Dry::Struct
|
|
6
|
+
attribute :steamid?, Types::Integer
|
|
7
|
+
attribute :relationship?, Types::String
|
|
8
|
+
attribute :friend_since, Types::Integer
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class PlayerFriends < Base
|
|
12
|
+
attribute :friendslist do
|
|
13
|
+
attribute :friends?, Types::Strict::Array.of(InternalPlayerFriends)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds all Player Stats for a given game/appid
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetUserStatsForGame_.28v0002.29
|
|
5
|
+
class PlayerGameStats < Base
|
|
6
|
+
class InternalPlayerGameStatsAttributes < Dry::Struct
|
|
7
|
+
attribute :name?, Types::String
|
|
8
|
+
attribute :achieved?, Types::Integer
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
attribute :playerstats do
|
|
12
|
+
attribute :steamID?, Types::Coercible::Integer.optional.default(nil)
|
|
13
|
+
attribute :gameName?, Types::String
|
|
14
|
+
attribute :achievements?, Types::Strict::Array.of(
|
|
15
|
+
InternalPlayerGameStatsAttributes
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds the user level on Steam
|
|
4
|
+
# @see https://wiki.teamfortress.com/wiki/WebAPI/GetSteamLevel
|
|
5
|
+
class PlayerLevel < Base
|
|
6
|
+
attribute :response do
|
|
7
|
+
attribute :player_level?, Types::Integer
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds all user owned games
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29
|
|
5
|
+
class PlayerOwnedGames < Base
|
|
6
|
+
class InternalPlayerOwnedGames < Dry::Struct
|
|
7
|
+
attribute :appid, Types::Integer
|
|
8
|
+
attribute :name?, Types::String
|
|
9
|
+
attribute :playtime_forever, Types::Integer
|
|
10
|
+
attribute :img_icon_url?, Types::String
|
|
11
|
+
attribute :playtime_windows_forever, Types::Integer
|
|
12
|
+
attribute :playtime_mac_forever, Types::Integer
|
|
13
|
+
attribute :playtime_linux_forever, Types::Integer
|
|
14
|
+
attribute :rtime_last_played, Types::Integer
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
attribute :response do
|
|
18
|
+
attribute :game_count?, Types::Integer
|
|
19
|
+
attribute :games?, Types::Strict::Array.of(
|
|
20
|
+
InternalPlayerOwnedGames
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds all user recent played games
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetRecentlyPlayedGames_.28v0001.29
|
|
5
|
+
class PlayerRecentGames < Base
|
|
6
|
+
class InternalPlayerRecentGames < Dry::Struct
|
|
7
|
+
attribute :appid, Types::Integer
|
|
8
|
+
attribute :name, Types::String
|
|
9
|
+
attribute :playtime_2weeks, Types::Integer
|
|
10
|
+
attribute :playtime_forever, Types::Integer
|
|
11
|
+
attribute :img_icon_url, Types::String
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
attribute :response do
|
|
15
|
+
attribute :total_count?, Types::Integer
|
|
16
|
+
attribute :games?, Types::Strict::Array.of(
|
|
17
|
+
InternalPlayerRecentGames
|
|
18
|
+
).optional
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds the player SteamId
|
|
4
|
+
# @see https://wiki.teamfortress.com/wiki/WebAPI/ResolveVanityURL
|
|
5
|
+
class PlayerSteamId < Base
|
|
6
|
+
attribute :response do
|
|
7
|
+
# The 64 bit Steam ID the vanity URL resolves to. Not returned on resolution failures.
|
|
8
|
+
attribute :steamid?, Types::Coercible::Integer.optional.default(nil)
|
|
9
|
+
# The message associated with the request status. Currently only used on resolution failures.
|
|
10
|
+
attribute :message?, Types::String
|
|
11
|
+
# The status of the request. 1 if successful, 42 if there was no match.
|
|
12
|
+
attribute :success, Types::Integer
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds the Player Summaries information
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29
|
|
5
|
+
class PlayerSummaries < Base
|
|
6
|
+
attribute :response do
|
|
7
|
+
attribute :players, Types::Strict::Array.of(PlayerSummary)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
# Struct that holds the Player Summary information
|
|
4
|
+
# @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29
|
|
5
|
+
class PlayerSummary < Dry::Struct
|
|
6
|
+
# 64bit SteamID of the user
|
|
7
|
+
attribute :steamid, Types::String
|
|
8
|
+
# The player's persona name (display name)
|
|
9
|
+
attribute :personaname, Types::String
|
|
10
|
+
# The full URL of the player's Steam Community profile.
|
|
11
|
+
attribute :profileurl, Types::String
|
|
12
|
+
# The full URL of the player's 32x32px avatar. If the user hasn't configured an avatar
|
|
13
|
+
# this will be the default ? avatar.
|
|
14
|
+
attribute :avatar, Types::String
|
|
15
|
+
# The full URL of the player's 64x64px avatar. If the user hasn't configured an avatar
|
|
16
|
+
# this will be the default ? avatar.
|
|
17
|
+
attribute :avatarmedium, Types::String
|
|
18
|
+
# The full URL of the player's 184x184px avatar. If the user hasn't configured an avatar
|
|
19
|
+
# this will be the default ? avatar.
|
|
20
|
+
attribute :avatarfull, Types::String
|
|
21
|
+
# The user's current status. 0 - Offline, 1 - Online, 2 - Busy, 3 - Away, 4 - Snooze, 5 - looking to trade
|
|
22
|
+
# 6 - looking to play. If the player's profile is private, this will always be "0".
|
|
23
|
+
attribute :personastate, Types::Integer
|
|
24
|
+
# This represents whether the profile is visible or not, and if it is visible, why you are allowed to see it.
|
|
25
|
+
attribute :communityvisibilitystate, Types::Integer
|
|
26
|
+
# If set, indicates the user has a community profile configured (will be set to '1')
|
|
27
|
+
attribute :profilestate, Types::String
|
|
28
|
+
# The last time the user was online, in unix time.
|
|
29
|
+
attribute :lastlogoff, Types::Optional::Integer
|
|
30
|
+
# If set, indicates the profile allows public comments.
|
|
31
|
+
attribute :commentpermission, Types::Optional::Integer
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module Requests
|
|
4
|
+
# @abstract class for a base API endpoint Request's struct
|
|
5
|
+
class Abstract < SteamApiClient::Structs::Base
|
|
6
|
+
# Returns the version value to create the request path
|
|
7
|
+
# @abstract
|
|
8
|
+
# @return [String] the version of the request path
|
|
9
|
+
def version
|
|
10
|
+
raise NoMethodError, "Override this method"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Returns the interface value to create the request path
|
|
14
|
+
# @abstract
|
|
15
|
+
# @return [String] the interface of the request path
|
|
16
|
+
def interface
|
|
17
|
+
raise NoMethodError, "Override this method"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Returns the API path value to create the request path
|
|
21
|
+
# @abstract
|
|
22
|
+
# @return [String] the API path of the request path
|
|
23
|
+
def path
|
|
24
|
+
raise NoMethodError, "Override this method"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Returns the HTTP method used by the request.
|
|
28
|
+
# @return [Symbol]
|
|
29
|
+
def method
|
|
30
|
+
:get
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns the query params needed for the HTTP request
|
|
34
|
+
# @return [Hash]
|
|
35
|
+
def query_params
|
|
36
|
+
{}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Return the class attributes as a Hash
|
|
40
|
+
# @return [Hash]
|
|
41
|
+
def body
|
|
42
|
+
to_h
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Tells if the request require the api_token in the query params
|
|
46
|
+
# @return [Boolean]
|
|
47
|
+
def needs_authorization?
|
|
48
|
+
true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Tells the URL builder which format to choose from
|
|
52
|
+
# @return [Symbol]
|
|
53
|
+
def endpoint_kind
|
|
54
|
+
:base_endpoint
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module SteamApiClient
|
|
2
|
+
module Structs
|
|
3
|
+
module Requests
|
|
4
|
+
class GetAppDetails < StorefrontAbstract
|
|
5
|
+
attribute :appid, Types::Integer
|
|
6
|
+
attribute :filters, Types::Array.of(Types::String)
|
|
7
|
+
attribute :cc, Types::String
|
|
8
|
+
attribute :l, Types::String
|
|
9
|
+
|
|
10
|
+
# Build the struct through the received params.
|
|
11
|
+
# @params [Hash] params The hash params.
|
|
12
|
+
# @return an instance of the Struct
|
|
13
|
+
def self.build_from_params(params)
|
|
14
|
+
%i[appid].each do |attrib|
|
|
15
|
+
raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
new(params)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Returns the API path value to create the request path
|
|
22
|
+
# @return [String] the API path of the request path
|
|
23
|
+
def path
|
|
24
|
+
"appdetails/"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Returns the query params needed for the HTTP request
|
|
28
|
+
# @return [Hash]
|
|
29
|
+
def query_params
|
|
30
|
+
super.merge(
|
|
31
|
+
{
|
|
32
|
+
appids: appid,
|
|
33
|
+
filters: filters.join(","),
|
|
34
|
+
cc: cc,
|
|
35
|
+
l: l
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Return the class attributes as a Hash
|
|
41
|
+
# @return [Hash]
|
|
42
|
+
def body
|
|
43
|
+
{}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Tells if the request require the api_token in the query params
|
|
47
|
+
# @return [Boolean]
|
|
48
|
+
def needs_authorization?
|
|
49
|
+
false
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
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 StandardError, ":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
|
+
# Return the class attributes as a Hash
|
|
41
|
+
# @return [Hash]
|
|
42
|
+
def body
|
|
43
|
+
{}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Tells if the request require the api_token in the query params
|
|
47
|
+
# @return [Boolean]
|
|
48
|
+
def needs_authorization?
|
|
49
|
+
false
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|