Class: LUSI::API::VLE::VLESpace

Inherits:
Object
  • Object
show all
Defined in:
lib/lusi_api/vle.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml = nil, lookup = nil, copy_course_materials_from_prev_session: nil, course_departments: nil, course_type: nil, create_space_date: nil, create_space_date_utc: nil, display_long_title: nil, display_short_title: nil, end_date: nil, end_date_utc: nil, hide_content_on_rollover: nil, is_conversion_space: nil, lusi_vle_space_id: nil, lusi_year_id: nil, space_type: nil, start_date: nil, start_date_utc: nil, student_access_date: nil, student_access_date_utc: nil, url: nil, vle_provider: nil, vle_space_courses: nil, vle_template: nil) ⇒ void

Initialises a new VLESpace instance

Parameters:

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

    the parsed XML root of the VLE space

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

    the lookup service for object resolution

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

    the default space copy flag

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

    the default course departments

  • course_type (String, nil) (defaults to: nil)

    the default course type

  • create_space_date (DateTime) (defaults to: nil)

    the default VLE space creation date

  • create_space_date_utc (DateTime) (defaults to: nil)

    the default UTC VLE space creation date

  • display_long_title (String, nil) (defaults to: nil)

    the default long title

  • display_short_title (String, nil) (defaults to: nil)

    the default short title

  • end_date (DateTime) (defaults to: nil)

    the default VLE space end date

  • end_date_utc (DateTime) (defaults to: nil)

    the default UTC VLE space end date

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

    the default hide content on rollover flag

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

    the default conversion space flag

  • lusi_vle_space_id (String, nil) (defaults to: nil)

    the default VLE space ID

  • lusi_year_id (String, nil) (defaults to: nil)

    the default year identity code

  • space_type (String, nil) (defaults to: nil)

    the default space type

  • start_date (DateTime) (defaults to: nil)

    the default VLE space start date

  • start_date_utc (DateTime) (defaults to: nil)

    the default UTC VLE space start date

  • student_access_date (DateTime) (defaults to: nil)

    the default student enrolment date

  • student_access_date_utc (DateTime) (defaults to: nil)

    the default UTC student enrolment date

  • url (String, nil) (defaults to: nil)

    the URL for the VLE space

  • vle_provider (LUSI::API::Core::Code) (defaults to: nil)

    the VLE provider

  • vle_space_courses (Array<LUSI::API::VLESpace::VLESpaceCourse>) (defaults to: nil)

    the list of associated courses

  • vle_template (LUSI::API::Core::Code) (defaults to: nil)

    the VLE template



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/lusi_api/vle.rb', line 261

def initialize(xml = nil, lookup = nil,
               copy_course_materials_from_prev_session: nil,
               course_departments: nil,
               course_type: nil,
               create_space_date: nil,
               create_space_date_utc: nil,
               display_long_title: nil,
               display_short_title: nil,
               end_date: nil,
               end_date_utc: nil,
               hide_content_on_rollover: nil,
               is_conversion_space: nil,
               lusi_vle_space_id: nil,
               lusi_year_id: nil,
               space_type: nil,
               start_date: nil,
               start_date_utc: nil,
               student_access_date: nil,
               student_access_date_utc: nil,
               url: nil,
               vle_provider: nil,
               vle_space_courses: nil,
               vle_template: nil)
  @copy_course_materials_from_prev_session = LUSI::API::Core::XML.xml_boolean_at(xml, 'xmlns:CopyCourseMaterialsFromPrevSession', copy_course_materials_from_prev_session)
  @course_departments = LUSI::API::Core::XML.xml(xml, 'xmlns:Departments/xmlns:CourseDepartment',
                                                 course_departments) { |d| LUSI::API::Course::CourseDepartment.new(d, lookup) }
  @course_type = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:CourseType', course_type)
  @create_space_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:CreateSpaceDate', create_space_date)
  @create_space_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:CreateSpaceDateUTC', create_space_date_utc)
  @display_long_title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:DisplayLongTitle', display_long_title)
  @display_short_title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:DisplayShortTitle',
                                                             display_short_title)
  @end_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:EndDate', end_date)
  @end_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:EndDateUTC', end_date_utc)
  @hide_content_on_rollover = LUSI::API::Core::XML.xml_boolean_at(xml, 'xmlns:HideContentOnRollover', hide_content_on_rollover)
  @is_conversion_space = LUSI::API::Core::XML.xml_boolean_at(xml, 'xmlns:IsConversionSpace', is_conversion_space)
  @lusi_vle_space_id = LUSI::API::Core::XML.xml_content_at(xml, '@LUSIVLESpaceId', lusi_vle_space_id)
  @lusi_year_id = LUSI::API::Core::XML.xml_content_at(xml, '@LUSIYearId', lusi_year_id)
  @space_type = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:SpaceType', space_type)
  @start_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StartDate', start_date)
  @start_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StartDateUTC', start_date_utc)
  @student_access_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StudentAccessDate', student_access_date)
  @student_access_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StudentAccessDateUTC', student_access_date_utc)
  @url = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:URL', url)

  @vle_provider = LUSI::API::Core::Code.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:VLEProvider',
                                                                        vle_provider), lookup)
  @vle_space_courses = LUSI::API::Core::XML.xml(xml, 'xmlns:VLESpaceCourses/xmlns:VLESpaceCourse',
                                                vle_space_courses) { |c| VLESpaceCourse.new(c, lookup) }
  @vle_template = LUSI::API::Core::Code.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:VLETemplate',
                                                                        vle_template), lookup)
