Socket
Book a DemoInstallSign in
Socket

aeris-weather

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aeris-weather

Node.js Client to access data from Aeris Weather API

0.0.6
latest
Source
npmnpm
Version published
Weekly downloads
18
500%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

aeris

FAQs

Package last updated on 18 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.