From ec2a9b0af3c8891fc865e1df6480e8cd864bcc7e Mon Sep 17 00:00:00 2001 From: Germain Loret Date: Tue, 30 Jan 2024 14:59:52 +0100 Subject: [PATCH] Raise an error in #course when course_uid is nil (#15) --- lib/edusign/client.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/edusign/client.rb b/lib/edusign/client.rb index 57568f4..3ba1939 100644 --- a/lib/edusign/client.rb +++ b/lib/edusign/client.rb @@ -18,6 +18,8 @@ class BadGatewayError < StandardError; end class GatewayTimeoutError < StandardError; end + class CourseUidNilError < StandardError; end + def initialize(account_api_key: config.account_api_key) @account_api_key = account_api_key @@ -64,6 +66,8 @@ def delete_group(group_uid:) # COURSE def course(course_uid:) + raise CourseUidNilError, "Course UID can't be nil" if course_uid.blank? + response = api :get, "/course/#{course_uid}" response.result rescue Response::Error => e