Class: Juno::Configuration
- Inherits:
-
Object
- Object
- Juno::Configuration
- Defined in:
- lib/juno/configuration.rb
Constant Summary collapse
- POSSIBLES_ENVIRONMENTS =
%i[sandbox production].freeze
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#private_token ⇒ Object
Returns the value of attribute private_token.
Instance Method Summary collapse
- #endpoint_for(type) ⇒ Object
- #environment=(environment) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 |
# File 'lib/juno/configuration.rb', line 11 def initialize @environment = POSSIBLES_ENVIRONMENTS.first end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
7 8 9 |
# File 'lib/juno/configuration.rb', line 7 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
7 8 9 |
# File 'lib/juno/configuration.rb', line 7 def client_secret @client_secret end |
#private_token ⇒ Object
Returns the value of attribute private_token.
7 8 9 |
# File 'lib/juno/configuration.rb', line 7 def private_token @private_token end |
Instance Method Details
#endpoint_for(type) ⇒ Object
15 16 17 |
# File 'lib/juno/configuration.rb', line 15 def endpoint_for(type) ENDPOINTS.dig(@environment, type) end |
#environment=(environment) ⇒ Object
19 20 21 22 23 |
# File 'lib/juno/configuration.rb', line 19 def environment=(environment) raise ArgumentError, "environment #{environment} is not valid" unless valid_environment?(environment) @environment = environment end |