Class: LUSI::API::Course::Mark

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

Overview

Represents a module mark in the LUSI API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml = nil, lookup = nil, overall_percentage: nil, overall_aggregation: nil) ⇒ void

Initialises a new Mark instance

Parameters:

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

    the parsed XML root of the mark

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

    the lookup service for object resolution

  • overall_aggregation (Float, int) (defaults to: nil)

    the default overall aggregation

  • overall_percentage (Float, int) (defaults to: nil)

    the default overall percentage



690
691
692
693
694
# File 'lib/lusi_api/course.rb', line 690

def initialize(xml = nil, lookup = nil, overall_percentage: nil, overall_aggregation: nil)
  @overall_percentage = LUSI::API::Core::XML.xml_float_at(xml, 'xmlns:OverallPercentage', overall_percentage)
  @overall_aggregation = LUSI::API::Core::XML.xml_float_at(xml, 'xmlns:OverallAggregation',
                                                           overall_aggregation)
end

Instance Attribute Details

#overall_aggregationFloat?

Returns the overall aggregation score for the module.

Returns:

  • (Float, nil)

    the overall aggregation score for the module



682
683
684
# File 'lib/lusi_api/course.rb', line 682

def overall_aggregation
  @overall_aggregation
end

#overall_percentageFloat?

Returns the overall percentage mark for the module.

Returns:

  • (Float, nil)

    the overall percentage mark for the module



678
679
680
# File 'lib/lusi_api/course.rb', line 678

def overall_percentage
  @overall_percentage
end

Instance Method Details

#to_sString

Returns a string representation of the Mark instance

Returns:

  • (String)

    the string representation of the Mark instance



698
699
700
# File 'lib/lusi_api/course.rb', line 698

def to_s
  "#{@overall_aggregation} (#{@overall_percentage}%)"
end