Sha256: ca8afe8b16767716aec015eeaa9028ee57dee61878e5ebf03c5aea41f8cb6642

Contents?: true

Size: 417 Bytes

Versions: 19

Compression:

Stored size: 417 Bytes

Contents

module Pupa
  class Processor
    module Middleware
      # A Faraday response middleware for parsing JSON.
      #
      # @see https://github.com/lostisland/faraday_middleware/issues/30#issuecomment-4706892
      class ParseJson < FaradayMiddleware::ResponseMiddleware
        dependency 'oj'

        define_parser do |body|
          Oj.load(body) unless body.strip.empty?
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
pupa-0.2.4 lib/pupa/processor/middleware/parse_json.rb
pupa-0.2.3 lib/pupa/processor/middleware/parse_json.rb
pupa-0.2.2 lib/pupa/processor/middleware/parse_json.rb
pupa-0.2.1 lib/pupa/processor/middleware/parse_json.rb
pupa-0.2.0 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.11 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.10 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.9 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.8 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.7 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.6 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.5 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.4 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.3 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.2 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.1 lib/pupa/processor/middleware/parse_json.rb
pupa-0.1.0 lib/pupa/processor/middleware/parse_json.rb
pupa-0.0.13 lib/pupa/processor/middleware/parse_json.rb
pupa-0.0.12 lib/pupa/processor/middleware/parse_json.rb