Module: AeriesApi::Client::Students

Included in:
AeriesApi::Client
Defined in:
lib/aeries-api/client/students.rb

Instance Method Summary collapse

Instance Method Details

#student(school_code:, student_id:) ⇒ Object



4
5
6
7
8
# File 'lib/aeries-api/client/students.rb', line 4

def student(school_code:, student_id:)
  response = self.class.get("/schools/#{school_code}/students/#{student_id}")
  @error_handler.handle_error(response)
  mash_and_underscore_keys(response.parsed_response)
end

#students(school_code:, grade: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/aeries-api/client/students.rb', line 10

def students(school_code:, grade: nil)
  if grade
    endpoint = "/schools/#{school_code}/students/grade/#{grade}"
  else
    endpoint = "/schools/#{school_code}/students"
  end
  response = self.class.get(endpoint)
  @error_handler.handle_error(response)
  mash_and_underscore_keys(response.parsed_response)
end