Class: Stellar::Members

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

Overview

Stellar client scoped to a course’s Members module.

Defined Under Namespace

Classes: Photo, PhotoList

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(course) ⇒ Members

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

Parameters:



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

def initialize(course)
  @course = course
  @client = course.client
  @url = course.navigation['Membership']
  
  page = @client.get_nokogiri @url
  @navigation = Hash[page.css('#toolBox dd a').map { |link|
    [link.inner_text.strip, 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/members.rb', line 15

def client
  @client
end

#courseObject (readonly)

The course whose membership is exposed by this client.



12
13
14
# File 'lib/stellar/members.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/members.rb', line 9

def navigation
  @navigation
end

Instance Method Details

#photosStellar::Gradebook::PhotoList

All member photos in this course’s Membership module.

Returns:

  • (Stellar::Gradebook::PhotoList)

    list of member photos for students



33
34
35
# File 'lib/stellar/members.rb', line 33

def photos
  @students ||= Stellar::Members::PhotoList.new self
end