Skip to content

Commit

Permalink
Configurable api base [ch5140] (#29)
Browse files Browse the repository at this point in the history
* configurable api base, optional, defaults to prod api

* fixed no-unneeded-ternary operator for apiBase
  • Loading branch information
bogdanguranda authored and pkopac committed Jul 3, 2018
1 parent a28b655 commit ddd4c82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/chartmogul/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ const VERSION = require('../../package.json').version;
const API_BASE = 'https://api.chartmogul.com';

class Config {
constructor (accountToken, secretKey) {
constructor (accountToken, secretKey, apiBase) {
this.accountToken = accountToken;
this.secretKey = secretKey;
this.apiBase = apiBase || API_BASE;
}
getAccountToken () {
return this.accountToken;
Expand All @@ -20,7 +21,7 @@ class Config {
}

get API_BASE () {
return API_BASE;
return this.apiBase;
}

}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chartmogul-node",
"version": "1.0.5",
"version": "1.0.6",
"description": "Official Chartmogul API Node.js Client",
"main": "lib/chartmogul.js",
"scripts": {
Expand Down

0 comments on commit ddd4c82

Please sign in to comment.