Class: MediaWiktory::Wikipedia::Actions::Enlist

Inherits:
Post
  • Object
show all
Defined in:
lib/mediawiktory/wikipedia/actions/enlist.rb

Overview

Associate or disassociate a user as instructor or volunteer for a course.

Usage:

api.enlist.subaction(value).perform # returns string with raw output
# or
api.enlist.subaction(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 Post

#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

#courseid(value) ⇒ self

The ID of the course.

Parameters:

  • value (Integer)

Returns:

  • (self)


68
69
70
# File 'lib/mediawiktory/wikipedia/actions/enlist.rb', line 68

def courseid(value)
  merge(courseid: value.to_s)
end

#reason(value) ⇒ self

Reason for this deletion, for the log.

Parameters:

  • value (String)

Returns:

  • (self)


76
77
78
# File 'lib/mediawiktory/wikipedia/actions/enlist.rb', line 76

def reason(value)
  merge(reason: value.to_s)
end

#role(value) ⇒ self

The role to affect. "instructor" for instructor, "online" for online volunteer and "campus" for campus volunteer.

Parameters:

  • value (String)

    One of "instructor", "online", "campus", "student".

Returns:

  • (self)


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

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

#subaction(value) ⇒ self

Specifies what you want to do with the instructor or volunteer.

Parameters:

  • value (String)

    One of "add", "remove".

Returns:

  • (self)


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

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

#token(value) ⇒ self

A "csrf" token retrieved from action=query&meta=tokens

Parameters:

  • value (String)

Returns:

  • (self)


84
85
86
# File 'lib/mediawiktory/wikipedia/actions/enlist.rb', line 84

def token(value)
  merge(token: value.to_s)
end

#userid(value) ⇒ self

ID of the user to associate or disassociate.

Parameters:

  • value (Integer)

Returns:

  • (self)


60
61
62
# File 'lib/mediawiktory/wikipedia/actions/enlist.rb', line 60

def userid(value)
  merge(userid: value.to_s)
end

#username(value) ⇒ self

Name of the user to associate or disassociate.

Parameters:

  • value (String)

Returns:

  • (self)


52
53
54
# File 'lib/mediawiktory/wikipedia/actions/enlist.rb', line 52

def username(value)
  merge(username: value.to_s)
end