Coder Social home page Coder Social logo

node-uber's Introduction

Hi there ๐Ÿ‘‹

node-uber's People

Contributors

agraebe avatar davoodharun avatar esomnsi avatar gitter-badger avatar mjkaufer avatar objectivesee avatar shernshiou avatar signorekai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-uber's Issues

No settings to mention http-proxy/https-proxy

The module works well with open internet, but it is not working on internet with proxies. Also there are no options available to mention proxy settings. Please implement the option to add proxy setting too.

Need support for revoke

Need supports for the OAuth revoke call to revoke a bearer token. I'm calling the API endpoint directly for now, but it would be nice to use this package to do it. If there is anyone else interested in this I could take a stab at implementing it as it is really straight-forward, just call the revoke endpoint with client-id, client-secret, and token. I've never worked on a NPM so not entirely sure how to go about building one, but Google is my friend and it can't be that hard.

Rework testing architecture

Right now, the testing architecture is not suitable for more and advanced tests. For instance, nock responses are stored in variables in testing files. Those files should be stored separately.

Also, all nock instructions should be encapsulated to avoid duplicated calls (e.g. authorization is needed in almost every case).

how to use tracking api?

hi
am trying create to app for sales. my is made on nodejs with angularjs .i just want track field person like tracking cab in real time. so i decided to use uber tracking api only..!!

is that possible to use like that?
does uber has separate api for tracking purpose only.?

kindly explain flow of the process and how to make use of it..

thank you Team

HTTP status code checking

Currently the library does not check the HTTP status code returned from Uber API requests. The data.statusCode property would tell you whether there was a non 200 response. Uber will, for example, return a 409 when there is surge pricing in response to POST /requests. The response body contains enough info to determine that there is a surge w/o using the status code, but the status code may be nice to have as well.

The smallest change would be to pass data into the callback in Uber.js. Another option is to check the statusCode in the response handler and create an error if the code is non-200.

  request.get({
    url: url,
    //auth: accessToken,
    json: true
  }, function (err, data, res) {

  // TODO: non-200 data.statusCode handling here!

    if (err) {
      callback(err);
    } else {
      callback(null, res, data);       // include `data` in callback
    }
  });

Issues adding using yarn

When installing using yarn add, the following error is shown:

error [email protected]: The engine "node" is incompatible with this module. Expected version "6.10".

Node version: 7.8.0
yarn version: 0.24.5

Drop support for deprecated methods

The supported methods should not be maintained in the future. This will decrease the complexity of the package, especially since new Async (premise-based) methods will be coming with v.1.0.0

What is the simplest example to estimate ride price?

What is the simplest example to estimate ride, assuming that pick location is 28.5662241,77.2088588 and drop location 28.6115458,77.227003.

The uber developer site shows implementations for Curl, Python, Java and iOS only.

I would like to know for node.

Update access token for multi-user app.

This may not be an issue or may be required to improve reusability of code, shouldn't there be a way to update the access_token? I've many users using the same Uber back end and upon hitting the Node js app I need to override the Uber object's access token. This will help anybody accessing the system to get their information from the APIs and won't be restricted to single User.

Integrate node-geocoder?

What do you guys think - would it make sense to integrate node-geocoder to e.g. easily get products by address? I think most people will use it anyways to get lat & lon values for the calls...

I'd propose adding 3 new methods, e.g.:

  • uber.products.getAllForAddress(address)
  • uber.estimates.getPriceForRouteByAddress(start_address, end_address, [, seats])
  • uber.estimates.getETAForAddress(address [, product_id])

In addition to that, some methods might need to be revisited:

  • uber.requests.create(parameter)
  • uber.requests.getEstimates(parameter)
  • uber.requests.updateByID(request_id, parameter)
  • uber.reminders.create(parameter)
  • uber.reminders.updateByID(reminder_id, parameter).

how to set access_token

First off, thank you very much for node-uber!!

I was wondering how do I set an access_token on requests that require OAuth?

Sandbox Mode: request status, surge multiplier & driver's availability

Thanks to this post on ST, a bug was identified:

The methods requests.setStatusByID, products.setDriversAvailabilityByID and products.setSurgeMultiplierByID send HTTP requests to the wrong URL, e.g.:
https://sandbox-api.uber.com/v1/requests/{request_id}

While the base URL is correct, the endpoint requires another hierarchy, like that:
https://sandbox-api.uber.com/v1/sandbox/requests/{request_id}

Where to install node-uber at?

This might seem like a dumb question, but this is my first node_module I have used or am using.

  • I installed node-uber with: "npm install node-uber --save-dev"
  • and it installed to: \dev\appName\node_modules\node-uber.
  • But when I add the code to my script in \dev\appName\www\js\index.js : var Uber= require('node-uber') ;

i get this error: Uncaught ReferenceError: require is not defined.

'node-uber' is listed in my devDependencies section of my package.json file.

What am I doing wrong?

