twitchrb 1.9.1 → 1.11.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +5 -8
  3. data/.rubocop.yml +5 -0
  4. data/CHANGELOG.md +260 -0
  5. data/Gemfile +3 -1
  6. data/Gemfile.lock +69 -34
  7. data/README.md +135 -6
  8. data/bin/smoke +118 -0
  9. data/lib/twitch/client.rb +20 -0
  10. data/lib/twitch/collection.rb +4 -3
  11. data/lib/twitch/error.rb +3 -0
  12. data/lib/twitch/error_generator.rb +15 -4
  13. data/lib/twitch/oauth.rb +1 -3
  14. data/lib/twitch/objects/clip_download.rb +4 -0
  15. data/lib/twitch/objects/custom_power_up.rb +4 -0
  16. data/lib/twitch/objects/hype_train_status.rb +4 -0
  17. data/lib/twitch/objects/pinned_chat_message.rb +4 -0
  18. data/lib/twitch/objects/shared_chat_session.rb +4 -0
  19. data/lib/twitch/objects/suspicious_user.rb +4 -0
  20. data/lib/twitch/resource.rb +33 -9
  21. data/lib/twitch/resources/announcements.rb +3 -3
  22. data/lib/twitch/resources/automod.rb +1 -1
  23. data/lib/twitch/resources/badges.rb +1 -1
  24. data/lib/twitch/resources/banned_users.rb +1 -1
  25. data/lib/twitch/resources/blocked_terms.rb +2 -2
  26. data/lib/twitch/resources/channels.rb +3 -3
  27. data/lib/twitch/resources/charity_campaigns.rb +1 -1
  28. data/lib/twitch/resources/chat_messages.rb +10 -3
  29. data/lib/twitch/resources/clips.rb +29 -1
  30. data/lib/twitch/resources/custom_power_ups.rb +13 -0
  31. data/lib/twitch/resources/custom_reward_redemptions.rb +2 -2
  32. data/lib/twitch/resources/emotes.rb +2 -2
  33. data/lib/twitch/resources/eventsub_subscriptions.rb +7 -0
  34. data/lib/twitch/resources/games.rb +3 -5
  35. data/lib/twitch/resources/hype_train_events.rb +2 -2
  36. data/lib/twitch/resources/hype_train_status.rb +14 -0
  37. data/lib/twitch/resources/moderators.rb +1 -1
  38. data/lib/twitch/resources/pinned_chat_messages.rb +40 -0
  39. data/lib/twitch/resources/raids.rb +1 -1
  40. data/lib/twitch/resources/shared_chat_sessions.rb +12 -0
  41. data/lib/twitch/resources/shoutouts.rb +1 -1
  42. data/lib/twitch/resources/suspicious_users.rb +29 -0
  43. data/lib/twitch/resources/users.rb +12 -14
  44. data/lib/twitch/resources/videos.rb +1 -1
  45. data/lib/twitch/resources/vips.rb +1 -1
  46. data/lib/twitch/resources/warnings.rb +1 -1
  47. data/lib/twitch/version.rb +1 -1
  48. data/lib/twitch.rb +12 -0
  49. data/mise.toml +1 -1
  50. data/twitchrb.gemspec +2 -2
  51. metadata +26 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1a8ec322ca201921696368ca233dde770618982deddc216f4a312d392cadc84
4
- data.tar.gz: '092e46eccc58dca91227562cfbabacf8f234b17d49be1c4bc738acf0d9fc8331'
3
+ metadata.gz: 4a4de14d63208a337630d3530f24d90679645c2b4ad02d4f31beb96f687a6ff1
4
+ data.tar.gz: 2e49411b20156a55d93fa60e1dba87bf25121c228f601e10f6861e01aa9b0094
5
5
  SHA512:
