Class: Tweetsentiments::Client

Inherits:
API
  • Object
show all
Defined in:
lib/tweetsentiments/client.rb

Instance Method Summary collapse

Methods inherited from API

#initialize

Methods included from Request

#delete, #get, #post, #put

Constructor Details

This class inherits a constructor from Tweetsentiments::API

Instance Method Details

#analyze(text, options = {}) ⇒ Object



14
15
16
# File 'lib/tweetsentiments/client.rb', line 14

def analyze(text, options={})
  response = get("analyze", options.merge(:text => text))
end

#classify(text, options = {}) ⇒ Object



3
4
5
6
# File 'lib/tweetsentiments/client.rb', line 3

def classify(text, options={})
  response = get("classify", options.merge(:text => text))
  {:sentiment=>response["sentiment"], :translated_text=>response["translate_text"].to_s } if response 
end

#classify_simple(text, options = {}) ⇒ Object



7
8
9
10
# File 'lib/tweetsentiments/client.rb', line 7

def classify_simple(text, options={})
  response = get("classify_simple", options.merge(:text => text))
  response["value"] if response
end

#lang_detect(text, options = {}) ⇒ Object



11
12
13
# File 'lib/tweetsentiments/client.rb', line 11

def lang_detect(text, options={})
  response = get("lang/detect", options.merge(:text => text))
end

#search(options = {}) ⇒ Object



17
18
19
# File 'lib/tweetsentiments/client.rb', line 17

def search(options={})
  response = get("search", options)
end