Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey committed Oct 10, 2015
1 parent dc77ecc commit a9e67f6
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1 +1,3 @@
node_modules/

npm-debug.log
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -15,7 +15,7 @@ I decided to use `Uber API` in order to get my daily Uber ride.
Installation and setup
===
- Create an app on [Uber](https://developer.uber.com/dashboard) in order to consume their API.
- Modify `./src/config.js` with your dash button MAC address, your Uber application credentials and the start/end location of your drive
- Modify `./config.js` with your dash button MAC address, your Uber application credentials and the start/end location of your drive
- `$ npm install`
- `$ sudo ./uber-dash.js` #root needed to monitor the network AFAIK
- Visit `http://localhost:3000/login` to allow the app to request Uber rides for you then close the tab
Expand Down
14 changes: 14 additions & 0 deletions config.js
@@ -0,0 +1,14 @@
module.exports = {
dashbutton: 'a0:02:dc:b1:3d:b2', // Your button's MAC address in a 6 group of 2 hexadecimal digit separated by colons
uber: {
clientId: '',
clientSecret: '',
serverToken: '',
redirectUri: 'http://localhost:3000/callback'
},
start_latitude: 37.776130,
start_longitude: -122.409647,
end_latitude: 37.762892,
end_longitude: -122.408678,
product_id: '' // The product you want to order from Uber
};
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -10,7 +10,7 @@
},
"devDependencies": {},
"scripts": {
"start": "./dash-button.js",
"start": "./uber-dash.js",
"test": "npm test"
},
"repository": {
Expand Down
14 changes: 0 additions & 14 deletions src/config.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/uber.js
@@ -1,5 +1,5 @@
var request = require('request');
var config = require('./config');
var config = require('../config');
var app = require('express')();
var TOKEN = null;

Expand Down
10 changes: 5 additions & 5 deletions uber-dash.js
@@ -1,18 +1,18 @@
#!/usr/bin/env node

var config = require('./src/config');
var config = require('./config');

if (!config.dashbutton) {
console.log('Add your dash button MAC address to ./src/config.js');
console.log('Add your dash button MAC address to ./config.js');
process.exit();
}

if (!config.uber.clientId || !config.uber.clientSecret || !config.uber.serverToken) {
console.log('Create an Uber application and add the credentials to ./src/config.js');
console.log('Create an Uber application and add the credentials to ./config.js');
process.exit();
}

var network = require('./src/network');
var uber = require('./src/uber');
var network = require('./src/network');
var uber = require('./src/uber');

network.listenForDashPress(config.dashbutton, uber.call);

0 comments on commit a9e67f6

Please sign in to comment.