Class: LeonardoAI::Configuration
- Inherits:
-
Object
- Object
- LeonardoAI::Configuration
- Defined in:
- lib/leonardoai.rb
Constant Summary collapse
- DEFAULT_API_VERSION =
"v1".freeze
- DEFAULT_URI_BASE =
"https://cloud.leonardo.ai/api/rest/".freeze
- DEFAULT_REQUEST_TIMEOUT =
120
Instance Attribute Summary collapse
- #access_token ⇒ Object
-
#api_type ⇒ Object
Returns the value of attribute api_type.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
-
#uri_base ⇒ Object
Returns the value of attribute uri_base.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/leonardoai.rb', line 24 def initialize @access_token = nil @api_type = nil @api_version = DEFAULT_API_VERSION @uri_base = DEFAULT_URI_BASE @request_timeout = DEFAULT_REQUEST_TIMEOUT @extra_headers = { "accept" => "application/json", "content-type" => "application/json" } end |
Instance Attribute Details
#access_token ⇒ Object
36 37 38 39 40 41 |
# File 'lib/leonardoai.rb', line 36 def access_token return @access_token if @access_token error_text = "LeonardoAI access token missing! See https://github.com/alexrudall/ruby-openai#usage" raise ConfigurationError, error_text end |
#api_type ⇒ Object
Returns the value of attribute api_type.
17 18 19 |
# File 'lib/leonardoai.rb', line 17 def api_type @api_type end |
#api_version ⇒ Object
Returns the value of attribute api_version.
17 18 19 |
# File 'lib/leonardoai.rb', line 17 def api_version @api_version end |
#extra_headers ⇒ Object
Returns the value of attribute extra_headers.
17 18 19 |
# File 'lib/leonardoai.rb', line 17 def extra_headers @extra_headers end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
17 18 19 |
# File 'lib/leonardoai.rb', line 17 def request_timeout @request_timeout end |
#uri_base ⇒ Object
Returns the value of attribute uri_base.
17 18 19 |
# File 'lib/leonardoai.rb', line 17 def uri_base @uri_base end |