class Rack::Idempotency::Response

Attributes

body[R]
headers[R]
status[R]

Public Class Methods

new(status, headers, body) click to toggle source
# File lib/rack/idempotency/response.rb, line 8
def initialize(status, headers, body)
  @status  = status.to_i
  @headers = Rack::Utils::HeaderHash.new(headers)
  @body    = body
end

Public Instance Methods

success?() click to toggle source
# File lib/rack/idempotency/response.rb, line 14
def success?
  status.to_i >= 200 && status.to_i < 400
end
to_a() click to toggle source
# File lib/rack/idempotency/response.rb, line 18
def to_a
  [status, headers.to_hash, body.each(&:to_s)]
end
to_json() click to toggle source
# File lib/rack/idempotency/response.rb, line 22
def to_json
  to_a.to_json
end