Class: Miles::Tts
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
readonly
Returns the value of attribute base_uri.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #get_mp3(text) ⇒ Object
-
#initialize(host, port = 80) ⇒ Tts
constructor
A new instance of Tts.
Constructor Details
#initialize(host, port = 80) ⇒ Tts
Returns a new instance of Tts.
10 11 12 13 14 15 |
# File 'lib/miles/tts.rb', line 10 def initialize(host, port=80) @host = host @port = port @base_uri = "#{host}#{port != 80 ? ':' + @port.to_s : ''}" self.class.base_uri @base_uri end |
Instance Attribute Details
#base_uri ⇒ Object (readonly)
Returns the value of attribute base_uri.
8 9 10 |
# File 'lib/miles/tts.rb', line 8 def base_uri @base_uri end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
8 9 10 |
# File 'lib/miles/tts.rb', line 8 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
8 9 10 |
# File 'lib/miles/tts.rb', line 8 def port @port end |
Instance Method Details
#get_mp3(text) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/miles/tts.rb', line 17 def get_mp3(text) req = {'text' => text} response = self.class.post('/tts', :body => JSON.dump(req)) audio = response.body return audio end |