Giter Site home page Giter Site logo

gaotongfei / fixer Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 14 KB

Fixer is a simple API wrapper of http://fixer.io/, providing a clean way of converting currency

Home Page: https://rubygems.org/gems/fixer-rb

License: MIT License

Ruby 97.31% Shell 2.69%
currency-converter fixer currency currency-exchange-rates

fixer's Introduction

Fixer

Build Status

Fixer is a simple API wrapper of http://fixer.io/ to provide a clean way of converting currency

Install

gem install 'fixer-rb'

Usage

To convert Chinese Yuan to US Dollars, simply do this

require 'fixer'

fixer = Fixer::Request.new 'CNY'
params = {target: 'USD', ammount: 1000}

fixer.transfer(params)  # 149.75
$ 149.75

Get currency rate

fixer.get_rate do |rate|
  usd = rate.USD  # 0.14975
  rate_in_hash = rate.to_h
  rate_in_json = rate.to_json
end

$ 0.14975

Supported Currencies

  • CNY
  • AUD
  • BGN
  • BRL
  • CAD
  • CHF
  • CZK
  • DKK
  • GBP
  • HKD
  • HRK
  • HUF
  • IDR
  • ILS
  • INR
  • JPY
  • KRW
  • MXN
  • MYR
  • NOK
  • NZD
  • PHP
  • PLN
  • RON
  • RUB
  • SEK
  • SGD
  • THB
  • TRY
  • USD
  • ZAR
  • EUR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.