Skip to content

Commit

Permalink
docs: Update README.md with a better example
Browse files Browse the repository at this point in the history
  • Loading branch information
jamsea committed Feb 26, 2024
1 parent 2fca7d8 commit 75b68a3
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 121 deletions.
136 changes: 71 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,18 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g

## Installation

### Build a gem

To build the Ruby code into a gem:

```shell
gem build daily-ruby.gemspec
```

Then either install the gem locally:

```shell
gem install ./daily-ruby-0.0.1.gem
```

(for development, run `gem install --dev ./daily-ruby-0.0.1.gem` to install the development dependencies)

or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).

Finally add this to the Gemfile:
Add this line to your Gemfile:

gem 'daily-ruby', '~> 0.0.1'

### Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'daily-ruby', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

### Include the Ruby code directly

Include the Ruby code directly using `-I` as follows:

```shell
ruby -Ilib script.rb
```
Then run `bundle install`.

## Getting Started

Please follow the [installation](#installation) procedure and then run the following code:
The following example:

1. Creates a Daily room.
2. Creates a meeting token for the Daily room and associates it with the room

```ruby
# Load the gem
Expand All @@ -59,62 +32,95 @@ require 'daily-ruby'
# Setup authorization
Daily.configure do |config|
# Configure Bearer authorization: bearerAuth
config.access_token = 'YOUR_BEARER_TOKEN'
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' }
# config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
# Configure faraday connection
config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' }
# 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

api_instance = Daily::MeetingTokensApi.new
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 # MeetingTokenRequest | A room object
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
#Creates a meeting token
result = api_instance.create_meeting_token(opts)
p result
# Create a new meeting token
meeting_token = meeting_token_api_instance.create_meeting_token(opts)
p meeting_token
rescue Daily::ApiError => e
puts "Exception when calling MeetingTokensApi->create_meeting_token: #{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**](docs/MeetingTokensApi.md#create_meeting_token) | **POST** /meeting-tokens | Creates a meeting token
*Daily::RoomApi* | [**create_room**](docs/RoomApi.md#create_room) | **POST** /rooms | Create a new room
*Daily::RoomApi* | [**delete_room**](docs/RoomApi.md#delete_room) | **DELETE** /rooms/{name} | Delete room
*Daily::RoomApi* | [**get_room**](docs/RoomApi.md#get_room) | **GET** /rooms/{name} | Get room
*Daily::RoomApi* | [**get_rooms**](docs/RoomApi.md#get_rooms) | **GET** /rooms | Get a list rooms

| Class | Method | HTTP request | Description |
| ------------------------- | ------------------------------------------------------------------------- | ------------------------ | ----------------------- |
| _Daily::MeetingTokensApi_ | [**create_meeting_token**](docs/MeetingTokensApi.md#create_meeting_token) | **POST** /meeting-tokens | Creates a meeting token |
| _Daily::RoomApi_ | [**create_room**](docs/RoomApi.md#create_room) | **POST** /rooms | Create a new room |
| _Daily::RoomApi_ | [**delete_room**](docs/RoomApi.md#delete_room) | **DELETE** /rooms/{name} | Delete room |
| _Daily::RoomApi_ | [**get_room**](docs/RoomApi.md#get_room) | **GET** /rooms/{name} | Get room |
| _Daily::RoomApi_ | [**get_rooms**](docs/RoomApi.md#get_rooms) | **GET** /rooms | Get a list rooms |

## Documentation for Models

- [Daily::MeetingTokenRequest](docs/MeetingTokenRequest.md)
- [Daily::MeetingTokenRequestProperties](docs/MeetingTokenRequestProperties.md)
- [Daily::MeetingTokenRequestPropertiesPermissions](docs/MeetingTokenRequestPropertiesPermissions.md)
- [Daily::MeetingTokenRequestPropertiesPermissionsCanAdmin](docs/MeetingTokenRequestPropertiesPermissionsCanAdmin.md)
- [Daily::MeetingTokenRequestPropertiesPermissionsCanSend](docs/MeetingTokenRequestPropertiesPermissionsCanSend.md)
- [Daily::MeetingTokenResponse](docs/MeetingTokenResponse.md)
- [Daily::RoomDeletedResponse](docs/RoomDeletedResponse.md)
- [Daily::RoomNotFoundResponse](docs/RoomNotFoundResponse.md)
- [Daily::RoomRequest](docs/RoomRequest.md)
- [Daily::RoomRequestProperties](docs/RoomRequestProperties.md)
- [Daily::RoomResponse](docs/RoomResponse.md)
- [Daily::ServerErrorResponse](docs/ServerErrorResponse.md)

- [Daily::MeetingTokenRequest](docs/MeetingTokenRequest.md)
- [Daily::MeetingTokenRequestProperties](docs/MeetingTokenRequestProperties.md)
- [Daily::MeetingTokenRequestPropertiesPermissions](docs/MeetingTokenRequestPropertiesPermissions.md)
- [Daily::MeetingTokenRequestPropertiesPermissionsCanAdmin](docs/MeetingTokenRequestPropertiesPermissionsCanAdmin.md)
- [Daily::MeetingTokenRequestPropertiesPermissionsCanSend](docs/MeetingTokenRequestPropertiesPermissionsCanSend.md)
- [Daily::MeetingTokenResponse](docs/MeetingTokenResponse.md)
- [Daily::RoomDeletedResponse](docs/RoomDeletedResponse.md)
- [Daily::RoomNotFoundResponse](docs/RoomNotFoundResponse.md)
- [Daily::RoomRequest](docs/RoomRequest.md)
- [Daily::RoomRequestProperties](docs/RoomRequestProperties.md)
- [Daily::RoomResponse](docs/RoomResponse.md)
- [Daily::ServerErrorResponse](docs/ServerErrorResponse.md)

## Documentation for Authorization


Authentication schemes defined for the API:

### bearerAuth

- **Type**: Bearer authentication

56 changes: 0 additions & 56 deletions script.rb

This file was deleted.

0 comments on commit 75b68a3

Please sign in to comment.