Class: Bandwidth::Xml::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/bandwidth/xml/response.rb

Overview

Root class for Bandwidth XML

Instance Method Summary collapse

Constructor Details

#initialize(verbs = nil) ⇒ Response

Initializer

Parameters:

  • verbs (Array) (defaults to: nil)

    optional list of verbs to include into response



9
10
11
# File 'lib/bandwidth/xml/response.rb', line 9

def initialize(verbs = nil)
  @verbs = verbs || []
end

Instance Method Details

#<<(verb) ⇒ Object

Add a verb to this response



29
30
31
# File 'lib/bandwidth/xml/response.rb', line 29

def <<(verb)
  @verbs << verb
end

#push(*verbs) ⇒ Object

Add one or more verbs to this response



24
25
26
# File 'lib/bandwidth/xml/response.rb', line 24

def push(*verbs)
  @verbs.push(*verbs)
end

#to_xmlObject

Return XML presentaion of this response



14
15
16
17
18
19
20
21
# File 'lib/bandwidth/xml/response.rb', line 14

def to_xml()
  xml = Builder::XmlMarkup.new()
  xml.instruct!(:xml, :version=>'1.0', :encoding=>'UTF-8')
  xml.Response do
    @verbs.each {|verb| verb.to_xml(xml)}
  end
  xml.target!()
end