twitchrb 1.10.0 → 2.0.0
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/workflows/ci.yml +2 -2
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +104 -1
- data/Gemfile.lock +5 -5
- data/README.md +360 -45
- data/lib/twitch/client.rb +109 -20
- data/lib/twitch/collection.rb +58 -11
- data/lib/twitch/error_generator.rb +6 -4
- data/lib/twitch/eventsub_webhook.rb +140 -0
- data/lib/twitch/oauth.rb +50 -15
- data/lib/twitch/object.rb +28 -0
- data/lib/twitch/objects/ad_schedule.rb +4 -0
- data/lib/twitch/objects/analytics_report.rb +4 -0
- data/lib/twitch/objects/bits_leaderboard_entry.rb +4 -0
- data/lib/twitch/objects/charity_donation.rb +4 -0
- data/lib/twitch/objects/chat_settings.rb +4 -0
- data/lib/twitch/objects/cheermote.rb +4 -0
- data/lib/twitch/objects/content_classification_label.rb +4 -0
- data/lib/twitch/objects/drops_entitlement.rb +4 -0
- data/lib/twitch/objects/drops_entitlement_update.rb +4 -0
- data/lib/twitch/objects/extension.rb +4 -0
- data/lib/twitch/objects/extension_bits_product.rb +4 -0
- data/lib/twitch/objects/extension_configuration_segment.rb +4 -0
- data/lib/twitch/objects/extension_live_channel.rb +4 -0
- data/lib/twitch/objects/extension_secret.rb +4 -0
- data/lib/twitch/objects/extension_transaction.rb +4 -0
- data/lib/twitch/objects/guest_star_invite.rb +4 -0
- data/lib/twitch/objects/guest_star_session.rb +4 -0
- data/lib/twitch/objects/guest_star_settings.rb +4 -0
- data/lib/twitch/objects/shield_mode_status.rb +4 -0
- data/lib/twitch/objects/{tag.rb → team.rb} +1 -1
- data/lib/twitch/objects/user_active_extensions.rb +4 -0
- data/lib/twitch/objects/user_extension.rb +4 -0
- data/lib/twitch/resource.rb +49 -9
- data/lib/twitch/resources/ads.rb +18 -0
- data/lib/twitch/resources/analytics.rb +19 -0
- data/lib/twitch/resources/announcements.rb +1 -1
- data/lib/twitch/resources/automod.rb +8 -8
- data/lib/twitch/resources/badges.rb +3 -3
- data/lib/twitch/resources/banned_users.rb +4 -4
- data/lib/twitch/resources/bits.rb +16 -0
- data/lib/twitch/resources/blocked_terms.rb +5 -5
- data/lib/twitch/resources/channels.rb +7 -7
- data/lib/twitch/resources/charity_campaigns.rb +9 -1
- data/lib/twitch/resources/chat_messages.rb +1 -1
- data/lib/twitch/resources/chat_settings.rb +20 -0
- data/lib/twitch/resources/chatters.rb +1 -1
- data/lib/twitch/resources/clips.rb +3 -9
- data/lib/twitch/resources/content_classification_labels.rb +8 -0
- data/lib/twitch/resources/custom_power_ups.rb +1 -1
- data/lib/twitch/resources/custom_reward_redemptions.rb +3 -4
- data/lib/twitch/resources/custom_rewards.rb +5 -5
- data/lib/twitch/resources/drops_entitlements.rb +17 -0
- data/lib/twitch/resources/emotes.rb +5 -5
- data/lib/twitch/resources/eventsub_conduits.rb +14 -4
- data/lib/twitch/resources/eventsub_subscriptions.rb +9 -13
- data/lib/twitch/resources/extensions.rb +99 -0
- data/lib/twitch/resources/games.rb +5 -7
- data/lib/twitch/resources/goals.rb +1 -1
- data/lib/twitch/resources/guest_star.rb +102 -0
- data/lib/twitch/resources/moderators.rb +4 -4
- data/lib/twitch/resources/pinned_chat_messages.rb +4 -11
- data/lib/twitch/resources/polls.rb +1 -1
- data/lib/twitch/resources/predictions.rb +1 -1
- data/lib/twitch/resources/raids.rb +3 -4
- data/lib/twitch/resources/search.rb +2 -2
- data/lib/twitch/resources/shield_mode.rb +18 -0
- data/lib/twitch/resources/shoutouts.rb +1 -1
- data/lib/twitch/resources/stream_markers.rb +1 -1
- data/lib/twitch/resources/stream_schedule.rb +4 -5
- data/lib/twitch/resources/streams.rb +2 -2
- data/lib/twitch/resources/subscriptions.rb +13 -2
- data/lib/twitch/resources/suspicious_users.rb +6 -2
- data/lib/twitch/resources/teams.rb +20 -0
- data/lib/twitch/resources/unban_requests.rb +2 -2
- data/lib/twitch/resources/users.rb +37 -43
- data/lib/twitch/resources/videos.rb +3 -3
- data/lib/twitch/resources/vips.rb +3 -3
- data/lib/twitch/resources/warnings.rb +2 -2
- data/lib/twitch/resources/whispers.rb +1 -1
- data/lib/twitch/version.rb +1 -1
- data/lib/twitch.rb +33 -9
- data/twitchrb.gemspec +5 -5
- metadata +42 -18
- data/lib/twitch/objects/banned_event.rb +0 -4
- data/lib/twitch/objects/followed_user.rb +0 -4
- data/lib/twitch/objects/hype_train_event.rb +0 -4
- data/lib/twitch/objects/moderator_event.rb +0 -4
- data/lib/twitch/resources/banned_events.rb +0 -8
- data/lib/twitch/resources/hype_train_events.rb +0 -10
- data/lib/twitch/resources/moderator_events.rb +0 -9
- data/lib/twitch/resources/tags.rb +0 -18
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Twitch
|
|
2
2
|
class UsersResource < Resource
|
|
3
3
|
def retrieve(id: nil, ids: nil, username: nil, usernames: nil)
|
|
4
|
-
raise "Either id, ids, username or usernames is required" unless !id.nil? || !ids.nil? || !username.nil? || !usernames.nil?
|
|
4
|
+
raise ArgumentError, "Either id, ids, username or usernames is required" unless !id.nil? || !ids.nil? || !username.nil? || !usernames.nil?
|
|
5
5
|
|
|
6
6
|
if id
|
|
7
7
|
response = get_request("users", params: { id: id })
|
|
@@ -14,30 +14,27 @@ module Twitch
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
body = response.body.dig("data")
|
|
17
|
-
if id || username
|
|
18
|
-
User.new
|
|
19
|
-
elsif ids || usernames && body.count > 1
|
|
20
|
-
Collection.from_response(response, type: User)
|
|
17
|
+
if id || username
|
|
18
|
+
body.empty? ? nil : User.new(body[0])
|
|
21
19
|
else
|
|
22
|
-
|
|
20
|
+
collection(response, type: User)
|
|
23
21
|
end
|
|
24
22
|
end
|
|
25
23
|
|
|
26
24
|
# Updates the current users description
|
|
27
25
|
# Required scope: user:edit
|
|
28
26
|
def update(description:)
|
|
29
|
-
response = put_request("users",
|
|
27
|
+
response = put_request(query_path("users", description: description), body: {})
|
|
30
28
|
User.new response.body.dig("data")[0]
|
|
31
29
|
end
|
|
32
30
|
|
|
33
31
|
def get_color(user_id: nil, user_ids: nil)
|
|
34
|
-
if user_ids
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
response
|
|
38
|
-
Collection.from_response(response, type: UserColor)
|
|
32
|
+
if user_ids
|
|
33
|
+
ids = user_ids.is_a?(Array) ? user_ids : user_ids.split(",")
|
|
34
|
+
response = get_request("chat/color", params: { user_id: ids.map { |i| i.to_s.strip } })
|
|
35
|
+
collection(response, type: UserColor)
|
|
39
36
|
else
|
|
40
|
-
response = get_request("chat/color
|
|
37
|
+
response = get_request("chat/color", params: { user_id: user_id })
|
|
41
38
|
UserColor.new response.body.dig("data")[0]
|
|
42
39
|
end
|
|
43
40
|
end
|
|
@@ -46,56 +43,53 @@ module Twitch
|
|
|
46
43
|
# Required scope: user:manage:chat_color
|
|
47
44
|
# user_id must be the currently authenticated user
|
|
48
45
|
def update_color(user_id:, color:)
|
|
49
|
-
put_request("chat/color
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Deprecated.
|
|
53
|
-
def follows(**params)
|
|
54
|
-
warn "`users.follows` is deprecated. Use `channels.followers` or `channels.following` instead."
|
|
55
|
-
|
|
56
|
-
raise "from_id or to_id is required" unless !params[:from_id].nil? || !params[:to_id].nil?
|
|
57
|
-
|
|
58
|
-
response = get_request("users/follows", params: params)
|
|
59
|
-
Collection.from_response(response, type: FollowedUser)
|
|
46
|
+
put_request(query_path("chat/color", user_id: user_id, color: color), body: {})
|
|
60
47
|
end
|
|
61
48
|
|
|
62
49
|
# Required scope: user:read:blocked_users
|
|
63
50
|
def blocks(broadcaster_id:, **params)
|
|
64
|
-
response = get_request("users/blocks
|
|
65
|
-
|
|
51
|
+
response = get_request("users/blocks", params: params.merge(broadcaster_id: broadcaster_id))
|
|
52
|
+
collection(response, type: BlockedUser)
|
|
66
53
|
end
|
|
67
54
|
|
|
68
55
|
# Required scope: user:manage:blocked_users
|
|
69
56
|
def block_user(target_user_id:, **attributes)
|
|
70
|
-
put_request("users/blocks
|
|
57
|
+
put_request(query_path("users/blocks", attributes.merge(target_user_id: target_user_id)), body: {})
|
|
71
58
|
end
|
|
72
59
|
|
|
73
60
|
# Required scope: user:manage:blocked_users
|
|
74
61
|
def unblock_user(target_user_id:)
|
|
75
|
-
delete_request("users/blocks
|
|
62
|
+
delete_request("users/blocks", params: { target_user_id: target_user_id })
|
|
76
63
|
end
|
|
77
64
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
65
|
+
def emotes(user_id:, **params)
|
|
66
|
+
attrs = { user_id: user_id }
|
|
67
|
+
response = get_request("chat/emotes/user", params: attrs.merge(params))
|
|
68
|
+
collection(response, type: Emote)
|
|
69
|
+
end
|
|
81
70
|
|
|
82
|
-
|
|
71
|
+
# Gets all extensions the authenticated user has installed, active or not
|
|
72
|
+
# Required scope: user:read:broadcast or user:edit:broadcast (needed to include inactive extensions)
|
|
73
|
+
def extensions
|
|
74
|
+
response = get_request("users/extensions/list")
|
|
75
|
+
collection(response, type: UserExtension)
|
|
76
|
+
end
|
|
83
77
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
end
|
|
78
|
+
# Gets the active extensions installed for a user, or the authenticated user if user_id is omitted
|
|
79
|
+
def active_extensions(user_id: nil)
|
|
80
|
+
response = get_request("users/extensions", params: { user_id: user_id }.compact)
|
|
81
|
+
UserActiveExtensions.new(response.body.dig("data"))
|
|
89
82
|
end
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
84
|
+
# Required scope: user:edit:broadcast
|
|
85
|
+
# data: { panel: { "1" => { active: true, id: "abc", version: "1.0.0" } }, overlay: {...}, component: {...} }
|
|
86
|
+
def update_extensions(data:)
|
|
87
|
+
response = put_request("users/extensions", body: { data: data })
|
|
88
|
+
UserActiveExtensions.new(response.body.dig("data"))
|
|
95
89
|
end
|
|
96
90
|
|
|
97
91
|
def authorization(id: nil, ids: nil)
|
|
98
|
-
raise "Either id or ids is required" unless !id.nil? || !ids.nil?
|
|
92
|
+
raise ArgumentError, "Either id or ids is required" unless !id.nil? || !ids.nil?
|
|
99
93
|
|
|
100
94
|
if id
|
|
101
95
|
response = get_request("authorization/users", params: { user_id: id })
|
|
@@ -103,7 +97,7 @@ module Twitch
|
|
|
103
97
|
response = get_request("authorization/users", params: { user_id: ids })
|
|
104
98
|
end
|
|
105
99
|
|
|
106
|
-
|
|
100
|
+
collection(response, type: UserAuthorization)
|
|
107
101
|
end
|
|
108
102
|
end
|
|
109
103
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module Twitch
|
|
2
2
|
class VideosResource < Resource
|
|
3
3
|
def list(**params)
|
|
4
|
-
raise "user_id or
|
|
4
|
+
raise ArgumentError, "user_id, game_id or id is required" if params.values_at(:user_id, :game_id, :id).all?(&:nil?)
|
|
5
5
|
|
|
6
6
|
response = get_request("videos", params: params)
|
|
7
|
-
|
|
7
|
+
collection(response, type: Video)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def retrieve(id:)
|
|
@@ -16,7 +16,7 @@ module Twitch
|
|
|
16
16
|
|
|
17
17
|
# Required scope: channel:manage:videos
|
|
18
18
|
def delete(video_id:)
|
|
19
|
-
delete_request("videos
|
|
19
|
+
delete_request("videos", params: { id: video_id })
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -3,15 +3,15 @@ module Twitch
|
|
|
3
3
|
# Broadcaster ID must match the user in the OAuth token
|
|
4
4
|
def list(broadcaster_id:, **params)
|
|
5
5
|
response = get_request("channels/vips", params: params.merge(broadcaster_id: broadcaster_id))
|
|
6
|
-
|
|
6
|
+
collection(response, type: Vip)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def create(broadcaster_id:, user_id:)
|
|
10
|
-
post_request("channels/vips",
|
|
10
|
+
post_request(query_path("channels/vips", broadcaster_id: broadcaster_id, user_id: user_id), body: {})
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def delete(broadcaster_id:, user_id:)
|
|
14
|
-
delete_request("channels/vips
|
|
14
|
+
delete_request("channels/vips", params: { broadcaster_id: broadcaster_id, user_id: user_id })
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -5,8 +5,8 @@ module Twitch
|
|
|
5
5
|
def create(broadcaster_id:, moderator_id:, user_id:, reason:)
|
|
6
6
|
attrs = { user_id: user_id, reason: reason }
|
|
7
7
|
|
|
8
|
-
response = post_request("moderation/warnings
|
|
9
|
-
|
|
8
|
+
response = post_request(query_path("moderation/warnings", broadcaster_id: broadcaster_id, moderator_id: moderator_id), body: { data: attrs })
|
|
9
|
+
collection(response, type: Warning)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Twitch
|
|
2
2
|
class WhispersResource < Resource
|
|
3
3
|
def create(from_user_id:, to_user_id:, message:)
|
|
4
|
-
post_request("whispers",
|
|
4
|
+
post_request(query_path("whispers", from_user_id: from_user_id, to_user_id: to_user_id), body: { message: message })
|
|
5
5
|
end
|
|
6
6
|
end
|
|
7
7
|
end
|
data/lib/twitch/version.rb
CHANGED
data/lib/twitch.rb
CHANGED
|
@@ -18,6 +18,7 @@ module Twitch
|
|
|
18
18
|
autoload :Object, "twitch/object"
|
|
19
19
|
|
|
20
20
|
autoload :OAuth, "twitch/oauth"
|
|
21
|
+
autoload :EventsubWebhook, "twitch/eventsub_webhook"
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
autoload :UsersResource, "twitch/resources/users"
|
|
@@ -29,10 +30,8 @@ module Twitch
|
|
|
29
30
|
autoload :ClipsResource, "twitch/resources/clips"
|
|
30
31
|
autoload :EventsubSubscriptionsResource, "twitch/resources/eventsub_subscriptions"
|
|
31
32
|
autoload :EventsubConduitsResource, "twitch/resources/eventsub_conduits"
|
|
32
|
-
autoload :BannedEventsResource, "twitch/resources/banned_events"
|
|
33
33
|
autoload :BannedUsersResource, "twitch/resources/banned_users"
|
|
34
34
|
autoload :ModeratorsResource, "twitch/resources/moderators"
|
|
35
|
-
autoload :ModeratorEventsResource, "twitch/resources/moderator_events"
|
|
36
35
|
autoload :PollsResource, "twitch/resources/polls"
|
|
37
36
|
autoload :PredictionsResource, "twitch/resources/predictions"
|
|
38
37
|
autoload :StreamScheduleResource, "twitch/resources/stream_schedule"
|
|
@@ -40,12 +39,10 @@ module Twitch
|
|
|
40
39
|
autoload :StreamsResource, "twitch/resources/streams"
|
|
41
40
|
autoload :StreamMarkersResource, "twitch/resources/stream_markers"
|
|
42
41
|
autoload :SubscriptionsResource, "twitch/resources/subscriptions"
|
|
43
|
-
autoload :TagsResource, "twitch/resources/tags"
|
|
44
42
|
autoload :CustomRewardsResource, "twitch/resources/custom_rewards"
|
|
45
43
|
autoload :CustomRewardRedemptionsResource, "twitch/resources/custom_reward_redemptions"
|
|
46
44
|
autoload :CustomPowerUpsResource, "twitch/resources/custom_power_ups"
|
|
47
45
|
autoload :GoalsResource, "twitch/resources/goals"
|
|
48
|
-
autoload :HypeTrainEventsResource, "twitch/resources/hype_train_events"
|
|
49
46
|
autoload :HypeTrainStatusResource, "twitch/resources/hype_train_status"
|
|
50
47
|
autoload :AnnouncementsResource, "twitch/resources/announcements"
|
|
51
48
|
autoload :RaidsResource, "twitch/resources/raids"
|
|
@@ -62,10 +59,19 @@ module Twitch
|
|
|
62
59
|
autoload :UnbanRequestsResource, "twitch/resources/unban_requests"
|
|
63
60
|
autoload :WarningsResource, "twitch/resources/warnings"
|
|
64
61
|
autoload :SuspiciousUsersResource, "twitch/resources/suspicious_users"
|
|
62
|
+
autoload :AdsResource, "twitch/resources/ads"
|
|
63
|
+
autoload :AnalyticsResource, "twitch/resources/analytics"
|
|
64
|
+
autoload :BitsResource, "twitch/resources/bits"
|
|
65
|
+
autoload :ChatSettingsResource, "twitch/resources/chat_settings"
|
|
66
|
+
autoload :ContentClassificationLabelsResource, "twitch/resources/content_classification_labels"
|
|
67
|
+
autoload :DropsEntitlementsResource, "twitch/resources/drops_entitlements"
|
|
68
|
+
autoload :ExtensionsResource, "twitch/resources/extensions"
|
|
69
|
+
autoload :GuestStarResource, "twitch/resources/guest_star"
|
|
70
|
+
autoload :ShieldModeResource, "twitch/resources/shield_mode"
|
|
71
|
+
autoload :TeamsResource, "twitch/resources/teams"
|
|
65
72
|
|
|
66
73
|
|
|
67
74
|
autoload :User, "twitch/objects/user"
|
|
68
|
-
autoload :FollowedUser, "twitch/objects/followed_user"
|
|
69
75
|
autoload :BlockedUser, "twitch/objects/blocked_user"
|
|
70
76
|
autoload :StreamKey, "twitch/objects/stream_key"
|
|
71
77
|
|
|
@@ -80,10 +86,8 @@ module Twitch
|
|
|
80
86
|
autoload :EventsubSubscription, "twitch/objects/eventsub_subscription"
|
|
81
87
|
autoload :EventsubConduit, "twitch/objects/eventsub_conduit"
|
|
82
88
|
autoload :EventsubConduitShard, "twitch/objects/eventsub_conduit_shard"
|
|
83
|
-
autoload :BannedEvent, "twitch/objects/banned_event"
|
|
84
89
|
autoload :BannedUser, "twitch/objects/banned_user"
|
|
85
90
|
autoload :Moderator, "twitch/objects/moderator"
|
|
86
|
-
autoload :ModeratorEvent, "twitch/objects/moderator_event"
|
|
87
91
|
autoload :Poll, "twitch/objects/poll"
|
|
88
92
|
autoload :Prediction, "twitch/objects/prediction"
|
|
89
93
|
autoload :StreamSchedule, "twitch/objects/stream_schedule"
|
|
@@ -92,12 +96,10 @@ module Twitch
|
|
|
92
96
|
autoload :StreamMarker, "twitch/objects/stream_marker"
|
|
93
97
|
autoload :Subscription, "twitch/objects/subscription"
|
|
94
98
|
autoload :SubscriptionCount, "twitch/objects/subscription_count"
|
|
95
|
-
autoload :Tag, "twitch/objects/tag"
|
|
96
99
|
autoload :CustomReward, "twitch/objects/custom_reward"
|
|
97
100
|
autoload :CustomRewardRedemption, "twitch/objects/custom_reward_redemption"
|
|
98
101
|
autoload :CustomPowerUp, "twitch/objects/custom_power_up"
|
|
99
102
|
autoload :Goal, "twitch/objects/goal"
|
|
100
|
-
autoload :HypeTrainEvent, "twitch/objects/hype_train_event"
|
|
101
103
|
autoload :HypeTrainStatus, "twitch/objects/hype_train_status"
|
|
102
104
|
autoload :FollowCount, "twitch/objects/follow_count"
|
|
103
105
|
autoload :Raid, "twitch/objects/raid"
|
|
@@ -115,4 +117,26 @@ module Twitch
|
|
|
115
117
|
autoload :Warning, "twitch/objects/warning"
|
|
116
118
|
autoload :SuspiciousUser, "twitch/objects/suspicious_user"
|
|
117
119
|
autoload :UserAuthorization, "twitch/objects/user_authorization"
|
|
120
|
+
autoload :AdSchedule, "twitch/objects/ad_schedule"
|
|
121
|
+
autoload :AnalyticsReport, "twitch/objects/analytics_report"
|
|
122
|
+
autoload :BitsLeaderboardEntry, "twitch/objects/bits_leaderboard_entry"
|
|
123
|
+
autoload :Cheermote, "twitch/objects/cheermote"
|
|
124
|
+
autoload :CharityDonation, "twitch/objects/charity_donation"
|
|
125
|
+
autoload :ChatSettings, "twitch/objects/chat_settings"
|
|
126
|
+
autoload :ContentClassificationLabel, "twitch/objects/content_classification_label"
|
|
127
|
+
autoload :DropsEntitlement, "twitch/objects/drops_entitlement"
|
|
128
|
+
autoload :DropsEntitlementUpdate, "twitch/objects/drops_entitlement_update"
|
|
129
|
+
autoload :ShieldModeStatus, "twitch/objects/shield_mode_status"
|
|
130
|
+
autoload :Team, "twitch/objects/team"
|
|
131
|
+
autoload :UserExtension, "twitch/objects/user_extension"
|
|
132
|
+
autoload :UserActiveExtensions, "twitch/objects/user_active_extensions"
|
|
133
|
+
autoload :Extension, "twitch/objects/extension"
|
|
134
|
+
autoload :ExtensionLiveChannel, "twitch/objects/extension_live_channel"
|
|
135
|
+
autoload :ExtensionConfigurationSegment, "twitch/objects/extension_configuration_segment"
|
|
136
|
+
autoload :ExtensionSecret, "twitch/objects/extension_secret"
|
|
137
|
+
autoload :ExtensionBitsProduct, "twitch/objects/extension_bits_product"
|
|
138
|
+
autoload :ExtensionTransaction, "twitch/objects/extension_transaction"
|
|
139
|
+
autoload :GuestStarSettings, "twitch/objects/guest_star_settings"
|
|
140
|
+
autoload :GuestStarSession, "twitch/objects/guest_star_session"
|
|
141
|
+
autoload :GuestStarInvite, "twitch/objects/guest_star_invite"
|
|
118
142
|
end
|
data/twitchrb.gemspec
CHANGED
|
@@ -7,13 +7,13 @@ Gem::Specification.new do |spec|
|
|
|
7
7
|
spec.email = [ "dean@deanpcmad.com" ]
|
|
8
8
|
|
|
9
9
|
spec.summary = "A Ruby library for interacting with the Twitch Helix API"
|
|
10
|
-
spec.homepage = "https://
|
|
10
|
+
spec.homepage = "https://github.com/d34ndev/twitchrb"
|
|
11
11
|
spec.license = "MIT"
|
|
12
|
-
spec.required_ruby_version = Gem::Requirement.new(">=
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.3")
|
|
13
13
|
|
|
14
14
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
15
|
-
spec.metadata["
|
|
16
|
-
spec.metadata["
|
|
15
|
+
spec.metadata["changelog_uri"] = "https://github.com/d34ndev/twitchrb/blob/main/CHANGELOG.md"
|
|
16
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/d34ndev/twitchrb/issues"
|
|
17
17
|
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
25
|
spec.require_paths = [ "lib" ]
|
|
26
26
|
|
|
27
|
-
spec.add_dependency "faraday", ">= 2.14.
|
|
27
|
+
spec.add_dependency "faraday", ">= 2.14.3", "< 3"
|
|
28
28
|
spec.add_dependency "ostruct", "~> 0.6.0"
|
|
29
29
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: twitchrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dean Perry
|
|
@@ -15,7 +15,7 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 2.14.
|
|
18
|
+
version: 2.14.3
|
|
19
19
|
- - "<"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
21
|
version: '3'
|
|
@@ -25,7 +25,7 @@ dependencies:
|
|
|
25
25
|
requirements:
|
|
26
26
|
- - ">="
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: 2.14.
|
|
28
|
+
version: 2.14.3
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
31
|
version: '3'
|
|
@@ -69,43 +69,59 @@ files:
|
|
|
69
69
|
- lib/twitch/collection.rb
|
|
70
70
|
- lib/twitch/error.rb
|
|
71
71
|
- lib/twitch/error_generator.rb
|
|
72
|
+
- lib/twitch/eventsub_webhook.rb
|
|
72
73
|
- lib/twitch/oauth.rb
|
|
73
74
|
- lib/twitch/object.rb
|
|
75
|
+
- lib/twitch/objects/ad_schedule.rb
|
|
76
|
+
- lib/twitch/objects/analytics_report.rb
|
|
74
77
|
- lib/twitch/objects/automod_setting.rb
|
|
75
78
|
- lib/twitch/objects/automod_status.rb
|
|
76
79
|
- lib/twitch/objects/badge.rb
|
|
77
|
-
- lib/twitch/objects/banned_event.rb
|
|
78
80
|
- lib/twitch/objects/banned_user.rb
|
|
81
|
+
- lib/twitch/objects/bits_leaderboard_entry.rb
|
|
79
82
|
- lib/twitch/objects/blocked_term.rb
|
|
80
83
|
- lib/twitch/objects/blocked_user.rb
|
|
81
84
|
- lib/twitch/objects/channel.rb
|
|
82
85
|
- lib/twitch/objects/channel_editor.rb
|
|
83
86
|
- lib/twitch/objects/charity_campaign.rb
|
|
87
|
+
- lib/twitch/objects/charity_donation.rb
|
|
84
88
|
- lib/twitch/objects/chat_message.rb
|
|
89
|
+
- lib/twitch/objects/chat_settings.rb
|
|
85
90
|
- lib/twitch/objects/chatter.rb
|
|
91
|
+
- lib/twitch/objects/cheermote.rb
|
|
86
92
|
- lib/twitch/objects/clip.rb
|
|
87
93
|
- lib/twitch/objects/clip_download.rb
|
|
94
|
+
- lib/twitch/objects/content_classification_label.rb
|
|
88
95
|
- lib/twitch/objects/custom_power_up.rb
|
|
89
96
|
- lib/twitch/objects/custom_reward.rb
|
|
90
97
|
- lib/twitch/objects/custom_reward_redemption.rb
|
|
98
|
+
- lib/twitch/objects/drops_entitlement.rb
|
|
99
|
+
- lib/twitch/objects/drops_entitlement_update.rb
|
|
91
100
|
- lib/twitch/objects/emote.rb
|
|
92
101
|
- lib/twitch/objects/eventsub_conduit.rb
|
|
93
102
|
- lib/twitch/objects/eventsub_conduit_shard.rb
|
|
94
103
|
- lib/twitch/objects/eventsub_subscription.rb
|
|
104
|
+
- lib/twitch/objects/extension.rb
|
|
105
|
+
- lib/twitch/objects/extension_bits_product.rb
|
|
106
|
+
- lib/twitch/objects/extension_configuration_segment.rb
|
|
107
|
+
- lib/twitch/objects/extension_live_channel.rb
|
|
108
|
+
- lib/twitch/objects/extension_secret.rb
|
|
109
|
+
- lib/twitch/objects/extension_transaction.rb
|
|
95
110
|
- lib/twitch/objects/follow_count.rb
|
|
96
|
-
- lib/twitch/objects/followed_user.rb
|
|
97
111
|
- lib/twitch/objects/game.rb
|
|
98
112
|
- lib/twitch/objects/goal.rb
|
|
99
|
-
- lib/twitch/objects/
|
|
113
|
+
- lib/twitch/objects/guest_star_invite.rb
|
|
114
|
+
- lib/twitch/objects/guest_star_session.rb
|
|
115
|
+
- lib/twitch/objects/guest_star_settings.rb
|
|
100
116
|
- lib/twitch/objects/hype_train_status.rb
|
|
101
117
|
- lib/twitch/objects/moderator.rb
|
|
102
|
-
- lib/twitch/objects/moderator_event.rb
|
|
103
118
|
- lib/twitch/objects/pinned_chat_message.rb
|
|
104
119
|
- lib/twitch/objects/poll.rb
|
|
105
120
|
- lib/twitch/objects/prediction.rb
|
|
106
121
|
- lib/twitch/objects/raid.rb
|
|
107
122
|
- lib/twitch/objects/search_result.rb
|
|
108
123
|
- lib/twitch/objects/shared_chat_session.rb
|
|
124
|
+
- lib/twitch/objects/shield_mode_status.rb
|
|
109
125
|
- lib/twitch/objects/stream.rb
|
|
110
126
|
- lib/twitch/objects/stream_key.rb
|
|
111
127
|
- lib/twitch/objects/stream_marker.rb
|
|
@@ -113,38 +129,45 @@ files:
|
|
|
113
129
|
- lib/twitch/objects/subscription.rb
|
|
114
130
|
- lib/twitch/objects/subscription_count.rb
|
|
115
131
|
- lib/twitch/objects/suspicious_user.rb
|
|
116
|
-
- lib/twitch/objects/
|
|
132
|
+
- lib/twitch/objects/team.rb
|
|
117
133
|
- lib/twitch/objects/unban_request.rb
|
|
118
134
|
- lib/twitch/objects/user.rb
|
|
135
|
+
- lib/twitch/objects/user_active_extensions.rb
|
|
119
136
|
- lib/twitch/objects/user_authorization.rb
|
|
120
137
|
- lib/twitch/objects/user_color.rb
|
|
138
|
+
- lib/twitch/objects/user_extension.rb
|
|
121
139
|
- lib/twitch/objects/video.rb
|
|
122
140
|
- lib/twitch/objects/vip.rb
|
|
123
141
|
- lib/twitch/objects/warning.rb
|
|
124
142
|
- lib/twitch/rate_limiter.rb
|
|
125
143
|
- lib/twitch/resource.rb
|
|
144
|
+
- lib/twitch/resources/ads.rb
|
|
145
|
+
- lib/twitch/resources/analytics.rb
|
|
126
146
|
- lib/twitch/resources/announcements.rb
|
|
127
147
|
- lib/twitch/resources/automod.rb
|
|
128
148
|
- lib/twitch/resources/badges.rb
|
|
129
|
-
- lib/twitch/resources/banned_events.rb
|
|
130
149
|
- lib/twitch/resources/banned_users.rb
|
|
150
|
+
- lib/twitch/resources/bits.rb
|
|
131
151
|
- lib/twitch/resources/blocked_terms.rb
|
|
132
152
|
- lib/twitch/resources/channels.rb
|
|
133
153
|
- lib/twitch/resources/charity_campaigns.rb
|
|
134
154
|
- lib/twitch/resources/chat_messages.rb
|
|
155
|
+
- lib/twitch/resources/chat_settings.rb
|
|
135
156
|
- lib/twitch/resources/chatters.rb
|
|
136
157
|
- lib/twitch/resources/clips.rb
|
|
158
|
+
- lib/twitch/resources/content_classification_labels.rb
|
|
137
159
|
- lib/twitch/resources/custom_power_ups.rb
|
|
138
160
|
- lib/twitch/resources/custom_reward_redemptions.rb
|
|
139
161
|
- lib/twitch/resources/custom_rewards.rb
|
|
162
|
+
- lib/twitch/resources/drops_entitlements.rb
|
|
140
163
|
- lib/twitch/resources/emotes.rb
|
|
141
164
|
- lib/twitch/resources/eventsub_conduits.rb
|
|
142
165
|
- lib/twitch/resources/eventsub_subscriptions.rb
|
|
166
|
+
- lib/twitch/resources/extensions.rb
|
|
143
167
|
- lib/twitch/resources/games.rb
|
|
144
168
|
- lib/twitch/resources/goals.rb
|
|
145
|
-
- lib/twitch/resources/
|
|
169
|
+
- lib/twitch/resources/guest_star.rb
|
|
146
170
|
- lib/twitch/resources/hype_train_status.rb
|
|
147
|
-
- lib/twitch/resources/moderator_events.rb
|
|
148
171
|
- lib/twitch/resources/moderators.rb
|
|
149
172
|
- lib/twitch/resources/pinned_chat_messages.rb
|
|
150
173
|
- lib/twitch/resources/polls.rb
|
|
@@ -152,13 +175,14 @@ files:
|
|
|
152
175
|
- lib/twitch/resources/raids.rb
|
|
153
176
|
- lib/twitch/resources/search.rb
|
|
154
177
|
- lib/twitch/resources/shared_chat_sessions.rb
|
|
178
|
+
- lib/twitch/resources/shield_mode.rb
|
|
155
179
|
- lib/twitch/resources/shoutouts.rb
|
|
156
180
|
- lib/twitch/resources/stream_markers.rb
|
|
157
181
|
- lib/twitch/resources/stream_schedule.rb
|
|
158
182
|
- lib/twitch/resources/streams.rb
|
|
159
183
|
- lib/twitch/resources/subscriptions.rb
|
|
160
184
|
- lib/twitch/resources/suspicious_users.rb
|
|
161
|
-
- lib/twitch/resources/
|
|
185
|
+
- lib/twitch/resources/teams.rb
|
|
162
186
|
- lib/twitch/resources/unban_requests.rb
|
|
163
187
|
- lib/twitch/resources/users.rb
|
|
164
188
|
- lib/twitch/resources/videos.rb
|
|
@@ -169,13 +193,13 @@ files:
|
|
|
169
193
|
- lib/twitchrb.rb
|
|
170
194
|
- mise.toml
|
|
171
195
|
- twitchrb.gemspec
|
|
172
|
-
homepage: https://
|
|
196
|
+
homepage: https://github.com/d34ndev/twitchrb
|
|
173
197
|
licenses:
|
|
174
198
|
- MIT
|
|
175
199
|
metadata:
|
|
176
|
-
homepage_uri: https://
|
|
177
|
-
|
|
178
|
-
|
|
200
|
+
homepage_uri: https://github.com/d34ndev/twitchrb
|
|
201
|
+
changelog_uri: https://github.com/d34ndev/twitchrb/blob/main/CHANGELOG.md
|
|
202
|
+
bug_tracker_uri: https://github.com/d34ndev/twitchrb/issues
|
|
179
203
|
rdoc_options: []
|
|
180
204
|
require_paths:
|
|
181
205
|
- lib
|
|
@@ -183,14 +207,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
183
207
|
requirements:
|
|
184
208
|
- - ">="
|
|
185
209
|
- !ruby/object:Gem::Version
|
|
186
|
-
version:
|
|
210
|
+
version: '3.3'
|
|
187
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
212
|
requirements:
|
|
189
213
|
- - ">="
|
|
190
214
|
- !ruby/object:Gem::Version
|
|
191
215
|
version: '0'
|
|
192
216
|
requirements: []
|
|
193
|
-
rubygems_version: 4.0.
|
|
217
|
+
rubygems_version: 4.0.20
|
|
194
218
|
specification_version: 4
|
|
195
219
|
summary: A Ruby library for interacting with the Twitch Helix API
|
|
196
220
|
test_files: []
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
module Twitch
|
|
2
|
-
class BannedEventsResource < Resource
|
|
3
|
-
def list(broadcaster_id:, **params)
|
|
4
|
-
response = get_request("moderation/banned/events", params: params.merge(broadcaster_id: broadcaster_id))
|
|
5
|
-
Collection.from_response(response, type: BannedEvent)
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
module Twitch
|
|
2
|
-
class HypeTrainEventsResource < Resource
|
|
3
|
-
# Required scope: channel:read:hype_train
|
|
4
|
-
# Broadcaster ID must match the user in the OAuth token
|
|
5
|
-
def list(broadcaster_id:)
|
|
6
|
-
warn "`hype_train_events.list` is deprecated because Twitch removed GET /helix/hypetrain/events. Use `hype_train_status.retrieve` instead."
|
|
7
|
-
HypeTrainStatusResource.new(client).retrieve(broadcaster_id: broadcaster_id)
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
module Twitch
|
|
2
|
-
class ModeratorEventsResource < Resource
|
|
3
|
-
# Broadcaster ID must match the user in the OAuth token
|
|
4
|
-
def list(broadcaster_id:, **params)
|
|
5
|
-
response = get_request("moderation/moderators/events", params: params.merge(broadcaster_id: broadcaster_id))
|
|
6
|
-
Collection.from_response(response, type: ModeratorEvent)
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module Twitch
|
|
2
|
-
class TagsResource < Resource
|
|
3
|
-
def list(**params)
|
|
4
|
-
response = get_request("tags/streams", params: params)
|
|
5
|
-
Collection.from_response(response, type: Tag)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def stream(broadcaster_id:, **params)
|
|
9
|
-
response = get_request("streams/tags", params: params.merge(broadcaster_id: broadcaster_id))
|
|
10
|
-
Collection.from_response(response, type: Tag)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Required scope: channel:manage:broadcast
|
|
14
|
-
def replace(broadcaster_id:, **params)
|
|
15
|
-
put_request("streams/tags", body: params.merge(broadcaster_id: broadcaster_id))
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|