Skip to content

Commit

Permalink
V1.0.0 (#56)
Browse files Browse the repository at this point in the history
* adding bluebird

missing tests

* adding tests for async methods

* #33 implementation including tests and updated README.md

* adding error handling to samples

* resolving conflict for README

* update dependency versions

* remove publisher and fix gulpfile

* #24 first piece with tests

to come: Reindeers & Requests implementation

* solving #24, #40, #41, #42

- added all methods for #24 including tests
- updated READMEs & example files
- reworked entire testing architecture for #41
- removed deprecated methods for #42
- added scope checks for #40

* adding tests for #40

* sync updates from master

* Added mechanism for token refresh (#47)

* added token refresh functionality

* added unit test for oauth.js

* added unit test for oauthAsync.js

* added tests for complete code coverage

* code cleanup

* Updating dependencies and set engines

* Setting tokens to fix #39

* Added implicit surge handling (#49)

* added functionality for surge pricing

* added implicit surge handling

* Changed OAuth2 urls to v2 (#53)

* Adding tests for #53

* Dropping node v.1x/iojs in favor of ES6 #30
  • Loading branch information
agraebe authored Feb 26, 2017
1 parent 76d1ecc commit db9da1a
Show file tree
Hide file tree
Showing 65 changed files with 4,526 additions and 1,785 deletions.
13 changes: 0 additions & 13 deletions .publishrc

This file was deleted.

13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
language: node_js
node_js:
- "5"
- "5.1"
- "4"
- "6.10"
- "6.9"
- "4.8"
- "4.4.1"
- "4.2"
- "4.1"
- "4.0"
- "0.12"
- "0.11"
- "0.10"
- "iojs"
addons:
code_climate:
repo_token: 6131e0b97abea823e9a41cc90736f0c2fdbe5d6b442ce0603f7f131aea6b35c3
Expand Down
717 changes: 717 additions & 0 deletions README-Nodeback.md

Large diffs are not rendered by default.

469 changes: 261 additions & 208 deletions README.md

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions examples/auth-get-products-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var Uber = require('node-uber');

// create new Uber instance
var uber = new Uber({
client_id: 'YOUR CLIENT ID',
client_secret: 'YOUR CLIENT SECRET',
server_token: 'YOUR SERVER TOKEN',
redirect_uri: 'http://localhost/callback',
name: 'nodejs uber wrapper',
language: 'en_US',
sandbox: true
});

// get authorization URL
var authURL = uber.getAuthorizeUrl(['history', 'profile', 'request', 'places']);

// redirect user to the authURL

// the authorizarion_code will be provided via the callback after logging in using the authURL
uber.authorizationAsync({
authorization_code: 'YOUR AUTH CODE'
})
.spread(function(access_token, refresh_token, authorizedScopes, tokenExpiration) {
// store the user id and associated access_token, refresh_token, scopes and token expiration date
console.log('New access_token retrieved: ' + access_token);
console.log('... token allows access to scopes: ' + authorizedScopes);
console.log('... token is valid until: ' + tokenExpiration);
console.log('... after token expiration, re-authorize using refresh_token: ' + refresh_token);

// chain the promise to retrive all products for location
return uber.products.getAllForLocationAsync(3.1357169, 101.6881501);
})
.then(function(res) {
// response with all products
console.log(res);
})
.error(function(err) {
console.error(err);
});
22 changes: 14 additions & 8 deletions examples/auth-get-products.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,25 @@ var uber = new Uber({
});

// get authorization URL
var authURL = uber.getAuthorizeUrl(['history','profile', 'request', 'places']);
var authURL = uber.getAuthorizeUrl(['history', 'profile', 'request', 'places']);

// redirect user to the authURL

// the authorizarion_code will be provided via the callback after logging in using the authURL
uber.authorization({
// this code will be provided via the callback after logging in using the authURL
authorization_code: 'YOUR AUTH CODE'
}, function(err, access_token, refresh_token) {
if (err) console.error(err);
else {
console.log('Your access_token is: ' + access_token);
console.log('Your refresh_token is: ' + refresh_token);
}, function(err, res) {
if (err) {
console.error(err);
} else {
// store the user id and associated properties:
// access_token = res[0], refresh_token = res[1], scopes = res[2]),and token expiration date = res[3]
console.log('New access_token retrieved: ' + res[0]);
console.log('... token allows access to scopes: ' + res[2]);
console.log('... token is valid until: ' + res[3]);
console.log('... after token expiration, re-authorize using refresh_token: ' + res[1]);

uber.products.getAllForLocation(3.1357, 101.6880, function(err, res) {
uber.products.getAllForLocation(3.1357169, 101.6881501, function(err, res) {
if (err) console.error(err);
else console.log(res);
});
Expand Down
8 changes: 5 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ gulp.task('pre-test', function() {
.pipe(istanbul.hookRequire());
});

gulp.task('test', function() {
gulp.task('test', ['pre-test'], function() {
return gulp.src(['test/**/*.js'])
.pipe(mocha({
reporter: 'spec'
reporter: 'spec',
//useColors: false,
timeout: 5000
}))
// Creating the reports after tests ran
.pipe(istanbul.writeReports())
// Enforce a coverage of at least 90%
// Enforce a coverage of at least 95%
.pipe(istanbul.enforceThresholds({
thresholds: {
global: 95
Expand Down
Loading

0 comments on commit db9da1a

Please sign in to comment.