Class: MediaWiktory::Wikipedia::Actions::Managetags

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

Overview

Perform management tasks relating to change tags.

Usage:

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

#ignorewarningsself

Whether to ignore any warnings that are issued during the operation.

Returns:

  • (self)


54
55
56
# File 'lib/mediawiktory/wikipedia/actions/managetags.rb', line 54

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

#operation(value) ⇒ self

Which operation to perform:

Parameters:

  • value (String)

    One of "create" (Create a new change tag for manual use), "delete" (Remove a change tag from the database, including removing the tag from all revisions, recent change entries and log entries on which it is used), "activate" (Activate a change tag, allowing users to apply it manually), "deactivate" (Deactivate a change tag, preventing users from applying it manually).

Returns:

  • (self)


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

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

#reason(value) ⇒ self

An optional reason for creating, deleting, activating or deactivating the tag.

Parameters:

  • value (String)

Returns:

  • (self)


47
48
49
# File 'lib/mediawiktory/wikipedia/actions/managetags.rb', line 47

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

#tag(value) ⇒ self

Tag to create, delete, activate or deactivate. For tag creation, the tag must not exist. For tag deletion, the tag must exist. For tag activation, the tag must exist and not be in use by an extension. For tag deactivation, the tag must be currently active and manually defined.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#tags(*values) ⇒ self

Change tags to apply to the entry in the tag management log.

Parameters:

  • values (Array<String>)

    Allowed values: "ProveIt edit", "WPCleaner", "huggle", "large plot addition".

Returns:

  • (self)


62
63
64
# File 'lib/mediawiktory/wikipedia/actions/managetags.rb', line 62

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

#token(value) ⇒ self

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

Parameters:

  • value (String)

Returns:

  • (self)


75
76
77
# File 'lib/mediawiktory/wikipedia/actions/managetags.rb', line 75

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