steam_api_client 0.9.0 → 0.10.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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +140 -1
  3. data/README.md +39 -10
  4. data/lib/steam_api_client/errors/api_error.rb +29 -0
  5. data/lib/steam_api_client/errors/missing_api_token.rb +11 -0
  6. data/lib/steam_api_client/failure_handler.rb +3 -0
  7. data/lib/steam_api_client/request.rb +13 -6
  8. data/lib/steam_api_client/requestors/app_global_achievements.rb +3 -3
  9. data/lib/steam_api_client/requestors/app_news.rb +1 -1
  10. data/lib/steam_api_client/requestors/game_current_players.rb +1 -1
  11. data/lib/steam_api_client/requestors/player_achievements.rb +1 -1
  12. data/lib/steam_api_client/requestors/player_friends.rb +1 -1
  13. data/lib/steam_api_client/requestors/player_game_stats.rb +1 -1
  14. data/lib/steam_api_client/requestors/player_level.rb +1 -1
  15. data/lib/steam_api_client/requestors/player_owned_games.rb +1 -1
  16. data/lib/steam_api_client/requestors/player_recent_games.rb +1 -1
  17. data/lib/steam_api_client/requestors/player_steamid.rb +1 -1
  18. data/lib/steam_api_client/requestors/player_summaries.rb +1 -1
  19. data/lib/steam_api_client/response.rb +9 -1
  20. data/lib/steam_api_client/structs/app_global_achievements.rb +2 -2
  21. data/lib/steam_api_client/structs/app_new.rb +1 -1
  22. data/lib/steam_api_client/structs/player_achievements.rb +1 -1
  23. data/lib/steam_api_client/structs/player_friends.rb +1 -1
  24. data/lib/steam_api_client/structs/player_game_stats.rb +9 -1
  25. data/lib/steam_api_client/structs/player_owned_games.rb +11 -5
  26. data/lib/steam_api_client/structs/player_recent_games.rb +1 -1
  27. data/lib/steam_api_client/structs/player_summary.rb +15 -3
  28. data/lib/steam_api_client/structs/requests/get_app_details.rb +1 -7
  29. data/lib/steam_api_client/structs/requests/get_app_global_achievements.rb +1 -7
  30. data/lib/steam_api_client/structs/requests/get_app_news.rb +1 -7
  31. data/lib/steam_api_client/structs/requests/get_game_current_players.rb +1 -7
  32. data/lib/steam_api_client/structs/requests/get_player_achievements.rb +1 -7
  33. data/lib/steam_api_client/structs/requests/get_player_friends.rb +2 -8
  34. data/lib/steam_api_client/structs/requests/get_player_game_stats.rb +1 -7
  35. data/lib/steam_api_client/structs/requests/get_player_level.rb +1 -7
  36. data/lib/steam_api_client/structs/requests/get_player_owned_games.rb +1 -7
  37. data/lib/steam_api_client/structs/requests/get_player_recent_games.rb +1 -7
  38. data/lib/steam_api_client/structs/requests/get_player_steamid.rb +1 -7
  39. data/lib/steam_api_client/structs/requests/get_player_summaries.rb +1 -7
  40. data/lib/steam_api_client/structs/types.rb +13 -4
  41. data/lib/steam_api_client/version.rb +1 -1
  42. data/lib/steam_api_client.rb +2 -0
  43. metadata +7 -17
  44. data/.dockerignore +0 -21
  45. data/.pronto.yml +0 -12
  46. data/.reek.yml +0 -25
  47. data/.rspec +0 -4
  48. data/.ruby-version +0 -1
  49. data/.standard.yml +0 -3
  50. data/.tool-versions +0 -1
  51. data/CLAUDE.md +0 -52
  52. data/CODE_OF_CONDUCT.md +0 -84
  53. data/Gemfile +0 -34
  54. data/Gemfile.lock +0 -220
@@ -2,9 +2,9 @@ module SteamApiClient
2
2
  module Structs
3
3
  # Struct that holds the Player Summary information
4
4
  # @see https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29
5
- class PlayerSummary < Dry::Struct
5
+ class PlayerSummary < Base
6
6
  # 64bit SteamID of the user
7
- attribute :steamid, Types::String
7
+ attribute :steamid, Types::Integer
8
8
  # The player's persona name (display name)
9
9
  attribute :personaname, Types::String
10
10
  # The full URL of the player's Steam Community profile.
@@ -24,11 +24,23 @@ module SteamApiClient
24
24
  # This represents whether the profile is visible or not, and if it is visible, why you are allowed to see it.
