mediawiki-butt 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8287cc51bbd45b0b63fb8c16b5b86b74848b3e85
4
- data.tar.gz: 33b65213c477787cbfbf00ae5c834cf2d24705f0
3
+ metadata.gz: 213456f1170993110a675e00652fb5a4319797dd
4
+ data.tar.gz: f43f85a958898445e7690dadeb99b5d30cfd56df
5
5
  SHA512:
6
- metadata.gz: c14f1a0202eb3e5c4614fb1c43e59556162215162cdb1b22f570e00030254377f5cf3c61fbabbc2d4a75ffb38081f9f6e8674648262a1a2431c0834fb828df1e
7
- data.tar.gz: 5fb48bb4ef5ab53fa247581a05132e46e7de00a7a81a90a03c87d1024bdd52210fd159032b12659fe3002cb3dfa2980e329cc5f444047644158efffe093993c8
6
+ metadata.gz: 7911cdaa9abcd01d41f048e2b422e1cf55d1302e768286ffeb891b90e699774f8a94dd90e646fd216b7bcde61ddaa51c0e52d1bea02240eed01f8c0a98eb9a04
7
+ data.tar.gz: 4f740f7718b7de3934c8374463d37f1d2ebd1c21d969bcb0f321736093e7168c5f3bbf10b8ec93643a34bf340d544a3dd9811330274159942cc1050f6762321b
@@ -5,6 +5,8 @@ module MediaWiki
5
5
  # @param expiry [String] The expiry timestamp using a relative expiry time.
6
6
  # @param reason [String] The reason to show in the block log.
7
7
  # @param nocreate [Boolean] Whether to allow them to create an account.
8
+ # @see https://www.mediawiki.org/wiki/API:Block MediaWiki Block API Docs
9
+ # @since 0.5.0
8
10
  # @return [String] The error code.
9
11
  # @return [Int] The block ID.
10
12
  def block(user, expiry = '2 weeks', reason = nil, nocreate = true)
@@ -31,6 +33,8 @@ module MediaWiki
31
33
  # Unblocks the user.
32
34
  # @param user [String] The user to unblock.
33
35
  # @param reason [String] The reason to show in the block log.
36
+ # @see https://www.mediawiki.org/wiki/API:Block MediaWiki Block API Docs
37
+ # @since 0.5.0
34
38
  # @return [String] The error code.
35
39
  # @return [Int] The block ID.
36
40
  def unblock(user, reason = nil)
@@ -3,11 +3,26 @@ require_relative 'exceptions'
3
3
  module MediaWiki
4
4
  module Auth
5
5
  # Checks the login result for errors. Returns true if it is successful,
6
- # else false with an error raised.
6
+ # else false with an error raised.
7
7
  # @param result [String] The parsed version of the result.
8
8
  # @param secondtry [Boolean] Whether this login is the first or second try.
9
9
  # False for first, true for second.
10
- # @return [Boolean] true if successful. Does not return anything if not.
10
+ # @raise [NeedTokenMoreThanOnceError] When secondtry is true and the wiki
11
+ # still returns 'NeedToken'
12
+ # @raise [NoNameError] When the username is nil or undefined.
13
+ # @raise [IllegalUsernameError] When the username is illegal.
14
+ # @raise [UsernameNotExistsError] When the username does not exist.
15
+ # @raise [EmptyPassError] When the password is nil or undefined.
16
+ # @raise [WrongPassError] When the password is incorrect.
17
+ # @raise [WrongPluginPassError] When an authentication plugin, not
18
+ # MediaWiki, claims that the password is incorrect.
19
+ # @raise [CreateBlockedError] When the wiki tries to automatically create
20
+ # an account, but the user's IP address is already blocked.
21
+ # @raise [ThrottledError] When the user has logged in, or tried to, too
22
+ # much in a particular amount of time.
23
+ # @raise [BlockedError] When the user is blocked from the wiki.
24
+ # @since 0.1.0
25
+ # @return [Boolean] true if successful. Does not return anything otherwise.
11
26
  def check_login(result, secondtry)
12
27
  case result
13
28
  when 'Success'
@@ -37,8 +52,29 @@ module MediaWiki
37
52
  end
38
53
 
39
54
  # Checks the account creation result's error and raises the corresponding
40
- # exception.
55
+ # exception.
41
56
  # @param error [String] The parsed error code string
57
+ # @raise [NoNameError] When the username was either not provided or is
58
+ # invalid.
59
+ # @raise [UserExistsError] When the username is already in use.
60
+ # @raise [UserPassMatchError] When the username and password are identical.
61
+ # @raise [PasswordLoginForbiddenError] When the use of the username and
62
+ # password has been forbidden.
63
+ # @raise [NoEmailTitleError] When there is no provided email address.
64
+ # @raise [InvalidEmailAddressError] When the email address has an invalid
65
+ # format.
66
+ # @raise [PasswordTooShortError] When the password is shorter than the
67
+ # $wgMinimumPasswordLength option.
68
+ # @raise [NoEmailError] When there is no email address set for the user.
69
+ # @raise [ThrottledError] When the user has created too many accounts in one
70
+ # day.
71
+ # @raise [AbortedError] When an extension has aborted this action.
72
+ # @raise [BlockedError] When the IP or logged in user is blocked.
73
+ # @raise [PermDeniedError] When the user does not have the right to create
74
+ # accounts.
75
+ # @raise [HookAbortedError] Same as AbortedError.
76
+ # @since 0.1.1
77
+ # @return [void]
42
78
  def check_create(error)
43
79
  case error
44
80
  when 'noname'
@@ -74,6 +110,9 @@ module MediaWiki
74
110
  # getting restricted data. Will return the result of #check_login
75
111
  # @param username [String] The username
76
112
  # @param password [String] The password
113
+ # @see check_login
114
+ # @see https://www.mediawiki.org/wiki/API:Login MediaWiki Login API Docs
115
+ # @since 0.1.0
77
116
  # @return [Boolean] True if the login was successful, false if not.
78
117
  def login(username, password)
