Class: Bandwidth::Bxml::Verb
- Inherits:
-
Object
- Object
- Bandwidth::Bxml::Verb
- Defined in:
- lib/bandwidth-sdk/models/bxml/verb.rb
Direct Known Subclasses
Bridge, Conference, CustomParam, Forward, Hangup, NestableVerb, Pause, PauseRecording, PhoneNumber, PlayAudio, Record, Redirect, ResumeRecording, Ring, SendDtmf, SipUri, SpeakSentence, StartGather, StartRecording, StopGather, StopRecording, StopStream, StopTranscription, StreamParam, Tag
Instance Method Summary collapse
-
#generate_xml ⇒ Node
Generate an XML element for the verb.
-
#initialize(tag, content = nil, attributes = {}) ⇒ Verb
constructor
Initializer.
-
#set_attributes(attributes) ⇒ Object
Set XML attributes for the verb.
-
#to_bxml ⇒ String
Return BXML representaion of this element.
Constructor Details
#initialize(tag, content = nil, attributes = {}) ⇒ Verb
Initializer
10 11 12 13 14 |
# File 'lib/bandwidth-sdk/models/bxml/verb.rb', line 10 def initialize(tag, content = nil, attributes = {}) @tag = tag @content = content @attributes = attributes end |
Instance Method Details
#generate_xml ⇒ Node
Generate an XML element for the verb
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bandwidth-sdk/models/bxml/verb.rb', line 24 def generate_xml root = Ox::Element.new(@tag) if @content root << @content end if !@attributes.empty? && !@attribute_map.nil? @attributes.each do |key, value| if @attribute_map.include? key.to_sym root[@attribute_map[key.to_sym]] = value else raise NoMethodError.new("attribute '#{key}' is not a valid attribute for this verb") end end end root end |
#set_attributes(attributes) ⇒ Object
Set XML attributes for the verb
18 19 20 |
# File 'lib/bandwidth-sdk/models/bxml/verb.rb', line 18 def set_attributes(attributes) @attributes = attributes end |
#to_bxml ⇒ String
Return BXML representaion of this element
45 46 47 |
# File 'lib/bandwidth-sdk/models/bxml/verb.rb', line 45 def to_bxml Ox.dump(generate_xml) end |