twitchrb 0.1.0 → 0.2.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/.env.example +3 -0
- data/.github/FUNDING.yml +4 -0
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +28 -9
- data/README.md +46 -6
- data/bin/console +5 -0
- data/lib/twitch/client.rb +103 -65
- data/lib/twitch/collection.rb +21 -0
- data/lib/twitch/error.rb +4 -0
- data/lib/twitch/object.rb +19 -0
- data/lib/twitch/objects/badge.rb +4 -0
- data/lib/twitch/objects/banned_event.rb +4 -0
- data/lib/twitch/objects/banned_user.rb +4 -0
- data/lib/twitch/objects/blocked_user.rb +4 -0
- data/lib/twitch/objects/channel.rb +4 -0
- data/lib/twitch/objects/channel_editor.rb +4 -0
- data/lib/twitch/objects/clip.rb +4 -0
- data/lib/twitch/objects/custom_reward.rb +4 -0
- data/lib/twitch/objects/custom_reward_redemption.rb +4 -0
- data/lib/twitch/objects/emote.rb +4 -0
- data/lib/twitch/objects/event_sub_subscription.rb +4 -0
- data/lib/twitch/objects/followed_user.rb +4 -0
- data/lib/twitch/objects/game.rb +4 -0
- data/lib/twitch/objects/goal.rb +4 -0
- data/lib/twitch/objects/hype_train_event.rb +4 -0
- data/lib/twitch/objects/moderator.rb +4 -0
- data/lib/twitch/objects/moderator_event.rb +4 -0
- data/lib/twitch/objects/poll.rb +4 -0
- data/lib/twitch/objects/prediction.rb +4 -0
- data/lib/twitch/objects/search_result.rb +4 -0
- data/lib/twitch/objects/stream.rb +4 -0
- data/lib/twitch/objects/stream_marker.rb +4 -0
- data/lib/twitch/objects/stream_schedule.rb +4 -0
- data/lib/twitch/objects/subscription.rb +4 -0
- data/lib/twitch/objects/subscription_count.rb +4 -0
- data/lib/twitch/objects/tag.rb +4 -0
- data/lib/twitch/objects/user.rb +4 -0
- data/lib/twitch/objects/video.rb +4 -0
- data/lib/twitch/resource.rb +57 -0
- data/lib/twitch/resources/badges.rb +15 -0
- data/lib/twitch/resources/banned_events.rb +10 -0
- data/lib/twitch/resources/banned_users.rb +11 -0
- data/lib/twitch/resources/channels.rb +20 -0
- data/lib/twitch/resources/clips.rb +23 -0
- data/lib/twitch/resources/custom_reward_redemptions.rb +22 -0
- data/lib/twitch/resources/custom_rewards.rb +30 -0
- data/lib/twitch/resources/emotes.rb +20 -0
- data/lib/twitch/resources/event_sub_subscriptions.rb +21 -0
- data/lib/twitch/resources/games.rb +20 -0
- data/lib/twitch/resources/goals.rb +12 -0
- data/lib/twitch/resources/hype_train_events.rb +12 -0
- data/lib/twitch/resources/moderator_events.rb +11 -0
- data/lib/twitch/resources/moderators.rb +11 -0
- data/lib/twitch/resources/polls.rb +27 -0
- data/lib/twitch/resources/predictions.rb +32 -0
- data/lib/twitch/resources/search.rb +17 -0
- data/lib/twitch/resources/stream_markers.rb +19 -0
- data/lib/twitch/resources/stream_schedule.rb +47 -0
- data/lib/twitch/resources/streams.rb +19 -0
- data/lib/twitch/resources/subscriptions.rb +32 -0
- data/lib/twitch/resources/tags.rb +20 -0
- data/lib/twitch/resources/users.rb +54 -0
- data/lib/twitch/resources/videos.rb +17 -0
- data/lib/twitch/version.rb +1 -1
- data/lib/twitch.rb +63 -29
- data/twitchrb.gemspec +3 -2
- metadata +79 -13
- data/.travis.yml +0 -6
- data/lib/twitch/initializable.rb +0 -16
- data/lib/twitch/kraken/channels.rb +0 -22
- data/lib/twitch/kraken/clips.rb +0 -22
- data/lib/twitch/kraken/user.rb +0 -23
- data/lib/twitch/kraken/users.rb +0 -33
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitchrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.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:
|
11
|
+
date: 2021-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
27
41
|
description:
|
28
42
|
email:
|
29
43
|
- dean@deanpcmad.com
|
@@ -31,8 +45,9 @@ executables: []
|
|
31
45
|
extensions: []
|
32
46
|
extra_rdoc_files: []
|
33
47
|
files:
|
48
|
+
- ".env.example"
|
49
|
+
- ".github/FUNDING.yml"
|
34
50
|
- ".gitignore"
|
35
|
-
- ".travis.yml"
|
36
51
|
- Gemfile
|
37
52
|
- Gemfile.lock
|
38
53
|
- LICENSE.txt
|
@@ -42,11 +57,62 @@ files:
|
|
42
57
|
- bin/setup
|
43
58
|
- lib/twitch.rb
|
44
59
|
- lib/twitch/client.rb
|
45
|
-
- lib/twitch/
|
46
|
-
- lib/twitch/
|
47
|
-
- lib/twitch/
|
48
|
-
- lib/twitch/
|
49
|
-
- lib/twitch/
|
60
|
+
- lib/twitch/collection.rb
|
61
|
+
- lib/twitch/error.rb
|
62
|
+
- lib/twitch/object.rb
|
63
|
+
- lib/twitch/objects/badge.rb
|
64
|
+
- lib/twitch/objects/banned_event.rb
|
65
|
+
- lib/twitch/objects/banned_user.rb
|
66
|
+
- lib/twitch/objects/blocked_user.rb
|
67
|
+
- lib/twitch/objects/channel.rb
|
68
|
+
- lib/twitch/objects/channel_editor.rb
|
69
|
+
- lib/twitch/objects/clip.rb
|
70
|
+
- lib/twitch/objects/custom_reward.rb
|
71
|
+
- lib/twitch/objects/custom_reward_redemption.rb
|
72
|
+
- lib/twitch/objects/emote.rb
|
73
|
+
- lib/twitch/objects/event_sub_subscription.rb
|
74
|
+
- lib/twitch/objects/followed_user.rb
|
75
|
+
- lib/twitch/objects/game.rb
|
76
|
+
- lib/twitch/objects/goal.rb
|
77
|
+
- lib/twitch/objects/hype_train_event.rb
|
78
|
+
- lib/twitch/objects/moderator.rb
|
79
|
+
- lib/twitch/objects/moderator_event.rb
|
80
|
+
- lib/twitch/objects/poll.rb
|
81
|
+
- lib/twitch/objects/prediction.rb
|
82
|
+
- lib/twitch/objects/search_result.rb
|
83
|
+
- lib/twitch/objects/stream.rb
|
84
|
+
- lib/twitch/objects/stream_marker.rb
|
85
|
+
- lib/twitch/objects/stream_schedule.rb
|
86
|
+
- lib/twitch/objects/subscription.rb
|
87
|
+
- lib/twitch/objects/subscription_count.rb
|
88
|
+
- lib/twitch/objects/tag.rb
|
89
|
+
- lib/twitch/objects/user.rb
|
90
|
+
- lib/twitch/objects/video.rb
|
91
|
+
- lib/twitch/resource.rb
|
92
|
+
- lib/twitch/resources/badges.rb
|
93
|
+
- lib/twitch/resources/banned_events.rb
|
94
|
+
- lib/twitch/resources/banned_users.rb
|
95
|
+
- lib/twitch/resources/channels.rb
|
96
|
+
- lib/twitch/resources/clips.rb
|
97
|
+
- lib/twitch/resources/custom_reward_redemptions.rb
|
98
|
+
- lib/twitch/resources/custom_rewards.rb
|
99
|
+
- lib/twitch/resources/emotes.rb
|
100
|
+
- lib/twitch/resources/event_sub_subscriptions.rb
|
101
|
+
- lib/twitch/resources/games.rb
|
102
|
+
- lib/twitch/resources/goals.rb
|
103
|
+
- lib/twitch/resources/hype_train_events.rb
|
104
|
+
- lib/twitch/resources/moderator_events.rb
|
105
|
+
- lib/twitch/resources/moderators.rb
|
106
|
+
- lib/twitch/resources/polls.rb
|
107
|
+
- lib/twitch/resources/predictions.rb
|
108
|
+
- lib/twitch/resources/search.rb
|
109
|
+
- lib/twitch/resources/stream_markers.rb
|
110
|
+
- lib/twitch/resources/stream_schedule.rb
|
111
|
+
- lib/twitch/resources/streams.rb
|
112
|
+
- lib/twitch/resources/subscriptions.rb
|
113
|
+
- lib/twitch/resources/tags.rb
|
114
|
+
- lib/twitch/resources/users.rb
|
115
|
+
- lib/twitch/resources/videos.rb
|
50
116
|
- lib/twitch/version.rb
|
51
117
|
- twitchrb.gemspec
|
52
118
|
homepage: https://twitchrb.com
|
@@ -70,8 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
136
|
- !ruby/object:Gem::Version
|
71
137
|
version: '0'
|
72
138
|
requirements: []
|
73
|
-
rubygems_version: 3.1.
|
139
|
+
rubygems_version: 3.1.6
|
74
140
|
signing_key:
|
75
141
|
specification_version: 4
|
76
|
-
summary: A Ruby library for interacting with the Twitch API
|
142
|
+
summary: A Ruby library for interacting with the Twitch Helix API
|
77
143
|
test_files: []
|
data/.travis.yml
DELETED
data/lib/twitch/initializable.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Twitch
|
2
|
-
module Initializable
|
3
|
-
|
4
|
-
def initialize(params = {})
|
5
|
-
params.each do |key, value|
|
6
|
-
if key == "_id"
|
7
|
-
key = "id"
|
8
|
-
end
|
9
|
-
|
10
|
-
setter = "#{key}="
|
11
|
-
send(setter, value) if respond_to?(setter.to_sym, false)
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Twitch
|
2
|
-
module Kraken
|
3
|
-
class Channels
|
4
|
-
|
5
|
-
include Initializable
|
6
|
-
|
7
|
-
attr_accessor :id, :name, :display_name, :broadcaster_language, :followers, :game, :language, :logo, :mature, :partner, :profile_banner, :profile_banner_background_colour, :status, :url, :video_banner, :views, :created_at, :updated_at
|
8
|
-
|
9
|
-
class << self
|
10
|
-
|
11
|
-
# Gets a specified channel object
|
12
|
-
def get_channel_by_id(id)
|
13
|
-
response = Twitch.client.get(:kraken, "channels/#{id}")
|
14
|
-
|
15
|
-
new(response)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/twitch/kraken/clips.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Twitch
|
2
|
-
module Kraken
|
3
|
-
class Clips
|
4
|
-
|
5
|
-
include Initializable
|
6
|
-
|
7
|
-
attr_accessor :id, :title, :slug, :url, :embed_url, :game, :views, :duration, :language, :broadcaster, :curator, :vod, :created_at, :updated_at
|
8
|
-
|
9
|
-
class << self
|
10
|
-
|
11
|
-
# Gets details about a specified clip
|
12
|
-
def get(slug)
|
13
|
-
response = Twitch.client.get(:kraken, "clips/#{slug}")
|
14
|
-
|
15
|
-
new(response)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/twitch/kraken/user.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module Twitch
|
2
|
-
module Kraken
|
3
|
-
class User
|
4
|
-
|
5
|
-
include Initializable
|
6
|
-
|
7
|
-
attr_accessor :id, :name, :display_name, :email, :email_verified, :partnered, :type, :bio, :logo, :created_at, :updated_at
|
8
|
-
|
9
|
-
class << self
|
10
|
-
|
11
|
-
# Gets a user object based on the OAuth token provided
|
12
|
-
# Scopes required: user_read
|
13
|
-
def get
|
14
|
-
response = Twitch.client.get("user")
|
15
|
-
|
16
|
-
new(response)
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/twitch/kraken/users.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
module Twitch
|
2
|
-
module Kraken
|
3
|
-
class Users
|
4
|
-
|
5
|
-
include Initializable
|
6
|
-
|
7
|
-
attr_accessor :id, :name, :display_name, :type, :bio, :logo, :created_at, :updated_at
|
8
|
-
|
9
|
-
class << self
|
10
|
-
|
11
|
-
# Gets a specified user object
|
12
|
-
def get_user_by_id(id)
|
13
|
-
response = Twitch.client.get(:kraken, "users/#{id}")
|
14
|
-
|
15
|
-
new(response)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Gets the user objects for the specified Twitch login names
|
19
|
-
def get_users(username)
|
20
|
-
response = Twitch.client.get(:kraken, "users?login=#{username}")
|
21
|
-
|
22
|
-
if response["users"].count >= 1
|
23
|
-
new(response["users"].first)
|
24
|
-
else
|
25
|
-
raise Twitch::Errors::NotFound
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|