Unable to fetch a single request

requests.getReceiptByID seems to send the access_token in the query string instead of the header which causes Uber to deny the request.

oAuth Example

Can somebody provide an example of how to authorize? I dont know what to use for redirect URL

Functionality for Surge Pricing

Would love to have the functionality for surge pricing, which would include:
-Getting surge pricing confirmation id from HTTP 409 error
-Ability to pass back surge confirmation id in request

Thanks!

install issues

from my cordova 4.3.0 application directory I installed this plugin

C:\appdev/appTest>npm install -g node-uber
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
[email protected] node_modules\node-uber
โ”œโ”€โ”€ [email protected]
โ””โ”€โ”€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected].
0, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], form-data@0.
2.0, [email protected], [email protected], [email protected], [email protected])

Then: \appdev\appTest > npm test
C:\appdev\appTest>npm test

[email protected] test C:\appdev\appTest
echo "Error: no test specified"

"Error: no test specified"

However, I do see all the node-uber files instilled within my project and I added the basic call to the uber api with:

var Uber = require('node-uber');

And I get the following error: Uncaught ReferenceError: require is not defined

Receiving 3 failing errors during Authentication

After MUCH learning I finally am implementing node-uber the correct way. Apologies for the many reported issues previously - they were not your app and were my fault.

That being said, in the /test folder I have replaced your "var key" in index.js and key.json info with my own registered uber keys/tokens, and am now getting the following errors. Please advise:

[08:48:38] Using gulpfile ~\dev\WHIPSTER\node_modules\node-uber\gulpfile.js
[08:48:38] Starting 'test'...

Uber client general test
โˆš should load the key from a key.json
โˆš should initiate Uber client with the key

OAuth2 authorization methods
OAuth2 authorization url
โˆš generate OAuth2 correct authorization url
โˆš should return error if scope is not an array
โˆš should return error if scope is not an empty array
Exchange authorization code into access token
createCredentials() is deprecated, use tls.createSecureContext instead
โˆš should able to get access token and refresh token using authorization code
โˆš should able to get access token and refresh token using refresh token
โˆš should return error if there is no authorization_code or refresh_token

Products Resource
Products List
1) should list down all the product types
โˆš should return error if there is no required params

Estimates Resource
Price Estimates
2) should list all the price estimates from server
โˆš should return error if there is no required params
Time Estimates
3) should list all the price estimates from server
โˆš should return error if there is no required params

User Resource
User Profile
โˆš should get user profile after authentication
โˆš should get user profile after authentication by explicitly passing access token
โˆš should return invalid access token error when no token found

14 passing (125ms)
3 failing

  1. Products Resource Products List should list down all the product types:
    Uncaught AssertionError: expected [Error: Nock: No match for request GET https://api.uber.com/v1/products?server_token=XXXXXXPaPcEE0cHb
    whKiF_sl_ZUYvEHHO_f6U6dr&latitude=3.1357&longitude=101.688 ] to not exist

  2. Estimates Resource Price Estimates should list all the price estimates from server:
    Uncaught AssertionError: expected [Error: Nock: No match for request GET https://api.uber.com/v1/estimates/price?server_token=XXXXXXPaP
    cEE0cHbwhKiF_sl_ZUYvEHHO_f6U6dr&start_latitude=3.1357&start_longitude=101.688&end_latitude=3.0833&end_longitude=101.65 ] to not exist

  3. Estimates Resource Time Estimates should list all the price estimates from server:
    Uncaught AssertionError: expected [Error: Nock: No match for request GET https://api.uber.com/v1/estimates/time?server_token=XXXXXXPaPc
    EE0cHbwhKiF_sl_ZUYvEHHO_f6U6dr&start_latitude=3.1357&start_longitude=101.688&end_latitude=3.0833&end_longitude=101.65 ] to not exist

[Urgent] Keep master the same as published npm module

The npm version currently deployed 0.9.7 is not the same as master, which is 1.0.0. This is critical to keep in sync because hackers have vague errors due to expecting a promise-based API when it's still callback based.

Might I suggest keeping master and the currently deployed npm version in sync always?

Cheers ๐Ÿป๐Ÿ‘Œ

Add scope checks for API calls

To ensure a user is authorized with the right scopes (limited to OAuth2 tokens), scopes should be checked before a call is send to the Uber API.

Legal Code

Hi there,

Just wondering if we are legally allowed to use this API? e.g. is this Uber supported or will we be at risk of getting banned?

Replace geocoder 0.2.2 with node-geocoder latest

It seems this lib is using geocoder version 0.2.2. Unfortunately when google started requiring users to use an API key for their geocoder API, all functions in the lib that relayed on geocoder stopped working. I do see #24 where it seems node-geocoder was going to be added to the project, looking at the commit history I only ever see geocoder as being part of the project. It seems that we would need to replace geocoder with node-geocoder and add methods to pass API keys to the lib.

Thoughts?

