Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/clever.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module Clever
TEACHERS_ENDPOINT = '/v2.0/teachers'
EVENTS_ENDPOINT = '/v1.2/events'
TERMS_ENDPOINT = '/v2.0/terms'
DISTRICT_ENDPOINT = '/v2.1/districts'
GRADES_ENDPOINT = 'https://grades-api.beta.clever.com/v1/grade'

class DistrictNotFound < StandardError; end
Expand Down
10 changes: 10 additions & 0 deletions lib/clever/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ def send_grade(request_body)
@connection.execute(GRADES_ENDPOINT, :post, nil, request_body)
end

def district_exists?(uid)
begin
authenticate
rescue Clever::DistrictNotFound
return false
end

!!@connection.execute(DISTRICT_ENDPOINT, :get, id: uid)
end

private

def parse_enrollments(classroom_uids, sections)
Expand Down