New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gbfs-client

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gbfs-client

General Bikeshare Feed Specification (GBFS) client, compatible with Citibike NYC API

  • 0.8.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Node GBFS Client (CitiBike and others)

Build Status NPM Status Greenkeeper badge

Lightweight client for General Bikeshare Feed Specification (GBFS) feeds, with a Promise-based API and full type definitions (Typescript).

Compatible with the CitiBike NYC API.

Installation

npm install gbfs-client --save

Usage

const GbfsClient = require('gbfs-client');
const gbfsClient = new GbfsClient('https://gbfs.citibikenyc.com/gbfs/en/');

gbfsClient.system()
    .then(system => console.log(system));
    /* { system_id: 'NYC',
          language: 'en',
          name: 'Citi Bike',
          ... */

gbfsClient.stationInfo()
    .then(stations => console.log(stations));
    /* [ { station_id: '72',
            name: 'W 52 St & 11 Ave',
            short_name: '6926.01',
            lat: 40.76727216,
            lon: -73.99392888,
            ...
        ] */
gbfsClient.stationInfo('72')
    .then(stationInfo => console.log(stationInfo));
    /* { station_id: '72',
            name: 'W 52 St & 11 Ave',
            short_name: '6926.01',
            lat: 40.76727216,
            lon: -73.99392888,
            ... */

gbfsClient.stationStatus('72')
    .then(stationStatus => console.log(stationStatus));
    /*  { station_id: '72',
            num_bikes_available: 12,
            num_docks_available: 26,
            ... */

new GbfsClient(baseUrl)

  • baseUrl: optional url for the GBFS API. Defaults to 'https://gbfs.citibikenyc.com/gbfs/en/', for NYC's CitiBike.

gbfsClient.system()

gbfsClient.stationInfo(stationId)

  • stationId: optional id for a specific station. If this parameter is not provided, an array of info for all stations will be returned.
  • Returns a promise for a JSON object with station information for one or all stations. See the GBFS station information spec for a list of the JSON fields.

gbfsClient.stationStatus(stationId)

  • stationId: optional id for a specific station. If this parameter is not provided, an array of status for all stations will be returned.
  • Returns a promise for a JSON object with station status for one or all stations. See the GBFS station status spec for a list of the JSON fields.

Keywords

FAQs

Package last updated on 23 Feb 2020

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc