Nearly Perpendicular Macaroons
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

georide-js

2.0.1 • Public • Published

<ORG_NAME>

georide-js

georide-js is a tiny JavaScript API client for Georide which is awesome french tech, mostly if you are a motorcycle rider.

See full API documentation here.

Georide

Georide a french company that provide security and GPS features for motorcycle. To use it you need to buy from them a small box full of sensors that you put on your bike directly powered by its battery.

To make the UX great they also provide a mobile app (iOS and Android supported) and they made their API public so the users/customers can play with it.

See Georide API documentation here. See Georide services status page here.

Features

  • fetch : The project is using fetch to request the data from the API (node-fetch for Node environment). It permit to handle easyly request promises and make it usable in Node application as in browser's.

  • Customizable option : If Georide decide to change their API endpoints you can set options so your client can still works.

  • Socket client implementation : It implement socket.io client to simplify the event subscription the API provide.

Install

npm i -s georide-js

How to use

Example :

const { Client } = require('georide-js')
 
 
const EMAIL = process.env.EMAIL
const PASSWORD = process.env.PASSWORD
 
const main = async () => {
  // Create the client
  const client = new Client(EMAIL, PASSWORD)
 
  // Authenticate the user
  const token = await client.login()
 
  // Retrieve the user info
  const info = await client.Tracker.lock()
 
  // Retrieve my trackers
  const trackers = await client.User.trackers()
  const myTrackers = trackers.filter(t => t.role === 'owner')
  const myTrackerId = myTrackers[0].trackerId
 
  // Retrieve my tracker trips
  const trips = await client.Tracker.trips(myTrackerId, new Date('May 01, 2019 00:00:00'), new Date())
 
  // Lock a tracker
  await client.Tracker.lock(myTrackerId)
 
  // Toggle a tracker lock
  const { locked } = await client.Tracker.toggle(myTrackerId)
 
  // Share a trip
  const { url, shareId } = await client.Tracker.shareTrip(myTrackerId, {tripId: trips[0].id})
  
  // Subscribe to the `position` event
  client.onPosition(message => {
    const { trackerId, latitude, longitude, moving } = message
  })
 
  process.exit()
}
 
main()

Test

npm test

Contributing

Install

git clone git@github.com:NeilujD/next-blog.git
docker build ./

Tips

  • Update tests if needed
  • Update the JSDoc part

Install

npm i georide-js

DownloadsWeekly Downloads

0

Version

2.0.1

License

SEE LICENSE IN ./LICENSE

Unpacked Size

111 kB

Total Files

53

Last publish

Collaborators

  • avatar