Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eduardoportilho/trafikverket

🚂 A wrapper for the Trafikverket API which provides information about trains in Sweden.
https://github.com/eduardoportilho/trafikverket

Last synced: 28 days ago
JSON representation

🚂 A wrapper for the Trafikverket API which provides information about trains in Sweden.

Awesome Lists containing this project

README

        

# Trafikverket Wrapper

[![travis build](https://img.shields.io/travis/eduardoportilho/trafikverket.svg?style=flat)](https://travis-ci.org/eduardoportilho/trafikverket)
[![codecov coverage](https://img.shields.io/codecov/c/github/eduardoportilho/trafikverket.svg?style=flat)](https://codecov.io/github/eduardoportilho/trafikverket)
[![version](https://img.shields.io/npm/v/trafikverket.svg?style=flat)](http://npm.im/trafikverket)
[![MIT License](https://img.shields.io/npm/l/trafikverket.svg?style=flat)](http://opensource.org/licenses/MIT)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat)](https://github.com/semantic-release/semantic-release)

[![NPM](https://nodei.co/npm/trafikverket.png?downloads=true&stars=true)](https://nodei.co/npm/trafikverket/)

A wrapper for the [Trafikverket API](http://api.trafikinfo.trafikverket.se/API/) that provides information about trains in Sweden.

## Usage

```javascript
let trafikverket = require('trafikverket')
trafikverket.getDepartures('Cst', 'Flen')
```

## FAQ

* How do I set my API key in my host?

```
export TRAFIKVERKET_API_KEY=
```

* How do I test the api?

```
$ npm run build
$ cd dist
$ env TRAFIKVERKET_API_KEY= NODE_ENV=production node
> let trafik = require('./index')
> trafik.getDepartures('Fle').then((obj) => console.log(JSON.stringify(obj, null, 2)))
```

## Roadmap:

- [x] `trafik.getDepartures('Cst', 'Fle')` (When 'Fle' is not the final destination)
- [x] Create service to return station info (sync?)
- [x] Parametrize the time interval
- [ ] Filter anouncements without data