Class: WatsonAPIClient
- Inherits:
-
Object
- Object
- WatsonAPIClient
- Defined in:
- lib/watson-api-client.rb
Constant Summary collapse
- VERSION =
'0.8.2'
- Gateways =
api_docs.delete(:gateway)
- Options =
api_docs
- Services =
JSON.parse(ENV['VCAP_SERVICES'] || '{}')
- DefaultParams =
{:user=>'username', :password=>'password'}
- AvailableAPIs =
[]
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ WatsonAPIClient
constructor
All subclass constructors use following hash parameter -.
Constructor Details
#initialize(options = {}) ⇒ WatsonAPIClient
Note:
VCAP_SERVICES is IBM Bluemix™ environment variable.
All subclass constructors use following hash parameter -
123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/watson-api-client.rb', line 123 def initialize(={}) define_api_methods set_variables() @url ||= Gateways + self.class::API['apis']['basePath'] @options = {} self.class.superclass::DefaultParams.each_pair do |sym, key| @options[sym] = @credential[key] if @credential.key?(key) end @options.update() @service = RestClient::Resource.new(@url, @options) end |