6
- metadata.gz: 17230eacff5f07b1e2fd5442a0f811ba0028e6d568497f4e9e0ae75f3fbff77e85a6404b338f44598741bbe5789533fc28e93a36a56248188108290d495f227c
7
- data.tar.gz: 03c6b2866d43558f19e2610ad520b260622c1c03fce7b9e3575f694bc13ee6e47a2ec7a9f3c436b9ca9590bf745476633796ac8817fada01acc70acd521f4623
6
+ metadata.gz: 81bcbe6402c4cdf5f3cc90ac181aec22d8d46990053846f1bce3b92aead9f71462857c6b92e1b5dcbd4c34d1e635e057ce86516c856db1944252d01dc1e90b56
7
+ data.tar.gz: cfff782da54f1ffde515c8911febf8d251c1df677d0ba481399cfc86d2bd95c9885e0d5f6682aadbb96be98dc4cecf0ceda8aa72b073abdda842b4dc8e7ce120
@@ -1,21 +1,18 @@
1
1
  name: CI
2
2
  on:
3
3
  push:
4
- branches:
5
- - main
6
4
  pull_request:
7
- branches:
8
- - main
9
5
  jobs:
10
6
  lint:
11
7
  runs-on: ubuntu-latest
8
+ continue-on-error: true
12
9
  steps:
13
10
  - name: Checkout code
14
- uses: actions/checkout@v6
11
+ uses: actions/checkout@v7
15
12
  - name: Set up Ruby
16
13
  uses: ruby/setup-ruby@v1
17
14
  with:
18
- ruby-version: '3.4'
15
+ ruby-version: '4.0'
19
16
  bundler-cache: true
20
17
  - name: Lint code for consistent style
21
18
  run: bundle exec rubocop -f github
@@ -27,11 +24,11 @@ jobs:
27
24
  fail-fast: false
28
25
  matrix:
29
26
  ruby_version:
30
- - '3.2'
31
27
  - '3.3'
32
28
  - '3.4'
29
+ - '4.0'
33
30
  steps:
34
- - uses: actions/checkout@v6
31
+ - uses: actions/checkout@v7
35
32
  - uses: ruby/setup-ruby@v1
36
33
  with:
37
34
  ruby-version: ${{ matrix.ruby_version }}
data/.rubocop.yml CHANGED
@@ -1,6 +1,11 @@
1
1
  # Omakase Ruby styling for Rails
2
2
  inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3
3
 
4
+ AllCops:
5
+ Exclude:
6
+ - 'test/**/*'
7
+ TargetRubyVersion: 4.0
8
+
4
9
  # Overwrite or add rules to create your own house style
5
10
  #
6
11
  # # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