end

Instance Attribute Details

#copy_course_materials_from_prev_sessionBoolean?

Returns the space copy flag.

Returns:

  • (Boolean, nil)

    the space copy flag



87
88
89
# File 'lib/lusi_api/vle.rb', line 87

def copy_course_materials_from_prev_session
  @copy_course_materials_from_prev_session
end

#course_departmentsArray<LUSI::API::Course::CourseDepartment>?

Returns the list of associated course departments.

Returns:



92
93
94
# File 'lib/lusi_api/vle.rb', line 92

def course_departments
  @course_departments
end

#course_typeString?

Returns the course type (CMOD|SOS).

Returns:

  • (String, nil)

    the course type (CMOD|SOS)



96
97
98
# File 'lib/lusi_api/vle.rb', line 96

def course_type
  @course_type
end

#create_space_dateDateTime?

Returns the VLE space creation date.

Returns:

  • (DateTime, nil)

    the VLE space creation date



100
101
102
# File 'lib/lusi_api/vle.rb', line 100

def create_space_date
  @create_space_date
end

#create_space_date_utcDateTime?

Returns the UTC VLE space creation date.

Returns:

  • (DateTime, nil)

    the UTC VLE space creation date



104
105
106
# File 'lib/lusi_api/vle.rb', line 104

def create_space_date_utc
  @create_space_date_utc
end

#display_long_titleString?

Returns the long course title.

Returns:

  • (String, nil)

    the long course title



108
109
110
# File 'lib/lusi_api/vle.rb', line 108

def display_long_title
  @display_long_title
end

#display_short_titleString?

Returns the short course title.

Returns:

  • (String, nil)

    the short course title



112
113
114
# File 'lib/lusi_api/vle.rb', line 112

def display_short_title
  @display_short_title
end

#end_dateDateTime?

Returns the VLE space end date.

Returns:

  • (DateTime, nil)

    the VLE space end date



116
117
118
# File 'lib/lusi_api/vle.rb', line 116

def end_date
  @end_date
end

#end_date_utcDateTime?

Returns the UTC VLE space end date.

Returns:

  • (DateTime, nil)

    the UTC VLE space end date



120
121
122
# File 'lib/lusi_api/vle.rb', line 120

def end_date_utc
  @end_date_utc
end

#hide_content_on_rolloverBoolean?

Returns the hide content on rollover flag.

Returns:

  • (Boolean, nil)

    the hide content on rollover flag



124
125
126
# File 'lib/lusi_api/vle.rb', line 124

def hide_content_on_rollover
  @hide_content_on_rollover
end

#is_conversion_spaceBoolean?

Returns the space conversion flag.

Returns:

  • (Boolean, nil)

    the space conversion flag



128
129
130
# File 'lib/lusi_api/vle.rb', line 128

def is_conversion_space
  @is_conversion_space
end

#lusi_vle_space_idString

Returns the VLE space ID.

Returns:

  • (String)

    the VLE space ID



136
137
138
# File 'lib/lusi_api/vle.rb', line 136

def lusi_vle_space_id
  @lusi_vle_space_id
end

#lusi_year_idString

Returns the year identity code.

Returns:

  • (String)

    the year identity code



132
133
134
# File 'lib/lusi_api/vle.rb', line 132

def lusi_year_id
  @lusi_year_id
end

#space_typeString?

Returns the space type (SINGLE|SHARED).

Returns:

  • (String, nil)

    the space type (SINGLE|SHARED)



140
141
142
# File 'lib/lusi_api/vle.rb', line 140

def space_type
  @space_type
end

#start_dateDateTime?

Returns the VLE space start date.

Returns:

  • (DateTime, nil)

    the VLE space start date



144
145
146
# File 'lib/lusi_api/vle.rb', line 144

def start_date
  @start_date
end

#start_date_utcDateTime?

Returns the UTC VLE space start date.

Returns:

  • (DateTime, nil)

    the UTC VLE space start date



148
149
150
# File 'lib/lusi_api/vle.rb', line 148

