Class: LUSI::API::Course::Module

Inherits:
ModuleBase show all
Defined in:
lib/lusi_api/course.rb

Overview

Represents a module in the LUSI API

Instance Attribute Summary collapse

Attributes inherited from ModuleBase

#category_level, #cohorts, #course_departments, #course_documents, #credit, #delivery_mode, #display_long_title, #display_short_title, #enrolled_students, #external_course_identity, #identity, #identity_class, #learning_hours, #mnemonic, #status, #syllabus_rules, #teaching_institution, #title, #year

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ModuleBase

#enrolment_lookup_keys, get_instance, #major_departments

Methods included from LUSI::API::Core::Endpoint

#lusi_ws_endpoint, #lusi_ws_method, #lusi_ws_path, #lusi_ws_xml_root

Constructor Details

#initialize(xml = nil, lookup = nil, assessment_proportions: nil, course_convenors: nil, lecture_capture_enabled: nil, module_evaluation_cohorts: nil, partner_module_leaders: nil, validating_institution: nil, **kwargs) ⇒ Module

Initialises a new Module instance

Parameters:

  • assessment_proportions (Array<LUSI::API::Course::AssessmentProportion>, nil) (defaults to: nil)

    the default assessment proportions

  • course_convenors (Array<LUSI::API::Person::StaffMember>, nil) (defaults to: nil)

    the default course convenors

  • lecture_capture_enabled (Boolean, nil) (defaults to: nil)

    the default lecture-capture-enabled flag

  • module_evaluation_cohorts (Array<LUSI::API::Course::ModuleEvaluationCohort>, nil) (defaults to: nil)

    the default module evaluation cohorts

  • partner_module_leaders (Array<LUSI::API::Person::StaffMember>, nil) (defaults to: nil)

    the default partner module leaders

  • validating_institution (LUSI::API::Organisation::Unit) (defaults to: nil)

    the default validating institution

  • xml (Nokogiri::XML::Document, Nokogiri::XML::Node) (defaults to: nil)

    the parsed XML root of the module or scheme of study

  • lookup (LUSI::API::Core::Lookup::LookupService, nil) (defaults to: nil)

    the lookup service for object resolution

  • category_level (String, nil)

    the default category

  • cohort (LUSI::API::Course::Cohort, nil)

    the default cohort

  • course_departments (Array<LUSI::API::Course::CourseDepartment>, nil)

    the default course departments

  • course_documents (Array<LUSI::API::Course::CourseDocument>, nil)

    the default course documents

  • credit (String, nil)

    the default credit point value

  • delivery_mode (LUSI::API::Core::Code, nil)

    the default delivery mode

  • display_long_title (String, nil)

    the default long title

  • display_short_title (String, nil)

    the default short title

  • enrolled_students (Integer, nil)

    the default number of enrolled students

  • external_course_identity (String, nil)

    the default external course identity code

  • identity (String, nil)

    the default identity code

  • learning_hours (Integer, nil)

    the default number of learning hours

  • mnemonic (String, nil)

    the default mnemonic

  • subjects (Array<LUSI::API::Course::Subject>, nil)

    the default subjects

  • status (String, nil)

    the default status

  • syllabus_rules (Array<SyllabusRule>, nil)

    the default syllabus rules

  • teaching_institution (LUSI::API::Organisation::Unit, nil)

    the default teaching institution

  • title (String, nil)

    the default title

  • year (String, nil)

    the default year



1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
# File 'lib/lusi_api/course.rb', line 1153

def initialize(xml = nil, lookup = nil, assessment_proportions: nil, course_convenors: nil,
               lecture_capture_enabled: nil, module_evaluation_cohorts: nil, partner_module_leaders: nil,
               validating_institution: nil, **kwargs)
  super(xml, lookup, **kwargs)
  @assessment_proportions = LUSI::API::Core::XML.xml(xml,
                                                     'xmlns:AssessmentProportions/xmlns:AssessmentProportion',
                                                      assessment_proportions) { |a| AssessmentProportion.new(a, lookup) }
  @course_convenors = LUSI::API::Core::XML.xml(xml, 'xmlns:CourseConvenor/xmlns:StaffMember',
                                               course_convenors) { |s| LUSI::API::Person::StaffMember.new(s, lookup) }
  @lecture_caputure_enabled = LUSI::API::Core::XML.xml_boolean_at(xml, 'xmlns:LectureCaptureEnabled',
                                                                 lecture_capture_enabled)
  @module_evaluation_cohorts = LUSI::API::Core::XML.xml(xml, 'xmlns:ModuleEvaluationCohorts/xmlns:ModuleEvaluationCohort',
                                                        module_evaluation_cohorts) { |m| ModuleEvaluationCohort.new(m, lookup) }
  @partner_module_leaders = LUSI::API::Core::XML.xml(xml, 'xmlns:PartnerModuleLeader/xmlns:StaffMember',
                                                     partner_module_leaders) { |s| LUSI::API::Person::StaffMember.new(s, lookup) }
  @validating_institution = LUSI::API::Core::XML.lookup(xml, lookup, :institution,
                                                        'xmlns:ValidatingInstitution/xmlns:Identity',
                                                        validating_institution)
