Class: MediaWiktory::Wikipedia::Actions::Tag

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

Overview

Add or remove change tags from individual revisions or log entries.

Usage:

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

#add(*values) ⇒ self

Tags to add. Only manually defined tags can be added.

Parameters:

  • values (Array<String>)

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

Returns:

  • (self)


65
66
67
# File 'lib/mediawiktory/wikipedia/actions/tag.rb', line 65

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

#logid(*values) ⇒ self

One or more log entry IDs from which to add or remove the tag.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


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

def logid(*values)
  values.inject(self) { |res, val| res._logid(val) }
end

#rcid(*values) ⇒ self

One or more recent changes IDs from which to add or remove the tag.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


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

def rcid(*values)
  values.inject(self) { |res, val| res._rcid(val) }
end

#reason(value) ⇒ self

Reason for the change.

Parameters:

  • value (String)

Returns:

  • (self)


91
92
93
# File 'lib/mediawiktory/wikipedia/actions/tag.rb', line 91

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

#remove(*values) ⇒ self

Tags to remove. Only tags that are either manually defined or completely undefined can be removed.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


78
79
80
# File 'lib/mediawiktory/wikipedia/actions/tag.rb', line 78

def remove(*values)
  values.inject(self) { |res, val| res._remove(val) }
end

#revid(*values) ⇒ self

One or more revision IDs from which to add or remove the tag.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


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

def revid(*values)
  values.inject(self) { |res, val| res._revid(val) }
end

#tags(*values) ⇒ self

Tags to apply to the log entry that will be created as a result of this action.

Parameters:

  • values (Array<String>)

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

Returns:

  • (self)


99
100
101
# File 'lib/mediawiktory/wikipedia/actions/tag.rb', line 99

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)


112
113
114
# File 'lib/mediawiktory/wikipedia/actions/tag.rb', line 112

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