2007-12-21 08:48:59 +01:00
|
|
|
module ActiveResource
|
|
|
|
module Formats
|
|
|
|
module JsonFormat
|
|
|
|
extend self
|
2008-09-07 07:54:05 +02:00
|
|
|
|
2007-12-21 08:48:59 +01:00
|
|
|
def extension
|
|
|
|
"json"
|
|
|
|
end
|
2008-09-07 07:54:05 +02:00
|
|
|
|
2007-12-21 08:48:59 +01:00
|
|
|
def mime_type
|
|
|
|
"application/json"
|
|
|
|
end
|
2008-09-07 07:54:05 +02:00
|
|
|
|
2009-08-04 17:16:03 +02:00
|
|
|
def encode(hash, options = nil)
|
|
|
|
ActiveSupport::JSON.encode(hash, options)
|
2007-12-21 08:48:59 +01:00
|
|
|
end
|
2008-09-07 07:54:05 +02:00
|
|
|
|
2007-12-21 08:48:59 +01:00
|
|
|
def decode(json)
|
|
|
|
ActiveSupport::JSON.decode(json)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2008-09-07 07:54:05 +02:00
|
|
|
end
|