streamelements 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -21
- data/lib/stream_elements/client.rb +58 -31
- data/lib/stream_elements/configuration.rb +13 -0
- data/lib/stream_elements/models/activity.rb +21 -0
- data/lib/stream_elements/{objects/top_tip.rb → models/channel.rb} +1 -1
- data/lib/stream_elements/models/song_request.rb +56 -0
- data/lib/stream_elements/models/tip.rb +23 -0
- data/lib/stream_elements/models/user.rb +19 -0
- data/lib/stream_elements/object.rb +1 -0
- data/lib/stream_elements/version.rb +1 -1
- data/lib/stream_elements.rb +17 -9
- metadata +9 -12
- data/lib/stream_elements/objects/activity.rb +0 -10
- data/lib/stream_elements/objects/song_request.rb +0 -10
- data/lib/stream_elements/objects/tip.rb +0 -10
- data/lib/stream_elements/objects/top_activity.rb +0 -4
- data/lib/stream_elements/resource.rb +0 -58
- data/lib/stream_elements/resources/activities.rb +0 -17
- data/lib/stream_elements/resources/song_requests.rb +0 -43
- data/lib/stream_elements/resources/tips.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f59098ef3eac1b544e2ddb657c0c3c5abd92df95ca5a7b0c6b1a6263055b0688
|
4
|
+
data.tar.gz: 45073cf8652ed336f7c872dcbc80e153d6d3e64416b19307cb8643c328b961bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753fd8a5d596772a72b9e80283b1ff79088db9f6f08d84423e9e3ca524d0d2c8077a0d781e3744fe9d54f40ec35616a5314428c2cae685f66a37bdf71afbef2b
|
7
|
+
data.tar.gz: 8d3dc3c12760aed80003adcc619ff1a207ecfeab5e01529ca697cbcb2ca78782028f4d25341475515ce4d484cf07cb5cc5130f74e93904c13ef9af23ba4d2b8d
|
data/README.md
CHANGED
@@ -14,28 +14,25 @@ gem "streamelements"
|
|
14
14
|
|
15
15
|
### Authentication
|
16
16
|
|
17
|
-
Firstly you'll need to set
|
17
|
+
Firstly you'll need to set a JWT Token and Channel ID.
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
@client = StreamElements::Client.new(access_token: "")
|
20
|
+
StreamElements.configure do |config|
|
21
|
+
config.token = ENV["STREAMELEMENTS_JWT_TOKEN"]
|
22
|
+
config.channel = ENV["STREAMELEMENTS_CHANNEL_ID"]
|
23
|
+
end
|
25
24
|
```
|
26
25
|
|
27
|
-
Most of the API requires the Channel ID to be passed as an argument.
|
28
|
-
|
29
26
|
### Activities
|
30
27
|
|
31
28
|
```ruby
|
32
29
|
# Retrieve a list of Activities
|
33
30
|
# https://dev.streamelements.com/docs/api-docs/861a5d5450bbb-channel
|
34
|
-
|
31
|
+
StreamElements::Activity.list
|
35
32
|
|
36
33
|
# Retrieve the Top Activities
|
37
34
|
# https://dev.streamelements.com/docs/api-docs/2ce44d058b16b-channel-top
|
38
|
-
|
35
|
+
StreamElements::Activity.top
|
39
36
|
```
|
40
37
|
|
41
38
|
### Tips
|
@@ -43,44 +40,61 @@ Most of the API requires the Channel ID to be passed as an argument.
|
|
43
40
|
```ruby
|
44
41
|
# Retrieve a list of Tips
|
45
42
|
# https://dev.streamelements.com/docs/api-docs/704e5580be2d9-channel
|
46
|
-
|
43
|
+
StreamElements::Tip.list
|
47
44
|
|
48
45
|
# Retrieve a Tip
|
49
|
-
|
46
|
+
StreamElements::Tip.retrieve(id: "tip-id")
|
50
47
|
|
51
48
|
# Retrieve the Tip Tips
|
52
49
|
# https://dev.streamelements.com/docs/api-docs/b404f906817c4-channel-top
|
53
|
-
|
50
|
+
StreamElements::Tip.top
|
54
51
|
```
|
55
52
|
|
56
53
|
### Song Requests
|
57
54
|
|
58
55
|
```ruby
|
59
56
|
# Retrieve the current playing song
|
60
|
-
|
57
|
+
StreamElements::SongRequest.playing
|
61
58
|
|
62
59
|
# Retrieve a list of songs in the queue
|
63
|
-
|
60
|
+
StreamElements::SongRequest.queue
|
64
61
|
|
65
62
|
# Retrieve a list of previous songs
|
66
|
-
|
63
|
+
StreamElements::SongRequest.queue
|
67
64
|
|
68
65
|
# Add a song to the queue
|
69
66
|
# video is the YouTube video ID or URL
|
70
|
-
|
67
|
+
StreamElements::SongRequest.add(video: "video-id")
|
71
68
|
|
72
69
|
# Pause the player
|
73
|
-
|
70
|
+
StreamElements::SongRequest.pause
|
74
71
|
|
75
72
|
# Resume the player
|
76
|
-
|
73
|
+
StreamElements::SongRequest.play
|
77
74
|
|
78
75
|
# Set the volume of the player
|
79
76
|
# volume is a number between 0 and 100
|
80
|
-
|
77
|
+
StreamElements::SongRequest.volume(volume: 50)
|
81
78
|
|
82
79
|
# Skip the current song
|
83
|
-
|
80
|
+
StreamElements::SongRequest.skip
|
81
|
+
|
82
|
+
# Get the current song request settings
|
83
|
+
StreamElements::SongRequest.settings
|
84
|
+
|
85
|
+
# Set the current song request settings
|
86
|
+
# settings is a hash of settings
|
87
|
+
StreamElements::SongRequest.update_settings(settings: { max_requests: 5 })
|
88
|
+
```
|
89
|
+
|
90
|
+
### Users
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
# Get the current user
|
94
|
+
StreamElements::User.current
|
95
|
+
|
96
|
+
# Get the users Channels
|
97
|
+
StreamElements::User.channels
|
84
98
|
```
|
85
99
|
|
86
100
|
## Contributing
|
@@ -1,47 +1,74 @@
|
|
1
1
|
module StreamElements
|
2
2
|
class Client
|
3
|
-
BASE_URL = "https://api.streamelements.com/kappa/v2"
|
4
3
|
|
5
|
-
|
4
|
+
class << self
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@adapter = adapter
|
11
|
-
end
|
6
|
+
def connection
|
7
|
+
@connection ||= Faraday.new("https://api.streamelements.com/kappa/v2") do |conn|
|
8
|
+
conn.request :authorization, :Bearer, StreamElements.config.token
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
conn.headers = {
|
11
|
+
"User-Agent" => "streamelements/v#{VERSION} (github.com/deanpcmad/streamelements)"
|
12
|
+
}
|
16
13
|
|
17
|
-
|
18
|
-
TipsResource.new(self)
|
19
|
-
end
|
20
|
-
|
21
|
-
def song_requests
|
22
|
-
SongRequestsResource.new(self)
|
23
|
-
end
|
14
|
+
conn.request :json
|
24
15
|
|
25
|
-
|
26
|
-
@connection ||= Faraday.new(BASE_URL) do |conn|
|
27
|
-
if jwt_access_token
|
28
|
-
conn.request :authorization, :Bearer, jwt_access_token
|
29
|
-
elsif access_token
|
30
|
-
conn.request :authorization, :Bearer, access_token
|
31
|
-
else
|
32
|
-
raise Error, "You must provide a jwt or access token."
|
16
|
+
conn.response :json, content_type: "application/json"
|
33
17
|
end
|
18
|
+
end
|
34
19
|
|
35
|
-
conn.headers = {
|
36
|
-
"User-Agent" => "streamelements/v#{VERSION} (github.com/deanpcmad/streamelements)"
|
37
|
-
}
|
38
20
|
|
39
|
-
|
21
|
+
def get_request(url, params: {}, headers: {})
|
22
|
+
handle_response connection.get(replace_channel(url), params, headers)
|
23
|
+
end
|
40
24
|
|
41
|
-
|
25
|
+
def post_request(url, body: {}, headers: {})
|
26
|
+
handle_response connection.post(replace_channel(url), body, headers)
|
27
|
+
end
|
28
|
+
|
29
|
+
def put_request(url, body: {}, headers: {})
|
30
|
+
handle_response connection.put(replace_channel(url), body, headers)
|
31
|
+
end
|
42
32
|
|
43
|
-
|
33
|
+
def patch_request(url, body:, headers: {})
|
34
|
+
handle_response connection.patch(replace_channel(url), body, headers)
|
44
35
|
end
|
36
|
+
|
37
|
+
def delete_request(url, headers: {})
|
38
|
+
handle_response connection.delete(replace_channel(url), headers)
|
39
|
+
end
|
40
|
+
|
41
|
+
def replace_channel(url)
|
42
|
+
url.gsub(":channel", StreamElements.config.channel)
|
43
|
+
end
|
44
|
+
|
45
|
+
def handle_response(response)
|
46
|
+
case response.status
|
47
|
+
when 400
|
48
|
+
raise Error, "Error 400: Your request was malformed. '#{response.body["error"]}'"
|
49
|
+
when 401
|
50
|
+
raise Error, "Error 401: You did not supply valid authentication credentials. '#{response.body["error"]}'"
|
51
|
+
when 403
|
52
|
+
raise Error, "Error 403: You are not allowed to perform that action. '#{response.body["error"]}'"
|
53
|
+
when 404
|
54
|
+
raise Error, "Error 404: No results were found for your request. '#{response.body["error"]}'"
|
55
|
+
when 409
|
56
|
+
raise Error, "Error 409: Your request was a conflict. '#{response.body["error"]}'"
|
57
|
+
when 429
|
58
|
+
raise Error, "Error 429: Your request exceeded the API rate limit. '#{response.body["error"]}'"
|
59
|
+
when 500
|
60
|
+
raise Error, "Error 500: We were unable to perform the request due to server-side problems. '#{response.body["error"]}'"
|
61
|
+
when 503
|
62
|
+
raise Error, "Error 503: You have been rate limited for sending more than 20 requests per second. '#{response.body["error"]}'"
|
63
|
+
when 501
|
64
|
+
raise Error, "Error 501: This resource has not been implemented. '#{response.body["error"]}'"
|
65
|
+
when 204
|
66
|
+
return true
|
67
|
+
end
|
68
|
+
|
69
|
+
response
|
70
|
+
end
|
71
|
+
|
45
72
|
end
|
46
73
|
|
47
74
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module StreamElements
|
2
|
+
class Activity < Object
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def list(after:, before:, limit:, types:, **params)
|
7
|
+
attrs = { after: after, before: before, limit: limit, types: types }.merge(params)
|
8
|
+
response = Client.get_request("activities/:channel", params: attrs)
|
9
|
+
Collection.from_response(response, type: Activity)
|
10
|
+
end
|
11
|
+
|
12
|
+
def top(period:, offset:, limit:, type:)
|
13
|
+
attrs = { period: period, offset: offset, limit: limit, type: type }
|
14
|
+
response = Client.get_request("activities/:channel/top", params: attrs)
|
15
|
+
# Collection.from_response(response, type: TopActivity)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module StreamElements
|
2
|
+
class SongRequest < Object
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def playing
|
7
|
+
SongRequest.new Client.get_request("songrequest/:channel/playing").body
|
8
|
+
end
|
9
|
+
|
10
|
+
def queue
|
11
|
+
response = Client.get_request("songrequest/:channel/queue")
|
12
|
+
Collection.from_response(response, type: SongRequest)
|
13
|
+
end
|
14
|
+
|
15
|
+
def history(**params)
|
16
|
+
response = Client.get_request("songrequest/:channel/history", params: params)
|
17
|
+
Collection.from_response(response, type: SongRequest, name: "history")
|
18
|
+
end
|
19
|
+
|
20
|
+
def settings
|
21
|
+
Client.get_request("songrequest/:channel/settings").body
|
22
|
+
end
|
23
|
+
|
24
|
+
def update_settings(settings:)
|
25
|
+
response = Client.put_request("songrequest/:channel/settings", body: settings)
|
26
|
+
response.success?
|
27
|
+
end
|
28
|
+
|
29
|
+
def add(video:)
|
30
|
+
SongRequest.new Client.post_request("songrequest/:channel/queue", body: { video: video }).body
|
31
|
+
end
|
32
|
+
|
33
|
+
def pause
|
34
|
+
response = Client.post_request("songrequest/:channel/player/pause", body: {})
|
35
|
+
response.success?
|
36
|
+
end
|
37
|
+
|
38
|
+
def play
|
39
|
+
response = Client.post_request("songrequest/:channel/player/play", body: {})
|
40
|
+
response.success?
|
41
|
+
end
|
42
|
+
|
43
|
+
def volume(volume:)
|
44
|
+
response = Client.post_request("songrequest/:channel/player/volume", body: {volume: volume})
|
45
|
+
response.success?
|
46
|
+
end
|
47
|
+
|
48
|
+
def skip
|
49
|
+
response = Client.post_request("songrequest/:channel/skip", body: {})
|
50
|
+
response.success?
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module StreamElements
|
2
|
+
class Tip < Object
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def list(**params)
|
7
|
+
response = Client.get_request("tips/:channel", params: params)
|
8
|
+
Collection.from_response(response, type: Tip, name: "docs")
|
9
|
+
end
|
10
|
+
|
11
|
+
def retrieve(id:)
|
12
|
+
Tip.new Client.get_request("tips/:channel/#{id}").body
|
13
|
+
end
|
14
|
+
|
15
|
+
def top
|
16
|
+
response = Client.get_request("tips/:channel/top")
|
17
|
+
# Collection.from_response(response, type: TopTip)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module StreamElements
|
2
|
+
class User < Object
|
3
|
+
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def current
|
7
|
+
response = Client.get_request("users/current")
|
8
|
+
User.new response.body
|
9
|
+
end
|
10
|
+
|
11
|
+
def channels
|
12
|
+
response = Client.get_request("users/channels")
|
13
|
+
Collection.from_response(response, type: Channel)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/stream_elements.rb
CHANGED
@@ -6,20 +6,28 @@ require "stream_elements/version"
|
|
6
6
|
|
7
7
|
module StreamElements
|
8
8
|
|
9
|
+
autoload :Configuration, "stream_elements/configuration"
|
9
10
|
autoload :Client, "stream_elements/client"
|
10
11
|
autoload :Collection, "stream_elements/collection"
|
11
12
|
autoload :Error, "stream_elements/error"
|
12
|
-
autoload :Resource, "stream_elements/resource"
|
13
13
|
autoload :Object, "stream_elements/object"
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
class << self
|
16
|
+
attr_writer :config
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
def self.configure
|
20
|
+
yield(config) if block_given?
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.config
|
24
|
+
@config ||= StreamElements::Configuration.new
|
25
|
+
end
|
26
|
+
|
27
|
+
autoload :Activity, "stream_elements/models/activity"
|
28
|
+
autoload :Tip, "stream_elements/models/tip"
|
29
|
+
autoload :SongRequest, "stream_elements/models/song_request"
|
30
|
+
autoload :User, "stream_elements/models/user"
|
31
|
+
autoload :Channel, "stream_elements/models/channel"
|
24
32
|
|
25
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streamelements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.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-12-
|
11
|
+
date: 2023-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -38,17 +38,14 @@ files:
|
|
38
38
|
- lib/stream_elements.rb
|
39
39
|
- lib/stream_elements/client.rb
|
40
40
|
- lib/stream_elements/collection.rb
|
41
|
+
- lib/stream_elements/configuration.rb
|
41
42
|
- lib/stream_elements/error.rb
|
43
|
+
- lib/stream_elements/models/activity.rb
|
44
|
+
- lib/stream_elements/models/channel.rb
|
45
|
+
- lib/stream_elements/models/song_request.rb
|
46
|
+
- lib/stream_elements/models/tip.rb
|
47
|
+
- lib/stream_elements/models/user.rb
|
42
48
|
- lib/stream_elements/object.rb
|
43
|
-
- lib/stream_elements/objects/activity.rb
|
44
|
-
- lib/stream_elements/objects/song_request.rb
|
45
|
-
- lib/stream_elements/objects/tip.rb
|
46
|
-
- lib/stream_elements/objects/top_activity.rb
|
47
|
-
- lib/stream_elements/objects/top_tip.rb
|
48
|
-
- lib/stream_elements/resource.rb
|
49
|
-
- lib/stream_elements/resources/activities.rb
|
50
|
-
- lib/stream_elements/resources/song_requests.rb
|
51
|
-
- lib/stream_elements/resources/tips.rb
|
52
49
|
- lib/stream_elements/version.rb
|
53
50
|
- lib/streamelements.rb
|
54
51
|
- sig/streamelements.rbs
|
@@ -71,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
68
|
- !ruby/object:Gem::Version
|
72
69
|
version: '0'
|
73
70
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
71
|
+
rubygems_version: 3.5.1
|
75
72
|
signing_key:
|
76
73
|
specification_version: 4
|
77
74
|
summary: Ruby library for the StreamElements API
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module StreamElements
|
2
|
-
class Resource
|
3
|
-
attr_reader :client
|
4
|
-
|
5
|
-
def initialize(client)
|
6
|
-
@client = client
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def get_request(url, params: {}, headers: {})
|
12
|
-
handle_response client.connection.get(url, params, headers)
|
13
|
-
end
|
14
|
-
|
15
|
-
def post_request(url, body:, headers: {})
|
16
|
-
handle_response client.connection.post(url, body, headers)
|
17
|
-
end
|
18
|
-
|
19
|
-
def patch_request(url, body:, headers: {})
|
20
|
-
handle_response client.connection.patch(url, body, headers)
|
21
|
-
end
|
22
|
-
|
23
|
-
def put_request(url, body:, headers: {})
|
24
|
-
handle_response client.connection.put(url, body, headers)
|
25
|
-
end
|
26
|
-
|
27
|
-
def delete_request(url, params: {}, headers: {})
|
28
|
-
handle_response client.connection.delete(url, params, headers)
|
29
|
-
end
|
30
|
-
|
31
|
-
def handle_response(response)
|
32
|
-
case response.status
|
33
|
-
when 400
|
34
|
-
raise Error, "Error 400: Your request was malformed. '#{response.body["message"]}'"
|
35
|
-
when 401
|
36
|
-
raise Error, "Error 401: You did not supply valid authentication credentials. '#{response.body["error"]}'"
|
37
|
-
when 403
|
38
|
-
raise Error, "Error 403: You are not allowed to perform that action. '#{response.body["error"]}'"
|
39
|
-
when 404
|
40
|
-
raise Error, "Error 404: No results were found for your request. '#{response.body["error"]}'"
|
41
|
-
when 409
|
42
|
-
raise Error, "Error 409: Your request was a conflict. '#{response.body["message"]}'"
|
43
|
-
when 422
|
44
|
-
raise Error, "Error 422: Unprocessable Entity. '#{response.body["message"]}"
|
45
|
-
when 429
|
46
|
-
raise Error, "Error 429: Your request exceeded the API rate limit. '#{response.body["error"]}'"
|
47
|
-
when 500
|
48
|
-
raise Error, "Error 500: We were unable to perform the request due to server-side problems. '#{response.body["error"]}'"
|
49
|
-
when 503
|
50
|
-
raise Error, "Error 503: You have been rate limited for sending more than 20 requests per second. '#{response.body["error"]}'"
|
51
|
-
when 204
|
52
|
-
return true
|
53
|
-
end
|
54
|
-
|
55
|
-
response
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module StreamElements
|
2
|
-
class ActivitiesResource < Resource
|
3
|
-
|
4
|
-
def list(channel:, after:, before:, limit:, types:, **params)
|
5
|
-
attrs = { after: after, before: before, limit: limit, types: types }.merge(params)
|
6
|
-
response = get_request("activities/#{channel}", params: attrs)
|
7
|
-
Collection.from_response(response, type: Activity)
|
8
|
-
end
|
9
|
-
|
10
|
-
def top(channel:, period:, offset:, limit:, type:)
|
11
|
-
attrs = { period: period, offset: offset, limit: limit, type: type }
|
12
|
-
response = get_request("activities/#{channel}/top", params: attrs)
|
13
|
-
Collection.from_response(response, type: TopActivity)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module StreamElements
|
2
|
-
class SongRequestsResource < Resource
|
3
|
-
|
4
|
-
def playing(channel:)
|
5
|
-
SongRequest.new get_request("songrequest/#{channel}/playing").body
|
6
|
-
end
|
7
|
-
|
8
|
-
def queue(channel:)
|
9
|
-
response = get_request("songrequest/#{channel}/queue")
|
10
|
-
Collection.from_response(response, type: SongRequest)
|
11
|
-
end
|
12
|
-
|
13
|
-
def history(channel:, **params)
|
14
|
-
response = get_request("songrequest/#{channel}/history", params: params)
|
15
|
-
Collection.from_response(response, type: SongRequest, name: "history")
|
16
|
-
end
|
17
|
-
|
18
|
-
def add(channel:, video:)
|
19
|
-
SongRequest.new post_request("songrequest/#{channel}/queue", body: { video: video }).body
|
20
|
-
end
|
21
|
-
|
22
|
-
def pause(channel:)
|
23
|
-
response = post_request("songrequest/#{channel}/player/pause", body: {})
|
24
|
-
response.success?
|
25
|
-
end
|
26
|
-
|
27
|
-
def play(channel:)
|
28
|
-
response = post_request("songrequest/#{channel}/player/play", body: {})
|
29
|
-
response.success?
|
30
|
-
end
|
31
|
-
|
32
|
-
def volume(channel:, volume:)
|
33
|
-
response = post_request("songrequest/#{channel}/player/volume", body: {volume: volume})
|
34
|
-
response.success?
|
35
|
-
end
|
36
|
-
|
37
|
-
def skip(channel:)
|
38
|
-
response = post_request("songrequest/#{channel}/skip", body: {})
|
39
|
-
response.success?
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module StreamElements
|
2
|
-
class TipsResource < Resource
|
3
|
-
|
4
|
-
def list(channel:, **params)
|
5
|
-
response = get_request("tips/#{channel}", params: params)
|
6
|
-
Collection.from_response(response, type: Tip, name: "docs")
|
7
|
-
end
|
8
|
-
|
9
|
-
def retrieve(channel:, id:)
|
10
|
-
Tip.new get_request("tips/#{channel}/#{id}").body
|
11
|
-
end
|
12
|
-
|
13
|
-
def top(channel:)
|
14
|
-
response = get_request("tips/#{channel}/top")
|
15
|
-
Collection.from_response(response, type: TopTip)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|