Class: RunApi::GrokImagine::Resources::Upscales
- Inherits:
-
Object
- Object
- RunApi::GrokImagine::Resources::Upscales
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/grok_imagine/resources/upscales.rb
Overview
Grok-Imagine video upscale resource. Takes a prior grok-imagine video task_id and upscales it.
Constant Summary collapse
- ENDPOINT =
"/api/v1/grok_imagine/upscale_image"- RESPONSE_CLASS =
Types::VideoTaskResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedVideoTaskResponse
Instance Method Summary collapse
- #create(**params) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(http) ⇒ Upscales
constructor
A new instance of Upscales.
- #run(**params) ⇒ Object
Constructor Details
#initialize(http) ⇒ Upscales
Returns a new instance of Upscales.
16 17 18 |
# File 'lib/runapi/grok_imagine/resources/upscales.rb', line 16 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ Object
25 26 27 28 29 |
# File 'lib/runapi/grok_imagine/resources/upscales.rb', line 25 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ Object
31 32 33 |
# File 'lib/runapi/grok_imagine/resources/upscales.rb', line 31 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ Object
20 21 22 23 |
# File 'lib/runapi/grok_imagine/resources/upscales.rb', line 20 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |