Class: Tavus::Resources::Replicas
- Inherits:
-
Object
- Object
- Tavus::Resources::Replicas
- Defined in:
- lib/tavus/resources/replicas.rb
Instance Method Summary collapse
-
#create(train_video_url:, **options) ⇒ Hash
Create a new replica.
-
#delete(replica_id, hard: false) ⇒ Hash
Delete a replica.
-
#get(replica_id, verbose: false) ⇒ Hash
Get a single replica by ID.
-
#initialize(client) ⇒ Replicas
constructor
A new instance of Replicas.
-
#list(**options) ⇒ Hash
List all replicas.
-
#rename(replica_id, replica_name) ⇒ Hash
Rename a replica.
Constructor Details
#initialize(client) ⇒ Replicas
6 7 8 |
# File 'lib/tavus/resources/replicas.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create(train_video_url:, **options) ⇒ Hash
Create a new replica
19 20 21 22 |
# File 'lib/tavus/resources/replicas.rb', line 19 def create(train_video_url:, **) body = .merge(train_video_url: train_video_url) @client.post("/v2/replicas", body: body) end |
#delete(replica_id, hard: false) ⇒ Hash
Delete a replica
49 50 51 52 |
# File 'lib/tavus/resources/replicas.rb', line 49 def delete(replica_id, hard: false) params = hard ? { hard: true } : {} @client.delete("/v2/replicas/#{replica_id}", params: params) end |
#get(replica_id, verbose: false) ⇒ Hash
Get a single replica by ID
28 29 30 31 |
# File 'lib/tavus/resources/replicas.rb', line 28 def get(replica_id, verbose: false) params = verbose ? { verbose: true } : {} @client.get("/v2/replicas/#{replica_id}", params: params) end |
#list(**options) ⇒ Hash
List all replicas
41 42 43 |
# File 'lib/tavus/resources/replicas.rb', line 41 def list(**) @client.get("/v2/replicas", params: ) end |
#rename(replica_id, replica_name) ⇒ Hash
Rename a replica
58 59 60 |
# File 'lib/tavus/resources/replicas.rb', line 58 def rename(replica_id, replica_name) @client.patch("/v2/replicas/#{replica_id}/name", body: { replica_name: replica_name }) end |