Class: Voicemaker::TTS
- Inherits:
-
Object
- Object
- Voicemaker::TTS
- Defined in:
- lib/voicemaker/tts.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ TTS
constructor
A new instance of TTS.
-
#save(outpath) ⇒ Object
Saves the audio file.
-
#url ⇒ Object
Returns the URL for the generated file.
Constructor Details
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/voicemaker/tts.rb', line 5 def params @params end |
Instance Method Details
#save(outpath) ⇒ Object
Saves the audio file
20 21 22 |
# File 'lib/voicemaker/tts.rb', line 20 def save(outpath) Down.download url, destination: outpath end |
#url ⇒ Object
Returns the URL for the generated file
12 13 14 15 16 17 |
# File 'lib/voicemaker/tts.rb', line 12 def url response = API.post "api", params.api_params url = response['path'] raise BadResponse, "Received empty URL: #{response}" unless url url end |