class Xenon::XmlMarshaller
Public Class Methods
new()
click to toggle source
# File lib/xenon/marshallers.rb, line 37 def initialize gem 'builder' require 'active_support/core_ext/array/conversions' require 'active_support/core_ext/hash/conversions' rescue Gem::LoadError raise 'Install the "builder" gem to enable XML.' end
Public Instance Methods
marshal(obj)
click to toggle source
# File lib/xenon/marshallers.rb, line 49 def marshal(obj) raise "#{obj.class} does not support #to_xml" unless obj.respond_to?(:to_xml) [obj.to_xml] end
media_type()
click to toggle source
# File lib/xenon/marshallers.rb, line 45 def media_type MediaType::XML end
unmarshal(body, as:)
click to toggle source
# File lib/xenon/marshallers.rb, line 54 def unmarshal(body, as:) as.new.from_xml(body.read) end