Class: Ohme::Configuration
- Inherits:
-
Object
- Object
- Ohme::Configuration
- Defined in:
- lib/ohme/configuration.rb
Overview
Configuration of the Ohme API client gem.
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#client_name ⇒ Object
Returns the value of attribute client_name.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#configure {|config| ... } ⇒ Ohme::Configuration
Configures the Ohme API client with a block.
-
#initialize {|config| ... } ⇒ Ohme::Configuration
constructor
Initializes the configuration with default values.
-
#validate! ⇒ Object
Validates the configuration values.
Constructor Details
#initialize {|config| ... } ⇒ Ohme::Configuration
Initializes the configuration with default values.
12 13 14 15 16 17 |
# File 'lib/ohme/configuration.rb', line 12 def initialize @base_url = 'https://api-ohme.oneheart.fr/api/' @version = 'v1' @timeout = 30 yield self if block_given? end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/ohme/configuration.rb', line 6 def base_url @base_url end |
#client_name ⇒ Object
Returns the value of attribute client_name.
6 7 8 |
# File 'lib/ohme/configuration.rb', line 6 def client_name @client_name end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
6 7 8 |
# File 'lib/ohme/configuration.rb', line 6 def client_secret @client_secret end |
#timeout ⇒ Object
Returns the value of attribute timeout.
6 7 8 |
# File 'lib/ohme/configuration.rb', line 6 def timeout @timeout end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/ohme/configuration.rb', line 6 def version @version end |
Instance Method Details
#configure {|config| ... } ⇒ Ohme::Configuration
Configures the Ohme API client with a block.
23 24 25 |
# File 'lib/ohme/configuration.rb', line 23 def configure yield(self) if block_given? end |
#validate! ⇒ Object
Validates the configuration values.
30 31 32 33 |
# File 'lib/ohme/configuration.rb', line 30 def validate! error_on('client_name') unless @client_name error_on('client_secret') unless @client_secret end |