Sha256: 3414319e4625476cc394aa611bc4a678d63edbfd194db6f4f2dfc433de0d6035

Contents?: true

Size: 477 Bytes

Versions: 20

Compression:

Stored size: 477 Bytes

Contents

# encoding: utf-8

require 'faraday'
require 'nimbu-api/utils/json'

module Nimbu
  class Response::Json < Response
    include Nimbu::Utils::Json

    dependency 'multi_json'

    define_parser do |body|
      Nimbu::Utils::Json.decode body
    end

    def parse(body)
      case body
      when ''
        nil
      when 'true'
        true
      when 'false'
        false
      else
        self.class.parser.call body
      end
    end
  end # Response::Json
end # Nimbu

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
nimbu-api-0.5.0 lib/nimbu-api/response/json.rb
nimbu-api-0.4.4 lib/nimbu-api/response/json.rb
nimbu-api-0.4.3 lib/nimbu-api/response/json.rb
nimbu-api-0.4.2 lib/nimbu-api/response/json.rb
nimbu-api-0.4.1 lib/nimbu-api/response/json.rb
nimbu-api-0.4.0 lib/nimbu-api/response/json.rb
nimbu-api-0.3.0 lib/nimbu-api/response/json.rb
nimbu-api-0.2.1 lib/nimbu-api/response/json.rb
nimbu-api-0.2 lib/nimbu-api/response/json.rb
nimbu-api-0.2.beta.3 lib/nimbu-api/response/json.rb
nimbu-api-0.2.beta.2 lib/nimbu-api/response/json.rb
nimbu-api-0.2.beta.1 lib/nimbu-api/response/json.rb
nimbu-api-0.2.beta lib/nimbu-api/response/json.rb
nimbu-api-0.1.5 lib/nimbu-api/response/json.rb
nimbu-api-0.1.4 lib/nimbu-api/response/json.rb
nimbu-api-0.1.3 lib/nimbu-api/response/json.rb
nimbu-api-0.1.1 lib/nimbu-api/response/json.rb
nimbu-api-0.1 lib/nimbu-api/response/json.rb
nimbu-api-0.0.2 lib/nimbu-api/response/json.rb
nimbu-api-0.0.1 lib/nimbu-api/response/json.rb