Sha256: 8de0a43ac993827f92c1f0976084b9d7b0f49638c06d41368cef6aea1d9f855c

Contents?: true

Size: 390 Bytes

Versions: 3

Compression:

Stored size: 390 Bytes

Contents

require 'delegate'

module Plaza
  class Response < SimpleDelegator
    def success?
      status.to_s[0].to_i == 2
    end

    def redirected?
      status.to_s[0].to_i == 3
    end

    def failed?
      [4, 5].include?(status.to_s[0].to_i)
    end

    def to_str
      body.to_s
    end

    def code
      status
    end

    private
    def object
      __getobj__
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plaza-0.1.1 lib/plaza/response.rb
plaza-0.1.0 lib/plaza/response.rb
plaza-0.0.4 lib/plaza/response.rb