Class: MediaWiktory::Wikipedia::Actions::Visualeditoredit

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

Overview

Save an HTML5 page to MediaWiki (converted to wikitext via the Parsoid service).

Usage:

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

#basetimestamp(value) ⇒ self

When saving, set this to the timestamp of the revision that was edited. Used to detect edit conflicts.

Parameters:

  • value (String)

Returns:

  • (self)


79
80
81
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 79

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

#cachekey(value) ⇒ self

Use the result of a previous serializeforcache request with this key. Overrides html.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#captchaid(value) ⇒ self

Captcha ID (when saving with a captcha response).

Parameters:

  • value (String)

Returns:

  • (self)


143
144
145
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 143

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

#captchaword(value) ⇒ self

Answer to the captcha (when saving with a captcha response).

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#etag(value) ⇒ self

ETag to send.

Parameters:

  • value (String)

Returns:

  • (self)


127
128
129
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 127

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

#html(value) ⇒ self

HTML to send to Parsoid in exchange for wikitext.

Parameters:

  • value (String)

Returns:

  • (self)


119
120
121
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 119

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

#minor(value) ⇒ self

Flag for minor edit.

Parameters:

  • value (String)

Returns:

  • (self)


103
104
105
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 103

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

#oldid(value) ⇒ self

The revision number to use. Defaults to latest revision. Use 0 for a new page.

Parameters:

  • value (String)

Returns:

  • (self)


95
96
97
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 95

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

#paction(value) ⇒ self

Action to perform.

Parameters:

  • value (String)

    One of "serialize", "serializeforcache", "diff", "save".

Returns:

  • (self)


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

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

#page(value) ⇒ self

The page to perform actions on.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#section(value) ⇒ self

The section on which to act.

Parameters:

  • value (String)

Returns:

  • (self)


63
64
65
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 63

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

#sectiontitle(value) ⇒ self

Title for new section.

Parameters:

  • value (String)

Returns:

  • (self)


71
72
73
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 71

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

#starttimestamp(value) ⇒ self

When saving, set this to the timestamp of when the page was loaded. Used to detect edit conflicts.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#summary(value) ⇒ self

Edit summary.

Parameters:

  • value (String)

Returns:

  • (self)


135
136
137
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 135

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

#token(value) ⇒ self

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

Parameters:

  • value (String)

Returns:

  • (self)


47
48
49
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 47

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

#watch(value) ⇒ self

Parameters:

  • value (String)

Returns:

  • (self)


111
112
113
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 111

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

#wikitext(value) ⇒ self

Parameters:

  • value (String)

Returns:

  • (self)


55
56
57
# File 'lib/mediawiktory/wikipedia/actions/visualeditoredit.rb', line 55

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