Class: LUSI::API::Course::EnrolmentIdentity

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

Overview

Represents a module or scheme of study enrolment identity in the LUSI API

Instance Attribute Summary collapse

Attributes inherited from Identity

#asp, #course, #year

Instance Method Summary collapse

Methods inherited from Identity

#to_s

Constructor Details

#initialize(xml = nil, lookup = nil, cohort: nil, **kwargs) ⇒ void

Initialises a new EnrolmentIdentity instance

Parameters:

  • cohort (Integer, nil) (defaults to: nil)

    the default cohort identity code



68
69
70
71
# File 'lib/lusi_api/course.rb', line 68

def initialize(xml = nil, lookup = nil, cohort: nil, **kwargs)
  super(xml, lookup, **kwargs)
  @cohort = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:Cohort', cohort)
end

Instance Attribute Details

#cohortInteger?

Returns the identity code of the cohort for this course instance.

Returns:

  • (Integer, nil)

    the identity code of the cohort for this course instance



62
63
64
# File 'lib/lusi_api/course.rb', line 62

def cohort
  @cohort
end

Instance Method Details

#lookup_keyString

Returns a string suitable for use as a hash lookup key

Returns:

  • (String)

    the lookup key



74
75
76
# File 'lib/lusi_api/course.rb', line 74

def lookup_key
  "#{super}-#{cohort}"
end