Class: Bandwidth::Voice::Response
- Inherits:
-
Object
- Object
- Bandwidth::Voice::Response
- Defined in:
- lib/bandwidth/voice_lib/bxml/bxml.rb
Instance Method Summary collapse
-
#<<(verb) ⇒ Object
Add a verb to this response.
-
#initialize(verbs = nil) ⇒ Response
constructor
Initializer.
-
#push(*verbs) ⇒ Object
Add one or more verbs to this response.
-
#to_bxml ⇒ Object
Return BXML representaion of this response.
Constructor Details
#initialize(verbs = nil) ⇒ Response
Initializer
15 16 17 |
# File 'lib/bandwidth/voice_lib/bxml/bxml.rb', line 15 def initialize(verbs = nil) @verbs = verbs || [] end |
Instance Method Details
#<<(verb) ⇒ Object
Add a verb to this response
35 36 37 |
# File 'lib/bandwidth/voice_lib/bxml/bxml.rb', line 35 def <<(verb) @verbs << verb end |
#push(*verbs) ⇒ Object
Add one or more verbs to this response
30 31 32 |
# File 'lib/bandwidth/voice_lib/bxml/bxml.rb', line 30 def push(*verbs) @verbs.push(*verbs) end |
#to_bxml ⇒ Object
Return BXML representaion of this response
20 21 22 23 24 25 26 27 |
# File 'lib/bandwidth/voice_lib/bxml/bxml.rb', line 20 def to_bxml() xml = Builder::XmlMarkup.new() xml.instruct!(:xml, :version=>'1.0', :encoding=>'UTF-8') xml.Response do @verbs.each {|verb| verb.to_bxml(xml)} end xml.target!().gsub(SPEAK_SENTENCE_REGEX){|s|s.gsub(SSML_REGEX, '<\1>')} end |