From 1611761044c1406c0ed365f37b593133b97bc2ec Mon Sep 17 00:00:00 2001 From: Jose Bezerra Date: Wed, 2 May 2018 22:14:30 -0300 Subject: [PATCH] fix(configs.js): changed for env. variables --- .gitignore | 4 + .travis.yml | 18 + LICENSE | 21 + README.md | 487 ++++++++++++++++ lib/node-uber-rider.js | 467 ++++++++++++++++ package-lock.json | 1195 ++++++++++++++++++++++++++++++++++++++++ package.json | 42 ++ test/configs.js | 16 + test/test.js | 106 ++++ 9 files changed, 2356 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 lib/node-uber-rider.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 test/configs.js create mode 100644 test/test.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9769ab6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.vscode +node_modules +server.js +.DS_Store diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..14eb703 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +sudo: false +language: node_js +cache: + directories: + - node_modules +notifications: + email: false +node_js: + - "10" +before_install: + - npm i -g npm@^2.0.0 +before_script: + - npm prune +script: + - npm run test:single +after_success: + - npm run semantic-release + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..392764a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 José Bezerra de Melo Neto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2f66299 --- /dev/null +++ b/README.md @@ -0,0 +1,487 @@ +# A library to use Uber Riders' API faster and easily for Node.js +This project contains all endpoints you need to integrate Uber's API in your application + +## Installation + +Before begin, you need to register your app in the [Uber developer dashboard](https://developer.uber.com/dashboard). Notice that the app gets a **client ID, Client Secret, and Server Token** required for authenticating with the API. +After registering your application, you need to install this module in your Node.js project: + +```sh +npm install node-uber-driver +``` + +## Initialization + +So as to use this module, you have to import it in your application first: + +```javascript +var Uber = require('node-uber-rider'); +``` + +Next, initialize the Uber object with the keys you obtained from the [Uber developer dashboard](https://developer.uber.com/dashboard): + +```javascript +var uber = new Uber({ + clientID: 'CLIENT_ID', + clientSecret: 'CLIENT_SECRET', + redirectURI: 'REDIRECT_URI/getCode', + + //If you already have the authentication infos (they are all optional) + access_token: 'SERVER_TOKEN', + refresh_token: 'REFRESH_TOKEN', + selfScopes:[scopes] +}); +``` + +## Authenticating + +To make calls in the API, you need to create an authenticated session with the API. User-specific operations require you to use a OAuth 2 bearer token with specific [scopes](https://developer.uber.com/docs/scopes). General operations can use a simple server-token authentication. +You do it in two steps. Step One, request the User's Code `uber.getAuthorizeUrl([scopes])` with the scopes you need, step two, request the User's Bearer Token `uber.getUserToken(UserCode,[scopes],callback)` using the User's Code. + +### Step one: Authorize to get the Code + +To obtain a bearer token, you have to authorize your application with the required scope. Available scopes are: `history`, `history_lite`, `profile`, `request`, `all_trips`, and `places`. + +To do so, you are initially required to redirect your user to an authorization URL. You can generate the authorization URL using `uber.getAuthorizeUrl([scopes])`. In case you are using [Express](http://expressjs.com/), your route definition could look as follows: + +```javascript +app.get('/getAuth', function(req,res){ + var url = myUber.getAuthorizeUrl(['history','profile','all_trips']); + res.redirect(url); +}); +``` + +The URL will lead to a page where your user will be required to login and approve access to his/her Uber account. In case that step was successful, Uber will issue an HTTP 302 redirect to the redirect_uri defined in the [Uber developer dashboard](https://developer.uber.com/dashboard). On that redirect, you will receive an authorization code, which is single use and expires in 10 minutes. + +### Step two: Receive redirect and get an access token + +To complete the authorization you now need to receive the callback and convert the given authorization code into an OAuth access token. You can accomplish that using `uber.getUserToken(UserCode,[scopes],callback)`. This method will retrieve and store the access_token, refresh_token and authorized scopes with the uber object for consecutive requests. + +Using Express, you could achieve that as follows: + +```javascript +app.get('/getCode', function(req, res){ + code = req.query.code; + var token = myUber.getUserToken(code,['history','profile','all_trips'],function(err,data){ + if(err) + { + console.log(err); + } + res.send("token: "+ data); + }); +}); +``` + +## Endpoints + +### Authentication + +#### Generate Authorize URL + +After getting the authorize url, the user will be redirected to the redirect url with authorization code used in the next function. + +```javascript +uber.getAuthorizeUrl([scopes]); +``` + +##### Example + +```javascript +uber.getAuthorizeUrl(['history','profile', 'request', 'places']); +``` + +### Get Bearer Token + +#### It gets the authorization you need (Access Token, Refresh Token, Scopes) + +```javascript +uber.getUserToken(UserCode,[scopes],callback); +``` + +##### Example: Just getting access_token + +```javascript +myUber.getUserToken(code,['history','profile','all_trips'],function(err,token){ + if(err){ + console.log(err); + } + console.log("token: "+ token); +}); +``` + +##### Example 2: Getting refresh_token + +```javascript +myUber.getUserToken(code,['history','profile','all_trips'],function(err,token){ + if(err){ + console.log(err); + } + var refresh_token = uber.refresh_token; + console.log("refresh_token: "+ refresh_token); +}); +``` + +### Riders + +#### GET /me: + +##### Gets User's Informations + +```javascript +uber.me(callback); +``` + +##### Example +```javascript +uber.me(function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /history: + +##### Gets User's Trips + +```javascript +uber.history(limit,offset,callback); +``` + +##### Example +```javascript +uber.history(5,0,function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /payment-methods: + +##### Gets User's Payment Methods + +```javascript +uber.paymentMethods(callback); +``` + +##### Example +```javascript +uber.paymentMethods(function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /places/{place_id} + +##### Gets user's address for home/work + +```javascript +uber.getPlaceByPlaceId(palceId,callback); +``` + +##### Example +```javascript +uber.getPlaceByPlaceId('home',function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### PATCH /me + +##### It Applys Promotion + +```javascript +uber.applyPromotion(promotionCode,callback); +``` + +##### Example +```javascript +uber.applyPromotion('FREE_RIDEZ',function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### PUT /places/{place_id} + +##### Updates User Address for an ID + +```javascript +uber.updateHomeOrWork(placeId,newAddress,callback); +``` + +##### Example +```javascript +uber.updateHomeOrWork('home','New Street St',function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +## Ride Products + +#### GET /products + +##### Gets Uber's Products availabe near by + +```javascript +uber.products([coordinates],callback); +``` + +##### Example +```javascript +uber.products(['lat','long'],function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /products/{product_id} + +##### Gets Information about a Specific Product + +```javascript +uber.getProductByProductId(productID,callback); +``` + +##### Example +```javascript +uber.getProductByProductId('a1111c8c-c720-46c3-8534-2fcdd730040d',function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` +## Ride Estimates + +#### GET /estimates/price + +##### It Estimates Price between Start Location and End Location + +```javascript +uber.estimatePrice([startAndEndCoordinates],callback); +``` + +##### Example +```javascript +uber.estimatePrice(['startLat','startLon','endLat','endLon'],function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /estimates/time + +##### It Estimates Time between Start Location and End Location + +```javascript +uber.estimateTime([startAndEndCoordinates],callback); +``` + +##### Example +```javascript +uber.estimateTime(['startLat','startLon','endLat','endLon'],function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +## Ride Requests + +#### POST /requests/estimate + +##### The Request Estimate endpoint allows a ride to be estimated given the desired product + +```javascript +var infos = { + 'start_latitude':'start_latitude', + 'start_longitude':'start_longitude', + 'end_latitude':'end_latitude', + 'end_longitude':'end_longitude', + 'product_id':'product_id' +}; +uber.requestEstimate(infos,callback); +``` + +##### Example +```javascript +var infos = { + 'start_latitude':'start_latitude', + 'start_longitude':'start_longitude', + 'end_latitude':'end_latitude', + 'end_longitude':'end_longitude', + 'product_id':'product_id' +}; + +uber.requestEstimate(infos,function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### POST /requests + +##### The Ride Request endpoint allows a ride to be requested on behalf of an Uber user + +```javascript +var infos = { + 'start_latitude':'start_latitude', + 'start_longitude':'start_longitude', + 'end_latitude':'end_latitude', + 'end_longitude':'end_longitude', + 'product_id':'product_id', + 'fare_id':'fare_id' +}; +uber.createRequest(infos,callback); +``` + +##### Example +```javascript +var infos = { + 'start_latitude':'start_latitude', + 'start_longitude':'start_longitude', + 'end_latitude':'end_latitude', + 'end_longitude':'end_longitude', + 'product_id':'product_id', + 'fare_id':'fare_id' +}; + +uber.createRequest(infos,function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /requests/current + +##### It Returns Real Time Information about the Ongoing Trip + +```javascript +uber.currentRequest(callback); +``` + +##### Example +```javascript +uber.currentRequest(function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /requests/{request_id} + +##### The Ride Request endpoint allows retrieving the status of an ongoing or completed trip that was created by your app. + +```javascript +uber.getRequestDetails(requestId,callback); +``` + +##### Example +```javascript +uber.getRequestDetails(requestId,function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /requests/{request_id}/map + +##### It Returns a Map Link for a Request Id + +```javascript +uber.getRequestMap(requestId,callback); +``` + +##### Example +```javascript +uber.getRequestMap(requestId,function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### GET /requests/{request_id}/receipt + +##### It Returns the Receipt of a Trip + +```javascript +uber.getRequestReceipt(requestId,callback); +``` + +##### Example +```javascript +uber.getRequestReceipt(requestId,function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### PATCH /requests/current + +##### It Updates Ongoing Trip's Destiny + +```javascript +uber.updateOngoingDestination([endCoordinates],callback); +``` + +##### Example +```javascript +uber.updateOngoingDestination(['endLat','endLon'],function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### DELETE /requests/current + +##### It Cancels the Current Trip + +```javascript +uber.cancelCurrentRequest(callback); +``` + +##### Example +```javascript +uber.updateOngoingDestination(function(err,data){ + if(err){ + console.log(err); + } + console.log(data); +}); +``` + +#### In case you want to contribute to the project, feel free! 😁 diff --git a/lib/node-uber-rider.js b/lib/node-uber-rider.js new file mode 100644 index 0000000..36c6f2e --- /dev/null +++ b/lib/node-uber-rider.js @@ -0,0 +1,467 @@ +var request = require('request'); + + +function Uber(userOBJ) +{ + this.clientID = userOBJ.clientID || "No Client ID found"; + this.clientSecret = userOBJ.clientSecret || "No Client Secret found"; + this.redirectURI = userOBJ.redirectURI || "No Redirect URL found"; + this.access_token = userOBJ.access_token || "No Access Token Found"; + this.refresh_token = userOBJ.refresh_token || "No Refresh Token Found"; + this.selfScopes = userOBJ.scope; +} + +module.exports = Uber; + +var baseURLv2 = "https://login.uber.com/oauth/v2"; +var baseURLv1_2 = "https://api.uber.com/v1.2"; + +// Requests Functions ------------------------------- + +function requestURL(urlpath,params,token,callback) +{ + var url = params.length!=0 ? baseURLv1_2+urlpath+'?'+params : baseURLv1_2+urlpath; + //console.log(url); + var headers = {'Accept-Language':'en_US','Authorization':'Bearer '+token} + var options = { + url: url, + method: 'GET', + headers: headers + }; + //console.log(options); + request(options,function(error,response,body) + { + if(response.statusCode == 404) + { + return callback('Erro 404',null); + } + var jsonRes = JSON.parse(body); + if(error) + { + //console.log(error); + return callback("Error: "+error,null); + } + if(jsonRes["message"] == 'Invalid OAuth 2.0 credentials provided.') + { + //console.log('Invalid OAuth 2.0 credentials provided.'); + return callback("Error: "+'Invalid OAuth 2.0 credentials provided.',null); + } + if(jsonRes["message"] == 'No authentication provided.') + { + //console.log('Invalid OAuth 2.0 credentials provided.'); + return callback("Error: "+'No authentication provided.',null); + } + //console.log(jsonRes); + return callback(null,jsonRes); + }); +} + +function postRequestURL(urlpath,bodyData,token,callback) +{ + var url = baseURLv1_2+urlpath; + //console.log(url); + var postBodyData = bodyData; + var headers = {'Accept-Language':'en_US','Authorization':'Bearer '+token} + var options = { + url: url, + method: 'POST', + json:true, + headers: headers, + body:postBodyData + }; + //console.log(options); + request.post(options,function(error,response,body) + { + if(response.statusCode == 404) + { + return callback('Erro 404',null); + } + //console.log(JSON.stringify(body)); + var jsonStringfy = JSON.stringify(body); + var jsonRes = JSON.parse(jsonStringfy); + if(error) + { + return callback("Error: "+error,null); + } + if(jsonRes["message"] == 'Invalid OAuth 2.0 credentials provided.') + { + return callback("Error: "+'Invalid OAuth 2.0 credentials provided.',null); + } + return callback(null,jsonRes); + }); +} + +function patchPutRequestURL(urlpath,bodyData,method,token,callback) +{ + var url = baseURLv1_2+urlpath; + //console.log(url); + var postBodyData = bodyData; + var headers = {'Accept-Language':'en_US','Authorization':'Bearer '+token} + var options = { + url: url, + method: method, + json:true, + headers: headers, + body:postBodyData + }; + //console.log(options); + request(options,function(error,response,body) + { + var jsonRes = JSON.stringify(body); + var Json = JSON.parse(jsonRes); + if(error) + { + return callback("Error: "+error,null); + } + + return callback(null,Json); + }); +} + +//Authentication --------------------------------------- + +//endpoint: GET /authorize +Uber.prototype.getAuthorizeUrl = function(scopes) +{ + if(!Array.isArray(scopes)) + { + return callback("Scope is not an Array",null); + } + if(scopes.length == 0) + { + return new Error("Scope is empty") + } + + var params = "/authorize?response_type=code&client_id="+this.clientID+"&scope="+scopes.join('+')+"&redirect_uri="+this.redirectURI; + + return baseURLv2+params; +} + +//endpoint: POST /token +Uber.prototype.getUserToken = function(code,scope,callback) +{ + var self = this; + + var postData = { + 'client_secret': this.clientSecret, + 'client_id': this.clientID, + 'grant_type':'authorization_code', + 'redirect_uri': this.redirectURI, + 'scope': scope.join(','), + 'code':code + } + var headers = {'Accept-Language':'en_US','Content-Type':'application/x-www-form-urlencoded'} + var options = { + url: 'https://login.uber.com/oauth/v2/token', + method: 'POST', + headers: headers, + form:postData + }; + + request(options, function (error, response, body) { + + if(error) + { + console.log(error); + } + if(response.body == '{"error": "invalid_grant"}') + { + console.log("Invalid Grant"); + return new Error("Invalid Grant"); + } + + var response = JSON.parse(body); + + self.access_token = response["access_token"]; + self.refresh_token = response["refresh_token"]; + self.selfScopes = response["scope"].split(' '); + return callback(null,response["access_token"]); + }) + +} + +// Riders --------------------------------------- + +//endpoint: GET /me +Uber.prototype.me = function(callback) +{ + requestURL('/me','',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); + +} + +//endpoint: GET /history +Uber.prototype.history = function(limit,offset,callback) +{ + if(typeof(limit) != 'number' || typeof(offset) != 'number') + { + console.log("The paramaters has to be an number."); + return new Error("The paramaters has to be an number."); + } + params = 'limit='+limit+'&'+'offset='+offset; + requestURL('/history',params,this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); + +} + +//endpoint: GET /payment-methods +Uber.prototype.paymentMethods = function(callback) +{ + requestURL('/payment-methods','',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: GET /places/{place_id} +Uber.prototype.getPlaceByPlaceId = function(placeId,callback) +{ + requestURL('/places/'+placeId,'',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: PATCH /me +Uber.prototype.applyPromotion = function(code,callback) +{ + var data = {"applied_promotion_codes": code}; + patchPutRequestURL('/me',data,'PATCH',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }) +} + +//endpoint: PUT /places/{place_id} +Uber.prototype.updateHomeOrWork = function(place,placeAddress,callback) +{ + var data = {"address": placeAddress}; + patchPutRequestURL('/places/'+place,data,'PUT',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }) +} + + +// Ride Products --------------------------------------- + +//endpoint: GET /products +Uber.prototype.products = function(coordinates,callback) +{ + if(!Array.isArray(coordinates)) + { + return callback("Coordinates are not an Array", null) + } + var lat = coordinates[0]; + var lon = coordinates[1]; + params = 'latitude='+lat+"&"+'longitude='+lon; + requestURL('/products',params,this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: GET /products/{product_id} +Uber.prototype.getProductByProductId = function(productId,callback) +{ + requestURL('/products/'+productId,'',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +// Ride Estimates --------------------------------------- + +//endpoit: GET /estimates/price +Uber.prototype.estimatePrice = function(coordinates,callback) +{ + if(!Array.isArray(coordinates)) + { + return callback("Coordinates are not an Array", null) + } + var start_lon = coordinates[1]; + var start_lat = coordinates[0]; + var end_lat = coordinates[2]; + var end_lon = coordinates[3]; + + params = 'start_latitude='+start_lat+'&'+'start_longitude='+start_lon+'&'+'end_latitude='+end_lat+'&'+'end_longitude='+end_lon; + + requestURL('/estimates/price',params,this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: GET /estimates/time +Uber.prototype.estimateTime = function(coordinates,callback) +{ + if(!Array.isArray(coordinates)) + { + return callback("Coordinates are not an Array", null) + } + var start_latitude = coordinates[0]; + var start_longitude = coordinates[1]; + params = 'start_latitude='+start_latitude+"&"+'start_longitude='+start_longitude; + + requestURL('/estimates/time',params,this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +// Ride Requests --------------------------------------- + +//endpoint: POST /requests/estimate +Uber.prototype.requestEstimate = function(infos,callback) +{ + var product_id = infos.product_id; + var start_latitude = infos.start_latitude; + var start_longitude = infos.start_longitude; + var end_latitude = infos.end_latitude; + var end_longitude = infos.end_longitude; + + var postData = { + 'start_latitude':start_latitude, + 'start_longitude':start_longitude, + 'end_latitude':end_latitude, + 'end_longitude':end_longitude, + 'product_id':product_id + } + + postRequestURL('/requests/estimate',postData,this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: POST /requests +Uber.prototype.createRequest = function(infos,callback) +{ + var product_id = infos.product_id; + var start_latitude = infos.start_latitude; + var start_longitude = infos.start_longitude; + var end_latitude = infos.end_latitude; + var end_longitude = infos.end_longitude; + var fare_id = infos.fare_id; + var postData = { + 'start_latitude':start_latitude, + 'start_longitude':start_longitude, + 'end_latitude':end_latitude, + 'end_longitude':end_longitude, + 'product_id':product_id, + 'fare_id':fare_id + } + postRequestURL('/requests',postData,this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endoint: GET /requests/current +Uber.prototype.currentRequest = function(callback) +{ + requestURL('/requests/current','',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: GET /requests/{request_id} +Uber.prototype.getRequestDetails = function(request_id,callback) +{ + requestURL('/requests/'+request_id,'',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: GET /requests/{request_id}/map +Uber.prototype.getRequestMap = function(request_id,callback) +{ + requestURL('/requests/'+request_id+'/map','',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: GET /requests/{request_id}/receipt +Uber.prototype.getRequestReceipt = function(request_id,callback) +{ + requestURL('/requests/'+request_id+'/receipt','',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }); +} + +//endpoint: PATCH /requests/current +Uber.prototype.updateOngoingDestination = function(end_coordinates,callback) +{ + + if(!Array.isArray(end_coordinates)) + { + return callback("Scope is not an Array",null); + } + + var end_latitude = end_coordinates[0]; + var end_longitude = end_coordinates[1]; + + var data = { + "end_latitude": end_latitude, + "end_longitude": end_longitude + }; + + patchPutRequestURL('/requests/current',data,'PATCH',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }) +} + +//endpoint: DELETE /requests/current +Uber.prototype.cancelCurrentRequest = function(callback) +{ + patchPutRequestURL('/requests/current','','DELETE',this.access_token,function(err,data){ + if(err){ + return callback('There was an error: '+err,null); + } + return callback(null,data); + }) +} + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..dbacd65 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1195 @@ +{ + "name": "node-uber-rider", + "version": "0.0.0-development", + "lockfileVersion": 1, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=" + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "buffer-from": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", + "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==", + "dev": true + }, + "cachedir": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-1.2.0.tgz", + "integrity": "sha512-i3xIKd9U4ov0hWXYo08oJy0YVz0krZ9dbTZQim41xkg0IiScptkAK0UilZ5M1WE3gnWjXAa9+cMtrJ5dM+THbA==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "dependencies": { + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=" + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "commitizen": { + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-2.9.6.tgz", + "integrity": "sha1-wNAFNe8mTaf2Nzft/aQiiYP6IpE=", + "dev": true, + "dependencies": { + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true + }, + "cz-conventional-changelog": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-1.2.0.tgz", + "integrity": "sha1-K8oElkyJGbI/P9aonvXmAIsxs/g=", + "dev": true + }, + "external-editor": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-1.1.1.tgz", + "integrity": "sha1-Etew24UPf/fnCBuvQAVwAGDEYAs=", + "dev": true + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true + }, + "inquirer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-1.2.3.tgz", + "integrity": "sha1-TexvMvN+97sLLtPx0aXD9UUHSRg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true + }, + "lodash": { + "version": "4.17.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.2.tgz", + "integrity": "sha1-NKMFW6vgTOQkZ7YH1wAHLH/2v0I=", + "dev": true + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mute-stream": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.6.tgz", + "integrity": "sha1-SJYrGeFp/R38JAs/HnMXYnu8R9s=", + "dev": true + }, + "onetime": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true + }, + "tmp": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.29.tgz", + "integrity": "sha1-8lEl/w3Z2jzLDC3Tce4SiLuRKMA=", + "dev": true + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true + }, + "conventional-commit-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/conventional-commit-types/-/conventional-commit-types-2.2.0.tgz", + "integrity": "sha1-XblXOdbCEqy+e29lahG5QLqmiUY=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==" + } + } + }, + "cz-conventional-changelog": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-2.1.0.tgz", + "integrity": "sha1-L0vHOQ4yROTfKT5ro1Hkx0Cnx2Q=", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true + }, + "dedent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.6.0.tgz", + "integrity": "sha1-Dm2o8M5Sg471zsXI+TlrDBtko8s=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "detect-file": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-0.1.0.tgz", + "integrity": "sha1-STXe39lIhkjgBrASlWbpOGcR6mM=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true + }, + "find-node-modules": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-1.0.4.tgz", + "integrity": "sha1-tt6zzMtpnIcDdne87eLF9YYrJVA=", + "dev": true + }, + "find-root": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.0.0.tgz", + "integrity": "sha1-li/yEaqyXGUg/u641ih/j26VgHo=", + "dev": true + }, + "findup-sync": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.4.2.tgz", + "integrity": "sha1-qBF9D3MST1pFRoOVef5S1xKfteU=", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=" + }, + "fs-exists-sync": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", + "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=", + "dev": true + }, + "fs-extra": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-1.0.0.tgz", + "integrity": "sha1-zTzl9+fLYUWIP8rjGR6Yd/hYeVA=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=" + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true + }, + "global-modules": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", + "integrity": "sha1-6lo77ULG1s6ZWk+KEmm12uIjgo0=", + "dev": true + }, + "global-prefix": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", + "integrity": "sha1-jTvGuNo8qBEqFg2NSW/wRiv+948=", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=" + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==" + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hoek": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" + }, + "homedir-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", + "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=" + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "dev": true + }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "merge": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", + "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true + }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true + }, + "mocha": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.1.1.tgz", + "integrity": "sha512-kKKs/H1KrMMQIEsWNxGmb4/BGsmj0dkeyotEvbrAuQ01FcWRLssUNXCEUZk6SZtyJBi6EE7SL0zDDtItw1rGhw==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-shim": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/os-shim/-/os-shim-0.1.3.tgz", + "integrity": "sha1-a2LDeRz3kJ6jXtRuF2WLtBfLORc=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "pad-right": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/pad-right/-/pad-right-0.2.2.tgz", + "integrity": "sha1-b7ySQEXSRPKiokRQMGDTv8YAl3Q=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true + }, + "request": { + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==" + }, + "resolve": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "dev": true + }, + "resolve-dir": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", + "integrity": "sha1-shklmlYC+sXFxJatiUpujMQwJh4=", + "dev": true, + "dependencies": { + "expand-tilde": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-1.2.2.tgz", + "integrity": "sha1-C4HrqJflo9MdHD0QL48BRB5VlEk=", + "dev": true + } + } + }, + "right-pad": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/right-pad/-/right-pad-1.0.1.tgz", + "integrity": "sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA=", + "dev": true + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true + }, + "rx": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz", + "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "shelljs": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.6.tgz", + "integrity": "sha1-N5zM+1a5HIYB5HkzVutTgpJN6a0=", + "dev": true + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==" + }, + "spawn-sync": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/spawn-sync/-/spawn-sync-1.0.15.tgz", + "integrity": "sha1-sAeZVX63+wyDdsKdROih6mfldHY=", + "dev": true + }, + "sshpk": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=" + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=" + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..1961d51 --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "node-uber-rider", + "version": "0.0.0-development", + "description": "A library that helps who wants to use Uber API with fast and easy methods ✨", + "main": "lib/node-uber-rider.js", + "scripts": { + "commit": "git-cz", + "test": "mocha test/test.js --slow 1000 -w", + "test:single": "mocha test/test.js --slow 1000", + "semantic-release": "semantic-release" + }, + "repository": { + "type": "git", + "url": "https://github.com/JBezerra/node-uber-driver.git" + }, + "keywords": [ + "uber", + "uber-api", + "driver-api" + ], + "author": "José Bezerra ", + "license": "MIT", + "bugs": { + "url": "https://github.com/JBezerra/node-uber-driver/issues" + }, + "homepage": "https://github.com/JBezerra/node-uber-driver#readme", + "dependencies": { + "request": "2.85.0" + }, + "devDependencies": { + "chai": "4.1.2", + "commitizen": "2.9.6", + "cz-conventional-changelog": "2.1.0", + "mocha": "5.1.1", + "semantic-release": "^15.2.0" + }, + "config": { + "commitizen": { + "path": "node_modules/cz-conventional-changelog" + } + } +} diff --git a/test/configs.js b/test/configs.js new file mode 100644 index 0000000..47f29f5 --- /dev/null +++ b/test/configs.js @@ -0,0 +1,16 @@ +var Uber = require('../lib/node-uber-rider.js'); +var config = { + clientID: process.env.clientID, + clientSecret: process.env.clientSecret, + redirectURI:process.env.redirectURI, + access_token: process.env.access_token +}; + +var myUber = new Uber({ + clientID: config.clientID, + clientSecret: config.clientSecret, + redirectURI: config.redirectURI, + access_token: config.access_token +}); + +module.exports = myUber; \ No newline at end of file diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..8c4b806 --- /dev/null +++ b/test/test.js @@ -0,0 +1,106 @@ +var uber = require('../lib/node-uber-rider'); +var chai = require('chai'); +var expect = chai.expect; +var should = chai.should; +var myUber = require('./configs.js'); + +var baseURLv2 = "https://login.uber.com/oauth/v2"; +var baseURLv1_2 = "https://api.uber.com/v1.2"; +var scope = ['history','profile','all_trips','places']; +var coordinates = ['37.7752315','-122.418075']; + +describe('node-uber-rider', function(){ + + describe('Authentication', function(){ + it('.getAuthorizeUrl', function(){ + var scopes = ['history','profile','all_trips','places']; + var code = myUber.getAuthorizeUrl(scopes); + var url = baseURLv2+"/authorize?response_type=code&client_id="+myUber.clientID+"&scope="+scopes.join('+')+"&redirect_uri="+myUber.redirectURI; + gb_code = code; + expect(code).to.be.equal(url); + }); + }); + + describe('Riders', function(){ + it('.me', function(done){ + myUber.me(function(err,data){ + if (err) done(err); + else done(); + }); + + + }); + + it('.history', function(done){ + myUber.history(5,0,function(err,data){ + if (err) done(err); + else done(); + }); + }); + + it('.paymentMethods', function(done){ + myUber.paymentMethods(function(err,data){ + if (err) done(err); + else done(); + }); + }); + + it('.getPlaceByPlaceId', function(done){ + myUber.getPlaceByPlaceId('home',function(err,data){ + if (err) done(err); + else done(); + }); + }); + + it('.getPlaceByPlaceId', function(done){ + myUber.getPlaceByPlaceId('home',function(err,data){ + if (err) done(err); + else done(); + }); + }); + + }); + + describe('Ride Products', function(){ + it('.products', function(done){ + myUber.products(coordinates,function(err,data){ + if (err) done(err); + else done(); + }); + }); + + it('.getProductByProductId', function(done){ + myUber.getProductByProductId('a1111c8c-c720-46c3-8534-2fcdd730040d',function(err,data){ + if (err) done(err); + else done(); + }); + }); + }); + + describe('Ride Estimates', function(){ + it('.estimatePrice', function(done){ + myUber.estimatePrice(coordinates,function(err,data){ + if (err) done(err); + else done(); + }); + }); + + it('.estimateTime', function(done){ + myUber.estimateTime(coordinates,function(err,data){ + if (err) done(err); + else done(); + }); + }); + }); + + describe('Ride Requests', function(){ + it('.requestEstimate', function(done){ + myUber.requestEstimate(coordinates,function(err,data){ + if (err) done(err); + else done(); + }); + }); + + + }); +}); \ No newline at end of file