require_relative './input_error.rb' require_relative './api_error.rb' module ThinkificRuby module ResourceHelper def raise_input_error_if_not_natural_number(id) if id <= 0 raise ThinkificRuby::InputError end end def raise_error_if_response_status_not_200_or_return_parsed_response(response_status, parsed_response_body) unless response_status == 200 raise ThinkificRuby::ApiError.new(response_status, parsed_response_body) end parsed_response_body end end end