Class: Cambio::Configuration

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

Overview

Internal: An object to hold the internal configuration of the Cambio module

Constant Summary collapse

DEFAULT_APP_ID =

Internal: By default, don’t set an app ID

nil
DEFAULT_ENDPOINT =

Internal: The default API endpoint, it can also be set to use https

'http://openexchangerates.org/api/'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Internal: The configuration object should be initialized by the Cambio module



17
18
19
# File 'lib/cambio/configuration.rb', line 17

def initialize
  @endpoint = DEFAULT_ENDPOINT
end

Instance Attribute Details

#app_idObject

Public: Gets/Sets the String app_id



5
6
7
# File 'lib/cambio/configuration.rb', line 5

def app_id
  @app_id
end

#endpointObject

Public: Gets/Sets the String endpoint



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

def endpoint
  @endpoint
end

Instance Method Details

#resetObject

Public: resets the internal configuration to the defaults

Examples

configuration.reset


26
27
28
29
# File 'lib/cambio/configuration.rb', line 26

def reset
  @endpoint = DEFAULT_ENDPOINT
  @app_id   = DEFAULT_APP_ID
end