Class: Plivo::XML::Speak
Constant Summary collapse
- SUPPORTED_ENGINES =
%w(Polly)
- SUPPORTED_VOICES =
%w(Nicole Russell Vitoria Ricardo Chantal Naja Mads Lotte Ruben Lea Celine Mathieu Vicki Marlene Hans Aditi Dora Karl Raveena Aditi Carla Giorgio Mizuki Takumi Seoyeon Zhiyu Liv Ewa Maja Jacek Jan Ines Cristiano Carmen Tatyana Maxim Conchita Enrique Astrid Filiz Amy Emma Brian Joanna Matthew Salli Justin Kendra Joey Kimberly Ivy Penelope Miguel Gwyneth Geraint Zeina Mia)
Constants inherited from Element
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
-
#initialize(body, attributes = {}) ⇒ Speak
constructor
A new instance of Speak.
Methods inherited from Element
#add, #add_attribute, #convert_value, #hyphenate, #method_missing, #to_s, #to_xml
Constructor Details
#initialize(body, attributes = {}) ⇒ Speak
Returns a new instance of Speak.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/plivo/xml/speak.rb', line 9 def initialize(body, attributes = {}) if attributes.nil? || attributes[:voice].nil? || ['MAN', 'WOMAN'].include?(attributes[:voice]) @nestables = [] else engine = attributes[:voice].split('.')[0] voice = attributes[:voice].split('.')[1] if SUPPORTED_ENGINES.include?(engine) && SUPPORTED_VOICES.include?(voice) @nestables = %w(Break Emphasis Lang P Phoneme Prosody S SayAs Sub W) else raise PlivoXMLError, "<Speak> voice #{attributes[:voice]} is not valid." end end if !body raise PlivoXMLError, 'No text set for Speak' end super(body, attributes, @nestables) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Plivo::XML::Element