Module: MediaWiktory::Wikipedia::Modules::GAllimages

Defined in:
lib/mediawiktory/wikipedia/modules/g-allimages.rb

Overview

Enumerate all images sequentially. Generator module: for fetching pages corresponding to request.

The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):

api.query             # returns Actions::Query
   .prop(:revisions)  # adds prop=revisions to action URL, and includes Modules::Revisions into action
   .limit(10)         # method of Modules::Revisions, adds rvlimit=10 to URL

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

Instance Method Summary collapse

Instance Method Details

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


67
68
69
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 67

def continue(value)
  merge(gaicontinue: value.to_s)
end

#dir(value) ⇒ self

The direction in which to list.

Parameters:

  • value (String)

    One of "ascending", "descending", "newer", "older".

Returns:

  • (self)


38
39
40
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 38

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

#end(value) ⇒ self

The timestamp to end enumerating. Can only be used with aisort=timestamp.

Parameters:

  • value (Time)

Returns:

  • (self)


83
84
85
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 83

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

#filterbots(value) ⇒ self

How to filter files uploaded by bots. Can only be used with aisort=timestamp. Cannot be used together with aiuser.

Parameters:

  • value (String)

    One of "all", "bots", "nobots".

Returns:

  • (self)


139
140
141
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 139

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

#from(value) ⇒ self

The image title to start enumerating from. Can only be used with aisort=name.

Parameters:

  • value (String)

Returns:

  • (self)


51
52
53
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 51

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

#limit(value) ⇒ self

How many images in total to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


165
166
167
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 165

def limit(value)
  merge(gailimit: value.to_s)
end

#maxsize(value) ⇒ self

Limit to images with at most this many bytes.

Parameters:

  • value (Integer)

Returns:

  • (self)


107
108
109
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 107

def maxsize(value)
  merge(gaimaxsize: value.to_s)
end

#mime(*values) ⇒ self

Disabled due to miser mode.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


152
153
154
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 152

def mime(*values)
  values.inject(self) { |res, val| res._mime(val) }
end

#minsize(value) ⇒ self

Limit to images with at least this many bytes.

Parameters:

  • value (Integer)

Returns:

  • (self)


99
100
101
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 99

def minsize(value)
  merge(gaiminsize: value.to_s)
end

#prefix(value) ⇒ self

Search for all image titles that begin with this value. Can only be used with aisort=name.

Parameters:

  • value (String)

Returns:

  • (self)


91
92
93
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 91

def prefix(value)
  merge(gaiprefix: value.to_s)
end

#sha1(value) ⇒ self

SHA1 hash of image. Overrides aisha1base36.

Parameters:

  • value (String)

Returns:

  • (self)


115
116
117
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 115

def sha1(value)
  merge(gaisha1: value.to_s)
end

#sha1base36(value) ⇒ self

SHA1 hash of image in base 36 (used in MediaWiki).

Parameters:

  • value (String)

Returns:

  • (self)


123
124
125
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 123

def sha1base36(value)
  merge(gaisha1base36: value.to_s)
end

#sort(value) ⇒ self

Property to sort by.

Parameters:

  • value (String)

    One of "name", "timestamp".

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 25

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

#start(value) ⇒ self

The timestamp to start enumerating from. Can only be used with aisort=timestamp.

Parameters:

  • value (Time)

Returns:

  • (self)


75
76
77
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 75

def start(value)
  merge(gaistart: value.iso8601)
end

#to(value) ⇒ self

The image title to stop enumerating at. Can only be used with aisort=name.

Parameters:

  • value (String)

Returns:

  • (self)


59
60
61
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 59

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

#user(value) ⇒ self

Only return files uploaded by this user. Can only be used with aisort=timestamp. Cannot be used together with aifilterbots.

Parameters:

  • value (String)

Returns:

  • (self)


131
132
133
# File 'lib/mediawiktory/wikipedia/modules/g-allimages.rb', line 131

def user(value)
  merge(gaiuser: value.to_s)
end