Sha256: 7f8a4dfc2fcfc86feedaabbbe73d9d6a922d8070e7f677f64ba19802fa0a49a5

Contents?: true

Size: 528 Bytes

Versions: 9

Compression:

Stored size: 528 Bytes

Contents

require 'json'

module Hoth
  module Encoding
    class Json
      
      class <<self
        def encode(object)
          object.to_json
        end

        def decode(string)
          begin
            Hoth::Logger.debug "Original params before decode: #{string.inspect}"
            JSON.parse(string)
          rescue JSON::ParserError => jpe
            raise EncodingError.wrap(jpe)
          end
        end
        
        def content_type
          "application/json"
        end
      end
      
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hoth-0.4.2 lib/hoth/encoding/json.rb
hoth-0.4.1 lib/hoth/encoding/json.rb
hoth-0.4.0 lib/hoth/encoding/json.rb
hoth-0.3.4 lib/hoth/encoding/json.rb
hoth-0.3.3 lib/hoth/encoding/json.rb
hoth-0.3.2.beta4 lib/hoth/encoding/json.rb
hoth-0.3.2.beta3 lib/hoth/encoding/json.rb
hoth-0.3.2.beta2 lib/hoth/encoding/json.rb
hoth-0.3.2.beta1 lib/hoth/encoding/json.rb