Sha256: b6bb1d85a4756cdd4968e99e2fa1cec11dd940553c1d9d9e8df0a93bf134cac3

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

module Restfulie::Common::Representation

  # Implements the interface for marshal Xml media type requests (application/xml)
  class Json

    cattr_reader :media_type_name
    @@media_type_name = 'application/json'

    cattr_reader :headers
    @@headers = { 
      :post => { 'Content-Type' => media_type_name }
    }

    def unmarshal(string)
      JSON.parse(string)
    end

    def marshal(entity, rel)
      return entity if entity.kind_of? String
      entity.to_json
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restfulie-0.8.0 lib/restfulie/common/representation/json.rb
restfulie-0.7.1 lib/restfulie/common/representation/json.rb