Class: MaluubaNapi::Client
- Inherits:
-
Object
- Object
- MaluubaNapi::Client
- Includes:
- HTTParty
- Defined in:
- lib/maluuba_napi.rb
Overview
Provides simple access to the Maluuba NLP API (developer.maluuba.com) for Ruby scripts.
Basic Usage:
client = MaluubaNapi::Client.new 'your_apikey_here'
client.interpret phrase: 'who is barack obama'
client.normalize phrase: 'tomorrow', type: 'daterange', timezone: 'EST'
Your apikey is your ‘Consumer Key’ on (developer.maluuba.com)
For more information see (github.com/Maluuba/napi-ruby) Also visit us on our IRC channel at #maluuba on irc.freenode.net
Instance Method Summary collapse
-
#initialize(apikey, options = {}) ⇒ Client
constructor
Creates a new client object.
-
#interpret(query_parameters = {}) ⇒ Hash
Calls the Interpret Endpoint.
-
#normalize(query_parameters = {}) ⇒ Hash
Calls the Normalize Endpoint.
Constructor Details
#initialize(apikey, options = {}) ⇒ Client
Creates a new client object
30 31 32 33 |
# File 'lib/maluuba_napi.rb', line 30 def initialize(apikey, ={}) @auth = {} @auth[:apikey] = apikey end |
Instance Method Details
#interpret(query_parameters = {}) ⇒ Hash
Calls the Interpret Endpoint
38 39 40 41 42 43 |
# File 'lib/maluuba_napi.rb', line 38 def interpret(query_parameters={}) response = query "/#{MaluubaNapi::Configuration::VERSION}/interpret", query_parameters response[:category] = response[:category].to_sym response[:action] = response[:action].to_sym response end |
#normalize(query_parameters = {}) ⇒ Hash
Calls the Normalize Endpoint
48 49 50 |
# File 'lib/maluuba_napi.rb', line 48 def normalize(query_parameters={}) query "/#{MaluubaNapi::Configuration::VERSION}/normalize", query_parameters end |