25
25
  attribute :communityvisibilitystate, Types::Integer
26
26
  # If set, indicates the user has a community profile configured (will be set to '1')
27
- attribute :profilestate, Types::String
27
+ attribute :profilestate, Types::Integer
28
28
  # The last time the user was online, in unix time.
29
29
  attribute :lastlogoff, Types::Optional::Integer
30
30
  # If set, indicates the profile allows public comments.
31
31
  attribute :commentpermission, Types::Optional::Integer
32
+ # Optional fields: only sent when the profile (or that part of it) is public
33
+ # The player's "real" name, if they set one
34
+ attribute? :realname, Types::String
35
+ # When the account was created, in unix time
36
+ attribute? :timecreated, Types::Integer
37
+ # ISO 3166 country code of the player's location
38
+ attribute? :loccountrycode, Types::String
39
+ # Hash used in the avatar URLs
40
+ attribute? :avatarhash, Types::String
41
+ # The player's primary group (a group SteamID)
42
+ attribute? :primaryclanid, Types::Integer
43
+ attribute? :personastateflags, Types::Integer
32
44
  end
33
45
  end
34
46
  end
@@ -12,7 +12,7 @@ module SteamApiClient
12
12
  # @return an instance of the Struct
13
13
  def self.build_from_params(params)
14
14
  %i[appid].each do |attrib|
15
- raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
15
+ raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
16
16
  end
17
17
 
18
18
  new(params)
@@ -37,12 +37,6 @@ module SteamApiClient
37
37
  )
38
38
  end
39
39
 
40
- # Return the class attributes as a Hash
41
- # @return [Hash]
42
- def body
43
- {}
44
- end
45
-
46
40
  # Tells if the request require the api_token in the query params
47
41
  # @return [Boolean]
48
42
  def needs_authorization?
@@ -8,7 +8,7 @@ module SteamApiClient
8
8
  # @params [Hash] params The hash params.
9
9
  # @return an instance of the Struct
10
10
  def self.build_from_params(params)
11
- raise StandardError, ":gameid is missing" unless params.key?(:gameid)
11
+ raise ArgumentError, ":gameid is missing" unless params.key?(:gameid)
12
12
 
13
13
  new(params)
14
14
  end
@@ -37,12 +37,6 @@ module SteamApiClient
37
37
  {gameid: gameid}
38
38
  end
39
39
 
40
- # Return the class attributes as a Hash
41
- # @return [Hash]
42
- def body
43
- {}
44
- end
45
-
46
40
  # Tells if the request require the api_token in the query params
47
41
  # @return [Boolean]
48
42
  def needs_authorization?
@@ -11,7 +11,7 @@ module SteamApiClient
11
11
  # @return an instance of the Struct
12
12
  def self.build_from_params(params)
13
13
  %i[appid count maxlength].each do |attrib|
14
- raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
14
+ raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
15
15
  end
16
16
 
17
17
  new(params)
@@ -45,12 +45,6 @@ module SteamApiClient
45
45
  }
46
46
  end
47
47
 
48
- # Return the class attributes as a Hash
49
- # @return [Hash]
50
- def body
51
- {}
52
- end
53
-
54
48
  # Tells if the request require the api_token in the query params
55
49
  # @return [Boolean]
56
50
  def needs_authorization?
@@ -8,7 +8,7 @@ module SteamApiClient
8
8
  # @params [Hash] params The hash params.
9
9
  # @return an instance of the Struct
10
10
  def self.build_from_params(params)
11
- raise StandardError, ":appid is missing" unless params.key?(:appid)
11
+ raise ArgumentError, ":appid is missing" unless params.key?(:appid)
12
12
 
13
13
  new(params)
14
14
  end
@@ -37,12 +37,6 @@ module SteamApiClient
37
37
  {appid: appid}
38
38
  end
39
39
 
40
- # Return the class attributes as a Hash
41
- # @return [Hash]
42
- def body
43
- {}
44
- end
45
-
46
40
  # Tells if the request require the api_token in the query params
47
41
  # @return [Boolean]
48
42
  def needs_authorization?
@@ -10,7 +10,7 @@ module SteamApiClient
10
10
  # @return an instance of the Struct
11
11
  def self.build_from_params(params)
12
12
  %i[appid steamid].each do |attrib|
13
- raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
13
+ raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
14
14
  end
15
15
 
16
16
  new(params)
@@ -42,12 +42,6 @@ module SteamApiClient
42
42
  steamid: steamid
