class Bandwidth::Voice::Response

Public Class Methods

new(verbs = nil) click to toggle source

Initializer @param verbs [Array] optional list of verbs to include into response

# File lib/bandwidth/voice_lib/bxml/bxml.rb, line 14
def initialize(verbs = nil)
  @verbs = verbs || []
end

Public Instance Methods

<<(verb) click to toggle source

Add a verb to this response

# File lib/bandwidth/voice_lib/bxml/bxml.rb, line 34
def <<(verb)
  @verbs << verb
end
push(*verbs) click to toggle source

Add one or more verbs to this response

# File lib/bandwidth/voice_lib/bxml/bxml.rb, line 29
def push(*verbs)
  @verbs.push(*verbs)
end
to_bxml() click to toggle source

Return BXML representaion of this response

# File lib/bandwidth/voice_lib/bxml/bxml.rb, line 19
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