Class: LUSI::API::Course::Cohort
- Inherits:
-
Object
- Object
- LUSI::API::Course::Cohort
- Defined in:
- lib/lusi_api/course.rb
Overview
Represents a cohort (student intake) in the LUSI API
Instance Attribute Summary collapse
-
#display_long_title ⇒ String?
The long title of the cohort.
-
#display_short_title ⇒ String?
The short title of the cohort.
-
#end_date ⇒ DateTime?
The end date of study.
-
#identity ⇒ Integer?
The identity code of the cohort.
-
#start_date ⇒ DateTime?
The start date of study.
Instance Method Summary collapse
-
#initialize(xml = nil, lookup = nil, display_long_title: nil, display_short_title: nil, end_date: nil, identity: nil, start_date: nil) ⇒ void
constructor
Initialises a new Cohort instance.
-
#to_s ⇒ String
Returns a string representation of the Cohort instance.
Constructor Details
#initialize(xml = nil, lookup = nil, display_long_title: nil, display_short_title: nil, end_date: nil, identity: nil, start_date: nil) ⇒ void
Initialises a new Cohort instance
487 488 489 490 491 492 493 494 |
# File 'lib/lusi_api/course.rb', line 487 def initialize(xml = nil, lookup = nil, display_long_title: nil, display_short_title: nil, end_date: nil, identity: nil, start_date: nil) @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) @identity = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:Identity', identity) @start_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StartDate', start_date) end |
Instance Attribute Details
#display_long_title ⇒ String?
Returns the long title of the cohort.
460 461 462 |
# File 'lib/lusi_api/course.rb', line 460 def display_long_title @display_long_title end |
#display_short_title ⇒ String?
Returns the short title of the cohort.
464 465 466 |
# File 'lib/lusi_api/course.rb', line 464 def display_short_title @display_short_title end |
#end_date ⇒ DateTime?
Returns the end date of study.
468 469 470 |
# File 'lib/lusi_api/course.rb', line 468 def end_date @end_date end |
#identity ⇒ Integer?
Returns the identity code of the cohort.
472 473 474 |
# File 'lib/lusi_api/course.rb', line 472 def identity @identity end |
#start_date ⇒ DateTime?
Returns the start date of study.
476 477 478 |
# File 'lib/lusi_api/course.rb', line 476 def start_date @start_date end |
Instance Method Details
#to_s ⇒ String
Returns a string representation of the Cohort instance
498 499 500 501 502 |
# File 'lib/lusi_api/course.rb', line 498 def to_s end_date = @end_date ? @end_date.strftime('%d-%m-%Y') : '' start_date = @start_date ? @start_date.strftime('%d-%m-%Y') : '' "#{@display_long_title || @display_short_title} #{start_date}-#{end_date}" end |