Skip to content

Commit

Permalink
feat: add new endpoints, fix others (#1)
Browse files Browse the repository at this point in the history
* feat: add new endpoints, fix others

* Update gemfile

* Update github action

* docs: Update README.md with a better example

* Remove push step and bump version number

* Update Gemfile.lock
  • Loading branch information
jamsea authored Feb 26, 2024
1 parent 6015d94 commit 1026fb0
Show file tree
Hide file tree
Showing 47 changed files with 391 additions and 222 deletions.
36 changes: 24 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
name: CI
name: Ruby CI

on:
push:
pull_request:
branches:
- main
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["3.0", "3.1"]

steps:
- uses: actions/checkout@v2

- name: Set up Ruby 3.0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Install dependencies
run: make install
- name: Ruby version
run: ruby -v

- name: Run Rubocop
run: make lint
- name: Bundle config
run: bundle config set --local deployment true

- name: Bundle install
run: bundle install -j $(nproc)

- name: Run RSpec
run: bundle exec rspec

- name: Build the gem
run: bundle exec rake build

- name: Install the gem
run: bundle exec rake install
7 changes: 3 additions & 4 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
.gitignore
.gitlab-ci.yml
.openapi-generator-ignore
.rspec
.rubocop.yml
.travis.yml
Gemfile
README.md
Rakefile
daily-ruby.gemspec
docs/CreateMeetingToken200Response.md
docs/MeetingTokenRequest.md
docs/MeetingTokenRequestProperties.md
docs/MeetingTokenRequestPropertiesPermissions.md
docs/MeetingTokenRequestPropertiesPermissionsCanAdmin.md
docs/MeetingTokenRequestPropertiesPermissionsCanSend.md
docs/MeetingTokenResponse.md
docs/MeetingTokensApi.md
docs/RoomApi.md
docs/RoomDeletedResponse.md
Expand All @@ -29,12 +28,12 @@ lib/daily-ruby/api/room_api.rb
lib/daily-ruby/api_client.rb
lib/daily-ruby/api_error.rb
lib/daily-ruby/configuration.rb
lib/daily-ruby/models/create_meeting_token200_response.rb
lib/daily-ruby/models/meeting_token_request.rb
lib/daily-ruby/models/meeting_token_request_properties.rb
lib/daily-ruby/models/meeting_token_request_properties_permissions.rb
lib/daily-ruby/models/meeting_token_request_properties_permissions_can_admin.rb
lib/daily-ruby/models/meeting_token_request_properties_permissions_can_send.rb
lib/daily-ruby/models/meeting_token_response.rb
lib/daily-ruby/models/room_deleted_response.rb
lib/daily-ruby/models/room_not_found_response.rb
lib/daily-ruby/models/room_request.rb
Expand All @@ -44,12 +43,12 @@ lib/daily-ruby/models/server_error_response.rb
lib/daily-ruby/version.rb
spec/api/meeting_tokens_api_spec.rb
spec/api/room_api_spec.rb
spec/models/create_meeting_token200_response_spec.rb
spec/models/meeting_token_request_properties_permissions_can_admin_spec.rb
spec/models/meeting_token_request_properties_permissions_can_send_spec.rb
spec/models/meeting_token_request_properties_permissions_spec.rb
spec/models/meeting_token_request_properties_spec.rb
spec/models/meeting_token_request_spec.rb
spec/models/meeting_token_response_spec.rb
spec/models/room_deleted_response_spec.rb
spec/models/room_not_found_response_spec.rb
spec/models/room_request_properties_spec.rb
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ script:
- bundle install --path vendor/bundle
- bundle exec rspec
- gem build daily-ruby.gemspec
- gem install ./daily-ruby-0.0.0.gem
- gem install ./daily-ruby-0.0.2.gem
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
daily-ruby (0.0.0)
daily-ruby (0.0.1)
faraday (>= 1.0.1, < 3.0)
faraday-multipart

Expand Down
141 changes: 74 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,24 @@ The official library for communicating with the Daily REST API.

This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 0.0.0
- Package version: 0.0.0
- API version: 0.0.2
- Package version: 0.0.2
- Build package: org.openapitools.codegen.languages.RubyClientCodegen

## Installation

### Build a gem
Add this line to your Gemfile:

To build the Ruby code into a gem:
gem 'daily-ruby', '~> 0.0.2'

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

Then either install the gem locally:

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

(for development, run `gem install --dev ./daily-ruby-0.0.0.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:

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

### 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,61 +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_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::CreateMeetingToken200Response](docs/CreateMeetingToken200Response.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::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

2 changes: 1 addition & 1 deletion daily-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#The official library for communicating with the Daily REST API.
The version of the OpenAPI document: 0.0.0
The version of the OpenAPI document: 0.0.2
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 7.3.0
Expand Down
Loading

0 comments on commit 1026fb0

Please sign in to comment.