Class: MediaWiktory::Wikipedia::Actions::Watch

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

Overview

Add or remove pages from the current user's watchlist.

Usage:

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

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


41
42
43
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 41

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

#converttitlesself

Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz and zh.

Returns:

  • (self)


151
152
153
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 151

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

#generator(value) ⇒ self

Get the list of pages to work on by executing the specified query module.

Parameters:

Returns:

  • (self)


132
133
134
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 132

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

#pageids(*values) ⇒ self

A list of page IDs to work on.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


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

def pageids(*values)
  values.inject(self) { |res, val| res._pageids(val) }
end

#redirectsself

Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.

Returns:

  • (self)


144
145
146
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 144

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

#revids(*values) ⇒ self

A list of revision IDs to work on.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


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

def revids(*values)
  values.inject(self) { |res, val| res._revids(val) }
end

#title(value) ⇒ self

The page to (un)watch. Use titles instead.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#titles(*values) ⇒ self

A list of titles to work on.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


49
50
51
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 49

def titles(*values)
  values.inject(self) { |res, val| res._titles(val) }
end

#token(value) ⇒ self

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

Parameters:

  • value (String)

Returns:

  • (self)


159
160
161
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 159

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

#unwatchself

If set the page will be unwatched rather than watched.

Returns:

  • (self)


33
34
35
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 33

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