class MediaWiktory::Wikipedia::Actions::Import

Import a page from another wiki, or from an XML file.

Usage:

“`ruby api.import.summary(value).perform # returns string with raw output # or api.import.summary(value).response # returns output parsed and wrapped into Response object “`

See {Base} for generic explanation of working with MediaWiki actions and {MediaWiktory::Wikipedia::Response} for working with action responses.

All action's parameters are documented as its public methods, see below.

Public Instance Methods

_interwikisource(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/import.rb, line 47
def _interwikisource(value)
  defined?(super) && super || ["meta", "nost", "de", "es", "fr", "it", "pl", "outreachwiki", "test2wiki"].include?(value.to_s) && merge(interwikisource: value.to_s)
end
_namespace(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/import.rb, line 82
def _namespace(value)
  defined?(super) && super || ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "100", "101", "108", "109", "118", "119", "446", "447", "710", "711", "828", "829", "2300", "2301", "2302", "2303"].include?(value.to_s) && merge(namespace: value.to_s)
end
_tags(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/import.rb, line 103
def _tags(value)
  defined?(super) && super || ["ProveIt edit", "WPCleaner", "huggle", "large plot addition"].include?(value.to_s) && merge(tags: value.to_s, replace: false)
end
fullhistory() click to toggle source

For interwiki imports: import the full history, not just the current version.

@return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 62
def fullhistory()
  merge(fullhistory: 'true')
end
interwikipage(value) click to toggle source

For interwiki imports: page to import.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 55
def interwikipage(value)
  merge(interwikipage: value.to_s)
end
interwikisource(value) click to toggle source

For interwiki imports: wiki to import from.

@param value [String] One of “meta”, “nost”, “de”, “es”, “fr”, “it”, “pl”, “outreachwiki”, “test2wiki”. @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 42
def interwikisource(value)
  _interwikisource(value) or fail ArgumentError, "Unknown value for interwikisource: #{value}"
end
namespace(value) click to toggle source

Import to this namespace. Cannot be used together with rootpage.

@param value [String] One of “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12”, “13”, “14”, “15”, “100”, “101”, “108”, “109”, “118”, “119”, “446”, “447”, “710”, “711”, “828”, “829”, “2300”, “2301”, “2302”, “2303”. @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 77
def namespace(value)
  _namespace(value) or fail ArgumentError, "Unknown value for namespace: #{value}"
end
rootpage(value) click to toggle source

Import as subpage of this page. Cannot be used together with namespace.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 90
def rootpage(value)
  merge(rootpage: value.to_s)
end
summary(value) click to toggle source

Log entry import summary.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 26
def summary(value)
  merge(summary: value.to_s)
end
tags(*values) click to toggle source

Change tags to apply to the entry in the import log and to the null revision on the imported pages.

@param values [Array<String>] Allowed values: “ProveIt edit”, “WPCleaner”, “huggle”, “large plot addition”. @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 98
def tags(*values)
  values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, "Unknown value for tags: #{val}" }
end
templates() click to toggle source

For interwiki imports: import all included templates as well.

@return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 69
def templates()
  merge(templates: 'true')
end
token(value) click to toggle source

A “csrf” token retrieved from action=query&meta=tokens

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 111
def token(value)
  merge(token: value.to_s)
end
xml(value) click to toggle source

Uploaded XML file.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/import.rb, line 34
def xml(value)
  merge(xml: value.to_s)
end