twitchrb 1.0.1 → 1.0.3
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/Gemfile.lock +3 -3
- data/README.md +20 -0
- data/lib/twitch/client.rb +8 -0
- data/lib/twitch/objects/chatter.rb +4 -0
- data/lib/twitch/resources/announcements.rb +1 -0
- data/lib/twitch/resources/charity_campaigns.rb +6 -2
- data/lib/twitch/resources/chatters.rb +15 -0
- data/lib/twitch/resources/shoutouts.rb +13 -0
- data/lib/twitch/version.rb +1 -1
- data/lib/twitch.rb +4 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60c3e4872fe539340033a16467e0091ff8d0dbc4bef5f0e9f3aa71f524883b80
|
4
|
+
data.tar.gz: 76df58744f36bea5b0e8884958bbd05ff91cfce41a072b3c46c9df26aec2a0ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 530d727b629c4c1a3c52f7839e27a69466d5af0653370b371ab33f03175665a8c8851b1058c87264011e1700dd6e7fd36eb9337b207714d332785f6c9e2d0285
|
7
|
+
data.tar.gz: 25a314a0961681b53d2fc94a2aff462bfcca32d7d2807aad3a034289ea65f3289c8dafccb2ccd9928380e9daa98ec648669b5ee1a0451c867b019102ba3d5e78
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
twitchrb (1.0.
|
4
|
+
twitchrb (1.0.3)
|
5
5
|
faraday (~> 2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
dotenv (2.7.6)
|
11
|
-
faraday (2.
|
11
|
+
faraday (2.7.4)
|
12
12
|
faraday-net_http (>= 2.0, < 3.1)
|
13
13
|
ruby2_keywords (>= 0.0.4)
|
14
|
-
faraday-net_http (3.0.
|
14
|
+
faraday-net_http (3.0.2)
|
15
15
|
minitest (5.15.0)
|
16
16
|
rake (12.3.3)
|
17
17
|
ruby2_keywords (0.0.5)
|
data/README.md
CHANGED
@@ -220,6 +220,17 @@ These require an application OAuth access token.
|
|
220
220
|
@client.announcements.create broadcaster_id: 123, moderator_id: 123, message: "test message", color: "purple"
|
221
221
|
```
|
222
222
|
|
223
|
+
## Create a Shoutout
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
# Creates a Shoutout for a broadcaster
|
227
|
+
# Requires moderator:manage:shoutouts
|
228
|
+
# From: the ID of the Broadcaster creating the Shoutout
|
229
|
+
# To: the ID of the Broadcaster the Shoutout will be for
|
230
|
+
# moderator_id can be either the currently authenticated moderator or the broadcaster
|
231
|
+
@client.shoutouts.create from: 123, to: 321, moderator_id: 123
|
232
|
+
```
|
233
|
+
|
223
234
|
## Moderators
|
224
235
|
|
225
236
|
```ruby
|
@@ -372,6 +383,15 @@ messages = [{msg_id: "abc1", msg_text: "is this allowed?"}, {msg_id: "abc2", msg
|
|
372
383
|
@client.charity_campaigns.list broadcaster_id: 123
|
373
384
|
```
|
374
385
|
|
386
|
+
## Chatters
|
387
|
+
|
388
|
+
```ruby
|
389
|
+
# Gets the list of users that are connected to the specified broadcaster’s chat session
|
390
|
+
# Required scope: moderator:read:chatters
|
391
|
+
# broadcaster_id must match the currently authenticated user
|
392
|
+
@client.chatters.list broadcaster_id: 123, moderator_id: 123
|
393
|
+
```
|
394
|
+
|
375
395
|
## Contributing
|
376
396
|
|
377
397
|
Bug reports and pull requests are welcome on GitHub at https://github.com/twitchrb/twitchrb.
|
data/lib/twitch/client.rb
CHANGED
@@ -141,6 +141,14 @@ module Twitch
|
|
141
141
|
CharityCampaignsResource.new(self)
|
142
142
|
end
|
143
143
|
|
144
|
+
def chatters
|
145
|
+
ChattersResource.new(self)
|
146
|
+
end
|
147
|
+
|
148
|
+
def shoutouts
|
149
|
+
ShoutoutsResource.new(self)
|
150
|
+
end
|
151
|
+
|
144
152
|
def connection
|
145
153
|
@connection ||= Faraday.new(BASE_URL) do |conn|
|
146
154
|
conn.request :authorization, :Bearer, access_token
|
@@ -2,6 +2,7 @@ module Twitch
|
|
2
2
|
class AnnouncementsResource < Resource
|
3
3
|
|
4
4
|
# Moderator ID must match the user in the OAuth token
|
5
|
+
# Required scope: moderator:manage:announcements
|
5
6
|
def create(broadcaster_id:, moderator_id:, message:, color: nil)
|
6
7
|
attrs = {message: message, color: color}
|
7
8
|
|
@@ -4,8 +4,12 @@ module Twitch
|
|
4
4
|
# Required scope: channel:read:charity
|
5
5
|
# Broadcaster ID must match the user in the OAuth token
|
6
6
|
def list(broadcaster_id:)
|
7
|
-
response = get_request("charity/campaigns?broadcaster_id=#{broadcaster_id}")
|
8
|
-
|
7
|
+
response = get_request("charity/campaigns?broadcaster_id=#{broadcaster_id}")
|
8
|
+
if response.body.dig("data")[0]
|
9
|
+
CharityCampaign.new(response.body.dig("data")[0])
|
10
|
+
else
|
11
|
+
nil
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Twitch
|
2
|
+
class ChattersResource < Resource
|
3
|
+
|
4
|
+
# Gets a list of users that are connected to the specified broadcaster's chat session
|
5
|
+
# Moderator ID must match the user in the OAuth token
|
6
|
+
# Required scope: moderator:read:chatters
|
7
|
+
def list(broadcaster_id:, moderator_id:, **params)
|
8
|
+
attrs = {broadcaster_id: broadcaster_id, moderator_id: moderator_id}
|
9
|
+
response = get_request("chat/chatters", params: attrs.merge(params))
|
10
|
+
|
11
|
+
Collection.from_response(response, type: Chatter)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Twitch
|
2
|
+
class ShoutoutsResource < Resource
|
3
|
+
|
4
|
+
# Moderator ID must match the user in the OAuth token
|
5
|
+
# From: the ID of the Broadcaster creating the Shoutout
|
6
|
+
# To: the ID of the Broadcaster the Shoutout will be for
|
7
|
+
# Required scope: moderator:manage:shoutouts
|
8
|
+
def create(from:, to:, moderator_id:)
|
9
|
+
post_request("chat/shoutouts?from_broadcaster_id=#{from}&to_broadcaster_id=#{to}&moderator_id=#{moderator_id}", body: nil)
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
data/lib/twitch/version.rb
CHANGED
data/lib/twitch.rb
CHANGED
@@ -43,6 +43,8 @@ module Twitch
|
|
43
43
|
autoload :AutomodResource, "twitch/resources/automod"
|
44
44
|
autoload :BlockedTermsResource, "twitch/resources/blocked_terms"
|
45
45
|
autoload :CharityCampaignsResource, "twitch/resources/charity_campaigns"
|
46
|
+
autoload :ChattersResource, "twitch/resources/chatters"
|
47
|
+
autoload :ShoutoutsResource, "twitch/resources/shoutouts"
|
46
48
|
|
47
49
|
|
48
50
|
autoload :User, "twitch/objects/user"
|
@@ -81,6 +83,7 @@ module Twitch
|
|
81
83
|
autoload :AutomodStatus, "twitch/objects/automod_status"
|
82
84
|
autoload :AutomodSetting, "twitch/objects/automod_setting"
|
83
85
|
autoload :BlockedTerm, "twitch/objects/blocked_term"
|
84
|
-
autoload :
|
86
|
+
autoload :CharityCampaign, "twitch/objects/charity_campaign"
|
87
|
+
autoload :Chatter, "twitch/objects/chatter"
|
85
88
|
|
86
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitchrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/twitch/objects/channel.rb
|
58
58
|
- lib/twitch/objects/channel_editor.rb
|
59
59
|
- lib/twitch/objects/charity_campaign.rb
|
60
|
+
- lib/twitch/objects/chatter.rb
|
60
61
|
- lib/twitch/objects/clip.rb
|
61
62
|
- lib/twitch/objects/custom_reward.rb
|
62
63
|
- lib/twitch/objects/custom_reward_redemption.rb
|
@@ -93,6 +94,7 @@ files:
|
|
93
94
|
- lib/twitch/resources/channels.rb
|
94
95
|
- lib/twitch/resources/charity_campaigns.rb
|
95
96
|
- lib/twitch/resources/chat_messages.rb
|
97
|
+
- lib/twitch/resources/chatters.rb
|
96
98
|
- lib/twitch/resources/clips.rb
|
97
99
|
- lib/twitch/resources/custom_reward_redemptions.rb
|
98
100
|
- lib/twitch/resources/custom_rewards.rb
|
@@ -107,6 +109,7 @@ files:
|
|
107
109
|
- lib/twitch/resources/predictions.rb
|
108
110
|
- lib/twitch/resources/raids.rb
|
109
111
|
- lib/twitch/resources/search.rb
|
112
|
+
- lib/twitch/resources/shoutouts.rb
|
110
113
|
- lib/twitch/resources/stream_markers.rb
|
111
114
|
- lib/twitch/resources/stream_schedule.rb
|
112
115
|
- lib/twitch/resources/streams.rb
|
@@ -140,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
143
|
- !ruby/object:Gem::Version
|
141
144
|
version: '0'
|
142
145
|
requirements: []
|
143
|
-
rubygems_version: 3.3
|
146
|
+
rubygems_version: 3.4.3
|
144
147
|
signing_key:
|
145
148
|
specification_version: 4
|
146
149
|
summary: A Ruby library for interacting with the Twitch Helix API
|