class LUSI::API::Course::Identity

Represents the identity of a module or scheme of study

Attributes

asp[RW]

@!attribute [rw] asp

@return [String, nil] the academically-significant period (ASP)
course[RW]

@!attribute [rw] course

@return [String, nil] the identity code of the module or scheme of study
year[RW]

@!attribute [rw] year

@return [String, nil] the identity code of the academic year

Public Class Methods

new(xml = nil, lookup = nil, asp: nil, course: nil, year: nil) click to toggle source

Initialises a new Identity instance @param xml [Nokogiri::XML::Document, Nokogiri::XML::Node] the parsed XML root of the identity @param lookup [LUSI::API::Core::Lookup::LookupService, nil] the lookup service for object resolution @param asp [String, nil] the default academically-significant period (ASP) @param course [String, nil] the default identity of the module or schemem of study @param year [String, nil] the default academic year identity code @return [void]

# File lib/lusi_api/course.rb, line 36
def initialize(xml = nil, lookup = nil, asp: nil, course: nil, year: nil)
  @asp = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:ASP', asp)
  @course = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Course', course)
  @year = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Year', year)
end

Public Instance Methods

lookup_key() click to toggle source

Returns a string suitable for use as a hash lookup key @return [String] the lookup key

# File lib/lusi_api/course.rb, line 44
def lookup_key
  "#{course}-#{year}"
end
to_s() click to toggle source

Returns a string representation of the Identity instance @return [String] the string representation of the Identity instance

# File lib/lusi_api/course.rb, line 50
def to_s
  "lusi-#{lookup_key}"
end