Class: RunApi::Topaz::Resources::UpscaleImage

Inherits:
Object
  • Object
show all
Includes:
Core::ResourceHelpers
Defined in:
lib/runapi/topaz/resources/upscale_image.rb

Overview

AI-powered image upscaling resource. Supports upscale factors of 1x, 2x, 4x, and 8x.

Constant Summary collapse

ENDPOINT =
"/api/v1/topaz/upscale_image"
RESPONSE_CLASS =
Types::UpscaleImageResponse
COMPLETED_RESPONSE_CLASS =
Types::CompletedUpscaleImageResponse

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ UpscaleImage

Returns a new instance of UpscaleImage.



16
17
18
# File 'lib/runapi/topaz/resources/upscale_image.rb', line 16

def initialize(http)
  @http = http
end

Instance Method Details

#create(options: nil, **params) ⇒ Object



25
26
27
28
29
# File 'lib/runapi/topaz/resources/upscale_image.rb', line 25

def create(options: nil, **params)
  params = compact_params(params)
  validate_contract!(CONTRACT["upscale-image"], params)
  request(:post, ENDPOINT, body: params, options: options)
end

#get(id, options: nil) ⇒ Object



31
32
33
# File 'lib/runapi/topaz/resources/upscale_image.rb', line 31

def get(id, options: nil)
  request(:get, "#{ENDPOINT}/#{id}", options: options)
end

#run(options: nil, **params) ⇒ Object



20
21
22
23
# File 'lib/runapi/topaz/resources/upscale_image.rb', line 20

def run(options: nil, **params)
  task = create(options: options, **params)
  poll_until_complete { get(task.id, options: options) }
end