Class: MediaWiktory::Wikipedia::Actions::Stashedit

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

Overview

Prepare an edit in shared cache.

Usage:

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

#baserevid(value) ⇒ self

Revision ID of the base revision.

Parameters:

  • value (Integer)

Returns:

  • (self)


100
101
102
# File 'lib/mediawiktory/wikipedia/actions/stashedit.rb', line 100

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

#contentformat(value) ⇒ self

Content serialization format used for the input text.

Parameters:

  • value (String)

    One of "application/json", "text/x-wiki", "text/javascript", "text/css", "text/plain".

Returns:

  • (self)


87
88
89
# File 'lib/mediawiktory/wikipedia/actions/stashedit.rb', line 87

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

#contentmodel(value) ⇒ self

Content model of the new content.

Parameters:

  • value (String)

    One of "GadgetDefinition", "SecurePoll", "MassMessageListContent", "JsonSchema", "wikitext", "javascript", "json", "css", "text", "Scribunto".

Returns:

  • (self)


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

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

#section(value) ⇒ self

Section number. 0 for the top section, new for a new section.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#sectiontitle(value) ⇒ self

The title for a new section.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#stashedtexthash(value) ⇒ self

Page content hash from a prior stash to use instead.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#summary(value) ⇒ self

Change summary.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#text(value) ⇒ self

Page content.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#title(value) ⇒ self

Title of the page being edited.

Parameters:

  • value (String)

Returns:

  • (self)


26
27
28
# File 'lib/mediawiktory/wikipedia/actions/stashedit.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)


108
109
110
# File 'lib/mediawiktory/wikipedia/actions/stashedit.rb', line 108

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