Class: RunApi::GptImage2::Resources::EditImage
- Inherits:
-
Object
- Object
- RunApi::GptImage2::Resources::EditImage
- Includes:
- Core::ResourceHelpers
- Defined in:
- lib/runapi/gpt_image_2/resources/edit_image.rb
Constant Summary collapse
- ENDPOINT =
"/api/v1/gpt_image_2/edit_image"- RESPONSE_CLASS =
Types::EditImageResponse
- COMPLETED_RESPONSE_CLASS =
Types::CompletedEditImageResponse
Instance Method Summary collapse
- #create(**params) ⇒ Object
- #get(id) ⇒ Object
-
#initialize(http) ⇒ EditImage
constructor
A new instance of EditImage.
- #run(**params) ⇒ Object
Constructor Details
#initialize(http) ⇒ EditImage
Returns a new instance of EditImage.
14 15 16 |
# File 'lib/runapi/gpt_image_2/resources/edit_image.rb', line 14 def initialize(http) @http = http end |
Instance Method Details
#create(**params) ⇒ Object
23 24 25 26 27 |
# File 'lib/runapi/gpt_image_2/resources/edit_image.rb', line 23 def create(**params) params = compact_params(params) validate_params!(params) request(:post, ENDPOINT, body: params) end |
#get(id) ⇒ Object
29 30 31 |
# File 'lib/runapi/gpt_image_2/resources/edit_image.rb', line 29 def get(id) request(:get, "#{ENDPOINT}/#{id}") end |
#run(**params) ⇒ Object
18 19 20 21 |
# File 'lib/runapi/gpt_image_2/resources/edit_image.rb', line 18 def run(**params) task = create(**params) poll_until_complete { get(task.id) } end |