Sha256: 6c1054021570143e18af040d46910cd6b866f6407c5f38350b83dd92db218037

Contents?: true

Size: 358 Bytes

Versions: 2

Compression:

Stored size: 358 Bytes

Contents

require 'faraday'
require 'multi_json'

module Evrythng
  module Response
    class ParseJson < Faraday::Response::Middleware

      def parse(body)
        case body
        when ''
          nil
        when 'true'
          true
        when 'false'
          false
        else
          ::MultiJson.decode(body)
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
evrythng-0.1.1 lib/evrythng/response/parse_json.rb
evrythng-0.1.0 lib/evrythng/response/parse_json.rb