Module: NUSMods::Endpoints
- Included in:
- Client
- Defined in:
- lib/nusmods/endpoints.rb
Constant Summary collapse
- CURRENT_YEAR =
2014
- CURRENT_SEMESTER =
2
Instance Method Summary collapse
-
#get_faculty_departments(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
Returns a Hash of all faculties as keys, and departments under the respective faculties as values.
-
#get_lesson_types ⇒ Object
Returns the types of lessons (lecture, tutorial, etc) in a Hash.
-
#get_module_codes(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
Returns a Array of all module codes in the given year and semester.
-
#get_module_codes_with_names(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
Returns a Hash of all module codes as keys, and its respective module name as values.
- #get_module_details(module_code, year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
- #get_modules(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
Instance Method Details
#get_faculty_departments(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
Returns a Hash of all faculties as keys, and departments under the respective faculties as values.
18 19 20 |
# File 'lib/nusmods/endpoints.rb', line 18 def get_faculty_departments(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) get "#{format_year(year)}/#{semester}/facultyDepartments.json" end |
#get_lesson_types ⇒ Object
Returns the types of lessons (lecture, tutorial, etc) in a Hash
23 24 25 |
# File 'lib/nusmods/endpoints.rb', line 23 def get_lesson_types get "lessonTypes.json" end |
#get_module_codes(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
Returns a Array of all module codes in the given year and semester
8 9 10 |
# File 'lib/nusmods/endpoints.rb', line 8 def get_module_codes(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) get "#{format_year(year)}/#{semester}/moduleCodes.json" end |
#get_module_codes_with_names(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
Returns a Hash of all module codes as keys, and its respective module name as values.
13 14 15 |
# File 'lib/nusmods/endpoints.rb', line 13 def get_module_codes_with_names(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) get "#{format_year(year)}/#{semester}/moduleList.json" end |
#get_module_details(module_code, year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
27 28 29 |
# File 'lib/nusmods/endpoints.rb', line 27 def get_module_details(module_code, year = CURRENT_YEAR, semester = CURRENT_SEMESTER) get "#{format_year(year)}/#{semester}/modules/#{module_code}.json" end |
#get_modules(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) ⇒ Object
31 32 33 |
# File 'lib/nusmods/endpoints.rb', line 31 def get_modules(year = CURRENT_YEAR, semester = CURRENT_SEMESTER) get "#{format_year(year)}/#{semester}/modules.json" end |