def start_date_utc
  @start_date_utc
end

#student_access_dateDateTime?

Returns the VLE space student access date.

Returns:

  • (DateTime, nil)

    the VLE space student access date



152
153
154
# File 'lib/lusi_api/vle.rb', line 152

def student_access_date
  @student_access_date
end

#student_access_date_utcDateTime?

Returns the UTC VLE space student access date.

Returns:

  • (DateTime, nil)

    the UTC VLE space student access date



156
157
158
# File 'lib/lusi_api/vle.rb', line 156

def student_access_date_utc
  @student_access_date_utc
end

#urlString?

Returns the VLE space URL.

Returns:

  • (String, nil)

    the VLE space URL



160
161
162
# File 'lib/lusi_api/vle.rb', line 160

def url
  @url
end

#vle_providerLUSI::API::Core::Code?

Returns the VLE provider.

Returns:



164
165
166
# File 'lib/lusi_api/vle.rb', line 164

def vle_provider
  @vle_provider
end

#vle_space_coursesArray<LUSI::API::VLESpace::VLESpaceCourse>?

Returns the list of associated courses.

Returns:

  • (Array<LUSI::API::VLESpace::VLESpaceCourse>, nil)

    the list of associated courses



169
170
171
# File 'lib/lusi_api/vle.rb', line 169

def vle_space_courses
  @vle_space_courses
end

#vle_templateLUSI::API::Core::Code?

Returns the VLE template.

Returns:



173
174
175
# File 'lib/lusi_api/vle.rb', line 173

def vle_template
  @vle_template
end

Class Method Details

.get_instance(api, lookup = nil, **kwargs) {|obj| ... } ⇒ <Array<LUSI::API::VLE::VLESpace>] the matching instances

Returns an array of instances matching the specified search criteria

Parameters:

Yields:

  • (obj)

    Passes the instance to the block

Yield Parameters:

Returns:

  • (<Array<LUSI::API::VLE::VLESpace>] the matching instances)

    <Array<LUSI::API::VLE::VLESpace>] the matching instances



181
182
183
184
185
186
187
188
189
190
# File 'lib/lusi_api/vle.rb', line 181

def self.get_instance(api, lookup = nil, **kwargs)
  params = get_instance_params(**kwargs)
  xml = api.call('LUSIReference', 'General.asmx', 'GetVLESpaces',
                 **params)
  LUSI::API::Core::XML.xml(xml, 'xmlns:VLESpace') do |m|
    obj = self.new(m, lookup)
    yield(obj) if block_given?
    obj
  end
end

.get_instance_params(**kwargs) {|obj| ... } ⇒ Array<VLESpace>?

Returns a hash of parameters for the LUSI API call.

Parameters:

  • asp_identity (String, nil)

    return instances matching this academic significant period (ASP)

  • cohort_identity (String, nil)

    return instances matching this cohort identity

  • course_identity (String, nil)

    return instances matching this course identity

  • course_type (String, nil)

    return instances matching this course type (CMOD|SOS)

  • department_identity (String, nil)

    return instances matching this department identity

  • space_type (String, nil)

    return instances matching this space type (SHARED|SINGLE)

  • vle_space_identity (String, nil)

    return instances matching this VLE space identity

  • vle_provider_identity (String, nil)

    return instances matching this VLE provider identity

  • year_identity (String, nil)

    return instances matching this year identity

  • active_vle_space_only (Boolean, nil)

    if true, return only active VLE spaces, otherwise return all spaces

Yields:

  • (obj)

    Passes the VLESpace instance to the block

Yield Parameters:

Returns:

  • (Array<VLESpace>, nil)

    the matching VLESpace instances



216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/lusi_api/vle.rb', line 216

def self.get_instance_params(**kwargs)
  {
    ActiveVLESpaceOnly: kwargs.fetch(:active_vle_space_only, true) ? 'true' : 'false',
    ASPIdentity: kwargs.fetch(:asp_identity, ''),
    CohortIdentity: kwargs.fetch(:cohort_identity, ''),
    CourseIdentity: kwargs.fetch(:course_identity, ''),
    CourseType: kwargs.fetch(:course_type, ''),
    DepartmentIdentity: kwargs.fetch(:department_identity, ''),
    SpaceType: kwargs.fetch(:space_type, ''),
    VLEProviderIdentity: kwargs.fetch(:vle_provider_identity, ''),
    VLESpaceIdentity: kwargs.fetch(:vle_space_identity, ''),
    YearIdentity: kwargs.fetch(:year_identity, '')
  }
end

Instance Method Details

#to_sString

Returns a string representation of the VLESpace instance

Returns:

  • (String)

    the string representation of the VLESpace instance



316
317
318
# File 'lib/lusi_api/vle.rb', line 316

def to_s
  display_long_title || display_short_title
end