Class: MediaWiktory::Wikipedia::Actions::Wikilove

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

Overview

Give WikiLove to another user.

Usage:

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

#email(value) ⇒ self

Content of the optional email message to send to the user. A warning will be returned if the user cannot be emailed. WikiLove will be sent to the users talk page either way.

Parameters:

  • value (String)

Returns:

  • (self)


74
75
76
# File 'lib/mediawiktory/wikipedia/actions/wikilove.rb', line 74

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

#message(value) ⇒ self

Actual message the user has entered, for logging purposes.

Parameters:

  • value (String)

Returns:

  • (self)


42
43
44
# File 'lib/mediawiktory/wikipedia/actions/wikilove.rb', line 42

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

#subject(value) ⇒ self

Subject header of the new section.

Parameters:

  • value (String)

Returns:

  • (self)


58
59
60
# File 'lib/mediawiktory/wikipedia/actions/wikilove.rb', line 58

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

#text(value) ⇒ self

Raw wikitext to add in the new section.

Parameters:

  • value (String)

Returns:

  • (self)


34
35
36
# File 'lib/mediawiktory/wikipedia/actions/wikilove.rb', line 34

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

#title(value) ⇒ self

Full pagename of the user page or user talk page of the user to send WikiLove to.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#token(value) ⇒ self

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

Parameters:

  • value (String)

Returns:

  • (self)


50
51
52
# File 'lib/mediawiktory/wikipedia/actions/wikilove.rb', line 50

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

#type(value) ⇒ self

Type of WikiLove (for statistics); this corresponds with a type selected in the menu, and optionally a subtype after that (e.g. as in "The Original Barnstar" or "A kitten for you!").

Parameters:

  • value (String)

Returns:

  • (self)


66
67
68
# File 'lib/mediawiktory/wikipedia/actions/wikilove.rb', line 66

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