Class: Stability::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/stability.rb

Constant Summary collapse

DEFAULT_API_VERSION =
"v2beta"
DEFAULT_REQUEST_TIMEOUT =
120
DEFAULT_URI_BASE =
"https://api.stability.ai"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



19
20
21
22
23
24
25
26
# File 'lib/stability.rb', line 19

def initialize
  self.api_key = nil
  self.api_version = DEFAULT_API_VERSION
  self.extra_headers = {}
  self.log_errors = false
  self.request_timeout = DEFAULT_REQUEST_TIMEOUT
  self.uri_base = DEFAULT_URI_BASE
end

Instance Attribute Details

#api_keyObject

Raises:



28
29
30
31
32
# File 'lib/stability.rb', line 28

def api_key
  return @api_key if @api_key

  raise ConfigurationError, "Stability AI api key missing!"
end

#api_versionObject

Returns the value of attribute api_version.



13
14
15
# File 'lib/stability.rb', line 13

def api_version
  @api_version
end

#extra_headersObject

Returns the value of attribute extra_headers.



13
14
15
# File 'lib/stability.rb', line 13

def extra_headers
  @extra_headers
end

#faraday_configObject

Returns the value of attribute faraday_config.



13
14
15
# File 'lib/stability.rb', line 13

def faraday_config
  @faraday_config
end

#log_errorsObject

Returns the value of attribute log_errors.



13
14
15
# File 'lib/stability.rb', line 13

def log_errors
  @log_errors
end

#request_timeoutObject

Returns the value of attribute request_timeout.



13
14
15
# File 'lib/stability.rb', line 13

def request_timeout
  @request_timeout
end

#uri_baseObject

Returns the value of attribute uri_base.



13
14
15
# File 'lib/stability.rb', line 13

def uri_base
  @uri_base
end

Instance Method Details

#faraday(&block) ⇒ Object



34
35
36
# File 'lib/stability.rb', line 34

def faraday(&block)
  self.faraday_config = block
end