Sha256: eacaaf0de6706636c7e9bec7b126f3800fd3ce2411f5a33d6ca1cf0c3ba7f735

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

module Bandwidth
  module Bxml
    class SpeakSentence
      include Bandwidth::Bxml::Verb

      # Initializer
      # @param text [String] The text to speak. Cannot be blank. Can be a mixture of plain text and SSML tags.
      # @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash.
      def initialize(text, attributes = {})
        super("SpeakSentence", text, attributes)
        
        @attribute_map = {
          voice: 'voice',   # Optional [String]: Selects the voice of the speaker. If the voice attribute is present, gender and locale are ignored. You can find a list of supported voices here: https://dev.bandwidth.com/docs/voice/bxml/speakSentence/#supported-voices
          gender: 'gender', # Optional [String]: Selects the gender of the speaker. Valid values are "male" or "female". Default "female".
          locale: 'locale', # Optional [String]: Selects the locale of the speaker. Default "en_US"
        }
      end

      # Return BXML representaion of this response
      # @return [String] The XML response in string format.
      def to_bxml
        bxml = Ox.dump(generate_xml)
        return bxml.gsub(SPEAK_SENTENCE_REGEX) { |text| text.gsub(SSML_REGEX, '<\1>')}
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bandwidth-sdk-11.0.0.pre.beta.1.1 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.0.0.pre.beta.1 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb