class Appfirst::Response

Constants

BadRequest
Conflict
EXCEPTION_MAPPING
NotFound
Unexpected
Unprocessable

Attributes

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

Public Class Methods

new(status, headers, body) click to toggle source
# File lib/appfirst/response.rb, line 27
def initialize(status, headers, body)
  @status, @headers, @body = status, headers, body
end

Public Instance Methods

raise!() click to toggle source
# File lib/appfirst/response.rb, line 35
def raise!
  if !successful?
    raise (EXCEPTION_MAPPING[self.status] || Error).new(self)
  else self
  end
end
successful?() click to toggle source
# File lib/appfirst/response.rb, line 31
def successful?
  self.status < 300 && self.status > 199 || self.status == 304
end