Class: RunApi::HappyHorse::Resources::EditVideo
- Inherits:
-
Object
- Object
- RunApi::HappyHorse::Resources::EditVideo
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/happyhorse/resources/edit_video.rb
Overview
HappyHorse edit-video resource. Transform an existing video with a text prompt and optional reference images.
Constant Summary collapse
- ENDPOINT =
"/api/v1/happyhorse/edit_video"- RESPONSE_CLASS =
Types::EditVideoResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedEditVideoResponse
- REFERENCE_IMAGE_RANGE =
(0..5)
Instance Method Summary collapse
-
#create(**params) ⇒ RunApi::HappyHorse::Types::EditVideoResponse
Create an edit-video task.
-
#get(id) ⇒ RunApi::HappyHorse::Types::EditVideoResponse
Get edit-video task status by task ID.
-
#initialize(http) ⇒ EditVideo
constructor
A new instance of EditVideo.
-
#run(**params) ⇒ RunApi::HappyHorse::Types::CompletedEditVideoResponse
Create an edit-video task and wait until complete.
Constructor Details
#initialize(http) ⇒ EditVideo
Returns a new instance of EditVideo.
17 18 19 |
# File 'lib/runapi/happyhorse/resources/edit_video.rb', line 17 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ RunApi::HappyHorse::Types::EditVideoResponse
Create an edit-video task.
34 35 36 37 38 |
# File 'lib/runapi/happyhorse/resources/edit_video.rb', line 34 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ RunApi::HappyHorse::Types::EditVideoResponse
Get edit-video task status by task ID.
44 45 46 |
# File 'lib/runapi/happyhorse/resources/edit_video.rb', line 44 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ RunApi::HappyHorse::Types::CompletedEditVideoResponse
Create an edit-video task and wait until complete.
25 26 27 28 |
# File 'lib/runapi/happyhorse/resources/edit_video.rb', line 25 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |