Sha256: f50adf36414a3566284c02c2ad63c782cbf60a4e326bc050a063641fb2b70b3a

Contents?: true

Size: 824 Bytes

Versions: 6

Compression:

Stored size: 824 Bytes

Contents

# frozen_string_literal: true

module Acfs
  class Response
    # Method to fetch information about response status.
    #
    module Status
      # Return response status code. Will return zero if
      # request was not executed or failed on client side.
      #
      def status_code
        return @status.to_i if defined? :@status
        # return response.response_code unless response.nil?
        # 0
      end
      alias code status_code

      # Return true if response was successful indicated by
      # response status code.
      #
      def success?
        code >= 200 && code < 300
      end

      # Return true unless response status code indicates that
      # resource was not modified according to send precondition headers.
      #
      def modified?
        code != 304
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
acfs-1.7.0 lib/acfs/response/status.rb
acfs-1.6.0 lib/acfs/response/status.rb
acfs-1.5.1 lib/acfs/response/status.rb
acfs-1.5.0 lib/acfs/response/status.rb
acfs-1.4.0 lib/acfs/response/status.rb
acfs-1.3.4 lib/acfs/response/status.rb