Class: Stellar::Gradebook

Inherits:
Object
  • Object
show all
Defined in:
lib/stellar/gradebook.rb

Overview

Stellar client scoped to a course’s Gradebook module.

Defined Under Namespace

Classes: Assignment, AssignmentList, Student, StudentList

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(course) ⇒ Gradebook

Creates a Stellar client scoped to a course’s Gradebook module.

Parameters:



20
21
22
23
24
25
26
27
28
29
# File 'lib/stellar/gradebook.rb', line 20

def initialize(course)
  @course = course
  @client = course.client
  @url = course.navigation['Gradebook']
  
  page = @client.get_nokogiri @url
  @navigation = Hash[page.css('#toolBox.dashboard dd a').map { |link|
    [link.inner_text, URI.join(page.url, link['href'])]
  }]
end

Instance Attribute Details

#clientObject (readonly)

Generic Stellar client used to make requests.



15
16
17
# File 'lib/stellar/gradebook.rb', line 15

def client
  @client
end

#courseObject (readonly)

The course whose Gradebook is exposed by this client.



12
13
14
# File 'lib/stellar/gradebook.rb', line 12

def course
  @course
end

Maps the text in navigation links to URI objects.

Example: navigation => <# URI: …/ >



9
10
11
# File 'lib/stellar/gradebook.rb', line 9

def navigation
  @navigation
end

Instance Method Details

#assignmentsStellar::Gradebook::AssignmentList

All assignments in this course’s Gradebook module.

Returns:



34
35
36
# File 'lib/stellar/gradebook.rb', line 34

def assignments
  @assignments ||= Stellar::Gradebook::AssignmentList.new self
end

#studentsStellar::Gradebook::StudentList

All students in this course’s Gradebook module.

Returns:



40
41
42
# File 'lib/stellar/gradebook.rb', line 40

def students
  @students ||= Stellar::Gradebook::StudentList.new self
end