class Stellar::Members::Photo
Information about a member's photo
Attributes
client[R]
Generic Stellar
client used to make requests.
course[R]
The course this member belongs to.
email[R]
The member's e-mail.
name[R]
The member's full name.
url[R]
URL of the member's photo.
Public Class Methods
new(div, course)
click to toggle source
Creates a Stellar
client scoped to a student's Gradebook
page.
@param [Nokogiri::XML::Element] div a <div> representing a member's photo
and info in the Members Photo page
@param [Stellar::Course] course Stellar
client scoped to the
course that this student belongs to
# File lib/stellar/members.rb, line 119 def initialize(div, course) @course = course @client = course.client unless img = div.css('img[src*="pictures"]').first raise ArgumentError, 'Invalid photo-listing <div>' end @url = URI.join div.document.url, img['src'].gsub('/half/', '/full/') unless mail_link = div.css('a[href*="mailto"]').first raise ArgumentError, 'Invalid photo-listing <div>' end @email = mail_link['href'].sub(/^mailto\:/, '') @name = mail_link.inner_text end
Public Instance Methods
data()
click to toggle source
The member's photo bits.
# File lib/stellar/members.rb, line 135 def data @client.get_file @url end