class Breacan::Response::Custom

Private Instance Methods

on_complete(res) click to toggle source
# File lib/breacan/response/custom.rb, line 13
def on_complete(res)
  if error = Breacan::Error.from_response(res)
    raise error
  end

  return if res[:body].empty?

  body = Sawyer::Agent.serializer.decode(res[:body])
  if body[:ok]
    res[:body].gsub!('"ok":true,', '')
  end

  if error = Breacan::Error.from_body(res, body)
    raise error
  end
end