Class: Roseflow::StabilityAI::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/roseflow/stabilityai/client.rb

Constant Summary collapse

FARADAY_RETRY_OPTIONS =
{
  max: 3,
  interval: 0.05,
  interval_randomness: 0.5,
  backoff_factor: 2,
}

Instance Method Summary collapse

Constructor Details

#initialize(config = Config.new, provider = nil) ⇒ Client

Returns a new instance of Client.



21
22
23
24
# File 'lib/roseflow/stabilityai/client.rb', line 21

def initialize(config = Config.new, provider = nil)
  @config = config
  @provider = provider
end

Instance Method Details

#modelsObject



26
27
28
29
# File 'lib/roseflow/stabilityai/client.rb', line 26

def models
  response = connection.get("/v1/engines/list")
  body = JSON.parse(response.body)
end

#post(operation) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/roseflow/stabilityai/client.rb', line 31

def post(operation)
  if operation.multipart?
    response = multipart_connection.post(operation.path) do |request|
      request.body = operation.body
    end
  else
    response = connection.post(operation.path) do |request|
      request.body = operation.body
    end
  end
  response
end