daily-ruby
Daily - the Ruby gem for the Daily
The official library for communicating with the Daily REST API.
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 0.0.2
- Package version: 0.0.2
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
Installation
Add this line to your Gemfile:
gem 'daily-ruby', '~> 0.0.2'
Then run bundle install.
Getting Started
The following example:
- Creates a Daily room.
- Creates a meeting token for the Daily room and associates it with the room
# Load the gem
require 'daily-ruby'
# Setup authorization
Daily.configure do |config|
# Configure Bearer authorization: bearerAuth
config.access_token = ENV['DAILY_API_KEY']
# Configure a proc to get access tokens in lieu of the static access_token configuration
# config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
# Configure faraday connection
# config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' }
end
room_api_instance = Daily::RoomApi.new
opts = {
room_request: Daily::RoomRequest.new(
privacy: 'private',
properties: Daily::RoomRequestProperties.new({
exp: (Time.now + (3600 * 2)).to_i, # Delete the room after two hours
enable_mesh_sfu: true,
sfu_switchover: 0.5
})
)
}
begin
# Create a new room
room = room_api_instance.create_room(opts)
p room
rescue Daily::ApiError => e
puts "Error when calling RoomApi->create_room: #{e}"
end
meeting_token_api_instance = Daily::MeetingTokensApi.new
# Create an owner meeting_token for the room with privacy set to private and
# the expiration set to 2 hours from now.
opts = {
meeting_token_request: Daily::MeetingTokenRequest.new({
properties: Daily::MeetingTokenRequestProperties.new({
is_owner: true,
room_name: room.name,
exp: (Time.now + (3600 * 2)).to_i # Expire the token after two hours
})
})
}
begin
# Create a new meeting token
meeting_token = meeting_token_api_instance.create_meeting_token(opts)
p meeting_token
rescue Daily::ApiError => e
puts "Error when calling MeetingTokensApi->create_meeting_token: #{e}"
end
p "Room url: " + room.url
p "Meeting token: " + meeting_token.token
Documentation for API Endpoints
All URIs are relative to https://api.daily.co/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| Daily::MeetingTokensApi | create_meeting_token | POST /meeting-tokens | Creates a meeting token |
| Daily::RoomApi | create_room | POST /rooms | Create a new room |
| Daily::RoomApi | delete_room | DELETE /rooms/name | Delete room |
| Daily::RoomApi | get_room | GET /rooms/name | Get room |
| Daily::RoomApi | get_rooms | GET /rooms | Get a list rooms |
Documentation for Models
- Daily::MeetingTokenRequest
- Daily::MeetingTokenRequestProperties
- Daily::MeetingTokenRequestPropertiesPermissions
- Daily::MeetingTokenRequestPropertiesPermissionsCanAdmin
- Daily::MeetingTokenRequestPropertiesPermissionsCanSend
- Daily::MeetingTokenResponse
- Daily::RoomDeletedResponse
- Daily::RoomNotFoundResponse
- Daily::RoomRequest
- Daily::RoomRequestProperties
- Daily::RoomResponse
- Daily::ServerErrorResponse
Documentation for Authorization
Authentication schemes defined for the API:
bearerAuth
- Type: Bearer authentication