twitchrb 1.6.0 → 1.8.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/.github/workflows/ci.yml +2 -2
- data/Gemfile.lock +15 -15
- data/README.md +13 -0
- data/lib/twitch/objects/stream_key.rb +4 -0
- data/lib/twitch/objects/user_authorization.rb +4 -0
- data/lib/twitch/resources/channels.rb +5 -0
- data/lib/twitch/resources/users.rb +12 -0
- data/lib/twitch/version.rb +1 -1
- data/lib/twitch.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f92c10fcfb6dba2f494d6bd5e0c24bb8cc89662a8dd577d4b8478e744f0f0fa
|
|
4
|
+
data.tar.gz: 32082cfe85dfb4fc7ded29a37b80dc25ce68ccb47481af2957c6a0a990a1c09b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b021607c7e10827384d6d6461b3ba8b9d3f6459996efca1cc276a8e304f9d9ce9c16371e4f6d0a6b136f5ade2cd856d730e38f5f1df94a9d1805f7cf6f1570d
|
|
7
|
+
data.tar.gz: 94e26f89f370b871527b4c76f4aeda72ac77093a5012801efc9cd25695d05e5e683f8e3bbcef9342f0747f6e9595904f9060573e5260de017f8fb8806f9cc13d
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
steps:
|
|
13
13
|
- name: Checkout code
|
|
14
|
-
uses: actions/checkout@
|
|
14
|
+
uses: actions/checkout@v6
|
|
15
15
|
- name: Set up Ruby
|
|
16
16
|
uses: ruby/setup-ruby@v1
|
|
17
17
|
with:
|
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
- '3.3'
|
|
32
32
|
- '3.4'
|
|
33
33
|
steps:
|
|
34
|
-
- uses: actions/checkout@
|
|
34
|
+
- uses: actions/checkout@v6
|
|
35
35
|
- uses: ruby/setup-ruby@v1
|
|
36
36
|
with:
|
|
37
37
|
ruby-version: ${{ matrix.ruby_version }}
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
twitchrb (1.
|
|
4
|
+
twitchrb (1.8.0)
|
|
5
5
|
faraday (~> 2.11)
|
|
6
6
|
ostruct (~> 0.6.0)
|
|
7
7
|
|
|
@@ -23,12 +23,12 @@ GEM
|
|
|
23
23
|
ast (2.4.3)
|
|
24
24
|
base64 (0.3.0)
|
|
25
25
|
benchmark (0.4.1)
|
|
26
|
-
bigdecimal (3.
|
|
26
|
+
bigdecimal (3.3.1)
|
|
27
27
|
concurrent-ruby (1.3.5)
|
|
28
28
|
connection_pool (2.5.4)
|
|
29
29
|
dotenv (3.1.8)
|
|
30
30
|
drb (2.2.3)
|
|
31
|
-
faraday (2.
|
|
31
|
+
faraday (2.14.0)
|
|
32
32
|
faraday-net_http (>= 2.0, < 3.5)
|
|
33
33
|
json
|
|
34
34
|
logger
|
|
@@ -36,11 +36,11 @@ GEM
|
|
|
36
36
|
net-http (>= 0.5.0)
|
|
37
37
|
i18n (1.14.7)
|
|
38
38
|
concurrent-ruby (~> 1.0)
|
|
39
|
-
json (2.
|
|
39
|
+
json (2.15.1)
|
|
40
40
|
language_server-protocol (3.17.0.5)
|
|
41
41
|
lint_roller (1.1.0)
|
|
42
42
|
logger (1.7.0)
|
|
43
|
-
minitest (5.
|
|
43
|
+
minitest (5.26.0)
|
|
44
44
|
net-http (0.6.0)
|
|
45
45
|
uri
|
|
46
46
|
ostruct (0.6.3)
|
|
@@ -48,13 +48,13 @@ GEM
|
|
|
48
48
|
parser (3.3.9.0)
|
|
49
49
|
ast (~> 2.4.1)
|
|
50
50
|
racc
|
|
51
|
-
prism (1.
|
|
51
|
+
prism (1.6.0)
|
|
52
52
|
racc (1.8.1)
|
|
53
|
-
rack (3.2.
|
|
53
|
+
rack (3.2.3)
|
|
54
54
|
rainbow (3.1.1)
|
|
55
55
|
rake (12.3.3)
|
|
56
|
-
regexp_parser (2.11.
|
|
57
|
-
rubocop (1.
|
|
56
|
+
regexp_parser (2.11.3)
|
|
57
|
+
rubocop (1.81.1)
|
|
58
58
|
json (~> 2.3)
|
|
59
59
|
language_server-protocol (~> 3.17.0.2)
|
|
60
60
|
lint_roller (~> 1.1.0)
|
|
@@ -62,17 +62,17 @@ GEM
|
|
|
62
62
|
parser (>= 3.3.0.2)
|
|
63
63
|
rainbow (>= 2.2.2, < 4.0)
|
|
64
64
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
65
|
-
rubocop-ast (>= 1.
|
|
65
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
66
66
|
ruby-progressbar (~> 1.7)
|
|
67
67
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
68
|
-
rubocop-ast (1.
|
|
68
|
+
rubocop-ast (1.47.1)
|
|
69
69
|
parser (>= 3.3.7.2)
|
|
70
70
|
prism (~> 1.4)
|
|
71
|
-
rubocop-performance (1.26.
|
|
71
|
+
rubocop-performance (1.26.1)
|
|
72
72
|
lint_roller (~> 1.1)
|
|
73
73
|
rubocop (>= 1.75.0, < 2.0)
|
|
74
|
-
rubocop-ast (>= 1.
|
|
75
|
-
rubocop-rails (2.33.
|
|
74
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
75
|
+
rubocop-rails (2.33.4)
|
|
76
76
|
activesupport (>= 4.2.0)
|
|
77
77
|
lint_roller (~> 1.1)
|
|
78
78
|
rack (>= 1.1)
|
|
@@ -89,7 +89,7 @@ GEM
|
|
|
89
89
|
unicode-display_width (3.2.0)
|
|
90
90
|
unicode-emoji (~> 4.1)
|
|
91
91
|
unicode-emoji (4.1.0)
|
|
92
|
-
uri (1.0.
|
|
92
|
+
uri (1.0.4)
|
|
93
93
|
vcr (6.3.1)
|
|
94
94
|
base64
|
|
95
95
|
|
data/README.md
CHANGED
|
@@ -149,6 +149,13 @@ This library includes the ability to create, refresh and revoke OAuth tokens.
|
|
|
149
149
|
@client.users.emotes(user_id: 123)
|
|
150
150
|
@client.users.emotes(user_id: 123, broadcaster_id: 321)
|
|
151
151
|
@client.users.emotes(user_id: 123, after: "abc123")
|
|
152
|
+
|
|
153
|
+
# Gets the authorization scopes that the specified user(s) have granted the application. Takes a single User ID or multiple as an array.
|
|
154
|
+
# Requires an App Access Token
|
|
155
|
+
# Returns a collection of Twitch::UserAuthorization's
|
|
156
|
+
# #<Twitch::UserAuthorization user_id="72938118", user_name="deanpcmad", user_login="deanpcmad", scopes=["user:read:email"], has_authorized=true>
|
|
157
|
+
@client.users.authorization(id: 123)
|
|
158
|
+
@client.users.authorization(ids: [123, 321])
|
|
152
159
|
```
|
|
153
160
|
|
|
154
161
|
### Channels
|
|
@@ -183,6 +190,12 @@ attributes = {title: "My new title"}
|
|
|
183
190
|
|
|
184
191
|
# Retrieves editors for a channel
|
|
185
192
|
@client.channels.editors(broadcaster_id: 141981764)
|
|
193
|
+
|
|
194
|
+
# Retrieve the Stream Key for a channel
|
|
195
|
+
# broadcaster_id must match the currently authenticated user
|
|
196
|
+
# Required scope: channel:read:stream_key
|
|
197
|
+
@client.channels.stream_key(broadcaster_id: 123123)
|
|
198
|
+
=> #<Twitch::StreamKey stream_key="live_abc123">
|
|
186
199
|
```
|
|
187
200
|
|
|
188
201
|
### Videos
|
|
@@ -45,5 +45,10 @@ module Twitch
|
|
|
45
45
|
response = get_request("channels/editors?broadcaster_id=#{broadcaster_id}")
|
|
46
46
|
Collection.from_response(response, type: ChannelEditor)
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
def stream_key(broadcaster_id:)
|
|
50
|
+
response = get_request("streams/key?broadcaster_id=#{broadcaster_id}")
|
|
51
|
+
StreamKey.new(response.body.dig("data")[0])
|
|
52
|
+
end
|
|
48
53
|
end
|
|
49
54
|
end
|
|
@@ -93,5 +93,17 @@ module Twitch
|
|
|
93
93
|
response = get_request("chat/emotes/user", params: attrs.merge(params))
|
|
94
94
|
Collection.from_response(response, type: Emote)
|
|
95
95
|
end
|
|
96
|
+
|
|
97
|
+
def authorization(id: nil, ids: nil)
|
|
98
|
+
raise "Either id or ids is required" unless !id.nil? || !ids.nil?
|
|
99
|
+
|
|
100
|
+
if id
|
|
101
|
+
response = get_request("authorization/users", params: { user_id: id })
|
|
102
|
+
elsif ids
|
|
103
|
+
response = get_request("authorization/users", params: { user_id: ids })
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
Collection.from_response(response, type: UserAuthorization)
|
|
107
|
+
end
|
|
96
108
|
end
|
|
97
109
|
end
|
data/lib/twitch/version.rb
CHANGED
data/lib/twitch.rb
CHANGED
|
@@ -59,6 +59,7 @@ module Twitch
|
|
|
59
59
|
autoload :User, "twitch/objects/user"
|
|
60
60
|
autoload :FollowedUser, "twitch/objects/followed_user"
|
|
61
61
|
autoload :BlockedUser, "twitch/objects/blocked_user"
|
|
62
|
+
autoload :StreamKey, "twitch/objects/stream_key"
|
|
62
63
|
|
|
63
64
|
autoload :Channel, "twitch/objects/channel"
|
|
64
65
|
autoload :ChannelEditor, "twitch/objects/channel_editor"
|
|
@@ -99,4 +100,5 @@ module Twitch
|
|
|
99
100
|
autoload :ChatMessage, "twitch/objects/chat_message"
|
|
100
101
|
autoload :UnbanRequest, "twitch/objects/unban_request"
|
|
101
102
|
autoload :Warning, "twitch/objects/warning"
|
|
103
|
+
autoload :UserAuthorization, "twitch/objects/user_authorization"
|
|
102
104
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: twitchrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dean Perry
|
|
@@ -94,6 +94,7 @@ files:
|
|
|
94
94
|
- lib/twitch/objects/raid.rb
|
|
95
95
|
- lib/twitch/objects/search_result.rb
|
|
96
96
|
- lib/twitch/objects/stream.rb
|
|
97
|
+
- lib/twitch/objects/stream_key.rb
|
|
97
98
|
- lib/twitch/objects/stream_marker.rb
|
|
98
99
|
- lib/twitch/objects/stream_schedule.rb
|
|
99
100
|
- lib/twitch/objects/subscription.rb
|
|
@@ -101,6 +102,7 @@ files:
|
|
|
101
102
|
- lib/twitch/objects/tag.rb
|
|
102
103
|
- lib/twitch/objects/unban_request.rb
|
|
103
104
|
- lib/twitch/objects/user.rb
|
|
105
|
+
- lib/twitch/objects/user_authorization.rb
|
|
104
106
|
- lib/twitch/objects/user_color.rb
|
|
105
107
|
- lib/twitch/objects/video.rb
|
|
106
108
|
- lib/twitch/objects/vip.rb
|
|
@@ -167,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
167
169
|
- !ruby/object:Gem::Version
|
|
168
170
|
version: '0'
|
|
169
171
|
requirements: []
|
|
170
|
-
rubygems_version: 3.6.
|
|
172
|
+
rubygems_version: 3.6.9
|
|
171
173
|
specification_version: 4
|
|
172
174
|
summary: A Ruby library for interacting with the Twitch Helix API
|
|
173
175
|
test_files: []
|