Merge pull request #6 from btmills/master

Support custom base_url
This commit is contained in:
Dan Zajdband
2013-06-02 17:29:29 -07:00

View File

@@ -10,8 +10,8 @@ var request = require('superagent')
* Exports the constructor
*/
module.exports = function(api_key){
if(api_key) return new MovieDB(api_key);
module.exports = function(api_key, base_url){
if(api_key) return new MovieDB(api_key, base_url);
else throw new Error('Bad api key');
};
@@ -19,8 +19,9 @@ module.exports = function(api_key){
* Constructor
*/
function MovieDB(api_key) {
function MovieDB(api_key, base_url) {
this.api_key = api_key;
if(base_url) endpoints.base_url = base_url;
return this;
}