end

Instance Attribute Details

#assessment_proportionsArray<LUSI::API::Course::AssessmentProportion>?

Returns the assessment proportions for the module.

Returns:



1121
1122
1123
# File 'lib/lusi_api/course.rb', line 1121

def assessment_proportions
  @assessment_proportions
end

#course_convenorsArray<LUSI::API::Person::StaffMember>

Returns the course convenor(s).

Returns:



1125
1126
1127
# File 'lib/lusi_api/course.rb', line 1125

def course_convenors
  @course_convenors
end

#lecture_capture_enabledBoolean?

Returns true if automated lecture capture is available for the module, otherwise false.

Returns:

  • (Boolean, nil)

    true if automated lecture capture is available for the module, otherwise false



1129
1130
1131
# File 'lib/lusi_api/course.rb', line 1129

def lecture_capture_enabled
  @lecture_capture_enabled
end

#module_evaluation_cohortsArray<LUSI::API::Course::ModuleEvaluationCohort>?

Returns the evaluation cohorts for the module.

Returns:



1133
1134
1135
# File 'lib/lusi_api/course.rb', line 1133

def module_evaluation_cohorts
  @module_evaluation_cohorts
end

#partner_module_leadersArray<LUSI::API::Person::StaffMember>?

Returns the staff members leading the module.

Returns:



1137
1138
1139
# File 'lib/lusi_api/course.rb', line 1137

def partner_module_leaders
  @partner_module_leaders
end

#validating_institutionLUSI::API::Organisation::Unit?

Returns the validating institution for the module.

Returns:



1141
1142
1143
# File 'lib/lusi_api/course.rb', line 1141

def validating_institution
  @validating_institution
end

Class Method Details

.get_instance_params(validating_institution_id: nil, **kwargs) ⇒ Object

Returns a hash of parameters for the LUSI API call

Parameters:

  • awarding_institution_id (String, nil)

    the awarding institution identity code



1181
1182
1183
1184
1185
# File 'lib/lusi_api/course.rb', line 1181

def self.get_instance_params(validating_institution_id: nil, **kwargs)
  params = super(**kwargs)
  params[:ValidatingInstitutionId] = kwargs.fetch(:validating_institution_id, '')
  params
end

.lusi_ws_endpointString

Returns the LUSI API endpoint

Returns:

  • (String)

    the LUSI API endpoint



1189
1190
1191
# File 'lib/lusi_api/course.rb', line 1189

def self.lusi_ws_endpoint
  'CourseManager.asmx'
end

.lusi_ws_methodString

Returns the LUSI API method

Returns:

  • (String)

    the LUSI API method



1195
1196
1197
# File 'lib/lusi_api/course.rb', line 1195

def self.lusi_ws_method
  'GetModuleFullDetails'
end

.lusi_ws_xml_rootString

Returns the root element name of the LUSI API XML response

Returns:

  • (String)

    the root element name of the LUSI API XML response



1201
1202
1203
# File 'lib/lusi_api/course.rb', line 1201

def self.lusi_ws_xml_root
  'ModuleRecord'
end

Instance Method Details

#enrolment_lookup_indicesObject

See Also:

  • LUSI::API::Course::Module.(LUSI(LUSI::API(LUSI::API::Course(LUSI::API::Course::ModuleBase(LUSI::API::Course::ModuleBase#enrolment_lookup_indices)


1174
1175
1176
# File 'lib/lusi_api/course.rb', line 1174

def enrolment_lookup_indices
  [:module_staff, :module_student]
end