Socket
Socket
Sign inDemoInstall

cts-tram-api

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cts-tram-api

API from 'Compagnie des transports strasbourgeois' (CTS)


Version published
Weekly downloads
2
Maintainers
1
Install size
24.8 kB
Created
Weekly downloads
 

Readme

Source

CTS Tram API

API from "Compagnie des transports strasbourgeois". For more informations go to CTS Portail Open Data and API service

Installation

npm install --save cts-tram-api

or

<script src="https://cdn.jsdelivr.net/gh/w-jerome/cts-tram-api/dist/cts-tram-api.min.js"></script>

Usage

import CTSTramAPI from 'cts-tram-api';

const cts_tram_api = new CTSTramAPI('my_api_key');

Methods

Estimated Timetable

// ES6
cts_tram_api.estimatedTimetable()
  .then(estimated_timetables => {
    console.log(estimated_timetables);
  })
  .catch(error => {
    console.error(error);
  });

// ES5
cts_tram_api.estimatedTimetable(function(estimated_timetables, error) {
  if (error) {
    console.error(error);
    return false;
  }

  console.log(estimated_timetables);
});

Configuration properties:

PropertyTypeRequireDescription
vehicle_modestringfalsevehicle_mode
line_refstringfalseline_ref
direction_refstringfalsedirection_ref

Example:

// ES6
cts_tram_api.estimatedTimetable(vehicle_mode, line_ref, direction_ref)

// ES5
cts_tram_api.estimatedTimetable(function() {}, vehicle_mode, line_ref, direction_ref)

Stop Monitoring

// ES6
cts_tram_api.stopMonitoring('233A')
  .then(stop_monitoring => {
    console.log(stop_monitoring);
  })
  .catch(error => {
    console.error(error);
  });

// ES5
cts_tram_api.stopMonitoring(function(stop_monitoring, error) {
  if (error) {
    console.error(error);
    return false;
  }

  console.log(stop_monitoring);
}, '233A');

Configuration properties:

PropertyTypeRequireDescription
monitoring_refstringtruemonitoring_ref
vehicule_modestringfalsevehicule_mode
preview_intervalstringfalsepreview_interval
start_timestringfalsestart_time
line_refstringfalseline_ref
direction_refnumberfalsedirection_ref
maximum_stop_visitsnumberfalsemaximum_stop_visits
minimum_stop_visits_per_linenumberfalseminimum_stop_visits_per_line

Example:

// ES6
cts_tram_api.stopMonitoring(monitoring_ref, vehicule_mode, preview_interval, start_time, line_ref, direction_ref, maximum_stop_visits, minimum_stop_visits_per_line)

// ES5
cts_tram_api.stopMonitoring(function() {}, monitoring_ref, vehicule_mode, preview_interval, start_time, line_ref, direction_ref, maximum_stop_visits, minimum_stop_visits_per_line)

Stop Points Discovery

// ES6
cts_tram_api.stopPointsDiscovery()
  .then(stop_points => {
    console.log(stop_points);
  })
  .catch(error => {
    console.error(error);
  });

// ES5
cts_tram_api.stopPointsDiscovery(function(stop_points, error) {
  if (error) {
    console.error(error);
    return false;
  }

  console.log(stop_points);
});

Configuration properties:

PropertyTypeRequireDescription
latitudenumberfalselatitude
longitudenumberfalselongitude
distancenumberfalsedistance

Example:

// ES6
cts_tram_api.stopPointsDiscovery(latitude, longitude, distance)

// ES5
cts_tram_api.stopPointsDiscovery(function() {}, latitude, longitude, distance)

Lines Discovery

// ES6
cts_tram_api.linesDiscovery()
  .then(lines => {
    console.log(lines);
  })
  .catch(error => {
    console.error(error);
  });

// ES5
cts_tram_api.linesDiscovery(function(lines, error) {
  if (error) {
    console.error(error);
    return false;
  }

  console.log(lines);
});

Version update

CTS Tram APIREST API
v1v1

License

MIT, see LICENSE for details.

Keywords

FAQs

Last updated on 23 Jul 2019

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc