Skip to main content
Version: 2.0.0

Ruby

Install#

Add the following line to your Gemfile:

gem 'resemble'

Alternatively, just run bundle add resemble

Usage#

Authentication#

Before using the library, set your api key.

1 2 3 require 'resemble' Resemble.api_key = 'YOUR_API_TOKEN'

Projects#

Get all projects#

page = 1page_size = 10
response = Resemble::V2::Project.all(page, page_size)projects = response['items']

Create a project#

name = 'My project'description = 'My description'is_public = falseis_archived = falseis_collaborative = false
response = Resemble::V2::Project.create(name, description, is_public, is_collaborative, is_archived)project = response['item']

Update a project#

project_uuid = '<project_uuid>'name = 'My project (archived)'description = 'My description (this project has been archived)'is_public = falseis_archived = trueis_collaborative = false
response = Resemble::V2::Project.update(project_uuid, name, description, is_public, is_collaborative, is_archived)project = response['item']

Get a project#

project_uuid = '<project_uuid>'
response = Resemble::V2::Project.get(project_uuid)project = response['item']

Delete a project#

project_uuid = '<project_uuid>'
response = Resemble::V2::Project.delete(project_uuid)

Voices#

Get all voices#

page = 1page_size = 10
response = Resemble::V2::Voice.all(page, page_size)voices = response['items']

Create a voice#

name = 'Test Voice'
response = Resemble::V2::Voice.create(name)voice = response['item']

Update a voice#

voice_uuid = '<uuid>'updated_name = 'Test voice'
response = Resemble::V2::Voice.update(voice_uuid, updated_name)voice = response['item']

Build a voice#

voice_uuid = '<voice_uuid>'
response = Resemble::V2::Voice.build(voice_uuid)

Get a voice#

voice_uuid = '<voice_uuid>'
response = Resemble::V2::Voice.get(voice_uuid)voice = response['item']

Delete a voice#

voice_uuid = '<voice_uuid>'
response = Resemble::V2::Voice.delete(voice_uuid)

Recordings#

Get all recordings#

voice_uuid = '<voice_uuid>'page = 1page_size = 10
response = Resemble::V2::Recording.all(voice_uuid, page, page_size)recordings = response['items']

Create a recording#

voice_uuid = '<voice_uuid>'name = 'recording'text = 'This is a test'is_active = trueemotion = 'neutral'
File.open('path/to/audio.wav') do |file|  response = Resemble::V2::Recording.create(voice_uuid, file, name, text, is_active, emotion)  recording = response['item']end

Update a recording#

voice_uuid = '<voice_uuid>'recording_uuid = '<uuid>'name = 'recording'text = 'This is a test'is_active = trueemotion = 'neutral'
response = Resemble::V2::Recording.update(voice_uuid, recording_uuid, name, text, is_active, emotion)recording = response['item']

Get a recording#

voice_uuid = '<voice_uuid>'recording_uuid = '<recording_uuid>'
response = Resemble::V2::Recording.get(voice_uuid, recording_uuid)recording = response['item']

Delete a recording#

voice_uuid = '<voice_uuid>'recording_uuid = '<recording_uuid>'
response = Resemble::V2::Recording.delete(voice_uuid, recording_uuid)

Clips#

Get all clips#

project_uuid = '<project_uuid>'page = 1page_size = 10
response = Resemble::V2::Clip.all(project_uuid, page, page_size)clips = response['items']

Create a clip (sync)#

project_uuid = '<project_uuid>'voice_uuid = '<voice_uuid>'body = 'This is a sync test'
response = Resemble::V2::Clip.create_sync(  project_uuid,  voice_uuid,  body,  title: nil,  sample_rate: nil,  output_format: nil,  precision: nil,  include_timestamps: nil,  is_public: nil,  is_archived: nil,  raw: nil)
clip = response['item']

Create a clip (async)#

project_uuid = '<project_uuid>'voice_uuid = '<voice_uuid>'callback_uri = 'https://example.com/callback/resemble-clip'body = 'This is an async test'
response = Resemble::V2::Clip.create_async(  project_uuid,  voice_uuid,  callback_uri,  body,  title: nil,  sample_rate: nil,  output_format: nil,  precision: nil,  include_timestamps: nil,  is_public: nil,  is_archived: nil)clip = response['item']

Update a clip (async)#

project_uuid = '<project_uuid>'clip_uuid = '<clip_uuid>'voice_uuid = '<voice_uuid>'callback_uri = 'https://example.com/callback/resemble-clip'body = 'This is an updated async test'
response = Resemble::V2::Clip.update_async(  project_uuid,  clip_uuid,  voice_uuid,  callback_uri,  body,  title: nil,  sample_rate: nil,  output_format: nil,  precision: nil,  include_timestamps: nil,  is_public: nil,  is_archived: nil)clip = response['item']

Get a clip#

project_uuid = '<project_uuid>'clip_uuid = '<clip_uuid>'
response = Resemble::V2::Clip.get(project_uuid, clip_uuid)clip = response['item']

Delete a clip#

project_uuid = '<project_uuid>'clip_uuid = '<clip_uuid>'
response = Resemble::V2::Clip.delete(project_uuid, clip_uuid)