class LUSI::API::Course::CourseDocument

Represents a course document in the LUSI API

Attributes

html_text[RW]

@!attribute [rw] html_text

@return [String, nil] the text document as pre-formatted HTML
type[RW]

@!attribute [rw] type

@return [LUSI::API::Core::Code, nil] the course document type

Public Class Methods

new(xml = nil, lookup = nil, type: nil, html_text: nil) click to toggle source

Initialises a new CourseDocument instance @param xml [Nokogiri::XML::Document, Nokogiri::XML::Node] the parsed XML root of the course document @param lookup [LUSI::API::Core::Lookup::LookupService, nil] the lookup service for object resolution @param type [LUSI::API::Core::Code, nil] the default document type @param html_text [String, nil] the default document text @return [void]

# File lib/lusi_api/course.rb, line 560
def initialize(xml = nil, lookup = nil, type: nil, html_text: nil)
  @type = LUSI::API::Core::Code.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:Type', type), lookup)
  @html_text = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:HTMLText', html_text)
end

Public Instance Methods

to_s() click to toggle source

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

# File lib/lusi_api/course.rb, line 567
def to_s
  @type.description
end