Skip to content

Commit

Permalink
removing reference to old use_vcap_services option, improving jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
nfriedly committed Aug 25, 2016
1 parent 5b44775 commit 6efa8bb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
npm-debug.log
npm-debug.log.*
coverage
.DS_Store
test/resources/auth.js
Expand Down
19 changes: 15 additions & 4 deletions lib/base_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ var request = require('request');


/**
* Base class that other services inherit from
* Internal base class that other services inherit from
* @param {Object} options
* @param {String} [options.username] - required unless use_unauthenticated is set
* @param {String} [options.password] - required unless use_unauthenticated is set
* @param {Boolean} [options.use_unauthenticated] - skip credential requirement
* @param {Object} [options.headers]
* @param {Boolean} [options.headers.X-Watson-Learning-Opt-Out=false] - opt-out of data collection
* @param {String} [options.url] - override default service base url
* @private
* @param {Object} [options]
* @constructor
*/
function BaseService(user_options) {
Expand All @@ -38,15 +44,19 @@ function BaseService(user_options) {

options = this.initCredentials(options);

options = omit(options, ['version', 'username', 'password',
'use_vcap_services', 'use_unauthenticated', 'apikey']);
options = omit(options, ['version', 'username', 'password', 'use_unauthenticated', 'apikey']);

if (options.url)
options.url = helper.stripTrailingSlash(options.url);

this._options = extend({qs: {}, url: this.constructor.URL}, this.serviceDefaults, options);
}

/**
* @private
* @param options
* @returns {*}
*/
BaseService.prototype.initCredentials = function(options) {
if (options.token) {
options.headers = options.headers || {};
Expand Down Expand Up @@ -92,6 +102,7 @@ BaseService.prototype.initCredentials = function(options) {
*
* For example, if service.name is speech_to_text, env properties are SPEECH_TO_TEXT_USERNAME and SPEECH_TO_TEXT_PASSWORD
*
* @private
* @param name
* @returns {{username: String|undefined, password: String|undefined}}
*/
Expand Down
1 change: 1 addition & 0 deletions text-to-speech/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var util = require('util');
var BaseService = require('../lib/base_service');

/**
* Watson Text to Speech service
*
* @param options
* @constructor
Expand Down

0 comments on commit 6efa8bb

Please sign in to comment.