Class: MediaWiktory::Wikipedia::Actions::Tag
- 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
-
#add(*values) ⇒ self
Tags to add.
-
#logid(*values) ⇒ self
One or more log entry IDs from which to add or remove the tag.
-
#rcid(*values) ⇒ self
One or more recent changes IDs from which to add or remove the tag.
-
#reason(value) ⇒ self
Reason for the change.
-
#remove(*values) ⇒ self
Tags to remove.
-
#revid(*values) ⇒ self
One or more revision IDs from which to add or remove the tag.
-
#tags(*values) ⇒ self
Tags to apply to the log entry that will be created as a result of this action.
-
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens.
Methods inherited from Post
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.
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.
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.
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.
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.
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.
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.
99 100 101 |
# File 'lib/mediawiktory/wikipedia/actions/tag.rb', line 99 def (*values) values.inject(self) { |res, val| res.(val) or fail ArgumentError, "Unknown value for tags: #{val}" } end |
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens
112 113 114 |
# File 'lib/mediawiktory/wikipedia/actions/tag.rb', line 112 def token(value) merge(token: value.to_s) end |