43
43
  }
44
44
  end
45
-
46
- # Return the class attributes as a Hash
47
- # @return [Hash]
48
- def body
49
- {}
50
- end
51
45
  end
52
46
  end
53
47
  end
@@ -10,11 +10,11 @@ module SteamApiClient
10
10
  # @return an instance of the Struct
11
11
  def self.build_from_params(params)
12
12
  %i[steamid relationship].each do |attrib|
13
- raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
13
+ raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
14
14
  end
15
15
 
16
16
  # The only possible values are: all, friend.
17
- raise StandardError, ":relationship value not allowed" unless %w[all friend].include? params[:relationship]
17
+ raise ArgumentError, ":relationship value not allowed" unless %w[all friend].include? params[:relationship]
18
18
 
19
19
  new(params)
20
20
  end
@@ -45,12 +45,6 @@ module SteamApiClient
45
45
  relationship: relationship
46
46
  }
47
47
  end
48
-
49
- # Return the class attributes as a Hash
50
- # @return [Hash]
51
- def body
52
- {}
53
- end
54
48
  end
55
49
  end
56
50
  end
@@ -10,7 +10,7 @@ module SteamApiClient
10
10
  # @return an instance of the Struct
11
11
  def self.build_from_params(params)
12
12
  %i[appid steamid].each do |attrib|
13
- raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
13
+ raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
14
14
  end
15
15
 
16
16
  new(params)
@@ -42,12 +42,6 @@ module SteamApiClient
42
42
  steamid: steamid
43
43
  }
44
44
  end
45
-
46
- # Return the class attributes as a Hash
47
- # @return [Hash]
48
- def body
49
- {}
50
- end
51
45
  end
52
46
  end
53
47
  end
@@ -8,7 +8,7 @@ module SteamApiClient
8
8
  # @params [Hash] params The hash params.
9
9
  # @return an instance of the Struct
10
10
  def self.build_from_params(params)
11
- raise StandardError, ":steamid is missing" unless params.key?(:steamid)
11
+ raise ArgumentError, ":steamid is missing" unless params.key?(:steamid)
12
12
 
13
13
  new(params)
14
14
  end
@@ -36,12 +36,6 @@ module SteamApiClient
36
36
  def query_params
37
37
  {steamid: steamid}
38
38
  end
39
-
40
- # Return the class attributes as a Hash
41
- # @return [Hash]
42
- def body
43
- {}
44
- end
45
39
  end
46
40
  end
47
41
  end
@@ -11,7 +11,7 @@ module SteamApiClient
11
11
  # @return an instance of the Struct
12
12
  def self.build_from_params(params)
13
13
  %i[steamid include_appinfo include_played_free_games].each do |attrib|
14
- raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
14
+ raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
15
15
  end
16
16
 
17
17
  new(params)
@@ -44,12 +44,6 @@ module SteamApiClient
44
44
  include_played_free_games: include_played_free_games
45
45
  }
46
46
  end
47
-
48
- # Return the class attributes as a Hash
49
- # @return [Hash]
50
- def body
51
- {}
52
- end
53
47
  end
54
48
  end
55
49
  end
@@ -10,7 +10,7 @@ module SteamApiClient
10
10
  # @return an instance of the Struct
11
11
  def self.build_from_params(params)
12
12
  %i[steamid count].each do |attrib|
13
- raise StandardError, "#{attrib} is missing" unless params.key?(attrib)
13
+ raise ArgumentError, "#{attrib} is missing" unless params.key?(attrib)
14
14
  end
15
15
 
16
16
  new(params)
@@ -42,12 +42,6 @@ module SteamApiClient
42
42
  count: count
43
43
  }
44
44
  end
45
-
46
- # Return the class attributes as a Hash
47
- # @return [Hash]
48
- def body
49
- {}
50
- end
51
45
  end
52
46
  end
53
47
  end
@@ -8,7 +8,7 @@ module SteamApiClient
8
8
  # @params [Hash] params The hash params.
9
9
  # @return an instance of the Struct
10
10
  def self.build_from_params(params)
11
- raise StandardError, ":vanityurl is missing" unless params.key?(:vanityurl)
11
+ raise ArgumentError, ":vanityurl is missing" unless params.key?(:vanityurl)
12
12
 
13
13
  new(params)
14
14
  end
@@ -36,12 +36,6 @@ module SteamApiClient
36
36
  def query_params
37
37
  {vanityurl: vanityurl}
38
38
  end
