Sha256: 8f21050676eab4ac4e8cfb60dbea4bbbe9d3173c59ea81b66975b8610347ed28

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

require 'nokogiri'
require 'open-uri'

module Fixer
  class Feed
    def initialize(type)
      @type = type
    end

    def get
      doc = Nokogiri::XML(feed)
      doc.xpath('/gesmes:Envelope/xmlns:Cube/xmlns:Cube', doc.root.namespaces).map do |node|
        Builder.new(node).build
      end
    end

    private

    def feed
      open(path).read
    end

    def path
      "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-#{@type}.xml"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fixer-0.4 lib/fixer/feed.rb