/samtrafiken_api

This Ruby gem is a thin wrapper around the Swedish public transportation APIs provided by Samtrafiken.

Primary LanguageRubyMIT LicenseMIT

Samtrafiken API

Gem Version Build Status

This gem is a thin wrapper around the public transportation web APIs provided by Samtrafiken. Its classes and methods correspond to the different APIs and their HTTP endpoints.

Please see the following pages to get an idea of what each API provides.

The methods return the raw json data provided by the APIs, parsed into Ruby objects.

Usage

You need to sign up with Trafiklab and get API keys for each of the APIs that you are going to use.

Please see the class documentation and the test suite for examples of how the gem is used.

Testing

Samtrafiken API uses rspec for testing. These environment variables need to be defined in order to run the test suite.

Example:

RESROBOT_API_KEY=MY-KEY RESROBOT_STOPS_API_KEY=MY-OTHER-KEY STATIONSINFO_API_KEY=MY-THIRD-KEY bundle exec rake test