Class: LUSI::API::Course::Identity
- Inherits:
-
Object
- Object
- LUSI::API::Course::Identity
- Defined in:
- lib/lusi_api/course.rb
Overview
Represents the identity of a module or scheme of study
Direct Known Subclasses
Instance Attribute Summary collapse
-
#asp ⇒ String?
The academically-significant period (ASP).
-
#course ⇒ String?
The identity code of the module or scheme of study.
-
#year ⇒ String?
The identity code of the academic year.
Instance Method Summary collapse
-
#initialize(xml = nil, lookup = nil, asp: nil, course: nil, year: nil) ⇒ void
constructor
Initialises a new Identity instance.
-
#lookup_key ⇒ String
Returns a string suitable for use as a hash lookup key.
-
#to_s ⇒ String
Returns a string representation of the Identity instance.
Constructor Details
#initialize(xml = nil, lookup = nil, asp: nil, course: nil, year: nil) ⇒ void
Initialises a new Identity instance
36 37 38 39 40 |
# 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 |
Instance Attribute Details
#asp ⇒ String?
Returns the academically-significant period (ASP).
19 20 21 |
# File 'lib/lusi_api/course.rb', line 19 def asp @asp end |
#course ⇒ String?
Returns the identity code of the module or scheme of study.
23 24 25 |
# File 'lib/lusi_api/course.rb', line 23 def course @course end |
#year ⇒ String?
Returns the identity code of the academic year.
27 28 29 |
# File 'lib/lusi_api/course.rb', line 27 def year @year end |
Instance Method Details
#lookup_key ⇒ String
Returns a string suitable for use as a hash lookup key
44 45 46 |
# File 'lib/lusi_api/course.rb', line 44 def lookup_key "#{course}-#{year}" end |
#to_s ⇒ String
Returns a string representation of the Identity instance
50 51 52 |
# File 'lib/lusi_api/course.rb', line 50 def to_s "lusi-#{lookup_key}" end |