Module: BandwidthIris::XmlArraySerializer

Defined in:
lib/bandwidth-iris/client.rb

Instance Method Summary collapse

Instance Method Details

#element_name=(name) ⇒ Object



256
257
258
# File 'lib/bandwidth-iris/client.rb', line 256

def element_name=(name)
  @element_name = name
end

#to_xml(options = {}) ⇒ Object



260
261
262
263
264
265
266
267
268
269
270
# File 'lib/bandwidth-iris/client.rb', line 260

def to_xml(options = {})
  builder = options[:builder]
  self.map do |item|
    if item.class.method_defined?(:to_xml)
      builder << item.to_xml({skip_instruct: true, root: @element_name, skip_types: true, indent:0})
    else
      builder << "<#{@element_name}>#{item}</#{@element_name}>"
    end
  end
  builder
end