Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ptv-api-signature

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ptv-api-signature

Assist with PTV Api path signature generation

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

Build

PTV API signature generator

Hacked together a method for the API signature generation only

If you are after a full fledged swagger client implementation see ptv-api npm

Requirements

First obtain a dev id and key from PTV here

If using in the browser - Please consider that you will need to support the crypto nodejs module. A polyfil exists here

Example usage

const ptvSig = require ('ptv-api-signature')
const BASE_URL = 'http://timetableapi.ptv.vic.gov.au'
const DEV_ID  =  'REPLACE'
const DEV_KEY =  'REPLACE1-1111-1111-1111-111111111111'

/**
* Search for stops based on search term
* @param {String} search_term
*/
const getStopsBySearchTerm = (search_term)  =>  {
return fetch(`${BASE_URL}${ptvSig.pathWithSig(`/v3/search/${search_term.toLowerCase()}`,  [{ name:  'route_types', value:  '0'  }], DEV_ID, DEV_KEY)}`).then(res  =>  res.json())
}

getStopsBySearchTerm('Balaclava').then(d => {
  console.log(d)
})

Keywords

FAQs

Package last updated on 25 Mar 2019

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