class Plivo::XML::Speak
Constants
- SUPPORTED_ENGINES
- SUPPORTED_VOICES
Public Class Methods
new(body, attributes = {})
click to toggle source
Calls superclass method
Plivo::XML::Element::new
# 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 Cont 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