twitchrb 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28141d97db1c65bc42dda669d521812ebb2e1d7fd427831fa1d8a9b6eadde7cc
4
- data.tar.gz: a9057eef186fb46f1f9d7910c724f6408b0044259171c021609d421887777d18
3
+ metadata.gz: 1df6403caadd7a32c52d8c3c17f9cbf4347cc3b830d5d02bdb2328b82770271d
4
+ data.tar.gz: ddefb273c7f21aa359da843dd50e9c1caedb6ace5c3a65bbead6809e50830149
5
5
  SHA512:
6
- metadata.gz: 9574825b2d2ea5e91230c2580fbd4bdc08c18b5bd7d5de1a19957f6ac199618b9cfc78ed8232cae390f03ede8249b2a06784afecb60d62cef0e335830ea9f2f7
7
- data.tar.gz: 6d877434646d740a291153a554f5af69450e9e84f042b277c65d5a5f0617caa459160ed859d4fb2ca18abd275911f8d2656b9f2b95a66b1712890f46e4d87bad
6
+ metadata.gz: e8e9852558b0b8888ba5a805bea1fa48d02c80680385f48a763da6800780f3ebf4bcc2a160e30cbe1025c83a20b87d957f358a4e930394c3ab27a40a1ce8a30e
7
+ data.tar.gz: 236dc69a027f34684c88bf527a7f0dd2a77bad46699b2e7cfbe25512014bd009e4fe4a0181b3874a6c141135d21118e12f0dfbf16d030491349829a84a726b14
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitchrb (1.0.2)
4
+ twitchrb (1.0.4)
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.5.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.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
data/lib/twitch/client.rb CHANGED
@@ -145,10 +145,19 @@ module Twitch
145
145
  ChattersResource.new(self)
146
146
  end
147
147
 
148
+ def shoutouts
149
+ ShoutoutsResource.new(self)
150
+ end
151
+
148
152
  def connection
149
153
  @connection ||= Faraday.new(BASE_URL) do |conn|
150
154
  conn.request :authorization, :Bearer, access_token
151
- conn.headers = { "Client-ID": client_id }
155
+
156
+ conn.headers = {
157
+ "User-Agent" => "twitchrb/v#{VERSION} (github.com/deanpcmad/twitchrb)",
158
+ "Client-ID": client_id
159
+ }
160
+
152
161
  conn.request :json
153
162
 
154
163
  conn.response :json, content_type: "application/json"
@@ -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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Twitch
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.4"
3
3
  end
data/lib/twitch.rb CHANGED
@@ -44,6 +44,7 @@ module Twitch
44
44
  autoload :BlockedTermsResource, "twitch/resources/blocked_terms"
45
45
  autoload :CharityCampaignsResource, "twitch/resources/charity_campaigns"
46
46
  autoload :ChattersResource, "twitch/resources/chatters"
47
+ autoload :ShoutoutsResource, "twitch/resources/shoutouts"
47
48
 
48
49
 
49
50
  autoload :User, "twitch/objects/user"
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.2
4
+ version: 1.0.4
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-10-02 00:00:00.000000000 Z
11
+ date: 2023-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -109,6 +109,7 @@ files:
109
109
  - lib/twitch/resources/predictions.rb
110
110
  - lib/twitch/resources/raids.rb
111
111
  - lib/twitch/resources/search.rb
112
+ - lib/twitch/resources/shoutouts.rb
112
113
  - lib/twitch/resources/stream_markers.rb
113
114
  - lib/twitch/resources/stream_schedule.rb
114
115
  - lib/twitch/resources/streams.rb
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
145
- rubygems_version: 3.3.7
146
+ rubygems_version: 3.4.5
146
147
  signing_key:
147
148
  specification_version: 4
148
149
  summary: A Ruby library for interacting with the Twitch Helix API