Sha256: fc7cd5aceb470664511af3828143c8129d928a798ac98c172604cb4db540778d

Contents?: true

Size: 432 Bytes

Versions: 4

Compression:

Stored size: 432 Bytes

Contents

module Segurofacil
  module Responses
    class Response

      HTTP_SUCCESS=[200, 201, 202, 203, 204, 205, 206, 207, 226]

      attr_reader :status_code, :raw_body

      def initialize(response)
        @status_code = response.fetch(:code)
        @raw_body = response.fetch(:body)
      end

      def success?
        HTTP_SUCCESS.include? status_code
      end

      def error?
        !success?
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
segurofacil-ruby-0.1.8 lib/segurofacil/responses/response.rb
segurofacil-ruby-0.1.7 lib/segurofacil/responses/response.rb
segurofacil-0.1.7 lib/segurofacil/responses/response.rb
segurofacil-0.1.4 lib/segurofacil/responses/response.rb