twitchrb 1.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8ee21feb703fb97c6fe0d5a3dd7da8072f70d1a959fc84f5e502aaa2ec45d68
4
- data.tar.gz: 75723ca8b4285ac950ebe0e722238b72c42b3be9d0e7214d57afbaf613586b3c
3
+ metadata.gz: 28141d97db1c65bc42dda669d521812ebb2e1d7fd427831fa1d8a9b6eadde7cc
4
+ data.tar.gz: a9057eef186fb46f1f9d7910c724f6408b0044259171c021609d421887777d18
5
5
  SHA512:
6
- metadata.gz: 28c24c46f1b678e8db7e56ff24a5e80f25b3c0a491a61373b57d98ccf9081ca2157adf91f8767c01aa23bcfbfd04559188ef589d5055aee38f6aef945e8ef21e
7
- data.tar.gz: e6253a4bc7c31232fff212dbfddca8b86d2205c4be7bffc9da9beb5e233016a9c8bb97bfcd4147a6833521e09b01cfa2be3d3c661ceb4a33e886cbb48440c9d5
6
+ metadata.gz: 9574825b2d2ea5e91230c2580fbd4bdc08c18b5bd7d5de1a19957f6ac199618b9cfc78ed8232cae390f03ede8249b2a06784afecb60d62cef0e335830ea9f2f7
7
+ data.tar.gz: 6d877434646d740a291153a554f5af69450e9e84f042b277c65d5a5f0617caa459160ed859d4fb2ca18abd275911f8d2656b9f2b95a66b1712890f46e4d87bad
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitchrb (1.0.1)
4
+ twitchrb (1.0.2)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
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
@@ -0,0 +1,4 @@
1
+ module Twitch
2
+ class Chatter < Object
3
+ end
4
+ end
@@ -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
- Collection.from_response(response, type: CharityCampaign)
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
@@ -1,3 +1,3 @@
1
1
  module Twitch
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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 :CHarityCampaign, "twitch/objects/charity_campaign"
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.1
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-08-26 00:00:00.000000000 Z
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