data/CHANGELOG.md ADDED
@@ -0,0 +1,260 @@
1
+ # Changelog
2
+
3
+ All notable changes to `twitchrb` are documented in this file.
4
+
5
+ Published release notes were sourced from GitHub releases where available. Older tag-only versions and the current unreleased work were reconstructed from local git history.
6
+
7
+ ## [1.11.0] - 2026-08-11
8
+
9
+ ### Fixed
10
+ - Fixed a `NoMethodError` crash when API responses have non-JSON bodies, such as `stream_schedule.icalendar` (which was completely broken) and HTML error pages from proxies.
11
+ - Fixed `users.retrieve` and `games.retrieve` returning `nil` when a plural lookup (`ids`, `usernames`, `names`) matched exactly one item; plural lookups now always return a `Collection`. Singular lookups with no match now return `nil` instead of an empty object.
12
+ - Fixed `oauth.revoke` always returning `true`; it now returns `false` when revocation fails, matching `validate`, `create`, and `refresh`.
13
+ - Fixed `blocked_terms.create` returning a `BannedUser` instead of a `BlockedTerm`.
14
+ - Fixed `suspicious_users.delete` crashing on 204 No Content responses; it now returns `true`.
15
+ - Fixed query string values not being escaped in request paths. Notably, `users.update_color` silently dropped hex colors like `#9146FF`.
16
+ - Errors are now raised for any 4xx/5xx response; previously 422, 502, and 504 slipped through unraised.
17
+ - `Collection#total` now reports the `total` field from the API for paginated endpoints instead of the page size, and responses without a `data` key return an empty collection instead of raising.
18
+ - Removed a leftover debug `puts` in `users.get_color`.
19
+ - Error messages for unmapped statuses no longer duplicate the Twitch message.
20
+ - Updated the minimum Faraday version to 2.14.3 to fix the uncontrolled recursion denial-of-service vulnerability in `NestedParamsEncoder` (CVE-2026-54297).
21
+
22
+ ### Changed
23
+ - The `auto_retry_rate_limit` client option (default `true`) now works: requests that hit a 429 wait until the rate limit window resets and retry once. Previously the option was accepted but ignored.
24
+ - All API errors now inherit from `Twitch::Error`, so they can be rescued with a single base class.
25
+ - `eventsub_subscriptions.create` now goes through the shared request helpers, gaining request path validation and rate limit auto-retry.
26
+
27
+ ### Added
28
+ - `users.get_color` accepts an array for `user_ids`, in line with other multi-id endpoints. Comma-separated strings still work.
29
+
30
+ ## [1.10.0] - 2026-05-16
31
+
32
+ ### Added
33
+ - Added custom power-up API support.
34
+ - Added shared chat announcement support.
35
+ - Added shared chat session support.
36
+ - Added suspicious user moderation APIs.
37
+ - Added VOD clip creation and downloads.
38
+ - Added pinned chat message support.
39
+
40
+ ### Changed
41
+ - Replaced hype train events with the status API.
42
+ - Improved EventSub subscription conflict handling.
43
+
44
+ ### Fixed
45
+ - Fixed SSRF via protocol-relative request paths.
46
+
47
+ ## [1.9.1] - 2025-12-06
48
+
49
+ ### Fixed
50
+ - Permissions fix.
51
+
52
+ ## [1.9.0] - 2025-12-05
53
+
54
+ ### Changed
55
+ - Tag-only release with no published release notes or recorded user-facing changes beyond the version bump.
56
+
57
+ ## [1.8.1] - 2025-12-05
58
+
59
+ ### Added
60
+ - Added support for Start Commercial.
61
+
62
+ ### Changed
63
+ - Imported `Enumerable` into collections.
64
+
65
+ ## [1.8.0] - 2025-12-01
66
+
67
+ ### Added
68
+ - Added support for Get Stream Key.
69
+
70
+ ## [1.7.0] - 2025-10-20
71
+
72
+ ### Added
73
+ - Added support for Get Authorization By User.
74
+
75
+ ## [1.6.0] - 2025-09-13
76
+
77
+ ### Fixed
78
+ - Fixed issues in the error generator.
79
+
80
+ ## [1.5.0] - 2025-09-12
81
+
82
+ ### Added
83
+ - Added an explicit `ostruct` dependency.
84
+
85
+ ### Changed
86
+ - Updated Faraday.
87
+
88
+ ## [1.4.0] - 2024-08-02
89
+
90
+ ### Added
91
+ - Added a new error generator.
92
+
93
+ ### Changed
94
+ - Required `ostruct` globally.
95
+ - Refreshed CI and dependency configuration.
96
+
97
+ ## [1.3.0] - 2024-06-28
98
+
99
+ ### Added
100
+ - Added Warn Chat User API support.
101
+ - Added `each`, `first`, and `last` on collections.
102
+
103
+ ## [1.2.6] - 2024-05-27
104
+
105
+ ### Fixed
106
+ - Returned `false` when token validation fails.
107
+
108
+ ### Changed
109
+ - Minor README updates.
110
+
111
+ ## [1.2.5] - 2024-03-17
112
+
113
+ ### Added
114
+ - Added Unban Requests API support.
115
+ - Added Get User Emotes API support.
116
+
117
+ ## [1.2.4] - 2024-01-31
118
+
119
+ ### Fixed
120
+ - Fixed users/games lookups so `ids`, `usernames`, and `names` return collections consistently.
121
+
122
+ ## [1.2.3] - 2024-01-27
123
+
124
+ ### Added
125
+ - Added send chat messages support.
126
+
127
+ ## [1.2.2] - 2024-01-09
128
+
129
+ ### Added
130
+ - Added `moderators.channels`.
131
+
132
+ ## [1.2.1] - 2024-01-02
133
+
134
+ ### Fixed
135
+ - Fixed custom reward redemption updates.
136
+ - Corrected documentation headings and repository metadata.
137
+
138
+ ### Changed
139
+ - Added Ruby 3.3 to CI coverage.
140
+
141
+ ## [1.2.0] - 2023-10-29
142
+
143
+ ### Changed
144
+ - Renamed Users `get_by_id` to `retrieve`.
145
+ - Renamed Users `get_by_username` to `retrieve`.
146
+ - Expanded Users `retrieve` to accept `id`, `ids`, `name`, and `names`.
147
+ - Renamed Channels `get` to `retrieve`.
148
+
149
+ ### Added
150
+ - Added Videos `retrieve`.
151
+ - Added Games `retrieve` with support for `id`, `ids`, `name`, and `names`.
152
+
153
+ ## [1.1.0] - 2023-02-21
154
+
155
+ ### Added
156
+ - Added support for Get Followed Channels.
157
+ - Added support for Get Channel Followers.
158
+
159
+ ### Deprecated
160
+ - Deprecated `user.follows`.
161
+ - Deprecated `user.following?` ahead of the Twitch API removal on August 3, 2023.
162
+
163
+ ## [1.0.4] - 2023-01-22
164
+
165
+ ### Changed
166
+ - Set the default User-Agent.
167
+
168
+ ## [1.0.3] - 2023-01-22
169
+
170
+ ### Added
171
+ - Added support for Shoutouts.
172
+
173
+ ## [1.0.2] - 2022-10-02
174
+
175
+ ### Added
176
+ - Added Chatters support.
177
+
178
+ ### Fixed
179
+ - Fixed Charity Campaigns handling.
180
+
181
+ ## [1.0.1] - 2022-08-26
182
+
183
+ ### Added
184
+ - Added support for the Charity Campaigns API.
185
+
186
+ ## [1.0.0] - 2022-07-18
187
+
188
+ ### Changed
189
+ - Removed Client Secret as a required client value; only Client ID and Access Token are required.
190
+
191
+ ### Added
192
+ - Added chat announcements.
193
+ - Added raids.
194
+ - Added chat message deletion.
195
+ - Added user chat colours.
196
+ - Added moderator management.
197
+ - Added VIP management.
198
+ - Added send whisper support.
199
+ - Added AutoMod status.
200
+ - Added AutoMod settings get/update support.
201
+ - Added ban/unban user support.
202
+ - Added blocked terms management.
203
+
204
+ ## [0.2.6] - 2022-04-26
205
+
206
+ ### Changed
207
+ - Removed thumbnail handling that was no longer needed.
208
+
209
+ ## [0.2.5] - 2022-04-10
210
+
211
+ ### Added
212
+ - Added channel follow count support.
213
+ - Added subscriber counts to channels.
214
+ - Expanded test coverage.
215
+
216
+ ### Changed
217
+ - Upgraded to Faraday 2.
218
+ - Improved project documentation.
219
+
220
+ ## [0.2.4] - 2021-12-31
221
+
222
+ ### Fixed
223
+ - Fixed handling for resources without a thumbnail URL.
224
+
225
+ ## [0.2.3] - 2021-12-31
226
+
227
+ ### Added
228
+ - Added `require "twitchrb"` so `require "twitch"` is no longer necessary.
229
+ - Added generated large thumbnail and animated image URLs.
230
+
231
+ ### Changed
232
+ - Improved channel return behavior.
233
+ - Added client secret support in the client flow.
234
+
235
+ ## [0.2.2] - 2021-12-12
236
+
237
+ ### Added
238
+ - Added `retrieve` to clips.
239
+
240
+ ## [0.2.1] - 2021-10-02
241
+
242
+ ### Changed
243
+ - Removed the older subscriber counting approach in favor of Twitch's newer totals/points behavior.
244
+ - Removed Travis CI configuration.
245
+
246
+ ## [0.2.0] - 2021-09-26
247
+
248
+ ### Added
249
+ - Expanded the gem to focus on the Twitch Helix API.
250
+ - Added badges, emotes, channels, channel editors, games, follows, blocks, videos, clips, EventSub subscriptions, banned events, banned users, moderators, moderator events, polls, predictions, stream schedule segments, search, streams, stream markers, subscriptions, tags, custom rewards, redemptions, goals, and hype train event support.
251
+ - Added model-based resource objects and improved error reporting.
252
+
253
+ ### Changed
254
+ - Replaced HTTParty with Faraday.
255
+ - Simplified collection handling by always reading from `data`.
256
+
257
+ ## [0.1.1] - 2021-06-20
258
+
259
+ ### Added
260
+ - Early tagged release of the Helix client.
data/Gemfile CHANGED
@@ -6,6 +6,8 @@ gemspec
6
6
  gem "rake", "~> 12.0"
