Class: Twitch::RaidsResource

Inherits:
Resource show all
Defined in:
lib/twitch/resources/raids.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Twitch::Resource

Instance Method Details

#create(from_broadcaster_id:, to_broadcaster_id:) ⇒ Object

from_broadcaster_id must match the user in the OAuth token



4
5
6
7
8
9
10
# File 'lib/twitch/resources/raids.rb', line 4

def create(from_broadcaster_id:, to_broadcaster_id:)
  attrs = { from_broadcaster_id: from_broadcaster_id, to_broadcaster_id: to_broadcaster_id }

  response = post_request("raids", body: attrs)

  Raid.new(response.body.dig("data")[0]) if response.success?
end

#delete(broadcaster_id:) ⇒ Object

broadcaster_id must match the user in the OAuth token



13
14
15
# File 'lib/twitch/resources/raids.rb', line 13

def delete(broadcaster_id:)
  delete_request("raids?broadcaster_id=#{broadcaster_id}")
end