39
-
40
- # Return the class attributes as a Hash
41
- # @return [Hash]
42
- def body
43
- {}
44
- end
45
39
  end
46
40
  end
47
41
  end
@@ -8,7 +8,7 @@ module SteamApiClient
8
8
  # @params [Hash] params The hash params.
9
9
  # @return an instance of the Struct
10
10
  def self.build_from_params(params)
11
- raise StandardError, ":steamids are missing" unless params.key?(:steamids)
11
+ raise ArgumentError, ":steamids are missing" unless params.key?(:steamids)
12
12
 
13
13
  new(params)
14
14
  end
@@ -40,12 +40,6 @@ module SteamApiClient
40
40
  steamids: steamids.join(",")
41
41
  }
42
42
  end
43
-
44
- # Return the class attributes as a Hash
45
- # @return [Hash]
46
- def body
47
- {}
48
- end
49
43
  end
50
44
  end
51
45
  end
@@ -1,13 +1,22 @@
1
1
  module SteamApiClient
2
2
  module Structs
3
- # Wrapper module to help use the dry types and easily extend them
4
- # when necessary
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.
5
8
  module Types
6
9
  include ::Dry.Types(default: :nominal)
7
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
+
8
17
  module Optional
9
- String = ::Dry.Types::String.optional.default(nil)
10
- Integer = ::Dry.Types::Integer.optional.default(nil)
18
+ String = Types::String.optional.default(nil)
19
+ Integer = Types::Integer.optional.default(nil)
11
20
  end
12
21
  end
13
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SteamApiClient
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  end
@@ -3,6 +3,7 @@
3
3
  require "dry-configurable"
4
4
  require "dry-struct"
5
5
  require "json"
6
+ require "time"
6
7
  require "singleton"
7
8
  require "typhoeus"
8
9
 
@@ -12,6 +13,7 @@ require_relative "steam_api_client/response"
12
13
  require_relative "steam_api_client/failure_handler"
13
14
 
14
15
  require_relative "steam_api_client/errors/api_error"
16
+ require_relative "steam_api_client/errors/missing_api_token"
15
17
  require_relative "steam_api_client/errors/response_parse_error"
16
18
  require_relative "steam_api_client/errors/url_error"
17
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steam_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Pedro
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: '1.1'
20
20
  type: :runtime
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: 1.1.0
26
+ version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dry-struct
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -59,23 +59,13 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".dockerignore"
63
- - ".pronto.yml"
64
- - ".reek.yml"
65
- - ".rspec"
66
- - ".ruby-version"
67
- - ".standard.yml"
68
- - ".tool-versions"
69
62
  - CHANGELOG.md
70
- - CLAUDE.md
71
- - CODE_OF_CONDUCT.md
72
- - Gemfile
73
- - Gemfile.lock
74
63
  - LICENSE
75
64
  - README.md
76
65
  - lib/steam_api_client.rb
77
66
  - lib/steam_api_client/client.rb
78
67
  - lib/steam_api_client/errors/api_error.rb
68
+ - lib/steam_api_client/errors/missing_api_token.rb
79
69
  - lib/steam_api_client/errors/response_parse_error.rb
80
70
  - lib/steam_api_client/errors/url_error.rb
81
71
  - lib/steam_api_client/failure_handler.rb
@@ -133,11 +123,11 @@ files:
133
123
  - lib/steam_api_client/structs/requests/storefront_abstract.rb
134
124
  - lib/steam_api_client/structs/types.rb
135
125
  - lib/steam_api_client/version.rb
136
- homepage: https://github.com/sosolidkk/steam_api
126
+ homepage: https://github.com/jpechaves/steam_api
137
127
  licenses:
138
128
  - MIT
139
129
  metadata:
140
- homepage_uri: https://github.com/sosolidkk/steam_api
130
+ homepage_uri: https://github.com/jpechaves/steam_api
141
131
  rubygems_mfa_required: 'true'
142
132
  post_install_message:
143
133
  rdoc_options: []
@@ -147,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
137
  requirements:
148
138
  - - ">="
149
139
  - !ruby/object:Gem::Version
150
- version: '3.0'
140
+ version: '3.3'
151
141
  required_rubygems_version: !ruby/object:Gem::Requirement
152
142
  requirements:
153
143
  - - ">="
