twitchrb 1.0.4 → 1.1.0

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: 1df6403caadd7a32c52d8c3c17f9cbf4347cc3b830d5d02bdb2328b82770271d
4
- data.tar.gz: ddefb273c7f21aa359da843dd50e9c1caedb6ace5c3a65bbead6809e50830149
3
+ metadata.gz: 828f7c0543e796014befead46a15222e41a9c775ea7baa4d4cd346e674777dd8
4
+ data.tar.gz: 2a9a88da2bf52a0362c24d38201806545d0483a36217f14ed30f120c89664f88
5
5
  SHA512:
6
- metadata.gz: e8e9852558b0b8888ba5a805bea1fa48d02c80680385f48a763da6800780f3ebf4bcc2a160e30cbe1025c83a20b87d957f358a4e930394c3ab27a40a1ce8a30e
7
- data.tar.gz: 236dc69a027f34684c88bf527a7f0dd2a77bad46699b2e7cfbe25512014bd009e4fe4a0181b3874a6c141135d21118e12f0dfbf16d030491349829a84a726b14
6
+ metadata.gz: 3a0695cf7d5600a1c171f43ff1fae6ba39c2242ddd5092d7e04c1c234c03a9ca00f9f2c51036a685a6d08356bc5fb5f9cdabb2e150ecd9854962074f69df75a1
7
+ data.tar.gz: be4161b6cdc5f83c6169fc49733146c1c3fc210b43be9b8823fbd0f8e4b97dc42c1d722b5d8b01bf98623498b367318779f94f790b9cfc2c99cb125697310889
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitchrb (1.0.4)
4
+ twitchrb (1.1.0)
5
5
  faraday (~> 2.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -35,6 +35,7 @@ An access token is required because the Helix API requires authentication.
35
35
  # Required scope: user:edit
36
36
  @client.users.update(description: "New Description")
37
37
 
38
+ # Deprecated. Please look at using channels.followed or channels.followers
38
39
  # Shows users who follow or are following a user ID
39
40
  @client.users.follows(from_id: 141981764)
40
41
  @client.users.follows(to_id: 141981764)
@@ -75,6 +76,16 @@ An access token is required because the Helix API requires authentication.
75
76
  # Retrieve a channel by their ID
76
77
  @client.channels.get(broadcaster_id: 141981764)
77
78
 
79
+ # Retrieve a list of broadcasters a specified user follows
80
+ # user_id must match the currently authenticated user
81
+ # Required scope: user:read:follows
82
+ @client.channels.followed user_id: 123123
83
+
84
+ # Retrieve a list of users that follow a specified broadcaster
85
+ # broadcaster_id must match the currently authenticated user
86
+ # Required scope: moderator:read:followers
87
+ @client.channels.followers broadcaster_id: 123123
88
+
78
89
  # Retrieve the number of Followers a broadcaster has
79
90
  @client.channels.follows_count(broadcaster_id: 141981764)
80
91
 
@@ -5,9 +5,25 @@ module Twitch
5
5
  Channel.new get_request("channels?broadcaster_id=#{broadcaster_id}").body.dig("data")[0]
6
6
  end
7
7
 
8
+ # Retrieve a list of broadcasters a specified user follows
9
+ # Required scope: user:read:follows
10
+ # user_id must match the authenticated user
11
+ def followed(user_id:, **params)
12
+ response = get_request("channels/followed", params: params.merge(user_id: user_id))
13
+ Collection.from_response(response, type: User)
14
+ end
15
+
16
+ # Retrieve a list of users that follow a specified broadcaster
17
+ # Required scope: moderator:read:followers
18
+ # broadcaster_id must match the authenticated user
19
+ def followers(broadcaster_id:, **params)
20
+ response = get_request("channels/followers", params: params.merge(broadcaster_id: broadcaster_id))
21
+ Collection.from_response(response, type: User)
22
+ end
23
+
8
24
  # Grabs the number of Followers a broadcaster has
9
25
  def follows_count(broadcaster_id:)
10
- response = get_request("users/follows", params: {to_id: broadcaster_id})
26
+ response = get_request("channels/followers", params: {broadcaster_id: broadcaster_id})
11
27
 
12
28
  FollowCount.new(count: response.body["total"])
13
29
  end
@@ -35,7 +35,10 @@ module Twitch
35
35
  put_request("chat/color?user_id=#{user_id}&color=#{color}", body: {})
36
36
  end
37
37
 
38
+ # Deprecated.
38
39
  def follows(**params)
40
+ warn "`users.follows` is deprecated. Use `channels.followers` or `channels.following` instead."
41
+
39
42
  raise "from_id or to_id is required" unless !params[:from_id].nil? || !params[:to_id].nil?
40
43
 
41
44
  response = get_request("users/follows", params: params)
@@ -60,6 +63,8 @@ module Twitch
60
63
 
61
64
  # A quick method to see if a user is following a channel
62
65
  def following?(from_id:, to_id:)
66
+ warn "`users.following?` is deprecated. Use `channels.followers` or `channels.following` instead."
67
+
63
68
  response = get_request("users/follows", params: {from_id: from_id, to_id: to_id})
64
69
 
65
70
  if response.body["data"].empty?
@@ -1,3 +1,3 @@
1
1
  module Twitch
2
- VERSION = "1.0.4"
2
+ VERSION = "1.1.0"
3
3
  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
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dean Perry
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-22 00:00:00.000000000 Z
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.4.5
146
+ rubygems_version: 3.4.6
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: A Ruby library for interacting with the Twitch Helix API