Class: MediaWiktory::Wikipedia::Actions::Import
- Defined in:
- lib/mediawiktory/wikipedia/actions/import.rb
Overview
Import a page from another wiki, or from an XML file.
Usage:
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 Response for working with action responses.
All action's parameters are documented as its public methods, see below.
Instance Method Summary collapse
-
#fullhistory ⇒ self
For interwiki imports: import the full history, not just the current version.
-
#interwikipage(value) ⇒ self
For interwiki imports: page to import.
-
#interwikisource(value) ⇒ self
For interwiki imports: wiki to import from.
-
#namespace(value) ⇒ self
Import to this namespace.
-
#rootpage(value) ⇒ self
Import as subpage of this page.
-
#summary(value) ⇒ self
Log entry import summary.
-
#tags(*values) ⇒ self
Change tags to apply to the entry in the import log and to the null revision on the imported pages.
-
#templates ⇒ self
For interwiki imports: import all included templates as well.
-
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens.
-
#xml(value) ⇒ self
Uploaded XML file.
Methods inherited from Post
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
#fullhistory ⇒ self
For interwiki imports: import the full history, not just the current version.
62 63 64 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 62 def fullhistory() merge(fullhistory: 'true') end |
#interwikipage(value) ⇒ self
For interwiki imports: page to import.
55 56 57 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 55 def interwikipage(value) merge(interwikipage: value.to_s) end |
#interwikisource(value) ⇒ self
For interwiki imports: wiki to import from.
42 43 44 |
# 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) ⇒ self
Import to this namespace. Cannot be used together with rootpage.
77 78 79 |
# 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) ⇒ self
Import as subpage of this page. Cannot be used together with namespace.
90 91 92 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 90 def rootpage(value) merge(rootpage: value.to_s) end |
#summary(value) ⇒ self
Log entry import summary.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 26 def summary(value) merge(summary: value.to_s) end |
#tags(*values) ⇒ self
Change tags to apply to the entry in the import log and to the null revision on the imported pages.
98 99 100 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 98 def (*values) values.inject(self) { |res, val| res.(val) or fail ArgumentError, "Unknown value for tags: #{val}" } end |
#templates ⇒ self
For interwiki imports: import all included templates as well.
69 70 71 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 69 def templates() merge(templates: 'true') end |
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens
111 112 113 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 111 def token(value) merge(token: value.to_s) end |
#xml(value) ⇒ self
Uploaded XML file.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/import.rb', line 34 def xml(value) merge(xml: value.to_s) end |