Class: Stability::Configuration
- Inherits:
-
Object
- Object
- Stability::Configuration
- 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
- #api_key ⇒ Object
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
-
#faraday_config ⇒ Object
Returns the value of attribute faraday_config.
-
#log_errors ⇒ Object
Returns the value of attribute log_errors.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
-
#uri_base ⇒ Object
Returns the value of attribute uri_base.
Instance Method Summary collapse
- #faraday(&block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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_key ⇒ Object
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_version ⇒ Object
Returns the value of attribute api_version.
13 14 15 |
# File 'lib/stability.rb', line 13 def api_version @api_version end |
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
13 14 15 |
# File 'lib/stability.rb', line 13 def extra_headers @extra_headers end |
#faraday_config ⇒ Object
Returns the value of attribute faraday_config.
13 14 15 |
# File 'lib/stability.rb', line 13 def faraday_config @faraday_config end |
#log_errors ⇒ Object
Returns the value of attribute log_errors.
13 14 15 |
# File 'lib/stability.rb', line 13 def log_errors @log_errors end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
13 14 15 |
# File 'lib/stability.rb', line 13 def request_timeout @request_timeout end |
#uri_base ⇒ Object
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 |