7
7
  gem "minitest", "~> 5.0"
8
8
  gem "dotenv"
9
- gem "vcr"
9
+ gem "webmock"
10
10
  gem "rubocop-rails-omakase", require: false
11
11
  gem "activesupport", ">= 4.2.0", "< 8.0"
12
+ gem "irb"
13
+ gem "cgi"
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitchrb (1.9.1)
5
- faraday (~> 2.11)
4
+ twitchrb (1.10.0)
5
+ faraday (>= 2.14.3, < 3)
6
6
  ostruct (~> 0.6.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.2.2.2)
11
+ activesupport (7.2.3.1)
12
12
  base64
13
13
  benchmark (>= 0.3)
14
14
  bigdecimal
@@ -17,62 +17,91 @@ GEM
17
17
  drb
18
18
  i18n (>= 1.6, < 2)
19
19
  logger (>= 1.4.2)
20
- minitest (>= 5.1)
20
+ minitest (>= 5.1, < 6)
21
21
  securerandom (>= 0.3)
22
22
  tzinfo (~> 2.0, >= 2.0.5)
23
+ addressable (2.9.0)
24
+ public_suffix (>= 2.0.2, < 8.0)
23
25
  ast (2.4.3)
24
26
  base64 (0.3.0)
25
- benchmark (0.4.1)
26
- bigdecimal (3.3.1)
27
- concurrent-ruby (1.3.5)
28
- connection_pool (2.5.4)
29
- dotenv (3.1.8)
27
+ benchmark (0.5.0)
28
+ bigdecimal (4.1.2)
29
+ cgi (0.5.1)
30
+ concurrent-ruby (1.3.8)
31
+ connection_pool (3.0.2)
32
+ crack (1.0.1)
33
+ bigdecimal
34
+ rexml
35
+ date (3.5.1)
36
+ dotenv (3.2.0)
30
37
  drb (2.2.3)
