0.1.0 • Published 8 years ago

tripfinder v0.1.0

Weekly downloads
2
License
ISC
Repository
-
Last release
8 years ago

TripFinder

Build Status

TripFinder is a JavaScript tool for searching and retrieving car rides, stored in carpooling platform Tripda's database.

Installation

NodeJS

npm install https://github.com/tripda/tripfinder

AngularJS

bower install https://github.com/tripda/tripfinder

Requirements

In order to use TripFinder you need to get a Google Places API Key. This key can be obtained for free, you only need a Google account.

Usage

NodeJS

var finder = require('tripfinder');

finder.setGeocoderKey('YOUR-KEY');

finder.setOrigin('Sao Paulo, SP, Brazil');

finder.setDestination('Rio de Janeiro, RJ, Brazil');

finder.find()
    .then(function(trips) {

        if (trips.length == 0) {

            // No trips were found...

            return;

        }

        console.log(trips.length + ' trips were found.');

        trips.forEach(function(trip) {

            var driver = trip.getDriver();

            console.log('From: ' + trip.getOriginAddress());
            console.log('To: ' + trip.getDestinationAddress());
            console.log('Driver: ' + driver.getName());
            console.log("\n");

        });

    });

AngularJS

(To do...)