Skip to content

Commit

Permalink
Added ability to modify host
Browse files Browse the repository at this point in the history
With this pull request you can change the base url using the ODESKAPI
environment variable.
  • Loading branch information
xjamundx committed Apr 17, 2013
1 parent f76d1ff commit 520603c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions lib/oauth.js
@@ -1,10 +1,11 @@
var oauth = require('oauth'),
qs = require('querystring');
qs = require('querystring'),
baseUrl = process.env.ODESKAPI || 'https://www.odesk.com';


exports.OAuth = function(key, secret) {
this.requestUrl = 'https://www.odesk.com/api/auth/v1/oauth/token/request';
this.accessUrl = 'https://www.odesk.com/api/auth/v1/oauth/token/access';
this.requestUrl = baseUrl + '/api/auth/v1/oauth/token/request';
this.accessUrl = baseUrl + '/api/auth/v1/oauth/token/access';
this.key = key;
this.secret = secret;
this.version = '1.0';
Expand Down Expand Up @@ -44,7 +45,7 @@ oauth.OAuth.prototype.getAccessToken = function(requestToken, requestTokenSecret
}

oauth.OAuth.prototype.getAuthorizeUrl = function(callbackUrl, callback) {
var authorizeUrl = 'https://www.odesk.com/services/api/auth';
var authorizeUrl = baseUrl + '/services/api/auth';
var params = {};
if(typeof callbackUrl == 'function') {
callback = callbackUrl;
Expand Down
5 changes: 3 additions & 2 deletions lib/odesk.js
@@ -1,10 +1,11 @@
var OAuth = require('./oauth').OAuth,
URL = require('url'),
qs = require('querystring');
qs = require('querystring'),
baseUrl = process.env.ODESKAPI || 'https://www.odesk.com';


exports.oDesk = function(key, secret) {
this.baseUrl = 'https://www.odesk.com/api/';
this.baseUrl = baseUrl + '/api/';
this.OAuth = new OAuth(key, secret);
}

Expand Down

0 comments on commit 520603c

Please sign in to comment.