31
- faraday (2.14.0)
38
+ erb (6.0.4)
39
+ faraday (2.14.3)
32
40
  faraday-net_http (>= 2.0, < 3.5)
33
41
  json
34
42
  logger
35
- faraday-net_http (3.4.1)
36
- net-http (>= 0.5.0)
37
- i18n (1.14.7)
43
+ faraday-net_http (3.4.2)
44
+ net-http (~> 0.5)
45
+ hashdiff (1.2.1)
46
+ i18n (1.14.8)
38
47
  concurrent-ruby (~> 1.0)
39
- json (2.15.1)
48
+ io-console (0.8.2)
49
+ irb (1.18.0)
50
+ pp (>= 0.6.0)
51
+ prism (>= 1.3.0)
52
+ rdoc (>= 4.0.0)
53
+ reline (>= 0.4.2)
54
+ json (2.21.2)
40
55
  language_server-protocol (3.17.0.5)
41
56
  lint_roller (1.1.0)
42
57
  logger (1.7.0)
43
- minitest (5.26.0)
44
- net-http (0.6.0)
45
- uri
58
+ minitest (5.27.0)
59
+ net-http (0.9.1)
60
+ uri (>= 0.11.1)
46
61
  ostruct (0.6.3)
47
- parallel (1.27.0)
48
- parser (3.3.9.0)
62
+ parallel (2.1.0)
63
+ parser (3.3.11.1)
49
64
  ast (~> 2.4.1)
