Sha256: 4714fdf1b466bf94a5edd8bc88bc7a1daae443f233fea48c747b61fe91de345d

Contents?: true

Size: 694 Bytes

Versions: 18

Compression:

Stored size: 694 Bytes

Contents

module Poms
  module Api
    # Response is an implementation-agnostic representation of an HTTP-response,
    # composing a HTTP status code, body and hash of headers.
    class Response
      # @return [Fixnum]
      attr_reader :code

      # @return [String]
      attr_reader :body

      # @return [Hash]
      attr_reader :headers

      def initialize(code, body, headers)
        @code = code.to_i
        @body = body.to_s
        @headers = headers.to_h
        freeze
      end

      def eql?(other)
        other.is_a?(self.class) &&
          code == other.code &&
          body == other.body &&
          headers == other.headers
      end
      alias == eql?
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
poms-3.0.0 lib/poms/api/response.rb
poms-2.6.0 lib/poms/api/response.rb
poms-2.5.1 lib/poms/api/response.rb
poms-2.5.0 lib/poms/api/response.rb
poms-2.4.0 lib/poms/api/response.rb
poms-2.3.1 lib/poms/api/response.rb
poms-2.3.0 lib/poms/api/response.rb
poms-2.2.1 lib/poms/api/response.rb
poms-2.2.0 lib/poms/api/response.rb
poms-2.1.3 lib/poms/api/response.rb
poms-2.1.2.1 lib/poms/api/response.rb
poms-2.1.2 lib/poms/api/response.rb
poms-2.1.1 lib/poms/api/response.rb
poms-2.1.0 lib/poms/api/response.rb
poms-2.0.1 lib/poms/api/response.rb
poms-2.0.0 lib/poms/api/response.rb
poms-2.0.0.b lib/poms/api/response.rb
poms-2.0.0.a lib/poms/api/response.rb