data/.dockerignore DELETED
@@ -1,21 +0,0 @@
1
- # GIT
2
- .git
3
- .gitignore
4
-
5
- # Editor temp files
6
- *.swp
7
- *.swo
8
-
9
- # Docker
10
- *Dockerfile*
11
- *docker-compose*
12
- .dockerignore
13
-
14
- # Bundle
15
- vendor/bundle/
16
-
17
- # Specs
18
- spec/
19
-
20
- # Dev tools
21
- .rspec_status
data/.pronto.yml DELETED
@@ -1,12 +0,0 @@
1
- ---
2
-
3
- # References:
4
- # https://github.com/prontolabs/pronto#configuration
5
-
6
- all:
7
- exclude:
8
- - 'spec/**/*'
9
- - 'coverage/**/*'
10
- - 'bin/**/*'
11
-
12
- verbose: true
data/.reek.yml DELETED
@@ -1,25 +0,0 @@
1
- ---
2
-
3
- # References:
4
- # https://github.com/troessner/reek#configuration-options
5
-
6
- exclude_paths:
7
- - bin
8
- - public
9
- - spec
10
- - storage
11
- - tmp
12
- - vendor
13
-
14
- detectors:
15
- # https://github.com/troessner/reek/blob/master/docs/Irresponsible-Module.md
16
- IrresponsibleModule:
17
- enabled: false
18
-
19
- # https://github.com/troessner/reek/blob/master/docs/Nil-Check.md
20
- NilCheck:
21
- enabled: false
22
-
23
- # https://github.com/troessner/reek/blob/master/docs/Too-Many-Statements.md
24
- TooManyStatements:
25
- enabled: false # Rubocop's responsability
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
4
- --profile 5
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.3.4
data/.standard.yml DELETED
@@ -1,3 +0,0 @@
1
- # For available configuration options, see:
2
- # https://github.com/standardrb/standard
3
- ruby_version: 3.3
data/.tool-versions DELETED
@@ -1 +0,0 @@
1
- ruby 3.3.4
data/CLAUDE.md DELETED
@@ -1,52 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Project
6
-
7
- `steam_api_client` is a Ruby gem wrapping the Steam Web API (`https://api.steampowered.com`) and the Storefront API (`https://store.steampowered.com/api/`). Runtime dependencies are only `dry-configurable`, `dry-struct`, and `typhoeus`. Ruby 3.3.4 is used locally (`.ruby-version`); the gemspec allows `>= 3.0`, CI tests 3.2 and 3.3.
8
-
9
- ## Commands
10
-
11
- ```bash
12
- bin/setup # bundle install
13
- bin/console # IRB with the gem loaded
14
- bin/rspec # full test suite (CI runs `bundle exec rspec`)
15
- bin/rspec spec/steam_api_client/request_spec.rb # single file
16
- bin/rspec spec/steam_api_client/request_spec.rb:42 # single example by line
17
- bin/rspec --only-failures # re-run failures (.rspec_status persistence is enabled)
18
- bin/lint # standardrb --no-fix (target ruby_version 3.3)
19
- bin/standardrb --fix # autofix style
20
- bundle exec rubycritic lib --no-browser # Flay/Flog/Reek analysis (report in tmp/rubycritic; Reek reads .reek.yml)
21
- bundle exec bundler-audit check --update # known advisories in Gemfile.lock
22
- ```
23
-
24
- CI (`.github/workflows/ci.yml`) runs three jobs: `lint` (standardrb), `analysis` (RubyCritic with a `--minimum-score` gate; raise it when the score improves) and `test` (rspec matrix). `.github/workflows/audit.yml` runs bundler-audit on push, PRs and weekly.
25
-
26
- SimpleCov runs automatically with the specs. Specs never hit the network: they stub `Typhoeus::Request`/responses with `instance_double`.
27
-
28
- ## Architecture
29
-
30
- Every endpoint is implemented as three pieces wired together through a shared pipeline:
31
-
32
- 1. **Requestor** (`lib/steam_api_client/requestors/*.rb`, subclass of `Requestors::Base`) — the public method (usually `retrieve`) exposed on the client. It calls `build_request_and_run(RequestStructClass, ResponseStructClass, **params)`.
33
- 2. **Request struct** (`lib/steam_api_client/structs/requests/get_*.rb`) — a Dry::Struct describing the HTTP call. Subclasses either:
34
- - `Requests::Abstract` for the Web API: must define `interface`, `path`, `version` (each with a trailing `/`, e.g. `"ISteamUser/"`, `"GetPlayerSummaries/"`, `"v0002/"`), or
35
- - `Requests::StorefrontAbstract` for the Storefront API: defines only `path`; default `query_params` includes `cc`/`l`.
36
- Each also defines `self.build_from_params(params)` (validates required keys, raises `StandardError` if missing), `query_params`, and usually overrides `body` to `{}` and `needs_authorization?` (adds `key=<api_token>` to the query when true). `endpoint_kind` (`:base_endpoint` / `:storefront_endpoint`) selects the URL builder in `Request`.
37
- 3. **Response struct** (`lib/steam_api_client/structs/*.rb`, subclass of `Structs::Base`) — a Dry::Struct mirroring the JSON payload; `build_from_response(hash)` defaults to `new(**hash)` but can be overridden to reshape the payload (e.g. `AppDetails::Details` unwraps the app-id-keyed top level). Use `attribute?` for fields Steam may omit; shared types live in `Structs::Types` (incl. `Types::Optional::String/Integer`).
38
-
39
- Pipeline: `Requestor` → `RequestStruct.build_from_params` → `SteamApiClient::Request` (builds URL with `URI.join` and a `Typhoeus::Request`) → `#run` → `SteamApiClient::Response` (wraps Typhoeus response; `#result` parses JSON with symbolized keys into the response struct, raising `Errors::ResponseParseError` with the JSON/Dry::Struct error as `cause` when that fails) → `FailureHandler.instance.call` raises `SteamApiClient::Errors::*` subclasses of `ApiError` by status code / timeout.
40
-
41
- ### Adding a new endpoint
42
-
43
- - Create the request struct, response struct, and requestor (plus specs mirroring the `lib/` path under `spec/`).
44
- - **Register every new file manually in `lib/steam_api_client.rb`** — there is no autoloading, and require order matters (nested struct classes such as `PlayerSummary` or `AppDetails::*` must be required before the structs that reference them).
45
- - Add an `attr_reader` and instantiate the requestor in `SteamApiClient::Client#initialize`.
46
-
47
- ### Gotchas
48
-
49
- - `Client.new` takes a keyword arg: `SteamApiClient::Client.new(api_token: "...")` (the README's positional example is outdated).
50
- - `Client#api_token` returns the instance token, falling back to the class-level `Client.configure` value. Specs that call `configure` must reset it (`after { described_class.config.api_token = nil }`) because the setting is global.
51
- - ActiveSupport is not a dependency — don't use `as_json`, `deep_symbolize_keys`, etc. `Dry::Struct#to_h` already returns a recursively symbolized hash.
52
- - SimpleCov loads stdlib gems (e.g. `json`) during specs, which can mask missing requires in `lib/steam_api_client.rb`. Check with `bundle exec ruby -Ilib -e 'require "steam_api_client"; ...'` outside RSpec.
data/CODE_OF_CONDUCT.md DELETED
@@ -1,84 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
-
7
- We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
-
9
- ## Our Standards
10
-
11
- Examples of behavior that contributes to a positive environment for our community include:
12
-
13
- * Demonstrating empathy and kindness toward other people
14
- * Being respectful of differing opinions, viewpoints, and experiences
15
- * Giving and gracefully accepting constructive feedback
16
- * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
- * Focusing on what is best not just for us as individuals, but for the overall community
18
-
19
- Examples of unacceptable behavior include:
20
-
21
- * The use of sexualized language or imagery, and sexual attention or
22
- advances of any kind
23
- * Trolling, insulting or derogatory comments, and personal or political attacks
24
- * Public or private harassment
25
- * Publishing others' private information, such as a physical or email
26
- address, without their explicit permission
27
- * Other conduct which could reasonably be considered inappropriate in a
28
- professional setting
29
-
30
- ## Enforcement Responsibilities
31
-
32
- Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
-
34
- Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
-
36
- ## Scope
37
-
38
- This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
-
40
- ## Enforcement
41
-
42
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at TODO: Write your email address. All complaints will be reviewed and investigated promptly and fairly.
43
-
44
- All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
-
46
- ## Enforcement Guidelines
47
-
48
- Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
-
50
- ### 1. Correction
51
-
52
- **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
-
54
- **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
-
56
- ### 2. Warning
57
-
58
- **Community Impact**: A violation through a single incident or series of actions.
59
-
60
- **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
-
62
- ### 3. Temporary Ban
63
-
64
- **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
-
66
- **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
-
68
- ### 4. Permanent Ban
69
-
70
- **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
-
72
- **Consequence**: A permanent ban from any sort of public interaction within the community.
73
-
74
- ## Attribution
75
-
76
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
- available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
-
79
- Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
-
81
- [homepage]: https://www.contributor-covenant.org
82
-
83
- For answers to common questions about this code of conduct, see the FAQ at
84
- https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.