50
65
  racc
51
- prism (1.6.0)
66
+ pp (0.6.3)
67
+ prettyprint
68
+ prettyprint (0.2.0)
69
+ prism (1.9.0)
70
+ psych (5.3.1)
71
+ date
72
+ stringio
73
+ public_suffix (7.0.5)
52
74
  racc (1.8.1)
53
- rack (3.2.3)
75
+ rack (3.2.6)
54
76
  rainbow (3.1.1)
55
77
  rake (12.3.3)
56
- regexp_parser (2.11.3)
57
- rubocop (1.81.1)
78
+ rdoc (7.2.0)
79
+ erb
80
+ psych (>= 4.0.0)
81
+ tsort
82
+ regexp_parser (2.12.0)
83
+ reline (0.6.3)
84
+ io-console (~> 0.5)
85
+ rexml (3.4.4)
86
+ rubocop (1.86.2)
58
87
  json (~> 2.3)
59
88
  language_server-protocol (~> 3.17.0.2)
60
89
  lint_roller (~> 1.1.0)
61
- parallel (~> 1.10)
90
+ parallel (>= 1.10)
62
91
  parser (>= 3.3.0.2)
63
92
  rainbow (>= 2.2.2, < 4.0)
64
93
  regexp_parser (>= 2.9.3, < 3.0)
65
- rubocop-ast (>= 1.47.1, < 2.0)
94
+ rubocop-ast (>= 1.49.0, < 2.0)
66
95
  ruby-progressbar (~> 1.7)
67
96
  unicode-display_width (>= 2.4.0, < 4.0)
68
- rubocop-ast (1.47.1)
97
+ rubocop-ast (1.49.1)
69
98
  parser (>= 3.3.7.2)
70
- prism (~> 1.4)
99
+ prism (~> 1.7)
71
100
  rubocop-performance (1.26.1)
72
101
  lint_roller (~> 1.1)
73
102
  rubocop (>= 1.75.0, < 2.0)
74
103
  rubocop-ast (>= 1.47.1, < 2.0)
75
- rubocop-rails (2.33.4)
104
+ rubocop-rails (2.35.0)
76
105
  activesupport (>= 4.2.0)
77
106
  lint_roller (~> 1.1)
78
107
  rack (>= 1.1)
@@ -84,26 +113,32 @@ GEM
84
113
  rubocop-rails (>= 2.30)
85
114
  ruby-progressbar (1.13.0)
86
115
  securerandom (0.4.1)
116
+ stringio (3.2.0)
117
+ tsort (0.2.0)
87
118
  tzinfo (2.0.6)
88
119
  concurrent-ruby (~> 1.0)
89
120
  unicode-display_width (3.2.0)
90
121
  unicode-emoji (~> 4.1)
91
- unicode-emoji (4.1.0)
92
- uri (1.0.4)
93
- vcr (6.3.1)
94
- base64
122
+ unicode-emoji (4.2.0)
123
+ uri (1.1.1)
124
+ webmock (3.26.2)
125
+ addressable (>= 2.8.0)
126
+ crack (>= 0.3.2)
127
+ hashdiff (>= 0.4.0, < 2.0.0)
95
128
 
96
129
  PLATFORMS
97
130
  ruby
98
131
 
99
132
  DEPENDENCIES
100
133
  activesupport (>= 4.2.0, < 8.0)
134
+ cgi
101
135
  dotenv
136
+ irb
102
137
  minitest (~> 5.0)
103
138
  rake (~> 12.0)
104
139
  rubocop-rails-omakase
105
140
  twitchrb!
106
- vcr
141
+ webmock
107
142
 
108
143
  BUNDLED WITH
109
- 2.5.17
144
+ 4.0.11