Module: Fyb::Configuration

Defined in:
lib/fyb/configuration.rb

Overview

Configuration class that sets the default values if needed. Call this using:

Fyb::Configuration.configure do |config|
  config.currency = :sek
  config.key = 'your-fyb-key'
  config.sig = 'your-fyb-secret'
end

Constant Summary collapse

APIS =
{
  sek: 'https://www.fybse.se/api/SEK/',
  sgd: 'https://www.fybsg.com/api/SGD/',
  test: 'https://fyb.apiary.io/'
}

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.currencyObject

Returns the value of attribute currency.



13
14
15
# File 'lib/fyb/configuration.rb', line 13

def currency
  @currency
end

.keyObject

Returns the value of attribute key.



13
14
15
# File 'lib/fyb/configuration.rb', line 13

def key
  @key
end

.sigObject

Returns the value of attribute sig.



13
14
15
# File 'lib/fyb/configuration.rb', line 13

def sig
  @sig
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



32
33
34
# File 'lib/fyb/configuration.rb', line 32

def configure
  yield self
end

.domainObject



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

def domain
  return APIS[:sek] if currency.nil?

  APIS[currency]
end