class EndpointFlux::Response

Attributes

body[RW]
headers[RW]

Public Class Methods

new(headers: {}, body: {}) click to toggle source
# File lib/endpoint_flux/response.rb, line 3
def initialize(headers: {}, body: {})
  @body = body
  @headers = headers
end

Public Instance Methods

forbidden?() click to toggle source
# File lib/endpoint_flux/response.rb, line 18
def forbidden?
  body[:status] == 403
end
invalid?() click to toggle source
# File lib/endpoint_flux/response.rb, line 14
def invalid?
  body[:status] == 422
end
not_found?() click to toggle source
# File lib/endpoint_flux/response.rb, line 26
def not_found?
  body[:status] == 404
end
success?() click to toggle source
# File lib/endpoint_flux/response.rb, line 10
def success?
  body[:status] && body[:status].between?(200, 209)
end
unauthorized?() click to toggle source
# File lib/endpoint_flux/response.rb, line 22
def unauthorized?
  body[:status] == 401
end