Sha256: 94ae8f50f8d0b21024184e91372e6c8e114c56d9522376742866c2e47db4288c

Contents?: true

Size: 419 Bytes

Versions: 1

Compression:

Stored size: 419 Bytes

Contents

module OMCMS
  class ParseResponse
    def initialize app
      @app = app
    end

    def call request_env
      @app.call(request_env).on_complete do |response_env|
        if response_env.status >= 400
          return OMCMS::Response::Error.new(response_env)
        else
          return response_env.body
        end
      end
    rescue => error
      return OMCMS::Response::Error.new(error)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omcms-ruby-client-1.0.2 lib/omcms/middleware/parse_response.rb