ngin_client
Advanced tools
Comparing version 0.2.47 to 0.2.48
{ | ||
"name": "ngin_client", | ||
"version": "0.2.47", | ||
"version": "0.2.48", | ||
"description": "Node client for interacting with the NGIN API services", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -10,2 +10,12 @@ "use strict" | ||
function scopeUrl(options, inst) { | ||
options = _.extend(_.clone(options || {}), inst) | ||
if (options.subvenue_id) { | ||
return ngin.Subvenue.urlRoot() + '/' + options.subvenue_id + '/subvenue_aliases' | ||
} else { | ||
return SubvenueAlias.urlRoot() | ||
} | ||
} | ||
/** | ||
@@ -22,4 +32,11 @@ * Subvenue Alias Class | ||
save: function(options, callback) { | ||
var url = SubvenueAlias.urlRoot() | ||
var url = scopeUrl(options) | ||
return Super.save.call(this, url, options, callback) | ||
}, | ||
destroy: function(options, callback) { | ||
if (!this.id) | ||
throw new Error('subvenue_id is required to delete subvenue alias') | ||
var url = scopeUrl(options, this) + '/' + this.id | ||
return Super.destroy.call(this, url, options, callback) | ||
} | ||
@@ -40,3 +57,3 @@ | ||
var url = SubvenueAlias.urlRoot() | ||
var url = scopeUrl(opts) | ||
@@ -43,0 +60,0 @@ return Model.list.call(this, url, options, callback) |
101128
3017