twitchrb 1.0.0 → 1.0.2
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/FUNDING.yml +1 -2
- data/Gemfile.lock +5 -5
- data/README.md +18 -0
- data/lib/twitch/client.rb +8 -0
- data/lib/twitch/objects/charity_campaign.rb +4 -0
- data/lib/twitch/objects/chatter.rb +4 -0
- data/lib/twitch/resources/charity_campaigns.rb +16 -0
- data/lib/twitch/resources/chatters.rb +15 -0
- data/lib/twitch/version.rb +1 -1
- data/lib/twitch.rb +4 -0
- metadata +10 -6
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/.github/FUNDING.yml
CHANGED
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.2)
|
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.
|
12
|
-
faraday-net_http (
|
11
|
+
faraday (2.5.2)
|
12
|
+
faraday-net_http (>= 2.0, < 3.1)
|
13
13
|
ruby2_keywords (>= 0.0.4)
|
14
|
-
faraday-net_http (
|
14
|
+
faraday-net_http (3.0.0)
|
15
15
|
minitest (5.15.0)
|
16
16
|
rake (12.3.3)
|
17
17
|
ruby2_keywords (0.0.5)
|
@@ -26,4 +26,4 @@ DEPENDENCIES
|
|
26
26
|
twitchrb!
|
27
27
|
|
28
28
|
BUNDLED WITH
|
29
|
-
2.3.
|
29
|
+
2.3.21
|
data/README.md
CHANGED
@@ -363,6 +363,24 @@ messages = [{msg_id: "abc1", msg_text: "is this allowed?"}, {msg_id: "abc2", msg
|
|
363
363
|
@client.blocked_terms.delete broadcaster_id: 123, moderator_id: 321, id: "abc12-12abc"
|
364
364
|
```
|
365
365
|
|
366
|
+
## Charity Campaigns
|
367
|
+
|
368
|
+
```ruby
|
369
|
+
# Gets information about the charity campaign that a broadcaster is running
|
370
|
+
# Required scope: channel:read:charity
|
371
|
+
# broadcaster_id must match the currently authenticated user
|
372
|
+
@client.charity_campaigns.list broadcaster_id: 123
|
373
|
+
```
|
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
|
+
|
366
384
|
## Contributing
|
367
385
|
|
368
386
|
Bug reports and pull requests are welcome on GitHub at https://github.com/twitchrb/twitchrb.
|
data/lib/twitch/client.rb
CHANGED
@@ -137,6 +137,14 @@ module Twitch
|
|
137
137
|
BlockedTermsResource.new(self)
|
138
138
|
end
|
139
139
|
|
140
|
+
def charity_campaigns
|
141
|
+
CharityCampaignsResource.new(self)
|
142
|
+
end
|
143
|
+
|
144
|
+
def chatters
|
145
|
+
ChattersResource.new(self)
|
146
|
+
end
|
147
|
+
|
140
148
|
def connection
|
141
149
|
@connection ||= Faraday.new(BASE_URL) do |conn|
|
142
150
|
conn.request :authorization, :Bearer, access_token
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Twitch
|
2
|
+
class CharityCampaignsResource < Resource
|
3
|
+
|
4
|
+
# Required scope: channel:read:charity
|
5
|
+
# Broadcaster ID must match the user in the OAuth token
|
6
|
+
def list(broadcaster_id:)
|
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
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
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
@@ -42,6 +42,8 @@ module Twitch
|
|
42
42
|
autoload :WhispersResource, "twitch/resources/whispers"
|
43
43
|
autoload :AutomodResource, "twitch/resources/automod"
|
44
44
|
autoload :BlockedTermsResource, "twitch/resources/blocked_terms"
|
45
|
+
autoload :CharityCampaignsResource, "twitch/resources/charity_campaigns"
|
46
|
+
autoload :ChattersResource, "twitch/resources/chatters"
|
45
47
|
|
46
48
|
|
47
49
|
autoload :User, "twitch/objects/user"
|
@@ -80,5 +82,7 @@ module Twitch
|
|
80
82
|
autoload :AutomodStatus, "twitch/objects/automod_status"
|
81
83
|
autoload :AutomodSetting, "twitch/objects/automod_setting"
|
82
84
|
autoload :BlockedTerm, "twitch/objects/blocked_term"
|
85
|
+
autoload :CharityCampaign, "twitch/objects/charity_campaign"
|
86
|
+
autoload :Chatter, "twitch/objects/chatter"
|
83
87
|
|
84
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
|
-
autorequire:
|
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
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- dean@deanpcmad.com
|
30
30
|
executables: []
|
@@ -56,6 +56,8 @@ files:
|
|
56
56
|
- lib/twitch/objects/blocked_user.rb
|
57
57
|
- lib/twitch/objects/channel.rb
|
58
58
|
- lib/twitch/objects/channel_editor.rb
|
59
|
+
- lib/twitch/objects/charity_campaign.rb
|
60
|
+
- lib/twitch/objects/chatter.rb
|
59
61
|
- lib/twitch/objects/clip.rb
|
60
62
|
- lib/twitch/objects/custom_reward.rb
|
61
63
|
- lib/twitch/objects/custom_reward_redemption.rb
|
@@ -90,7 +92,9 @@ files:
|
|
90
92
|
- lib/twitch/resources/banned_users.rb
|
91
93
|
- lib/twitch/resources/blocked_terms.rb
|
92
94
|
- lib/twitch/resources/channels.rb
|
95
|
+
- lib/twitch/resources/charity_campaigns.rb
|
93
96
|
- lib/twitch/resources/chat_messages.rb
|
97
|
+
- lib/twitch/resources/chatters.rb
|
94
98
|
- lib/twitch/resources/clips.rb
|
95
99
|
- lib/twitch/resources/custom_reward_redemptions.rb
|
96
100
|
- lib/twitch/resources/custom_rewards.rb
|
@@ -123,7 +127,7 @@ licenses:
|
|
123
127
|
metadata:
|
124
128
|
homepage_uri: https://deanpcmad.com
|
125
129
|
source_code_uri: https://github.com/deanpcmad/twitchrb
|
126
|
-
post_install_message:
|
130
|
+
post_install_message:
|
127
131
|
rdoc_options: []
|
128
132
|
require_paths:
|
129
133
|
- lib
|
@@ -139,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
143
|
version: '0'
|
140
144
|
requirements: []
|
141
145
|
rubygems_version: 3.3.7
|
142
|
-
signing_key:
|
146
|
+
signing_key:
|
143
147
|
specification_version: 4
|
144
148
|
summary: A Ruby library for interacting with the Twitch Helix API
|
145
149
|
test_files: []
|