Error: No coordinates found for my lat, lon

I am trying to execute the following Uber Api endpoint

Note: startLat=24.8793259&startLon=67.0570063 is coord of Karachi Pakistan
http://localhost:8000/api/getETAForLocation?startLat=24.8793259&startLon=67.0570063

here is the code

app.get('/api/getETAForLocation', function(request, response) {

  // extract the query from the request URL
  var query = url.parse(request.url, true).query;

  // if no query params sent, respond with Bad Request
  if (!query || !query.startLat || !query.startLon ) {
    response.sendStatus(400);
  } else {
    uber.estimates.getETAForAddressAsync(query.startLat, query.startLon)
    .then(function(res) {
        response.json(res);
    })
    .error(function(err) {
      console.error(err);
      response.sendStatus(500);
    });
  }
})

I am getting this Error log on my console

{ Error: No coordinates found for: "24.8793259"
    at /Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/node-uber/lib/Uber.js:64:42
    at Request._callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/geocoder/providers/google.js:20:5)
    at Request.self.callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1171:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1091:12)
    at IncomingMessage.g (events.js:286:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:973:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  cause: 
   Error: No coordinates found for: "24.8793259"
       at /Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/node-uber/lib/Uber.js:64:42
       at Request._callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/geocoder/providers/google.js:20:5)
       at Request.self.callback (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:188:22)
       at emitTwo (events.js:106:13)
       at Request.emit (events.js:191:7)
       at Request.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1171:10)
       at emitOne (events.js:96:13)
       at Request.emit (events.js:188:7)
       at IncomingMessage.<anonymous> (/Users/qadirhussain/Desktop/Development/nodeJS/Uber/node_modules/request/request.js:1091:12)
       at IncomingMessage.g (events.js:286:16)
       at emitNone (events.js:91:20)
       at IncomingMessage.emit (events.js:185:7)
       at endReadableNT (_stream_readable.js:973:12)
       at _combinedTickCallback (internal/process/next_tick.js:74:11)
       at process._tickCallback (internal/process/next_tick.js:98:9),
  isOperational: true }

And on browser I get

Internal Server Error

But when I try same Api with Zurich Coords. i.e 47.3769ยฐ N, 8.5417ยฐ E
http://localhost:8000/api/getETAForLocation?startLat=47.3769&startLon=8.5417
Its returns no any error but empty response on browser

{"times":[]}

"request" scope is not working

When I'm calling uber.getAuthorizeUrl(['request']); I'm getting an url. But after loging in getting an error "invalid_scope". I also tried to call the uber api directly from a cordova app, and also getting the same error. Maybe this is not your issue. I opened this issue to discuss and find the solution.

invalid_grant on request when obtaining access_token from somewhere else

Hello,
I have an iOS App where I use SSO to authenticate the user and then save the accessToken & refreshToken locally to keychain on my device. Then I'm calling my server who uses a javascript background function to call your library to make a request to Uber.
So far, I'm trying to set up your library with my 2 local tokens like this:

 var uber = new uberClient({
    client_id: '...',
    client_secret: '...',
    server_token: '...',
    name: 'My App',
    sandbox: true, //optional
    access_token: accessToken,
    refresh_token: refreshToken
  });

afterwards I want to call the uber.requests.getEstimatesAsync endpoint like this:

uber.requests.getEstimatesAsync({
      "start_latitude": pickupLocation["lat"],
      "start_longitude": pickupLocation["lng"],
      "end_latitude": dropoffLocation["lat"],
      "end_longitude": dropoffLocation["lng"]
      })
      .then(function(res) { 
        console.log(JSON.stringify(res)); 
      })
      .error(function(err) { 
        console.error(err); 
      });
})

Though every time I get an "invalid_grant" error while doing this. Did I make a mistake authenticating myself or setting up the Uber client wrong? Is it even possible to add my local accessToken & refreshToken manually to your uber client?
I'm using a Developer account for doing this, therefore I should actually have all the required permissions for the request endpoint, but I also obtained them previously in the App.

Best regards,
Matt

Using ES6 with Node 4.0.0+ as engine

Right now, our tests in TravisCI cover (and pass) older versions of Node (0.10, 0.11, 0.12, iojs). I'm considering to use some ES6 features and wanted to understand you think there would be a tremendous drawback if we remove backward compatibility.

@shernshiou @puzzlehe4d

Update to API v1.2 endpoints

Uber recently announced v1.2 endpoints for the Rides API. The following changes would be required to upgrade:

  1. API base URL would need to reflect the version bump: https://api.uber.com/v1.2/. Sample endpoint.
  2. A new ride request flow for upfront prices should be implemented, as described here
  3. All usage of rate limiting headers should be removed. The headers are deprecated with v1.2. A new endpoint to meet the needs will be created. Here are the impacted headers: X-Rate-Limit-Limit, X-Rate-Limit-Remaining, X-Rate-Limit-Reset.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.