Module: MediaWiktory::Wikipedia::Modules::Users

Defined in:
lib/mediawiktory/wikipedia/modules/users.rb

Overview

Get information about a list of users.

The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):

api.query             # returns Actions::Query
   .prop(:revisions)  # adds prop=revisions to action URL, and includes Modules::Revisions into action
   .limit(10)         # method of Modules::Revisions, adds rvlimit=10 to URL

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

Instance Method Summary collapse

Instance Method Details

#attachedwiki(value) ⇒ self

With usprop=centralids, indicate whether the user is attached with the wiki identified by this ID.

Parameters:

  • value (String)

Returns:

  • (self)


38
39
40
# File 'lib/mediawiktory/wikipedia/modules/users.rb', line 38

def attachedwiki(value)
  merge(usattachedwiki: value.to_s)
end

#prop(*values) ⇒ self

Which pieces of information to include:

Parameters:

  • values (Array<String>)

    Allowed values: "blockinfo" (Tags if the user is blocked, by whom, and for what reason), "groups" (Lists all the groups each user belongs to), "groupmemberships" (Lists groups that each user has been explicitly assigned to, including the expiry date of each group membership), "implicitgroups" (Lists all the groups a user is automatically a member of), "rights" (Lists all the rights each user has), "editcount" (Adds the user's edit count), "registration" (Adds the user's registration timestamp), "emailable" (Tags if the user can and wants to receive email through Special:Emailuser), "gender" (Tags the gender of the user. Returns "male", "female", or "unknown"), "centralids" (Adds the central IDs and attachment status for the user), "cancreate" (Indicates whether an account for valid but unregistered usernames can be created).

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/users.rb', line 25

def prop(*values)
  values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
end

#token(*values) ⇒ self

Use action=query&meta=tokens instead.

Parameters:

  • values (Array<String>)

    Allowed values: "userrights".

Returns:

  • (self)


72
73
74
# File 'lib/mediawiktory/wikipedia/modules/users.rb', line 72

def token(*values)
  values.inject(self) { |res, val| res._token(val) or fail ArgumentError, "Unknown value for token: #{val}" }
end

#userids(*values) ⇒ self

A list of user IDs to obtain information for.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


59
60
61
# File 'lib/mediawiktory/wikipedia/modules/users.rb', line 59

def userids(*values)
  values.inject(self) { |res, val| res._userids(val) }
end

#users(*values) ⇒ self

A list of users to obtain information for.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


46
47
48
# File 'lib/mediawiktory/wikipedia/modules/users.rb', line 46

def users(*values)
  values.inject(self) { |res, val| res._users(val) }
end