Class: MediaWiktory::Wikipedia::Actions::Liststudents

Inherits:
Get
  • Object
show all
Defined in:
lib/mediawiktory/wikipedia/actions/liststudents.rb

Overview

Get the usernames and other information for students enrolled in one or more courses.

Usage:

api.liststudents.courseids(value).perform # returns string with raw output
# or
api.liststudents.courseids(value).response # returns output parsed and wrapped into Response object

See Base for generic explanation of working with MediaWiki actions and Response for working with action responses.

All action's parameters are documented as its public methods, see below.

Instance Method Summary collapse

Methods inherited from Get

#perform

Methods inherited from Base

#inspect, #merge, #name, #perform, #response, #to_h, #to_param, #to_url

Methods included from GlobalParams

#assert, #assertuser, #centralauthtoken, #curtimestamp, #errorformat, #errorlang, #errorsuselocal, #format, #maxage, #maxlag, #origin, #requestid, #responselanginfo, #servedby, #smaxage, #uselang

Instance Method Details

#courseids(*values) ⇒ self

IDs of the courses.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


26
27
28
# File 'lib/mediawiktory/wikipedia/actions/liststudents.rb', line 26

def courseids(*values)
  values.inject(self) { |res, val| res._courseids(val) }
end

#csvself

If given, the query will return usernames in CSV format, and it will return the articles assigned to those students.

Returns:

  • (self)


58
59
60
# File 'lib/mediawiktory/wikipedia/actions/liststudents.rb', line 58

def csv()
  merge(csv: 'true')
end

#groupself

If given, the query will group students by course.

Returns:

  • (self)


51
52
53
# File 'lib/mediawiktory/wikipedia/actions/liststudents.rb', line 51

def group()
  merge(group: 'true')
end

#prop(value) ⇒ self

Which property to get for each student:

Parameters:

  • value (String)

    One of "username" (The username of the student), "id" (The user ID of the student).

Returns:

  • (self)


39
40
41
# File 'lib/mediawiktory/wikipedia/actions/liststudents.rb', line 39

def prop(value)
  _prop(value) or fail ArgumentError, "Unknown value for prop: #{value}"
end