Class: MediaWiktory::Wikipedia::Actions::Mergehistory

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

Overview

Merge page histories.

Usage:

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

#from(value) ⇒ self

Title of the page from which history will be merged. Cannot be used together with fromid.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#fromid(value) ⇒ self

Page ID of the page from which history will be merged. Cannot be used together with from.

Parameters:

  • value (Integer)

Returns:

  • (self)


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

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

#reason(value) ⇒ self

Reason for the history merge.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#timestamp(value) ⇒ self

Timestamp up to which revisions will be moved from the source page's history to the destination page's history. If omitted, the entire page history of the source page will be merged into the destination page.

Parameters:

  • value (Time)

Returns:

  • (self)


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

def timestamp(value)
  merge(timestamp: value.iso8601)
end

#to(value) ⇒ self

Title of the page to which history will be merged. Cannot be used together with toid.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#toid(value) ⇒ self

Page ID of the page to which history will be merged. Cannot be used together with to.

Parameters:

  • value (Integer)

Returns:

  • (self)


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

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

#token(value) ⇒ self

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

Parameters:

  • value (String)

Returns:

  • (self)


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

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