Code Monkey home page Code Monkey logo

opera's Introduction

Build Status

Coverage Status

OPERA

Another Unofficial OPenEchangesRAtes wrapper

Installation

opera is available on npm

npm install --save @aleengo/opera

Documentation

Opera supports two functionnalities :

latest(params)

Get the latest exchange rates (JSON) available from the Open Exchange Rates API.

Returns a promise

    const Opera = require('@aleengo/opera');
    
    let appID = '4554hshdhjsu';
    const opera = new Opera(appID);
    opera.latest()
        .then(res => res.body)
        .then(data => console.log(data.rates))
        .catch(e => console.log(e));

Params

params type optional description
base string yes Change base currency (3-letter code, default: USD)
symbols string yes Limit results to specific currencies (comma-separated liste of 3-letter codes)
show_alternative boolean yes Extend returned values with alternative, black market and digital currency rates

Note: Changing the base currency is available for all clients of paid plans. Other parameters are availbale for all plans, including free.

currencies(params)

Get a JSON list of all currency, and their full names, available from the Open Exchange Rates API. This list will always mirror the currencies available in the latest rates (given as their 3-letter codes).

Returns a promise

    const Opera = require('@aleengo/opera');
    
    let appID = '4554hshdhjsu';
    const opera = new Opera(appID);
    opera.currencies()
        .then(res => console.log(res.body))
        .catch(e => console.log(e));

params type optional description
show_alternative boolean yes Extend returned values with alternative, black market and digital currency rates
show_inactive boolean yes Include historical/inactive currencies

Proxy

If you are behind a proxy, you can specified an extra parameter to Opera object.

Specify a string as the extra parameter

    const Opera = require('@aleengo/opera');
    
    const appID = '4554hshdhjsu';
    const proxy = 'http://username:pass@proxy_host:proxy_port'

    const opera = new Opera(appID, proxy);
    opera.latest()
        .then(res => res.body )
        .then(data => console.log(data.rates))
        .catch(e => console.log(e));

Contributing

All contributions are welcome.

License

GNU GPLv3 © aleengo.

opera's People

Contributors

teebbo avatar

Watchers

 avatar

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.