Class: Bullfrog::TTS
- Inherits:
-
Object
- Object
- Bullfrog::TTS
- Defined in:
- lib/bullfrog.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#error ⇒ Object
Returns the value of attribute error.
-
#hashh ⇒ Object
Returns the value of attribute hashh.
-
#id ⇒ Object
Returns the value of attribute id.
-
#voice_id ⇒ Object
Returns the value of attribute voice_id.
Class Method Summary collapse
- .convert(data) ⇒ Object
-
.voices ⇒ Object
TODO: make this call out to the server.
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
34 35 36 |
# File 'lib/bullfrog.rb', line 34 def content @content end |
#error ⇒ Object
Returns the value of attribute error.
34 35 36 |
# File 'lib/bullfrog.rb', line 34 def error @error end |
#hashh ⇒ Object
Returns the value of attribute hashh.
34 35 36 |
# File 'lib/bullfrog.rb', line 34 def hashh @hashh end |
#id ⇒ Object
Returns the value of attribute id.
34 35 36 |
# File 'lib/bullfrog.rb', line 34 def id @id end |
#voice_id ⇒ Object
Returns the value of attribute voice_id.
34 35 36 |
# File 'lib/bullfrog.rb', line 34 def voice_id @voice_id end |
Class Method Details
.convert(data) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/bullfrog.rb', line 41 def convert(data) tts = Bullfrog::TTS.new tts.content = data[:content] tts.voice_id = data[:voice_id] tts.save tts end |
.voices ⇒ Object
TODO: make this call out to the server
49 50 51 52 53 54 55 |
# File 'lib/bullfrog.rb', line 49 def voices [ {id: 1, name: "Johnathon"}, {id: 2, name: "Bob"}, {id: 3, name: "Isaiah"} ] end |
Instance Method Details
#complete? ⇒ Boolean
83 84 85 |
# File 'lib/bullfrog.rb', line 83 def complete? status == "complete" end |
#link ⇒ Object
86 87 88 89 |
# File 'lib/bullfrog.rb', line 86 def link return unless complete? "#{Bullfrog.base_uri}/conversions/#{@hashh}/download" end |
#save ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/bullfrog.rb', line 57 def save = { body: { conversion:{ content: @content, voice_id: @voice_id } } } if @id [:body][:id] = @id response = Bullfrog.put("/conversions/#{@id}", ) else response = Bullfrog.post("/conversions", ) end @id = response["id"] @hashh = response["hashh"] @error = response["error"] (@error.nil? or @error == "") end |
#status ⇒ Object
77 78 79 80 81 82 |
# File 'lib/bullfrog.rb', line 77 def status return unless @id response = Bullfrog.get "/conversions/#{@id}/status" status = response["status"] status end |