Skip to content

Commit

Permalink
Merge branch 'master' into add_reports_endpoint_support
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Walsh committed Mar 15, 2017
2 parents 673c805 + 16c5b96 commit 10c879c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
26 changes: 12 additions & 14 deletions lib/application.js
Expand Up @@ -559,7 +559,7 @@ var RequireAuthorizationApplication = Application.extend({
accessSecret: results.oauth_token_secret,
sessionHandle: results.oauth_session_handle,
tokenExpiry: exp.toString()
}, false);
});
resolve({ results: results });
}
callback && callback.apply(callback, arguments);
Expand All @@ -581,7 +581,7 @@ var RequireAuthorizationApplication = Application.extend({
accessSecret: results.oauth_token_secret,
sessionHandle: results.oauth_session_handle,
tokenExpiry: exp.toString()
}, true);
});
resolve({ results: results });
}

Expand All @@ -593,21 +593,19 @@ var RequireAuthorizationApplication = Application.extend({
var q = Object.assign({}, { oauth_token: requestToken }, other);
return this.options.baseUrl + this.options.authorizeUrl + '?' + querystring.stringify(q);
},
setOptions: function(options, emitThisEvent) {
setOptions: function(options) {
logger.debug("Setting options");
options.accessToken ? this.options.accessToken = options.accessToken : false;
options.accessSecret ? this.options.accessSecret = options.accessSecret : false;
options.sessionHandle ? this.options.sessionHandle = options.sessionHandle : false;
options.tokenExpiry ? this.options.tokenExpiry = options.tokenExpiry : false;

if (emitThisEvent && this.eventEmitter) {
logger.debug("Emitting event");
try {
this.eventEmitter.emit('xeroTokenUpdate', options);
} catch (e) {
logger.error(e);

if (this.options.accessToken) {
if (options.accessToken !== this.options.accessToken) {
if (this.eventEmitter) {
logger.debug("Emitting event");
this.eventEmitter.emit('xeroTokenUpdate', options);
}
}
}

this.options = Object.assign(this.options, options);
}
});

Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -21,7 +21,6 @@
"license": "MIT",
"dependencies": {
"dateformat": "~1.0.7-1.2.3",
"events": "^1.1.1",
"lodash": "~2.4.1",
"log4js": "~0.6.9",
"lru-cache": "^4.0.2",
Expand Down
4 changes: 0 additions & 4 deletions yarn.lock
Expand Up @@ -662,10 +662,6 @@ esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"

events@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"

eventsource@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-0.1.6.tgz#0acede849ed7dd1ccc32c811bb11b944d4f29232"
Expand Down

0 comments on commit 10c879c

Please sign in to comment.