Class: FixerApiClient::CurrencyData

Inherits:
Object
  • Object
show all
Defined in:
lib/fixer_api_client/currency_data.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ratesObject



7
8
9
# File 'lib/fixer_api_client/currency_data.rb', line 7

def self.rates
  new.rates
end

.rates_creation_dateObject



15
16
17
# File 'lib/fixer_api_client/currency_data.rb', line 15

def self.rates_creation_date
  new.rates_creation_date
end

.symbolsObject



11
12
13
# File 'lib/fixer_api_client/currency_data.rb', line 11

def self.symbols
  new.symbols
end

Instance Method Details

#ratesObject



24
25
26
# File 'lib/fixer_api_client/currency_data.rb', line 24

def rates
  @rates ||= parse(rates_filename, 'rates')['rates']
end

#rates_creation_dateObject



19
20
21
22
# File 'lib/fixer_api_client/currency_data.rb', line 19

def rates_creation_date
  timestamp = parse(rates_filename, 'rates')['timestamp']
  timestamp && Time.strptime(timestamp.to_s,'%s').utc.to_s
end

#symbolsObject



28
29
30
# File 'lib/fixer_api_client/currency_data.rb', line 28

def symbols
  @symbols ||= parse(currencies_filename, 'symbols')['symbols']
end