Class: Easytone::ToneGen

Inherits:
Object
  • Object
show all
Defined in:
lib/easytone.rb

Class Method Summary collapse

Class Method Details

.tone(username, password, text, version = '2016-05-19') ⇒ Object



5
6
7
8
9
# File 'lib/easytone.rb', line 5

def self.tone(username, password, text, version = '2016-05-19')
  tone_url = "https://#{username}:#{password}@gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=#{version}&text=#{text}"
  response = JSON.parse(RestClient.get(tone_url))
  response["document_tone"]["tone_categories"][0]["tones"]
end