Sha256: f7f4703044f795dac9ee151882bd59c1cb7a5d3a471ca2c5eb2a39ba45b7a1f6

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 Bytes

Contents

module Restfulie
  module Common
    module Representation
      # Implements the interface for marshal Xml media type requests (application/xml)
      class XmlD
        cattr_reader :media_type_name
        @@media_type_name = 'application/xml'
    
        cattr_reader :headers
        @@headers = { 
          :post => { 'Content-Type' => media_type_name }
        }
    
        def unmarshal(string)
          Hash.from_xml(string)
        end
    
        def marshal(entity, rel)
          return entity if entity.kind_of? String
          return entity.values.first.to_xml(:root => entity.keys.first) if entity.kind_of?(Hash) && entity.size==1
          entity.to_xml
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restfulie-0.8.1 lib/restfulie/common/representation/xml.rb