Class: Fixer::Feed
Constant Summary collapse
- TYPES =
{ current: 'daily', ninety_days: 'hist-90d', historical: 'hist' }.freeze
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(type = :current) ⇒ Feed
constructor
A new instance of Feed.
Constructor Details
Instance Method Details
#each ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fixer/feed.rb', line 18 def each REXML::XPath.each(document, '/gesmes:Envelope/Cube/Cube[@time]') do |day| date = Date.parse(day.attribute('time').value) REXML::XPath.each(day, './Cube') do |currency| yield( date: date, iso_code: currency.attribute('currency').value, rate: Float(currency.attribute('rate').value) ) end end end |