Class: WatsonLanguage::Model

Inherits:
ActiveMethod::Base show all
Defined in:
lib/watson-language-translator/model.rb

Instance Attribute Summary

Attributes inherited from ActiveMethod::Base

#http_method, #json_result, #options, #password, #text, #username

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ActiveMethod::Base

#fetch_http_method, #initialize, #params_addressable, #request

Methods included from Generators::LanguageRequest

#base_url_request, #json_parser, #rest_client_api

Methods inherited from ActiveMethod::Extra

add_response_field, #result

Constructor Details

This class inherits a constructor from WatsonLanguage::ActiveMethod::Base

Class Method Details

.create(options = {}) ⇒ Object



6
7
8
# File 'lib/watson-language-translator/model.rb', line 6

def self.create(options={})
  self.new(nil, options)
end

.delete(options = {}) ⇒ Object



10
11
12
# File 'lib/watson-language-translator/model.rb', line 10

def self.delete(options={})
  self.new(nil, options)
end

Instance Method Details

#endpointObject



14
15
16
17
18
19
# File 'lib/watson-language-translator/model.rb', line 14

def endpoint
  return url = "models/#{@options[:model_id]}" if @options[:model_id]
  url = "models"      
  url << "&#{params_addressable}" unless params_addressable.empty?
  url
end