Sha256: e081164197db36341e4196dd822b61872cd59d14fa2fe0dc6e07b9736598b2b1

Contents?: true

Size: 508 Bytes

Versions: 21

Compression:

Stored size: 508 Bytes

Contents

# encoding: utf-8

require 'faraday'

module BitBucket
  class Response::Jsonize < Response
    dependency 'multi_json'

    define_parser do |body|
      if MultiJson.respond_to?(:load)
        MultiJson.load body
      else
        MultiJson.decode body
      end
    end

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

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
codenamev_bitbucket_api-0.4.1 lib/bitbucket_rest_api/response/jsonize.rb
codenamev_bitbucket_api-0.4.0 lib/bitbucket_rest_api/response/jsonize.rb
zz_bitbucket_rest_api-0.1.11 lib/bitbucket_rest_api/response/jsonize.rb
zz_bitbucket_rest_api-0.1.10 lib/bitbucket_rest_api/response/jsonize.rb
zz_bitbucket_rest_api-0.1.9 lib/bitbucket_rest_api/response/jsonize.rb
zz_bitbucket_rest_api-0.1.8 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api2-0.9.5 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api2-0.9.1 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api2-0.2.2 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api2-0.2.1 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api2-0.2.0 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api-0.1.7 lib/bitbucket_rest_api/response/jsonize.rb
reenhanced_bitbucket_api-0.3.2 lib/bitbucket_rest_api/response/jsonize.rb
reenhanced_bitbucket_api-0.3.1 lib/bitbucket_rest_api/response/jsonize.rb
reenhanced_bitbucket_api-0.3.0 lib/bitbucket_rest_api/response/jsonize.rb
reenhanced_bitbucket_api-0.1.6 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api-0.1.5 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api-0.1.4 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api-0.1.2 lib/bitbucket_rest_api/response/jsonize.rb
bitbucket_rest_api-0.1.1 lib/bitbucket_rest_api/response/jsonize.rb