Class: Juno::Configuration

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

Constant Summary collapse

POSSIBLES_ENVIRONMENTS =
%i[sandbox production].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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_idObject

Returns the value of attribute client_id.



7
8
9
# File 'lib/juno/configuration.rb', line 7

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



7
8
9
# File 'lib/juno/configuration.rb', line 7

def client_secret
  @client_secret
end

#private_tokenObject

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

Raises:

  • (ArgumentError)


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