def parse!(response)
      case response.code.to_i
      when 204, 205
        nil
      when 200...300
        JSON.parse(response.body) if !response.body.to_s.empty?
      when 401
        fail Errors::NotAuthorized, JSON.parse(response.body)['error']
      when 404
        fail Errors::NotFound, JSON.parse(response.body)['error']
      when 422
        handle_response_422(response)
      when 503
        fail Errors::RequestToLong, response.body
      else
        fail Errors::InvalidResponse, "Response code: #{response.code} message: #{response.body}"
      end
    end
def parse!(response)
      case response.code.to_i
      when 204, 205
        nil
      when 200...300
        JSON.parse(response.body) if !response.body.to_s.empty?
      when 401
        fail Errors::NotAuthorized, JSON.parse(response.body)['error']
      when 404
        fail Errors::NotFound, JSON.parse(response.body)['error']
      when 422
        handle_response_422(response)
      when 503
        fail Errors::RequestToLong, response.body
      else
        fail Errors::InvalidResponse, "Response code: #{response.code} message: #{response.body}"
      end
    end
parse the api response