26 lines
451 B
Ruby
26 lines
451 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Daily
|
|
include HTTParty
|
|
base_uri 'api.daily.co/v1'
|
|
|
|
class << self
|
|
def create_room
|
|
response = post "#{base_uri}/rooms", headers: headers
|
|
|
|
if response.code != 200
|
|
throw StandardError.new('Failed to create a room')
|
|
end
|
|
|
|
response.parsed_response
|
|
end
|
|
|
|
private
|
|
|
|
def headers
|
|
{
|
|
'Authorization': "Bearer #{ENV['DAILYCO_API_KEY']}"
|
|
}
|
|
end
|
|
end
|
|
end |