class Casica::Response

Public Class Methods

new(faraday_response) click to toggle source
# File lib/casica/response.rb, line 3
def initialize(faraday_response)
  @faraday_response = faraday_response
end

Public Instance Methods

failure?() click to toggle source
# File lib/casica/response.rb, line 21
def failure?
  !success?
end
method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/casica/response.rb, line 7
def method_missing(method, *args, &block)
  return @faraday_response.send(method, *args, &block) if @faraday_response.respond_to?(method)
  super
end
response() click to toggle source
# File lib/casica/response.rb, line 25
def response
  if success?
    @faraday_response.body || true
  else
    Casica::Error.new(self)
  end
end
success?() click to toggle source
# File lib/casica/response.rb, line 12
def success?
  case @faraday_response.status
  when 200..299 then true
  when 400..499 then false
  when 500..599 then false
  else false
  end
end