Sha256: 46c1b7d173ea2971f1aa91ca4d0c0d2db1d0e08cd033c65667652cde6079e8c1
Contents?: true
Size: 511 Bytes
Versions: 2
Compression:
Stored size: 511 Bytes
Contents
require "faraday" module Faraday class Response::ParseGzip < Response::Middleware class << self attr_accessor :mash_class end dependency do require 'json' require 'hashie/mash' self.mash_class = ::Hashie::Mash end def parse(body) sio = StringIO.new(body) begin gz = Zlib::GzipReader.new(sio) self.class.mash_class.new(JSON.parse(gz.read())) rescue self.class.mash_class.new JSON.parse body end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sqoot-1.0.0 | lib/sqoot/response/parse_gzip.rb |
sqoot-0.0.1 | lib/sqoot/response/parse_gzip.rb |