79
118
  params = {
@@ -106,6 +145,8 @@ module MediaWiki
106
145
  end
107
146
 
108
147
  # Logs the current user out.
148
+ # @see https://www.mediawiki.org/wiki/API:Logout MediaWiki Logout API Docs
149
+ # @since 0.1.0
109
150
  # @return [Boolean] True if it was able to log anyone out, false if not
110
151
  # (basically, if someone was logged in, it returns true).
111
152
  def logout
@@ -131,6 +172,10 @@ module MediaWiki
131
172
  # the name.
132
173
  # @param reason [String] The reason for creating the account, as shown in
133
174
  # the account creation log. Optional.
175
+ # @see check_create
176
+ # @see https://www.mediawiki.org/wiki/API:Account_creation MediaWiki Account
177
+ # Creation Docs
178
+ # @since 0.1.0
134
179
  # @return [Boolean] True if successful, false if not.
135
180
  def create_account(username, password, language = 'en', *reason)
136
181
  params = {
@@ -179,6 +224,10 @@ module MediaWiki
179
224
  # the name.
180
225
  # @param reason [String] The reason for creating the account, as shown in
181
226
  # the account creation log. Optional.
227
+ # @see check_create
228
+ # @see https://www.mediawiki.org/wiki/API:Account_creation MediaWiki Account
229
+ # Creation Docs
230
+ # @since 0.1.0
182
231
  # @return [Boolean] True if successful, false if not.
183
232
  def create_account_email(username, email, language = 'en', *reason)
184
233
  params = {
@@ -20,11 +20,12 @@ module MediaWiki
20
20
  include MediaWiki::Administration
21
21
 
22
22
  # Creates a new instance of MediaWiki::Butt. To work with any
23
- # MediaWiki::Butt methods, you must first create an instance of it.
23
+ # MediaWiki::Butt methods, you must first create an instance of it.
24
24
  # @param url [String] The FULL wiki URL. api.php can be omitted, but it
25
25
  # will make harsh assumptions about your wiki configuration.
26
26
  # @param use_ssl [Boolean] Whether or not to use SSL. Will default to true.
27
27
  # @param custom_agent [String] A custom User-Agent to use. Optional.
28
+ # @since 0.1.0
28
29
  def initialize(url, use_ssl = true, custom_agent = nil)
29
30
  @url = url =~ /api.php$/ ? url : "#{url}/api.php"
30
31
  @client = HTTPClient.new
@@ -36,24 +37,17 @@ module MediaWiki
36
37
  end
37
38
 
38
39
  # Performs a generic HTTP POST action and provides the response. This
39
- # method generally should not be used by the user, unless there is not a
40
- # method provided by the Butt developers for a particular action.
40
+ # method generally should not be used by the user, unless there is not a
41
+ # method provided by the Butt developers for a particular action.
41
42
  # @param params [Hash] A basic hash containing MediaWiki API parameters.
42
43
  # Please see the MediaWiki API for more information.
43
44
  # @param autoparse [Boolean] Whether or not to provide a parsed version
44
45
  # of the response's JSON. Will default to true.
45
46
  # @param header [Hash] The header hash. Optional.
47
+ # @since 0.1.0
46
48
  # @return [JSON/HTTPMessage] Parsed JSON if autoparse is true.
47
49
  # @return [HTTPMessage] Raw HTTP response.
48
50
  def post(params, autoparse = true, header = nil)
49
- # Note that defining the header argument as a splat argument (*header)
50
- # causes errors in HTTPClient. We must use header.nil? rather than a
51
- # splat argument and defined? header due to this error. For those
52
- # interested, the error is:
53
- # undefined method `downcase' for {"Set-Cookie"=>"cookie"}:Hash
54
- # This is obvisouly an error in HTTPClient, but we must work around it
55
- # until there is a fix in the gem.
56
-
57
51
  params[:format] = 'json'
58
52
  header = {} if header.nil?
59
53
 
@@ -69,13 +63,14 @@ module MediaWiki
69
63
  end
70
64
  end
71
65
 
72
- # Returns true if the currently logged in user is in the "bot" group.
73
- # This can be helpful to some developers, but it is mostly for use
74
- # internally in MediaWiki::Butt.
66
+ # Gets whether the currently logged in user is a bot.
75
67
  # @param username [String] The username to check. Optional. Defaults to
76
68
  # the currently logged in user if nil.
77
69
  # @return [Boolean] true if logged in as a bot, false if not logged in or
78
70
  # logged in as a non-bot
71
+ # @since 0.1.0 as is_current_user_bot
72
+ # @since 0.3.0 as is_user_bot?
73
+ # @since 0.4.1 as user_bot?
79
74
  def user_bot?(username = nil)
80
75
  groups = false
81
76
 
@@ -1,6 +1,10 @@
1
1
  module MediaWiki
2
2
  module Constants
3
- # Taken from https://www.mediawiki.org/wiki/Extension_default_namespaces
3
+ # @since 0.2.0 as a module with individual global constants
4
+ # @since 0.4.0 as a module with a single global hash identical to this.
5
+ # @since 0.8.0 as its current state.
6
+ # @see https://www.mediawiki.org/wiki/Extension_default_namespaces
7
+ # MediaWiki's list of extension namespace IDs and names.
4
8
  NAMESPACES = {
5
9
  'MAIN' => 0,
6
10
  'TALK' => 1,
@@ -1,7 +1,6 @@
1
1
  module MediaWiki
2
2
  module Edit
3
- # Performs a standard edit.
4
- # It cannot create pages. Please use create_page for that.
3
+ # Performs a standard non-creation edit.
5
4
  # @param title [String] The page title.
6
5
  # @param text [String] The new content.
7
6
  # @param minor [Boolean] Will mark the edit as minor if true.
@@ -9,6 +8,10 @@ module MediaWiki
9
8
  # @param bot [Boolean] Will mark the edit as bot edit if true.
10
9
  # Defualts to true, for your convenience, bot developers.
11
10
  # @param summary [String] The edit summary. Optional.
11
+ # @see https://www.mediawiki.org/wiki/API:Changing_wiki_content Changing
12
+ # wiki content on the MediaWiki API documentation
13
+ # @see https://www.mediawiki.org/wiki/API:Edit MediaWiki Edit API Docs
14
+ # @since 0.2.0
12
15
  # @return [String] The new revision ID, or if it failed, the error code.
13
16
  def edit(title, text, minor = false, bot = true, *summary)
14
17
  params = {
@@ -41,6 +44,10 @@ module MediaWiki
41
44
  # @param summary [String] The edit summary. Defaults to 'New page'.
42
45
  # @param bot [Boolean] Will mark the edit as a bot edit if true.
43
46
  # Defaults to true, for your convenience, bot developers.
47
+ # @see https://www.mediawiki.org/wiki/API:Changing_wiki_content Changing
48
+ # wiki content on the MediaWiki API documentation
49
+ # @see https://www.mediawiki.org/wiki/API:Edit MediaWiki Edit API Docs
50
+ # @since 0.3.0
44
51
  # @return [String] The new page ID, or if it failed, the error code.
45
52
  def create_page(title, text, summary = 'New page', bot = true)
46
53
  params = {
@@ -74,6 +81,10 @@ module MediaWiki
74
81
  # the last slash in the URL.
75
82
  # @return [Boolean] True if the upload was successful, false if the
76
83
  # file extension is not valid.
84
+ # @see https://www.mediawiki.org/wiki/API:Changing_wiki_content Changing
85
+ # wiki content on the MediaWiki API documentation
86
+ # @see https://www.mediawiki.org/wiki/API:Upload MediaWiki Upload API Docs
87
+ # @since 0.3.0
77
88
  # @return [String] The warning's key if it was unsuccessful.
78
89
  def upload(url, filename = nil)
79
90
  params = {
@@ -115,6 +126,10 @@ module MediaWiki
115
126
  # @param talk [Boolean] Whether to move the associated talk page.
116
127
  # Defaults to true.
117
128
  # @param redirect [Boolean] Whether to create a redirect. Defaults to false.
129
+ # @see https://www.mediawiki.org/wiki/API:Changing_wiki_content Changing
130
+ # wiki content on the MediaWiki API documentation
131
+ # @see https://www.mediawiki.org/wiki/API:Move MediaWiki Move API Docs
132
+ # @since 0.5.0
118
133
  # @return [Boolean] True if it was successful.
119
134
  # @return [String] The error code if it was unsuccessful.
120
135
  def move(from, to, reason = nil, talk = true, redirect = false)
@@ -141,6 +156,10 @@ module MediaWiki
141
156
  # Deletes a page.
142
157
  # @param title [String] The page to delete.
143
158
  # @param reason [String] The reason to be displayed in logs. Optional.
159
+ # @see https://www.mediawiki.org/wiki/API:Changing_wiki_content Changing
160
+ # wiki content on the MediaWiki API documentation
161
+ # @see https://www.mediawiki.org/wiki/API:Delete MediaWiki Delete API Docs
162
+ # @since 0.5.0
144
163
  # @return [Boolean] True if successful.
145
164
  # @return [String] The error code if it was not successful.
146
165
  def delete(title, reason = nil)
@@ -9,6 +9,9 @@ module MediaWiki
9
9
  # @param limit [Int] The maximum number of pages to get. Defaults to 500,
10
10
  # and cannot be greater than that unless the user is a bot. If the user
11
11
  # is a bot, the limit cannot be greater than 5000.
12
+ # @see https://www.mediawiki.org/wiki/API:Backlinks MediaWiki Backlinks
13
+ # API Docs
14
+ # @since 0.1.0
12
15
  # @return [Array] All backlinks until the limit
13
16
  def what_links_here(title, limit = 500)
14
17
  params = {
@@ -32,6 +35,9 @@ module MediaWiki
32
35
  # @param limit [Int] The maximum number of members to get. Defaults to
33
36
  # 500, and cannot be greater than that unless the user is a bot.
34
37
  # If the user is a bot, the limit cannot be greater than 5000.
38
+ # @see https://www.mediawiki.org/wiki/API:Categorymembers MediaWiki
39
+ # Category Members API Docs
40
+ # @since 0.1.0
35
41
  # @return [Array] All category members until the limit
36
42
  def get_category_members(category, limit = 500)
37
43
  params = {
@@ -59,6 +65,8 @@ module MediaWiki
59
65
  # or 20 for bots.
60
66
  # @param namespace [Int] The namespace ID. Defaults to
61
67
  # 0 (the main namespace).
68
+ # @see https://www.mediawiki.org/wiki/API:Random MediaWiki Random API Docs
69
+ # @since 0.2.0
62
70
  # @return [Array] All members
63
71
  def get_random_pages(number_of_pages = 1, namespace = 0)
64
72
  params = {
@@ -67,7 +75,7 @@ module MediaWiki
67
75
  rnlimit: get_limited(number_of_pages, 10, 20)
68
76
  }
69
77
 
70
- if @namespaces.value?(namespace)
78
+ if MediaWiki::Constants::NAMESPACES.value?(namespace)
71
79
  params[:rnnamespace] = namespace
72
80
  else
73
81
  params[:rnnamespace] = 0
@@ -81,10 +89,13 @@ module MediaWiki
81
89
  end
82
90
 
83
91
  # Gets user information. This method should rarely be used by
84
- # normal users.
92
+ # normal users, unless they want a huge amount of user data at once.
85
93
  # @param prop [String] The usprop parameter.
86
94
  # @param username [String] The username to get info for. Optional.
87
95
  # Defaults to the currently logged in user if ommitted.
96
+ # @see https://www.mediawiki.org/wiki/API:Users MediaWiki User Lists API
97
+ # Docs
98
+ # @since 0.3.0
88
99
  # @return [String] Parsed full response if successful.
89
100
  # @return [Nil] If the username is nil and the Butt is not logged in.
90
101
  def get_userlists(prop, username = nil)
@@ -111,6 +122,8 @@ module MediaWiki
111
122
  # Gets an array of all the user's groups.
112
123
  # @param username [String] The username to get groups of. Optional.
113
124
  # Defaults to the currently logged in user.
125
+ # @see get_userlists
126
+ # @since 0.3.0
114
127
  # @return [Array] All of the user's groups.
115
128
  # @return [Boolean] False if username is nil and not logged in.
116
129
  def get_usergroups(username = nil)
@@ -135,6 +148,8 @@ module MediaWiki
135
148
  # Gets the user rights for the user.
136
149
  # @param username [String] The user to get the rights for. Optional.
137
150
  # Defaults to the currently logged in user.
151
+ # @see get_userlists
152
+ # @since 0.3.0
138
153
  # @return [Array] All of the user's groups.
139
154
  # @return [Boolean] False if username is nil and not logged in.
140
155
  def get_userrights(username = nil)
@@ -161,6 +176,8 @@ module MediaWiki
161
176
  # Gets contribution count for the user.
162
177
  # @param username [String] The username to get the contribution count of.
163
178
  # Optional. Defaults to the currently logged in user.
179
+ # @see get_userlists
180
+ # @since 0.3.0
164
181
  # @return [Boolean] False if username is nil and not logged in.
165
182
  # @return [Int] The number of contributions the user has made.
166
183
  def get_contrib_count(username = nil)
@@ -183,6 +200,8 @@ module MediaWiki
183
200
  # Gets when the user registered.
184
201
  # @param username [String] The username to get the registration date and
185
202
  # time of. Optional. Defaults to the currently logged in user.
203
+ # @see get_userlists
204
+ # @since 0.4.0
186
205
  # @return [DateTime] The registration date and time as a DateTime object.
187
206
  def get_registration_time(username = nil)
188
207
  time = nil
@@ -211,6 +230,8 @@ module MediaWiki
211
230
 
212
231
  # Gets the gender for the provded user.
213
232
  # @param username [String] The user.
233
+ # @see get_userlists
234
+ # @since 0.4.0
214
235
  # @return [String] The gender. 'male', 'female', or 'unknown'.
215
236
  def get_user_gender(username)
216
237
  gender = nil
@@ -224,6 +245,8 @@ module MediaWiki
224
245
  # @param search_value [String] The thing to search for.
225
246
  # @param namespace [Int] The namespace to search in.
226
247
  # Defaults to 0 (the main namespace).
248
+ # @see https://www.mediawiki.org/wiki/API:Search MediaWiki Search API Docs
249
+ # @since 0.4.0
227
250
  # @return [Int] The number of pages that matched the search.
228
251
  def get_search_result_amount(search_value, namespace = 0)
229
252
  params = {
@@ -246,6 +269,8 @@ module MediaWiki
246
269
  # @param search_value [String] The thing to search for.
247
270
  # @param namespace [Int] The namespace to search in.
248
271
  # Defaults to 0 (the main namespace).
272
+ # @see https://www.mediawiki.org/wiki/API:Search MediaWiki Search API Docs
273
+ # @since 0.4.0
249
274
  # @return [Array] The page titles that matched the search.
250
275
  def get_search_results(search_value, namespace = 0)
251
276
  params = {
@@ -271,6 +296,9 @@ module MediaWiki
271
296
  # Gets all categories on the entire wiki.
272
297
  # @param limit [Int] The maximum number of categories to get. Defaults to
273
298
  # 500. Cannot be greater than 500 for normal users, or 5000 for bots.
299
+ # @see https://www.mediawiki.org/wiki/API:Allcategories MediaWiki
300
+ # Allcategories API Docs
301
+ # @since 0.7.0
274
302
  # @return [Array] An array of all categories.
275
303
  def get_all_categories(limit = 500)
276
304
  params = {
@@ -290,6 +318,9 @@ module MediaWiki
290
318
  # Gets all the images on the wiki.
291
319
  # @param limit [Int] The maximum number of images to get. Defaults to 500.
292
320
  # Cannot be greater than 500 for normal users, or 5000 for bots.
321
+ # @see https://www.mediawiki.org/wiki/API:Allimages MediaWiki Allimages
322
+ # API Docs
323
+ # @since 0.7.0
293
324
  # @return [Array] An array of all images.
294
325
  def get_all_images(limit = 500)
295
326
  params = {
@@ -309,6 +340,9 @@ module MediaWiki
309
340
  # Gets all pages within a namespace integer.
310
341
  # @param namespace [Int] The namespace ID.
311
342
  # @param limit [Int] See #get_all_images
343
+ # @see https://www.mediawiki.org/wiki/API:Allpages MediaWiki Allpages
344
+ # API Docs
345
+ # @since 0.8.0
312
346
  # @return [Array] An array of all page titles.
313
347
  def get_all_pages_in_namespace(namespace, limit = 500)
314
348
  params = {
@@ -329,6 +363,9 @@ module MediaWiki
329
363
  # Gets all users, or all users in a group.
330
364
  # @param group [String] The group to limit this query to.
331
365
  # @param limit [Int] See #get_all_images.
366
+ # @see https://www.mediawiki.org/wiki/API:Allusers MediaWiki Allusers
367
+ # API Docs
368
+ # @since 0.8.0
332
369
  # @return [Hash] A hash of all users, names are keys, IDs are values.
333
370
  def get_all_users(group = nil, limit = 500)
334
371
  params = {
@@ -349,6 +386,8 @@ module MediaWiki
349
386
  # Gets all block IDs on the wiki. It seems like this only gets non-IP
350
387
  # blocks, but the MediaWiki docs are a bit unclear.
351
388
  # @param limit [Int] See #get_all_images.
389
+ # @see https://www.mediawiki.org/wiki/API:Blocks MediaWiki Blocks API Docs
390
+ # @since 0.8.0
352
391
  # @return [Array] All block IDs as strings.
353
392
  def get_all_blocks(limit = 500)
354
393
  params = {
@@ -369,6 +408,9 @@ module MediaWiki
369
408
  # Gets all page titles that transclude a given page.
370
409
  # @param page [String] The page name.
371
410
  # @param limit [Int] See #get_all_images.
411
+ # @see https://www.mediawiki.org/wiki/API:Embeddedin MediaWiki Embeddedin
412
+ # API Docs
413
+ # @since 0.8.0
372
414
  # @return [Array] All transcluder page titles.
373
415
  def get_all_transcluders(page, limit = 500)
374
416
  params = {
@@ -388,6 +430,9 @@ module MediaWiki
388
430
 
389
431
  # Gets an array of all deleted or archived files on the wiki.
390
432
  # @param limit [Int] See #get_all_images
433
+ # @see https://www.mediawiki.org/wiki/API:Filearchive MediaWiki
434
+ # Filearchive API Docs
435
+ # @since 0.8.0
391
436
  # @return [Array] All deleted file names. These are not titles, so they do
392
437
  # not include "File:".
393
438
  def get_all_deleted_files(limit = 500)
@@ -408,6 +453,9 @@ module MediaWiki
408
453
  # Gets a list of all protected pages, by protection level if provided.
409
454
  # @param protection_level [String] The protection level, e.g., sysop
410
455
  # @param limit [Int] See #get_all_images.
456
+ # @see https://www.mediawiki.org/wiki/API:Protectedtitles MediaWiki
457
+ # Protectedtitles API Docs
458
+ # @since 0.8.0
411
459
  # @return [Array] All protected page titles.
412
460
  def get_all_protected_titles(protection_level = nil, limit = 500)
413
461
  params = {
@@ -428,6 +476,9 @@ module MediaWiki
428
476
  # Gets the latest contributions by the user until the limit.
429
477
  # @param user [String] The username.
430
478
  # @param limit [Int] See #get_all_images.
479
+ # @see https://www.mediawiki.org/wiki/API:Usercontribs MediaWiki
480
+ # User Contributions API Docs
481
+ # @since 0.8.0
431
482
  # @return [Hash] Each contribution by its revid, containing the title,
432
483
  # summary, total contribution size, and the size change relative to the
433
484
  # previous edit.
@@ -459,6 +510,9 @@ module MediaWiki
459
510
  # currently logged in user, according to the MediaWiki API.
460
511
  # @param user [String] The username.
461
512
  # @param limit [Int] See #get_all_images.
513
+ # @see https://www.mediawiki.org/wiki/API:Watchlist MediaWiki Watchlist
514
+ # API Docs
515
+ # @since 0.8.0
462
516
  # @return [Array] All the watchlist page titles.
463
517
  def get_full_watchlist(user = nil, limit = 500)
464
518
  params = {
@@ -1,9 +1,12 @@
1
1
  module MediaWiki
2
2
  module Query
3
3
  module Meta
4
+ # @see https://www.mediawiki.org/wiki/API:Filerepoinfo MediaWiki
5
+ # Filerepoinfo API Docs
4
6
  module FileRepoInfo
5
7
  # Gets FileRepoInfo for the property.
6
8
  # @param prop [String] The friprop to get.
9
+ # @since 0.7.0
7
10
  # @return [Response] The full parsed response.
8
11
  def get_filerepoinfo(prop)
9
12
  params = {
@@ -16,6 +19,7 @@ module MediaWiki
16
19
  end
17
20
 
18
21
  # Returns an array of all the wiki's file repository names.
22
+ # @since 0.1.0
19
23
  # @return [Array] All wiki's file repository names.
20
24
  def get_filerepo_names
21
25
  response = get_filerepoinfo('name|displayname')
@@ -25,6 +29,7 @@ module MediaWiki
25
29
  end
26
30
 
27
31
  # Gets the root URLs for the file repositories.
32
+ # @since 0.7.0
28
33
  # @return [Hash] A hash containing keys of the names, and values of the
29
34
  # root URLs.
30
35
  def get_filerepo_rooturls
@@ -35,6 +40,7 @@ module MediaWiki
35
40
  end
36
41
 
37
42
  # Gets an array containing all local repositories.
43
+ # @since 0.7.0
38
44
  # @return [Array] All repositories that are marked as local.
39
45
  def get_local_filerepos
40
46
  response = get_filerepoinfo('name|local')
@@ -47,6 +53,7 @@ module MediaWiki
47
53
  end
48
54
 
49
55
  # Gets an array containing all repositories that aren't local.
56
+ # @since 0.7.0
50
57
  # @return [Array] All repositories that are not marked as local.
51
58
  def get_nonlocal_filerepos
52
59
  response = get_filerepoinfo('name|local')
@@ -59,6 +66,7 @@ module MediaWiki
59
66
  end
60
67
 
61
68
  # Gets the repository names and their according URLs.
69
+ # @since 0.7.0
62
70
  # @return [Hash] Names as the keys, with their URLs as the values.
63
71
  def get_filerepo_urls
64
72
  response = get_filerepoinfo('name|url')
@@ -68,6 +76,7 @@ module MediaWiki
68
76
  end
69
77
 
70
78
  # Gets the repository names and their accoring thumbnail URLs.
79
+ # @since 0.7.0
71
80
  # @return [Hash] Names as the keys, with their URLs as the values.
72
81
  def get_filerepo_thumburls
73
82
  response = get_filerepoinfo('name|thumbUrl')
@@ -77,6 +86,7 @@ module MediaWiki
77
86
  end
78
87
 
79
88
  # Gets the repository names and their according favicon URLs.
89
+ # @since 0.7.0
80
90
  # @return [Hash] Names as the keys, with their favicons as the values.
81
91
  def get_filerepo_favicons
82
92
  response = get_filerepoinfo('name|favicon')
@@ -1,10 +1,13 @@
1
1
  module MediaWiki
2
2
  module Query
3
3
  module Meta
4
+ # @see https://www.mediawiki.org/wiki/API:Siteinfo MediaWiki Siteinfo
5
+ # API Docs
4
6
  module SiteInfo
5
7
  # Gets wiki information. This method should rarely be used by
6
8
  # normal users.
7
9
  # @param prop [String] The siprop parameter.
10
+ # @since 0.6.0
8
11
  # @return [Response] Parsed full response.
9
12
  def get_siteinfo(prop)
10
13
  params = {
@@ -17,6 +20,7 @@ module MediaWiki
17
20
  end
18
21
 
19
22
  # Gets the statistics for the wiki.
23
+ # @since 0.6.0
20
24
  # @return [Hash] The statistics and their according values.
21
25
  def get_statistics
22
26
  response = get_siteinfo('statistics')
@@ -26,6 +30,7 @@ module MediaWiki
26
30
  end
27
31
 
28
32
  # Gets the general information for the wiki.
33
+ # @since 0.6.0
29
34
  # @return [Hash] The general info and their according values.
30
35
  def get_general
31
36
  response = get_siteinfo('general')
@@ -35,6 +40,7 @@ module MediaWiki
35
40
  end
36
41
 
37
42
  # Gets all extensions installed on the wiki.
43
+ # @since 0.6.0
38
44
  # @return [Array] All extension names.
39
45
  def get_extensions
40
46
  response = get_siteinfo('extensions')
@@ -44,6 +50,7 @@ module MediaWiki
44
50
  end
45
51
 
46
52
  # Gets all languages and their codes.
53
+ # @since 0.6.0
47
54
  # @return [Hash] All languages. Hash key value pair formatted as
48
55
  # code => name.
49
56
  def get_languages
@@ -55,6 +62,7 @@ module MediaWiki
55
62
 
56
63
  # Gets all namespaces on the wiki and their IDs. Different from the
57
64
  # Namespaces module.
65
+ # @since 0.6.0
58
66
  # @return [Hash] All namespaces, formatted as ID => Name.
59
67
  def get_namespaces
60
68
  response = get_siteinfo('namespaces')
@@ -68,6 +76,7 @@ module MediaWiki
68
76
  end
69
77
 
70
78
  # Gets all namespace aliases and their IDs.
79
+ # @since 0.6.0
71
80
  # @return [Hash] All aliases, formatted as ID => Alias.
72
81
  def get_namespace_aliases
73
82
  response = get_siteinfo('namespacealiases')
@@ -79,6 +88,7 @@ module MediaWiki
79
88
  end
80
89
 
81
90
  # Gets all special page aliases.
91
+ # @since 0.6.0
82
92
  # @return [Hash] All aliases, formatted as RealName => Alias.
83
93
  def get_special_page_aliases
84
94
  response = get_siteinfo('specialpagealiases')
@@ -90,6 +100,7 @@ module MediaWiki
90
100
  end
91
101
 
92
102
  # Gets all magic words and their aliases.
103
+ # @since 0.6.0
93
104
  # @return [Hash] All magic words, formatted as Name => Alias.
94
105
  def get_magic_words
95
106
  response = get_siteinfo('magicwords')
@@ -101,6 +112,7 @@ module MediaWiki
101
112
  end
102
113
 
103
114
  # Gets all user groups total.
115
+ # @since 0.6.0
104
116
  # @return [Hash] All groups, formatted as Name => [Rights].
105
117
  def get_all_usergroups
106
118
  response = get_siteinfo('usergroups')
@@ -112,6 +124,7 @@ module MediaWiki
112
124
  end
113
125
 
114
126
  # Gets all file extensions that are allowed to be uploaded.
127
+ # @since 0.6.0
115
128
  # @return [Array] All file extensions.
116
129
  def get_allowed_file_extensions
117
130
  response = get_siteinfo('fileextensions')
@@ -124,12 +137,14 @@ module MediaWiki
124
137
 
125
138
  # Gets the response for the restrictions siteinfo API. Not really for
126
139
  # use by users, mostly for the other two restriction methods.
140
+ # @since 0.6.0
127
141
  def get_restrictions_data
128
142
  response = get_siteinfo('restrictions')
129
143
  response['query']['restrictions']
130
144
  end
131
145
 
132
146
  # Gets all restriction/protection types.
147
+ # @since 0.6.0
133
148
  # @return [Array] All protection types.
134
149
  def get_restriction_types
135
150
  restrictions = get_restrictions_data
@@ -139,6 +154,7 @@ module MediaWiki
139
154
  end
140
155
 
141
156
  # Gets all restriction/protection levels.
157
+ # @since 0.6.0
142
158
  # @return [Array] All protection levels.
143
159
  def get_restriction_levels
144
160
  restrictions = get_restrictions_data
@@ -148,6 +164,7 @@ module MediaWiki
148
164
  end
149
165
 
150
166
  # Gets all skins and their codes.
167
+ # @since 0.6.0
151
168
  # @return [Hash] All skins, formatted as Code => Name
152
169
  def get_skins
153
170
  response = get_siteinfo('skins')
@@ -159,6 +176,7 @@ module MediaWiki
159
176
  end
160
177
 
161
178
  # Gets all HTML tags added by installed extensions.
179
+ # @since 0.6.0
162
180
  # @return [Array] All extension tags.
163
181
  def get_extension_tags
164
182
  response = get_siteinfo('extensiontags')
@@ -170,6 +188,7 @@ module MediaWiki
170
188
  end
171
189
 
172
190
  # Gets all function hooks.
191
+ # @since 0.6.0
173
192
  # @return [Array] All function hooks.
174
193
  def get_function_hooks
175
194
  response = get_siteinfo('functionhooks')
@@ -181,6 +200,7 @@ module MediaWiki
181
200
  end
182
201
 
183
202
  # Gets all variables that are usable on the wiki, such as NUMBEROFPAGES.
203
+ # @since 0.6.0
184
204
  # @return [Array] All variable string values.
185
205
  def get_variables
186
206
  response = get_siteinfo('variables')
@@ -1,9 +1,12 @@
1
1
  module MediaWiki
2
2
  module Query
3
3
  module Meta
4
+ # @see https://www.mediawiki.org/wiki/API:Userinfo MediaWiki Userinfo
5
+ # API Docs
4
6
  module UserInfo
5
7
  # Gets meta information for the currently logged in user.
6
8
  # @param prop [String] The uiprop to get. Optional.
9
+ # @since 0.4.0
7
10
  # @return [Response/Boolean] Either a full, parsed response.
8
11
  # @return [Boolean] False if not logged in.
9
12
  def get_current_user_meta(prop = nil)
@@ -21,6 +24,7 @@ module MediaWiki
21
24
  end
22
25
 
23
26
  # Gets the current user's username.
27
+ # @since 0.7.0
24
28
  # @return [String] Returns the username.
25
29
  # @return [Boolean] False if...
26
30
  def get_current_user_name
@@ -36,6 +40,7 @@ module MediaWiki
36
40
 
37
41
  # Returns whether or not the currently logged in user has any unread
38
42
  # messages on their talk page.
43
+ # @since 0.7.0
39
44
  # @return [Boolean] True if they have unreads, else false.
40
45
  def current_user_hasmsg?
41
46
  response = get_current_user_meta('hasmsg')
@@ -52,6 +57,7 @@ module MediaWiki
52
57
 
53
58
  # Gets a hash-of-arrays containing all the groups the user can add and
54
59
  # remove people from.
60
+ # @since 0.7.0
55
61
  # @return [Boolean] False if get_current_user_meta is false
56
62
  # @return [Hash] All the groups that the user can add, remove, add-self,
57
63
  # and remove-self.
@@ -79,6 +85,7 @@ module MediaWiki
79
85
  end
80
86
 
81
87
  # Gets the currently logged in user's real name.
88
+ # @since 0.7.0
82
89
  # @return [String] The user's real name.
83
90
  # @return [Nil] If they don't have a real name set.
84
91
  def get_realname
@@ -91,6 +98,7 @@ module MediaWiki
91
98
  end
92
99
 
93
100
  # Gets the currently logged in user's email address.
101
+ # @since 0.7.0
94
102
  # @return [String] The user's email address.
95
103
  # @return [Nil] If their email address is not set.
96
104
  def get_email_address
@@ -103,6 +111,7 @@ module MediaWiki
103
111
  end
104
112
 
105
113
  # Gets the user's options.
114
+ # @since 0.7.0
106
115
  # @return [Hash] The user's options.
107
116
  def get_current_user_options
108
117
  response = get_current_user_meta('options')
@@ -9,6 +9,9 @@ module MediaWiki
9
9
  # @param limit [Int] The maximum number of users to get. Defaults to 500
10
10
  # and cannot be greater than that unless the user is a bot. If the
11
11
  # user is a bot, the limit cannot be greater than 5000.
12
+ # @see get_anonymous_contributors_count
13
+ # @see get_logged_in_contributors
14
+ # @since 0.8.0
12
15
  # @return [Int] The number of contributors to that page.
13
16
  def get_total_contributors(title, limit = 500)
14
17
  anon_users = get_anonymous_contributors_count(title, limit)
@@ -20,6 +23,8 @@ module MediaWiki
20
23
  # Gets the non-anonymous contributors for the given page.
21
24
  # @param title [String] See #get_total_contributors
22
25
  # @param limit [Int] See #get_total_contributors
26
+ # @see get_contributors_response
27
+ # @since 0.8.0
23
28
  # @return [Array] All usernames for the contributors.
24
29
  def get_logged_in_contributors(title, limit = 500)
25
30
  response = get_contributors_response(title, limit)
@@ -42,6 +47,9 @@ module MediaWiki
42
47
  # Gets the parsed response for the contributors property.
43
48
  # @param title [String] See #get_total_contributors
44
49
  # @param limit [Int] See #get_total_contributors
50
+ # @see https://www.mediawiki.org/wiki/API:Contributors MediaWiki
51
+ # Contributors Property API Docs
52
+ # @since 0.8.0
45
53
  # @return [JSON] See #post
46
54
  def get_contributors_response(title, limit = 500)
47
55
  params = {
@@ -57,6 +65,8 @@ module MediaWiki
57
65
  # Gets the total number of anonymous contributors for the given page.
58
66
  # @param title [String] See #get_total_contributors
59
67
  # @param limit [Int] See #get_total_contributors
68
+ # @see get_contributors_response
69
+ # @since 0.8.0
60
70
  # @return [Int] The number of anonymous contributors for the page.
61
71
  def get_anonymous_contributors_count(title, limit = 500)
62
72
  response = get_contributors_response(title, limit)
@@ -7,6 +7,9 @@ module MediaWiki
7
7
  # Gets the duplicated files of the title.
8
8
  # @param title [String] The title to get duplicated files of.
9
9
  # @param limit [Int] The maximum number of files to get.
10
+ # @see https://www.mediawiki.org/wiki/API:Duplicatefiles MediaWiki
11
+ # Duplicate Files API Docs
12
+ # @since 0.8.0
10
13
  # @return [Array] Array of all the duplicated file names.
11
14
  # @return [Nil] If there aren't any duplicated files.
12
15
  def get_duplicated_files_of(title, limit = 500)
@@ -30,6 +33,9 @@ module MediaWiki
30
33
 
31
34
  # Gets all duplicated files on the wiki.
32
35
  # @param limit [Int] The maximum number of files to get.
36
+ # @see https://www.mediawiki.org/wiki/API:Duplicatefiles MediaWiki
37
+ # Duplicate Files API Docs
38
+ # @since 0.8.0
33
39
  # @return [Array] All duplicate file titles on the wiki.
34
40
  def get_all_duplicated_files(limit = 500)
35
41
  params = {
@@ -49,6 +55,8 @@ module MediaWiki
49
55
 
50
56
  # Gets the size of an image in bytes.
51
57
  # @param image [String] The image to get info for.
58
+ # @see get_image_sizes
59
+ # @since 0.8.0
52
60
  # @return [Fixnum] The number of bytes.
53
61
  # @return [Nil] If the image does not exist.
54
62
  def get_image_bytes(image)
@@ -59,6 +67,8 @@ module MediaWiki
59
67
 
60
68
  # Gets the dimensions of an image as width, height.
61
69
  # @param image [String] The image to get info for.
70
+ # @see get_image_sizes
71
+ # @since 0.8.0
62
72
  # @return [Array] The dimensions as width, height.
63
73
  # @return [Nil] If the image does not exist.
64
74
  def get_image_dimensions(image)
@@ -71,6 +81,9 @@ module MediaWiki
71
81
 
72
82
  # Gets the imageinfo property 'size' for the image.
73
83
  # @param image [String] The image to get info for.
84
+ # @see https://www.mediawiki.org/wiki/API:Imageinfo MediaWiki Imageinfo
85
+ # API Docs
86
+ # @since 0.8.0
74
87
  # @return [Hash] A hash of the size, width, and height.
75
88
  # @return [Nil] If the image does not exist.
76
89
  def get_image_sizes(image)
@@ -6,6 +6,9 @@ module MediaWiki
6
6
  module Pages
7
7
  # Gets all categories in the page.
8
8
  # @param title [String] The page title.
9
+ # @see https://www.mediawiki.org/wiki/API:Property/Categories
10
+ # MediaWiki Categories Property API Docs
11
+ # @since 0.8.0
9
12
  # @return [Array] All the categories
10
13
  # @return [Nil] If the title does not exist.
11
14
  def get_categories_in_page(title)
@@ -33,6 +36,9 @@ module MediaWiki
33
36
  # Gets the wiki text for the given page. Returns nil if it for some
34
37
  # reason cannot get the text, for example, if the page does not exist.
35
38
  # @param title [String] The page title
39
+ # @see https://www.mediawiki.org/wiki/API:Revisions MediaWiki Revisions
40
+ # API Docs
41
+ # @since 0.8.0
36
42
  # @return [String/nil] String containing page contents.
37
43
  # @return [Nil] If the page does not exist.
38
44
  def get_text(title)
@@ -56,6 +62,9 @@ module MediaWiki
56
62
 
57
63
  # Gets the revision ID for the given page.
58
64
  # @param title [String] The page title
65
+ # @see https://www.mediawiki.org/wiki/API:Revisions MediaWiki Revisions
66
+ # API Docs
67
+ # @since 0.8.0
59
68
  # @return [Int/nil] The page's ID
60
69
  # @return [Nil] If the page does not exist.
61
70
  def get_id(title)
@@ -81,6 +90,9 @@ module MediaWiki
81
90
  # @param limit [Int] The maximum number of members to get. Defaults to
82
91
  # 500, and cannot be greater than that unless the user is a bot.
83
92
  # If the user is a bot, the limit cannot be greater than 5000.
93
+ # @see https://www.mediawiki.org/wiki/API:Extlinks MediaWiki Extlinks
94
+ # API Docs
95
+ # @since 0.8.0
84
96
  # @return [Array] All external link URLs.
85
97
  def get_external_links(page, limit = 500)
86
98
  params = {
@@ -107,6 +119,8 @@ module MediaWiki
107
119
 
108
120
  # Gets whether the current user watches the page.
109
121
  # @param page [String] The page title.
122
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
123
+ # @since 0.8.0
110
124
  # @return [Boolean] Whether the user watches the page.
111
125
  # @return [Boolean] False if the user is not logged in.
112
126
  # @return [Nil] If the page does not exist.
@@ -134,6 +148,8 @@ module MediaWiki
134
148
 
135
149
  # Gets whether the current user (can be anonymous) can read the page.
136
150
  # @param page [String] The page title.
151
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
152
+ # @since 0.8.0
137
153
  # @return [Boolean] Whether the user can read the page.
138
154
  # @return [Nil] If the page does not exist.
139
155
  def can_i_read?(page)
@@ -156,6 +172,8 @@ module MediaWiki
156
172
 
157
173
  # Gets whether the given page is a redirect.
158
174
  # @param page [String] The page title.
175
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
176
+ # @since 0.8.0
159
177
  # @return [Boolean] Whether the page is a redirect.
160
178
  # @return [Nil] If the page does not exist.
161
179
  def page_redirect?(page)
@@ -177,6 +195,8 @@ module MediaWiki
177
195
 
178
196
  # Gets whether the given page only has one edit.
179
197
  # @param page [String] The page title.
198
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
199
+ # @since 0.8.0
180
200
  # @return [Boolean] Whether the page only has one edit.
181
201
  # @return [Nil] If the page does not exist.
182
202
  def page_new?(page)
@@ -198,6 +218,8 @@ module MediaWiki
198
218
 
199
219
  # Gets the number of users that watch the given page.
200
220
  # @param page [String] The page title.
221
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
222
+ # @since 0.8.0
201
223
  # @return [Fixnum] The number of watchers.
202
224
  # @return [Nil] If the page does not exist.
203
225
  def get_number_of_watchers(page)
@@ -222,6 +244,8 @@ module MediaWiki
222
244
  # changes to its display, e.g., using a template to make the first
223
245
  # letter lowercase, in cases like iPhone.
224
246
  # @param page [String] The page title.
247
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
248
+ # @since 0.8.0
225
249
  # @return [String] The page's display title.
226
250
  # @return [Nil] If the page does not exist.
227
251
  def get_display_title(page)
@@ -250,6 +274,8 @@ module MediaWiki
250
274
  # that is needed to perform that type of edit, like 'sysop'. Expiry
251
275
  # refers to when the protection will expire, if never, it will be
252
276
  # 'infinity'.
277
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
278
+ # @since 0.8.0
253
279
  # @return [Nil] If the page does not exist.
254
280
  def get_protection_levels(page)
255
281
  params = {
@@ -275,6 +301,8 @@ module MediaWiki
275
301
 
276
302
  # Gets the size, in bytes, of the page.
277
303
  # @param page [String] The page title.
304
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
305
+ # @since 0.8.0
278
306
  # @return [Fixnum] The number of bytes.
279
307
  # @return [Nil] If the page does not exist.
280
308
  def get_page_size(page)
@@ -297,6 +325,9 @@ module MediaWiki
297
325
  # Gets all of the images in the given page.
298
326
  # @param page [String] The page title.
299
327
  # @param limit [Fixnum] See #get_external_links
328
+ # @see https://www.mediawiki.org/wiki/API:Images MediaWiki Images API
329
+ # Docs
330
+ # @since 0.8.0
300
331
  # @return [Array] All of the image titles in the page.
301
332
  # @return [Nil] If the page does not exist.
302
333
  def get_images_in_page(page, limit = 500)
@@ -325,6 +356,9 @@ module MediaWiki
325
356
  # Gets all of the templates in the given page.
326
357
  # @param page [String] The page title.
327
358
  # @param limit [Fixnum] See #get_external_links
359
+ # @see https://www.mediawiki.org/wiki/API:Templates MediaWiki Templates
360
+ # API Docs
361
+ # @since 0.8.0
328
362
  # @return [Array] All of the templte titles in the page.
329
363
  # @return [Nil] If the page does not exist.
330
364
  def get_templates_in_page(page, limit = 500)
@@ -353,6 +387,9 @@ module MediaWiki
353
387
  # Gets all of the interwiki links on the given page.
354
388
  # @param page [String] The page title.
355
389
  # @param limit [Fixnum] See #get_external_links.
390
+ # @see https://www.mediawiki.org/wiki/API:Iwlinks MediaWiki Interwiki
391
+ # Links API Docs
392
+ # @since 0.8.0
356
393
  # @return [Array] All interwiki link titles.
357
394
  # @return [Nil] If the page does not exist.
358
395
  def get_interwiki_links_in_page(page, limit = 500)
@@ -383,6 +420,9 @@ module MediaWiki
383
420
  # title. This method does not work with the Translate extension.
384
421
  # @param page [String] The page title.
385
422
  # @param limit [Fixnum] See #get_external_links
423
+ # @see https://www.mediawiki.org/wiki/API:Langlinks MediaWiki Langlinks
424
+ # API Docs
425
+ # @since 0.8.0
386
426
  # @return [Hash] The data described previously.
387
427
  # @return [Nil] If the page does not exist.
388
428
  def get_other_langs_of_page(page, limit = 500)
@@ -417,6 +457,8 @@ module MediaWiki
417
457
  # Gets every single link in a page.
418
458
  # @param page [String] The page title.
419
459
  # @param limit [Fixnum] See #get_external_links.
460
+ # @see https://www.mediawiki.org/wiki/API:Links MediaWiki Links API Docs
461
+ # @since 0.8.0
420
462
  # @return [Array] All link titles.
421
463
  # @return [Nil] If the page does not exist.
422
464
  def get_all_links_in_page(page, limit = 500)
@@ -13,6 +13,8 @@ module MediaWiki
13
13
  # used by normal users.
14
14
  # @param type [String] The type of token.
15
15
  # @param title [String] The page title for the token. Optional.
16
+ # @see https://www.mediawiki.org/wiki/API:Info MediaWiki Info API Docs
17
+ # @since 0.5.0
16
18
  # @return [String] The token. If the butt isn't logged in, it returns
17
19
  # with '+\\'.
18
20
  def get_token(type, title = nil)
@@ -11,10 +11,11 @@ module MediaWiki
11
11
  protected
12
12
 
13
13
  # Gets the limited version of the integer, to ensure nobody provides an int
14
- # that is too large.
14
+ # that is too large.
15
15
  # @param integer [Int] The number to limit.
16
16
  # @param max_user [Int] The maximum limit for normal users.
17
17
  # @param max_bot [Int] The maximum limit for bot users.
18
+ # @since 0.8.0
18
19
  # @return [Int] The capped number.
19
20
  def get_limited(integer, max_user = 500, max_bot = 5000)
20
21
  if integer > max_user
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediawiki-butt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eli Foster
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-07 00:00:00.000000000 Z
12
+ date: 2015-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient