Class: Fxify::ECBData

Inherits:
Object
  • Object
show all
Defined in:
lib/fxify/base_class.rb,
lib/fxify/nested_classes.rb

Direct Known Subclasses

ExchangeRate

Defined Under Namespace

Classes: Currency, ExchangeDate

Constant Summary collapse

ECB_90_DAYS_URL =
"http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml"

Instance Method Summary collapse

Constructor Details

#initializeECBData

Returns a new instance of ECBData.



7
8
9
10
11
12
# File 'lib/fxify/base_class.rb', line 7

def initialize  
    @days = []
    fetch_data("data.xml") 
    @data_file = Nokogiri::XML File.open("data.xml") 
    parse_xml
end

Instance Method Details

#currenciesObject



14
15
16
# File 'lib/fxify/base_class.rb', line 14

def currencies
    @days.first.currencies.map { |c| c.name } 
end

#datesObject



18
19
20
# File 'lib/fxify/base_class.rb', line 18

def dates
    @days.map { |d| d.day } 
end