Sha256: ae9dfbd70cc1515beabf44bdb2ae1db37728056dc653fbd3fcaaf5550592fff2

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

require 'rubygems'
# Would use this, but it only reads in from a file!
# require 'libxml' 
require 'open-uri'
require 'hpricot'

module Coinage
  module Exchange
    class Xurrency
      
      include Base
      
      def rate(current, target)
        super(current, target)
        uri = "http://xurrency.com/1/#{current}/#{target}/feed"
        
        (Hpricot(open(uri).read)/'dc:value').inner_html
      end
      
      # From:
      # http://xurrency.com/currencies
      def supported_currencies
        [ :ars, :aud, :brl, :bgn, :cad, :cny, :cop, :hrk, :czk, :dkk, :eek, :eur, :hkd, :huf, :isk, :inr,
        :jpy, :krw, :lvl, :ltl, :myr, :mxn, :ron, :try, :nzd, :nok, :php, :pln, :gbp, :rub, :sgd, :skk,
        :zar, :lkr, :sek, :chf, :twd, :thb, :usd, :vef ]
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
chrislloyd-coinage-0.2.0 lib/coinage/exchange/xurrency.rb
coinage-0.2.0 lib/coinage/exchange/xurrency.rb