Giter Site home page Giter Site logo

aeris-weather's Introduction

aeris-weather

aeris-weather is a chainable Node.js client for accessing Aeris Weather API

Getting Started

npm install aeris-weather

Instantiate

const Aeris = require('aeris-weather');
var aerisApi = new Aeris('[your-app-id]', '[your-secret-key]');

Examples

To get observation data for Auckland, NZ:

aerisApi.endpoint('observations/summary').action('closest').place('-45.039948,168.695312').filter('allstations').limit(1).process().then(function (data) {
    console.log('Auckland weather', data);
});

Or using callback:

aerisApi.endpoint('observations/summary').action('closest').place('-45.039948,168.695312').filter('allstations').limit(1).process(function (err, data) {
    console.log('Auckland weather', data);
});

Or using non-chained calls:

aerisApi.endpoint('observations/summary');
aerisApi.action('closest');
aerisApi.place('-45.039948,168.695312');
aerisApi.filter('allstations');
aerisApi.limit(1);
aerisApi.process(function (err, data) {
    console.log('Auckland weather', data);
});

Batch request for 24 hours and 7 day of forecast:

aerisApi.action('closest').place('-45.039948,168.695312').limit(7).filter('day');
aerisApi.batch('forecasts');
aerisApi.filter('1hr').limit(24);
aerisApi.batch('forecasts');
aerisApi.process(function (err, data) {
    console.log('Auckland forecast hours', data.response.responses[0].response[0]);
    console.log('Auckland forecast days', data.response.responses[1].response[0]);
});

NOTE: Parameters applying to a batch must be set prior to calling batch. In addition parameters persist between batch calls, but can be set to blank or null. Parameters DO NOT persist between process calls.

Starting Point

This is not a comprehensive SDK implementation and should be taken as a starting point for future implementation.

Possible Features/Improvements:

  • Validation of available endpoints
  • Validation of actions and filters available with given endpoints
  • Better error handling

Testing

In order to run unit tests, create the following files within the test directory:

  • aeris-id.txt (should contain a valid app/client ID)
  • aeris-secret.txt (should contain a valid secret key)

Then run npm run test from the command line.

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

Copyright (c) 2018 Dan Wilson & Skydrop Holdings, LLC. Licensed under the MIT license. See LICENSE.

aeris-weather's People

Contributors

killroyboy 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.