twitchrb 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +9 -0
- data/lib/twitch/client.rb +4 -0
- data/lib/twitch/objects/chatter.rb +4 -0
- data/lib/twitch/resources/charity_campaigns.rb +6 -2
- data/lib/twitch/resources/chatters.rb +15 -0
- data/lib/twitch/version.rb +1 -1
- data/lib/twitch.rb +3 -1
- 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: 28141d97db1c65bc42dda669d521812ebb2e1d7fd427831fa1d8a9b6eadde7cc
|
4
|
+
data.tar.gz: a9057eef186fb46f1f9d7910c724f6408b0044259171c021609d421887777d18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9574825b2d2ea5e91230c2580fbd4bdc08c18b5bd7d5de1a19957f6ac199618b9cfc78ed8232cae390f03ede8249b2a06784afecb60d62cef0e335830ea9f2f7
|
7
|
+
data.tar.gz: 6d877434646d740a291153a554f5af69450e9e84f042b277c65d5a5f0617caa459160ed859d4fb2ca18abd275911f8d2656b9f2b95a66b1712890f46e4d87bad
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -372,6 +372,15 @@ messages = [{msg_id: "abc1", msg_text: "is this allowed?"}, {msg_id: "abc2", msg
|
|
372
372
|
@client.charity_campaigns.list broadcaster_id: 123
|
373
373
|
```
|
374
374
|
|
375
|
+
## Chatters
|
376
|
+
|
377
|
+
```ruby
|
378
|
+
# Gets the list of users that are connected to the specified broadcaster’s chat session
|
379
|
+
# Required scope: moderator:read:chatters
|
380
|
+
# broadcaster_id must match the currently authenticated user
|
381
|
+
@client.chatters.list broadcaster_id: 123, moderator_id: 123
|
382
|
+
```
|
383
|
+
|
375
384
|
## Contributing
|
376
385
|
|
377
386
|
Bug reports and pull requests are welcome on GitHub at https://github.com/twitchrb/twitchrb.
|
data/lib/twitch/client.rb
CHANGED
@@ -141,6 +141,10 @@ module Twitch
|
|
141
141
|
CharityCampaignsResource.new(self)
|
142
142
|
end
|
143
143
|
|
144
|
+
def chatters
|
145
|
+
ChattersResource.new(self)
|
146
|
+
end
|
147
|
+
|
144
148
|
def connection
|
145
149
|
@connection ||= Faraday.new(BASE_URL) do |conn|
|
146
150
|
conn.request :authorization, :Bearer, access_token
|
@@ -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
|
data/lib/twitch/version.rb
CHANGED
data/lib/twitch.rb
CHANGED
@@ -43,6 +43,7 @@ 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"
|
46
47
|
|
47
48
|
|
48
49
|
autoload :User, "twitch/objects/user"
|
@@ -81,6 +82,7 @@ module Twitch
|
|
81
82
|
autoload :AutomodStatus, "twitch/objects/automod_status"
|
82
83
|
autoload :AutomodSetting, "twitch/objects/automod_setting"
|
83
84
|
autoload :BlockedTerm, "twitch/objects/blocked_term"
|
84
|
-
autoload :
|
85
|
+
autoload :CharityCampaign, "twitch/objects/charity_campaign"
|
86
|
+
autoload :Chatter, "twitch/objects/chatter"
|
85
87
|
|
86
88
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-02 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
|