Commit 93338acb by Alex MacCaw

add Version API

parent 1225282f
......@@ -60,6 +60,7 @@ ClearbitClient.prototype.request = function (options) {
this.url(options),
options.query,
{
headers: options.headers,
timeout: options.stream ? 60000 : 10000,
username: this.key,
password: '',
......
......@@ -4,6 +4,7 @@ var createError = require('create-error');
var _ = require('lodash');
function ClearbitResource (data) {
this.options = {};
_.extend(this, data);
}
......@@ -54,6 +55,11 @@ ClearbitResource.del = function (path, options) {
});
};
ClearbitResource.setVersion = function(value){
this.options.headers = this.options.headers || {};
this.options.headers['API-Version'] = value;
};
exports.create = function (name, options) {
var Resource = function () {
ClearbitResource.apply(this, arguments);
......@@ -103,7 +109,8 @@ function createErrors (name) {
function extractParams (options) {
var params = _.omit(options || {},
'path', 'method', 'params',
'client', 'api', 'stream'
'client', 'api', 'stream',
'headers'
);
return _.isEmpty(params) ? null : params;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment