Ejemplo n.º 1
0
var Client = exports.Client = function (options) {
  options = options || {};

  nest.Client.call(this, {
    host:       'api.crowdflower.com',
    secure:     false,
    path:       '/' + (options.version || 'v1') + '/',
    response:   'json',
    type:       'json',
    params: {
      key:      options.key
    },
    headers: {
      "Accept": 'application/json'
    }
  });
};
Ejemplo n.º 2
0
var Client = function (options) {
  var auth;

  options || (options = {});

  auth = new Buffer(options.sid + ':' + options.token).toString('base64');

  nest.Client.call(this, {
    host:             'api.twilio.com',
    path:             '/2010-04-01/',
    secure:           true,
    headers: {
      Authorization: 'Basic ' + auth,
      Accept:        'application/json'
    },
    response:        'json'
  });
};
Ejemplo n.º 3
0
var Client = exports.Client = function Client (options) {
  var client_options =
    { host:     'api.github.com'
    , secure:    true
    , response: 'json'
    , type:     'json'
    , path:     '/gists'
    , headers:   {}
    }

  options || (options = {})

  if (options.token) {
    client_options.headers.Authorization = 'token ' + options.token
  } else if (options.user && options.password) {
    client_options.headers.Authorization =
      'Basic ' + new Buffer(options.user + ':' + options.password).toString('base64')
  }

  nest.Client.call(this, client_options)
}