Class: MediaWiktory::Wikipedia::Actions::Mobileview
- Defined in:
- lib/mediawiktory/wikipedia/actions/mobileview.rb
Overview
Returns data needed for mobile views.
Usage:
api.mobileview.page(value).perform # returns string with raw output
# or
api.mobileview.page(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
-
#maxlen(value) ⇒ self
Pretend all text result is one string, and limit result to this length.
-
#noheadings ⇒ self
Don't include headings in output.
-
#noimages ⇒ self
Return HTML without images.
-
#notransform ⇒ self
Don't transform HTML into mobile-specific version.
-
#offset(value) ⇒ self
Pretend all text result is one string, and return the substring starting at this point.
-
#onlyrequestedsections ⇒ self
Return only requested sections even with prop=sections.
-
#page(value) ⇒ self
Title of page to process.
-
#pageprops(value) ⇒ self
What page properties to return, a pipe ("|") separated list or "*" for all properties.
-
#prop(*values) ⇒ self
Which information to get:.
-
#redirect(value) ⇒ self
Whether redirects should be followed.
-
#revision(value) ⇒ self
Request a specific revision.
-
#sectionprop(*values) ⇒ self
What information about sections to get.
-
#sections(value) ⇒ self
Pipe-separated list of section numbers for which to return text.
-
#thumbheight(value) ⇒ self
Maximum thumbnail height.
-
#thumbsize(value) ⇒ self
Maximum thumbnail dimensions.
-
#thumbwidth(value) ⇒ self
Maximum thumbnail width.
-
#variant(value) ⇒ self
Convert content into this language variant.
Methods inherited from Get
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
#maxlen(value) ⇒ self
Pretend all text result is one string, and limit result to this length.
133 134 135 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 133 def maxlen(value) merge(maxlen: value.to_s) end |
#noheadings ⇒ self
Don't include headings in output.
103 104 105 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 103 def noheadings() merge(noheadings: 'true') end |
#noimages ⇒ self
Return HTML without images.
96 97 98 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 96 def noimages() merge(noimages: 'true') end |
#notransform ⇒ self
Don't transform HTML into mobile-specific version.
110 111 112 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 110 def notransform() merge(notransform: 'true') end |
#offset(value) ⇒ self
Pretend all text result is one string, and return the substring starting at this point.
125 126 127 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 125 def offset(value) merge(offset: value.to_s) end |
#onlyrequestedsections ⇒ self
Return only requested sections even with prop=sections.
117 118 119 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 117 def onlyrequestedsections() merge(onlyrequestedsections: 'true') end |
#page(value) ⇒ self
Title of page to process.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 26 def page(value) merge(page: value.to_s) end |
#pageprops(value) ⇒ self
What page properties to return, a pipe ("|") separated list or "*" for all properties.
81 82 83 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 81 def pageprops(value) merge(pageprops: value.to_s) end |
#prop(*values) ⇒ self
Which information to get:
55 56 57 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 55 def prop(*values) values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" } end |
#redirect(value) ⇒ self
Whether redirects should be followed.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 34 def redirect(value) _redirect(value) or fail ArgumentError, "Unknown value for redirect: #{value}" end |
#revision(value) ⇒ self
Request a specific revision.
141 142 143 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 141 def revision(value) merge(revision: value.to_s) end |
#sectionprop(*values) ⇒ self
What information about sections to get.
68 69 70 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 68 def sectionprop(*values) values.inject(self) { |res, val| res._sectionprop(val) or fail ArgumentError, "Unknown value for sectionprop: #{val}" } end |
#sections(value) ⇒ self
Pipe-separated list of section numbers for which to return text. "all" can be used to return for all. Ranges in format "1-4" mean get sections 1,2,3,4. Ranges without second number, e.g. "1-" means get all until the end. "references" can be used to specify that all sections containing references should be returned.
47 48 49 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 47 def sections(value) merge(sections: value.to_s) end |
#thumbheight(value) ⇒ self
Maximum thumbnail height.
149 150 151 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 149 def thumbheight(value) merge(thumbheight: value.to_s) end |
#thumbsize(value) ⇒ self
Maximum thumbnail dimensions.
165 166 167 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 165 def thumbsize(value) merge(thumbsize: value.to_s) end |
#thumbwidth(value) ⇒ self
Maximum thumbnail width.
157 158 159 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 157 def thumbwidth(value) merge(thumbwidth: value.to_s) end |
#variant(value) ⇒ self
Convert content into this language variant.
89 90 91 |
# File 'lib/mediawiktory/wikipedia/actions/mobileview.rb', line 89 def variant(value) merge(variant: value.to_s) end |