Sha256: 6fcf32a16af9e79ec4799d470118a46b2581a20214e5e89507696896ba33c3d2

Contents?: true

Size: 1.15 KB

Versions: 12

Compression:

Stored size: 1.15 KB

Contents

class Evil::Client
  #
  # Exception to be risen when remote API responded with undefined status
  #
  class ResponseError < RuntimeError
    # @!attribute [r] schema
    # @return [Evil::Client::Container::Operation::Schema] The operation schema
    attr_reader :schema

    # @!attribute [r] settings
    # @return [Evil::Client::Settings] The settings used by the request
    attr_reader :settings

    # @!attribute [r] response
    # @return [Array] The rack response to the request
    attr_reader :response

    # @!attribute [r] settings
    # @return [Integer] The status of the [#response]
    attr_reader :status

    # @!attribute [r] headers
    # @return [Hash] The hash of the [#response] headers
    attr_reader :headers

    # @!attribute [r] settings
    # @return [Enumerable] The enumerable object describing the [#response] body
    attr_reader :body

    private

    def initialize(schema, settings, response)
      @schema   = schema
      @settings = settings
      @response = response
      @status, @headers, @body = Array(response)

      super "remote API responded to #{@schema}" \
            " with unexpected status #{@status}"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
evil-client-3.2.0 lib/evil/client/exceptions/response_error.rb
evil-client-3.1.0 lib/evil/client/exceptions/response_error.rb
evil-client-3.0.4 lib/evil/client/exceptions/response_error.rb
evil-client-3.0.3 lib/evil/client/exceptions/response_error.rb
evil-client-3.0.2 lib/evil/client/exceptions/response_error.rb
evil-client-3.0.1 lib/evil/client/exceptions/response_error.rb
evil-client-3.0.0 lib/evil/client/exceptions/response_error.rb
evil-client-2.1.1 lib/evil/client/exceptions/response_error.rb
evil-client-2.1.0 lib/evil/client/exceptions/response_error.rb
evil-client-2.0.0 lib/evil/client/exceptions/response_error.rb
evil-client-1.1.0 lib/evil/client/exceptions/response_error.rb
evil-client-1.0.0 lib/evil/client/exceptions/response_error.rb