Class: LUSI::API::Course::CreditPoints

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

Overview

Represents the credit points for a scheme of study

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml = nil, lookup = nil, part_2_year_2: 0, part_2_year_3: 0, part_2_year_4: 0, part_2_year_5: 0, total_overall: 0, total_part_1: 0, total_part_2: 0) ⇒ void

Initialises a new CreditPoints instance

Parameters:

  • xml (Nokogiri::XML::Document, Nokogiri::XML::Node) (defaults to: nil)

    the parsed XML root of the credit points

  • lookup (LUSI::API::Core::Lookup::LookupService, nil) (defaults to: nil)

    the lookup service for object resolution

  • part_2_year_2 (Integer, nil) (defaults to: 0)

    the default part 2 year 2 credit points

  • part_2_year_3 (Integer, nil) (defaults to: 0)

    the default part 2 year 3 credit points

  • part_2_year_4 (Integer, nil) (defaults to: 0)

    the default part 2 year 4 credit points

  • part_2_year_5 (Integer, nil) (defaults to: 0)

    the default part 2 year 5 credit points

  • total_overall (Integer, nil) (defaults to: 0)

    the default overall total credit points

  • total_part_1 (Integer, nil) (defaults to: 0)

    the default part 1 total credit points

  • total_part_2 (Integer, nil) (defaults to: 0)

    the default part 2 total



616
617
618
619
620
621
622
623
624
625
# File 'lib/lusi_api/course.rb', line 616

def initialize(xml = nil, lookup = nil, part_2_year_2: 0, part_2_year_3: 0, part_2_year_4: 0, part_2_year_5: 0,
               total_overall: 0, total_part_1: 0, total_part_2: 0)
  @part_2_year_2 = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:Part2Year2', part_2_year_2)
  @part_2_year_3 = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:Part2Year3', part_2_year_3)
  @part_2_year_4 = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:Part2Year4', part_2_year_4)
  @part_2_year_5 = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:Part2Year5', part_2_year_5)
  @total_overall = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:TotalOverall', total_overall)
  @total_part_1 = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:TotalPart1', total_part_1)
  @total_part_2 = LUSI::API::Core::XML.xml_int_at(xml, 'xmlns:TotalPart2', total_part_2)
end

Instance Attribute Details

#part_2_year_2Integer?

Returns the number of Part 2 credit points required in year 2.

Returns:

  • (Integer, nil)

    the number of Part 2 credit points required in year 2



583
584
585
# File 'lib/lusi_api/course.rb', line 583

def part_2_year_2
  @part_2_year_2
end

#part_2_year_3Integer?

Returns the number of Part 2 credit points required in year 3.

Returns:

  • (Integer, nil)

    the number of Part 2 credit points required in year 3



587
588
589
# File 'lib/lusi_api/course.rb', line 587

def part_2_year_3
  @part_2_year_3
end

#part_2_year_4Integer?

Returns the number of Part 2 credit points required in year 4.

Returns:

  • (Integer, nil)

    the number of Part 2 credit points required in year 4



591
592
593
# File 'lib/lusi_api/course.rb', line 591

def part_2_year_4
  @part_2_year_4
end

#part_2_year_5Integer?

Returns the number of Part 2 credit points required in year 5.

Returns:

  • (Integer, nil)

    the number of Part 2 credit points required in year 5



595
596
597
# File 'lib/lusi_api/course.rb', line 595

def part_2_year_5
  @part_2_year_5
end

#total_overallInteger?

Returns the total number of credit points required for the scheme of study.

Returns:

  • (Integer, nil)

    the total number of credit points required for the scheme of study



603
604
605
# File 'lib/lusi_api/course.rb', line 603

def total_overall
  @total_overall
end

#total_part_1Integer?

Returns the total number of credit points required at Part 1.

Returns:

  • (Integer, nil)

    the total number of credit points required at Part 1



579
580
581
# File 'lib/lusi_api/course.rb', line 579

def total_part_1
  @total_part_1
end

#total_part_2Integer?

Returns the total number of credit points required at Part 2.

Returns:

  • (Integer, nil)

    the total number of credit points required at Part 2



599
600
601
# File 'lib/lusi_api/course.rb', line 599

def total_part_2
  @total_part_2
end

Instance Method Details

#to_sString

Returns a string representation of the CreditPoints instance

Returns:

  • (String)

    the string representation of the CreditPoints instance



629
630
631
# File 'lib/lusi_api/course.rb', line 629

def to_s
  "#{@total_overall}"
end