module ApiResource::Formats::XmlFormat
Public Instance Methods
decode(xml)
click to toggle source
# File lib/api_resource/formats/xml_format.rb, line 20 def decode(xml) from_xml_data(Hash.from_xml(xml)) end
encode(hash, options={})
click to toggle source
# File lib/api_resource/formats/xml_format.rb, line 16 def encode(hash, options={}) hash.to_xml(options) end
extension()
click to toggle source
# File lib/api_resource/formats/xml_format.rb, line 8 def extension "xml" end
mime_type()
click to toggle source
# File lib/api_resource/formats/xml_format.rb, line 12 def mime_type "application/xml" end
Private Instance Methods
from_xml_data(data)
click to toggle source
Manipulate from_xml Hash, because xml_simple is not exactly what we want for Active Resource.
# File lib/api_resource/formats/xml_format.rb, line 27 def from_xml_data(data) if data.is_a?(Hash) && data.keys.size == 1 data.values.first else data end end