Sha256: 4cc3cf2c93eeb0e701605eeb78754fe6508f62e132e97123cb5a59b285a7b267

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

module Bandwidth
  module Bxml
    class SpeakSentence < 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)
        bxml.gsub(SPEAK_SENTENCE_REGEX) { |text| text.gsub(SSML_REGEX, '<\1>') }
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bandwidth-sdk-13.1.2 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-13.1.1 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-13.1.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-13.0.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-12.1.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.3.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.2.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.1.1 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.1.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.0.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.0.0.pre.beta.4.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.0.0.pre.beta.3.1 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.0.0.pre.beta.3.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb
bandwidth-sdk-11.0.0.pre.beta.2.0 lib/bandwidth-sdk/models/bxml/verbs/speak_sentence.rb