Class: Twitch::ClipsResource
- Defined in:
- lib/twitch/resources/clips.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#create(broadcaster_id:, **attributes) ⇒ Object
Required scope: clips:edit.
- #list(**params) ⇒ Object
- #retrieve(id:) ⇒ Object
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Twitch::Resource
Instance Method Details
#create(broadcaster_id:, **attributes) ⇒ Object
Required scope: clips:edit
15 16 17 18 19 |
# File 'lib/twitch/resources/clips.rb', line 15 def create(broadcaster_id:, **attributes) response = post_request("clips", body: attributes.merge(broadcaster_id: broadcaster_id)) Clip.new(response.body.dig("data")[0]) if response.success? end |
#list(**params) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/twitch/resources/clips.rb', line 3 def list(**params) raise "broadcaster_id or game_id is required" unless !params[:broadcaster_id].nil? || !params[:game_id].nil? response = get_request("clips", params: params) Collection.from_response(response, type: Clip) end |