Class: Twitch::StreamScheduleResource
- Defined in:
- lib/twitch/resources/stream_schedule.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#create_segment(broadcaster_id:, start_time:, timezone:, duration:, is_recurring:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token.
-
#delete_segment(broadcaster_id:, id:) ⇒ Object
Broadcaster ID must match the user in the OAuth token.
-
#icalendar(broadcaster_id:) ⇒ Object
Broadcaster ID must match the user in the OAuth token.
-
#list(broadcaster_id:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token.
-
#update(broadcaster_id:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token TODO: Allow the user to put any date format and then convert it to RFC3339.
-
#update_segment(broadcaster_id:, id:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Twitch::Resource
Instance Method Details
#create_segment(broadcaster_id:, start_time:, timezone:, duration:, is_recurring:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token
24 25 26 27 28 29 |
# File 'lib/twitch/resources/stream_schedule.rb', line 24 def create_segment(broadcaster_id:, start_time:, timezone:, duration:, is_recurring:, **params) attrs = { broadcaster_id: broadcaster_id, start_time: start_time, duration: duration, timezone: timezone, is_recurring: is_recurring } response = post_request("schedule/segment", body: attrs.merge(params)) StreamSchedule.new(response.body) if response.success? end |
#delete_segment(broadcaster_id:, id:) ⇒ Object
Broadcaster ID must match the user in the OAuth token
40 41 42 43 |
# File 'lib/twitch/resources/stream_schedule.rb', line 40 def delete_segment(broadcaster_id:, id:) attrs = { broadcaster_id: broadcaster_id, id: id } delete_request("schedule/segment", params: attrs) end |
#icalendar(broadcaster_id:) ⇒ Object
Broadcaster ID must match the user in the OAuth token
11 12 13 14 15 |
# File 'lib/twitch/resources/stream_schedule.rb', line 11 def icalendar(broadcaster_id:) response = get_request("schedule/icalendar", params: { broadcaster_id: broadcaster_id }) response.body end |
#list(broadcaster_id:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token
4 5 6 7 8 |
# File 'lib/twitch/resources/stream_schedule.rb', line 4 def list(broadcaster_id:, **params) response = get_request("schedule", params: params.merge(broadcaster_id: broadcaster_id)) StreamSchedule.new(response.body) if response.success? end |
#update(broadcaster_id:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token TODO: Allow the user to put any date format and then convert it to RFC3339
19 20 21 |
# File 'lib/twitch/resources/stream_schedule.rb', line 19 def update(broadcaster_id:, **params) patch_request("schedule/settings", body: params.merge(broadcaster_id: broadcaster_id)) end |
#update_segment(broadcaster_id:, id:, **params) ⇒ Object
Broadcaster ID must match the user in the OAuth token
32 33 34 35 36 37 |
# File 'lib/twitch/resources/stream_schedule.rb', line 32 def update_segment(broadcaster_id:, id:, **params) attrs = { broadcaster_id: broadcaster_id, id: id } response = patch_request("schedule/segment", body: attrs.merge(params)) StreamSchedule.new(response.body) if response.success? end |