mediawiktory 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (558) hide show
  1. checksums.yaml +4 -4
  2. data/.dokaz +1 -0
  3. data/.rubocop_todo.yml +16 -0
  4. data/.yardopts +2 -0
  5. data/CHANGELOG.md +10 -4
  6. data/CONTRIBUTING.md +6 -9
  7. data/README.md +153 -72
  8. data/bin/mediawiktory-gen +35 -0
  9. data/lib/media_wiktory.rb +2 -0
  10. data/lib/mediawiktory.rb +13 -14
  11. data/lib/mediawiktory/generator.rb +107 -0
  12. data/lib/mediawiktory/generator/api.rb +75 -0
  13. data/lib/mediawiktory/generator/module.rb +105 -0
  14. data/lib/mediawiktory/generator/param.rb +271 -0
  15. data/lib/mediawiktory/generator/renderable.rb +59 -0
  16. data/lib/mediawiktory/generator/templates/_action_method.erb +20 -0
  17. data/lib/mediawiktory/generator/templates/_module_in_param_docs.erb +2 -0
  18. data/lib/mediawiktory/generator/templates/_param_impl_boolean.erb +1 -0
  19. data/lib/mediawiktory/generator/templates/_param_impl_enum.erb +1 -0
  20. data/lib/mediawiktory/generator/templates/_param_impl_enum_of_modules.erb +1 -0
  21. data/lib/mediawiktory/generator/templates/_param_impl_string.erb +1 -0
  22. data/lib/mediawiktory/generator/templates/_param_impl_timestamp.erb +1 -0
  23. data/lib/mediawiktory/generator/templates/_param_method.erb +14 -0
  24. data/lib/mediawiktory/generator/templates/action.rb.erb +204 -0
  25. data/lib/mediawiktory/generator/templates/action_class.rb.erb +30 -0
  26. data/lib/mediawiktory/generator/templates/actions.rb.erb +31 -0
  27. data/lib/mediawiktory/generator/templates/api.rb.erb +65 -0
  28. data/lib/mediawiktory/{client.rb → generator/templates/client.rb.erb} +24 -10
  29. data/lib/mediawiktory/generator/templates/module_class.rb.erb +22 -0
  30. data/lib/mediawiktory/generator/templates/response.rb.erb +122 -0
  31. data/lib/mediawiktory/version.rb +4 -2
  32. data/lib/mediawiktory/wikipedia/actions.rb +2296 -0
  33. data/lib/mediawiktory/wikipedia/actions/abusefiltercheckmatch.rb +55 -0
  34. data/lib/mediawiktory/wikipedia/actions/abusefilterchecksyntax.rb +31 -0
  35. data/lib/mediawiktory/wikipedia/actions/abusefilterevalexpression.rb +31 -0
  36. data/lib/mediawiktory/wikipedia/actions/abusefilterunblockautopromote.rb +39 -0
  37. data/lib/mediawiktory/wikipedia/actions/addstudents.rb +52 -0
  38. data/lib/mediawiktory/wikipedia/actions/antispoof.rb +31 -0
  39. data/lib/mediawiktory/wikipedia/actions/base.rb +351 -0
  40. data/lib/mediawiktory/wikipedia/actions/block.rb +132 -0
  41. data/lib/mediawiktory/wikipedia/actions/bouncehandler.rb +31 -0
  42. data/lib/mediawiktory/wikipedia/actions/categorytree.rb +39 -0
  43. data/lib/mediawiktory/wikipedia/actions/centralauthtoken.rb +25 -0
  44. data/lib/mediawiktory/wikipedia/actions/centralnoticechoicedata.rb +39 -0
  45. data/lib/mediawiktory/wikipedia/actions/centralnoticequerycampaign.rb +31 -0
  46. data/lib/mediawiktory/wikipedia/actions/changeauthenticationdata.rb +39 -0
  47. data/lib/mediawiktory/wikipedia/actions/checktoken.rb +52 -0
  48. data/lib/mediawiktory/wikipedia/actions/cirrus-config-dump.rb +25 -0
  49. data/lib/mediawiktory/wikipedia/actions/cirrus-mapping-dump.rb +25 -0
  50. data/lib/mediawiktory/wikipedia/actions/cirrus-settings-dump.rb +25 -0
  51. data/lib/mediawiktory/wikipedia/actions/clearhasmsg.rb +25 -0
  52. data/lib/mediawiktory/wikipedia/actions/clientlogin.rb +86 -0
  53. data/lib/mediawiktory/wikipedia/actions/compare.rb +71 -0
  54. data/lib/mediawiktory/wikipedia/actions/createaccount.rb +86 -0
  55. data/lib/mediawiktory/wikipedia/actions/cspreport.rb +38 -0
  56. data/lib/mediawiktory/wikipedia/actions/cxconfiguration.rb +39 -0
  57. data/lib/mediawiktory/wikipedia/actions/cxdelete.rb +55 -0
  58. data/lib/mediawiktory/wikipedia/actions/cxpublish.rb +95 -0
  59. data/lib/mediawiktory/wikipedia/actions/cxsave.rb +87 -0
  60. data/lib/mediawiktory/wikipedia/actions/cxsuggestionlist.rb +81 -0
  61. data/lib/mediawiktory/wikipedia/actions/cxtoken.rb +31 -0
  62. data/lib/mediawiktory/wikipedia/actions/delete.rb +103 -0
  63. data/lib/mediawiktory/wikipedia/actions/deleteeducation.rb +65 -0
  64. data/lib/mediawiktory/wikipedia/actions/deleteglobalaccount.rb +47 -0
  65. data/lib/mediawiktory/wikipedia/actions/echomarkread.rb +77 -0
  66. data/lib/mediawiktory/wikipedia/actions/echomarkseen.rb +57 -0
  67. data/lib/mediawiktory/wikipedia/actions/edit.rb +266 -0
  68. data/lib/mediawiktory/wikipedia/actions/editmassmessagelist.rb +65 -0
  69. data/lib/mediawiktory/wikipedia/actions/emailuser.rb +62 -0
  70. data/lib/mediawiktory/wikipedia/actions/enlist.rb +89 -0
  71. data/lib/mediawiktory/wikipedia/actions/expandtemplates.rb +129 -0
  72. data/lib/mediawiktory/wikipedia/actions/fancycaptchareload.rb +25 -0
  73. data/lib/mediawiktory/wikipedia/actions/featuredfeed.rb +57 -0
  74. data/lib/mediawiktory/wikipedia/actions/feedcontributions.rb +121 -0
  75. data/lib/mediawiktory/wikipedia/actions/feedrecentchanges.rb +159 -0
  76. data/lib/mediawiktory/wikipedia/actions/feedwatchlist.rb +108 -0
  77. data/lib/mediawiktory/wikipedia/actions/filerevert.rb +55 -0
  78. data/lib/mediawiktory/wikipedia/actions/flagconfig.rb +25 -0
  79. data/lib/mediawiktory/wikipedia/actions/globalblock.rb +76 -0
  80. data/lib/mediawiktory/wikipedia/actions/globaluserrights.rb +94 -0
  81. data/lib/mediawiktory/wikipedia/actions/graph.rb +47 -0
  82. data/lib/mediawiktory/wikipedia/actions/help.rb +64 -0
  83. data/lib/mediawiktory/wikipedia/actions/imagerotate.rb +25 -0
  84. data/lib/mediawiktory/wikipedia/actions/import.rb +116 -0
  85. data/lib/mediawiktory/wikipedia/actions/jsonconfig.rb +60 -0
  86. data/lib/mediawiktory/wikipedia/actions/jsondata.rb +31 -0
  87. data/lib/mediawiktory/wikipedia/actions/languagesearch.rb +39 -0
  88. data/lib/mediawiktory/wikipedia/actions/linkaccount.rb +79 -0
  89. data/lib/mediawiktory/wikipedia/actions/liststudents.rb +63 -0
  90. data/lib/mediawiktory/wikipedia/actions/login.rb +55 -0
  91. data/lib/mediawiktory/wikipedia/actions/logout.rb +25 -0
  92. data/lib/mediawiktory/wikipedia/actions/managetags.rb +80 -0
  93. data/lib/mediawiktory/wikipedia/actions/massmessage.rb +55 -0
  94. data/lib/mediawiktory/wikipedia/actions/mergehistory.rb +79 -0
  95. data/lib/mediawiktory/wikipedia/actions/mobileview.rb +170 -0
  96. data/lib/mediawiktory/wikipedia/actions/move.rb +131 -0
  97. data/lib/mediawiktory/wikipedia/actions/oathvalidate.rb +47 -0
  98. data/lib/mediawiktory/wikipedia/actions/opensearch.rb +105 -0
  99. data/lib/mediawiktory/wikipedia/actions/options.rb +80 -0
  100. data/lib/mediawiktory/wikipedia/actions/pagetriageaction.rb +67 -0
  101. data/lib/mediawiktory/wikipedia/actions/pagetriagelist.rb +142 -0
  102. data/lib/mediawiktory/wikipedia/actions/pagetriagestats.rb +59 -0
  103. data/lib/mediawiktory/wikipedia/actions/pagetriagetagging.rb +83 -0
  104. data/lib/mediawiktory/wikipedia/actions/pagetriagetemplate.rb +39 -0
  105. data/lib/mediawiktory/wikipedia/actions/paraminfo.rb +91 -0
  106. data/lib/mediawiktory/wikipedia/actions/parse.rb +286 -0
  107. data/lib/mediawiktory/wikipedia/actions/parsoid-batch.rb +31 -0
  108. data/lib/mediawiktory/wikipedia/actions/patrol.rb +60 -0
  109. data/lib/mediawiktory/wikipedia/actions/protect.rb +121 -0
  110. data/lib/mediawiktory/wikipedia/actions/purge.rb +155 -0
  111. data/lib/mediawiktory/wikipedia/actions/query.rb +325 -0
  112. data/lib/mediawiktory/wikipedia/actions/refresheducation.rb +57 -0
  113. data/lib/mediawiktory/wikipedia/actions/removeauthenticationdata.rb +39 -0
  114. data/lib/mediawiktory/wikipedia/actions/resetpassword.rb +47 -0
  115. data/lib/mediawiktory/wikipedia/actions/review.rb +54 -0
  116. data/lib/mediawiktory/wikipedia/actions/reviewactivity.rb +60 -0
  117. data/lib/mediawiktory/wikipedia/actions/revisiondelete.rb +125 -0
  118. data/lib/mediawiktory/wikipedia/actions/rollback.rb +96 -0
  119. data/lib/mediawiktory/wikipedia/actions/rsd.rb +25 -0
  120. data/lib/mediawiktory/wikipedia/actions/sanitize-mapdata.rb +39 -0
  121. data/lib/mediawiktory/wikipedia/actions/scribunto-console.rb +62 -0
  122. data/lib/mediawiktory/wikipedia/actions/setglobalaccountstatus.rb +81 -0
  123. data/lib/mediawiktory/wikipedia/actions/setnotificationtimestamp.rb +180 -0
  124. data/lib/mediawiktory/wikipedia/actions/setpagelanguage.rb +81 -0
  125. data/lib/mediawiktory/wikipedia/actions/shortenurl.rb +31 -0
  126. data/lib/mediawiktory/wikipedia/actions/sitematrix.rb +91 -0
  127. data/lib/mediawiktory/wikipedia/actions/spamblacklist.rb +36 -0
  128. data/lib/mediawiktory/wikipedia/actions/stabilize.rb +76 -0
  129. data/lib/mediawiktory/wikipedia/actions/stashedit.rb +113 -0
  130. data/lib/mediawiktory/wikipedia/actions/strikevote.rb +60 -0
  131. data/lib/mediawiktory/wikipedia/actions/tag.rb +117 -0
  132. data/lib/mediawiktory/wikipedia/actions/templatedata.rb +148 -0
  133. data/lib/mediawiktory/wikipedia/actions/thank.rb +47 -0
  134. data/lib/mediawiktory/wikipedia/actions/titleblacklist.rb +51 -0
  135. data/lib/mediawiktory/wikipedia/actions/tokens.rb +36 -0
  136. data/lib/mediawiktory/wikipedia/actions/transcodereset.rb +47 -0
  137. data/lib/mediawiktory/wikipedia/actions/ulslocalization.rb +31 -0
  138. data/lib/mediawiktory/wikipedia/actions/unblock.rb +76 -0
  139. data/lib/mediawiktory/wikipedia/actions/undelete.rb +99 -0
  140. data/lib/mediawiktory/wikipedia/actions/unlinkaccount.rb +39 -0
  141. data/lib/mediawiktory/wikipedia/actions/upload.rb +172 -0
  142. data/lib/mediawiktory/wikipedia/actions/userrights.rb +107 -0
  143. data/lib/mediawiktory/wikipedia/actions/validatepassword.rb +55 -0
  144. data/lib/mediawiktory/wikipedia/actions/visualeditor.rb +96 -0
  145. data/lib/mediawiktory/wikipedia/actions/visualeditoredit.rb +164 -0
  146. data/lib/mediawiktory/wikipedia/actions/watch.rb +164 -0
  147. data/lib/mediawiktory/wikipedia/actions/webapp-manifest.rb +25 -0
  148. data/lib/mediawiktory/wikipedia/actions/wikilove.rb +79 -0
  149. data/lib/mediawiktory/wikipedia/actions/zeroconfig.rb +44 -0
  150. data/lib/mediawiktory/wikipedia/api.rb +80 -0
  151. data/lib/mediawiktory/wikipedia/client.rb +61 -0
  152. data/lib/mediawiktory/wikipedia/modules/abusefilters.rb +85 -0
  153. data/lib/mediawiktory/wikipedia/modules/abuselog.rb +101 -0
  154. data/lib/mediawiktory/wikipedia/modules/allcategories.rb +104 -0
  155. data/lib/mediawiktory/wikipedia/modules/alldeletedrevisions.rb +213 -0
  156. data/lib/mediawiktory/wikipedia/modules/allfileusages.rb +95 -0
  157. data/lib/mediawiktory/wikipedia/modules/allimages.rb +183 -0
  158. data/lib/mediawiktory/wikipedia/modules/alllinks.rb +108 -0
  159. data/lib/mediawiktory/wikipedia/modules/allmessages.rb +143 -0
  160. data/lib/mediawiktory/wikipedia/modules/allpages.rb +182 -0
  161. data/lib/mediawiktory/wikipedia/modules/allredirects.rb +108 -0
  162. data/lib/mediawiktory/wikipedia/modules/allrevisions.rb +181 -0
  163. data/lib/mediawiktory/wikipedia/modules/alltransclusions.rb +108 -0
  164. data/lib/mediawiktory/wikipedia/modules/allusers.rb +141 -0
  165. data/lib/mediawiktory/wikipedia/modules/authmanagerinfo.rb +63 -0
  166. data/lib/mediawiktory/wikipedia/modules/babel.rb +30 -0
  167. data/lib/mediawiktory/wikipedia/modules/backlinks.rb +100 -0
  168. data/lib/mediawiktory/wikipedia/modules/betafeatures.rb +30 -0
  169. data/lib/mediawiktory/wikipedia/modules/blocks.rb +127 -0
  170. data/lib/mediawiktory/wikipedia/modules/categories.rb +90 -0
  171. data/lib/mediawiktory/wikipedia/modules/categoryinfo.rb +30 -0
  172. data/lib/mediawiktory/wikipedia/modules/categorymembers.rb +183 -0
  173. data/lib/mediawiktory/wikipedia/modules/centralnoticelogs.rb +70 -0
  174. data/lib/mediawiktory/wikipedia/modules/checkuser.rb +83 -0
  175. data/lib/mediawiktory/wikipedia/modules/checkuserlog.rb +83 -0
  176. data/lib/mediawiktory/wikipedia/modules/contenttranslation.rb +83 -0
  177. data/lib/mediawiktory/wikipedia/modules/contenttranslationcorpora.rb +50 -0
  178. data/lib/mediawiktory/wikipedia/modules/contenttranslationlangtrend.rb +51 -0
  179. data/lib/mediawiktory/wikipedia/modules/contenttranslationstats.rb +22 -0
  180. data/lib/mediawiktory/wikipedia/modules/contenttranslationsuggestions.rb +70 -0
  181. data/lib/mediawiktory/wikipedia/modules/contributors.rb +90 -0
  182. data/lib/mediawiktory/wikipedia/modules/coordinates.rb +80 -0
  183. data/lib/mediawiktory/wikipedia/modules/cxpublishedtranslations.rb +54 -0
  184. data/lib/mediawiktory/wikipedia/modules/cxtranslatorstats.rb +30 -0
  185. data/lib/mediawiktory/wikipedia/modules/deletedrevisions.rb +169 -0
  186. data/lib/mediawiktory/wikipedia/modules/deletedrevs.rb +148 -0
  187. data/lib/mediawiktory/wikipedia/modules/duplicatefiles.rb +58 -0
  188. data/lib/mediawiktory/wikipedia/modules/embeddedin.rb +93 -0
  189. data/lib/mediawiktory/wikipedia/modules/extlinks.rb +66 -0
  190. data/lib/mediawiktory/wikipedia/modules/extracts.rb +81 -0
  191. data/lib/mediawiktory/wikipedia/modules/exturlusage.rb +92 -0
  192. data/lib/mediawiktory/wikipedia/modules/featureusage.rb +59 -0
  193. data/lib/mediawiktory/wikipedia/modules/filearchive.rb +104 -0
  194. data/lib/mediawiktory/wikipedia/modules/filerepoinfo.rb +35 -0
  195. data/lib/mediawiktory/wikipedia/modules/fileusage.rb +77 -0
  196. data/lib/mediawiktory/wikipedia/modules/flagged.rb +22 -0
  197. data/lib/mediawiktory/wikipedia/modules/g-allcategories.rb +91 -0
  198. data/lib/mediawiktory/wikipedia/modules/g-alldeletedrevisions.rb +200 -0
  199. data/lib/mediawiktory/wikipedia/modules/g-allfileusages.rb +82 -0
  200. data/lib/mediawiktory/wikipedia/modules/g-allimages.rb +170 -0
  201. data/lib/mediawiktory/wikipedia/modules/g-alllinks.rb +95 -0
  202. data/lib/mediawiktory/wikipedia/modules/g-allpages.rb +182 -0
  203. data/lib/mediawiktory/wikipedia/modules/g-allredirects.rb +95 -0
  204. data/lib/mediawiktory/wikipedia/modules/g-allrevisions.rb +168 -0
  205. data/lib/mediawiktory/wikipedia/modules/g-alltransclusions.rb +95 -0
  206. data/lib/mediawiktory/wikipedia/modules/g-backlinks.rb +100 -0
  207. data/lib/mediawiktory/wikipedia/modules/g-categories.rb +77 -0
  208. data/lib/mediawiktory/wikipedia/modules/g-categorymembers.rb +170 -0
  209. data/lib/mediawiktory/wikipedia/modules/g-contenttranslation.rb +83 -0
  210. data/lib/mediawiktory/wikipedia/modules/g-contenttranslationsuggestions.rb +70 -0
  211. data/lib/mediawiktory/wikipedia/modules/g-deletedrevisions.rb +156 -0
  212. data/lib/mediawiktory/wikipedia/modules/g-duplicatefiles.rb +58 -0
  213. data/lib/mediawiktory/wikipedia/modules/g-embeddedin.rb +93 -0
  214. data/lib/mediawiktory/wikipedia/modules/g-exturlusage.rb +79 -0
  215. data/lib/mediawiktory/wikipedia/modules/g-fileusage.rb +64 -0
  216. data/lib/mediawiktory/wikipedia/modules/g-geosearch.rb +116 -0
  217. data/lib/mediawiktory/wikipedia/modules/g-gettingstartedgetpages.rb +46 -0
  218. data/lib/mediawiktory/wikipedia/modules/g-images.rb +64 -0
  219. data/lib/mediawiktory/wikipedia/modules/g-imageusage.rb +100 -0
  220. data/lib/mediawiktory/wikipedia/modules/g-iwbacklinks.rb +67 -0
  221. data/lib/mediawiktory/wikipedia/modules/g-langbacklinks.rb +67 -0
  222. data/lib/mediawiktory/wikipedia/modules/g-links.rb +77 -0
  223. data/lib/mediawiktory/wikipedia/modules/g-linkshere.rb +64 -0
  224. data/lib/mediawiktory/wikipedia/modules/g-mostviewed.rb +51 -0
  225. data/lib/mediawiktory/wikipedia/modules/g-oldreviewedpages.rb +114 -0
  226. data/lib/mediawiktory/wikipedia/modules/g-pageswithprop.rb +59 -0
  227. data/lib/mediawiktory/wikipedia/modules/g-prefixsearch.rb +72 -0
  228. data/lib/mediawiktory/wikipedia/modules/g-projectpages.rb +58 -0
  229. data/lib/mediawiktory/wikipedia/modules/g-protectedtitles.rb +93 -0
  230. data/lib/mediawiktory/wikipedia/modules/g-querypage.rb +51 -0
  231. data/lib/mediawiktory/wikipedia/modules/g-random.rb +71 -0
  232. data/lib/mediawiktory/wikipedia/modules/g-recentchanges.rb +157 -0
  233. data/lib/mediawiktory/wikipedia/modules/g-redirects.rb +64 -0
  234. data/lib/mediawiktory/wikipedia/modules/g-revisions.rb +185 -0
  235. data/lib/mediawiktory/wikipedia/modules/g-search.rb +112 -0
  236. data/lib/mediawiktory/wikipedia/modules/g-templates.rb +77 -0
  237. data/lib/mediawiktory/wikipedia/modules/g-transcludedin.rb +64 -0
  238. data/lib/mediawiktory/wikipedia/modules/g-watchlist.rb +145 -0
  239. data/lib/mediawiktory/wikipedia/modules/g-watchlistraw.rb +109 -0
  240. data/lib/mediawiktory/wikipedia/modules/g-wblistentityusage.rb +64 -0
  241. data/lib/mediawiktory/wikipedia/modules/gadgetcategories.rb +48 -0
  242. data/lib/mediawiktory/wikipedia/modules/gadgets.rb +75 -0
  243. data/lib/mediawiktory/wikipedia/modules/geosearch.rb +129 -0
  244. data/lib/mediawiktory/wikipedia/modules/gettingstartedgetpages.rb +46 -0
  245. data/lib/mediawiktory/wikipedia/modules/globalallusers.rb +106 -0
  246. data/lib/mediawiktory/wikipedia/modules/globalblocks.rb +106 -0
  247. data/lib/mediawiktory/wikipedia/modules/globalgroups.rb +35 -0
  248. data/lib/mediawiktory/wikipedia/modules/globalusage.rb +58 -0
  249. data/lib/mediawiktory/wikipedia/modules/globaluserinfo.rb +43 -0
  250. data/lib/mediawiktory/wikipedia/modules/imageinfo.rb +142 -0
  251. data/lib/mediawiktory/wikipedia/modules/images.rb +64 -0
  252. data/lib/mediawiktory/wikipedia/modules/imageusage.rb +100 -0
  253. data/lib/mediawiktory/wikipedia/modules/info.rb +69 -0
  254. data/lib/mediawiktory/wikipedia/modules/iwbacklinks.rb +80 -0
  255. data/lib/mediawiktory/wikipedia/modules/iwlinks.rb +87 -0
  256. data/lib/mediawiktory/wikipedia/modules/json.rb +57 -0
  257. data/lib/mediawiktory/wikipedia/modules/jsonfm.rb +64 -0
  258. data/lib/mediawiktory/wikipedia/modules/langbacklinks.rb +80 -0
  259. data/lib/mediawiktory/wikipedia/modules/langlinks.rb +95 -0
  260. data/lib/mediawiktory/wikipedia/modules/links.rb +77 -0
  261. data/lib/mediawiktory/wikipedia/modules/linkshere.rb +77 -0
  262. data/lib/mediawiktory/wikipedia/modules/logevents.rb +151 -0
  263. data/lib/mediawiktory/wikipedia/modules/mapdata.rb +46 -0
  264. data/lib/mediawiktory/wikipedia/modules/mmsites.rb +30 -0
  265. data/lib/mediawiktory/wikipedia/modules/mostviewed.rb +51 -0
  266. data/lib/mediawiktory/wikipedia/modules/mystashedfiles.rb +51 -0
  267. data/lib/mediawiktory/wikipedia/modules/none.rb +22 -0
  268. data/lib/mediawiktory/wikipedia/modules/notifications.rb +174 -0
  269. data/lib/mediawiktory/wikipedia/modules/oath.rb +30 -0
  270. data/lib/mediawiktory/wikipedia/modules/oldreviewedpages.rb +114 -0
  271. data/lib/mediawiktory/wikipedia/modules/ores.rb +22 -0
  272. data/lib/mediawiktory/wikipedia/modules/pageassessments.rb +45 -0
  273. data/lib/mediawiktory/wikipedia/modules/pageimages.rb +72 -0
  274. data/lib/mediawiktory/wikipedia/modules/pagepropnames.rb +38 -0
  275. data/lib/mediawiktory/wikipedia/modules/pageprops.rb +43 -0
  276. data/lib/mediawiktory/wikipedia/modules/pageswithprop.rb +72 -0
  277. data/lib/mediawiktory/wikipedia/modules/pageterms.rb +43 -0
  278. data/lib/mediawiktory/wikipedia/modules/pageviews.rb +51 -0
  279. data/lib/mediawiktory/wikipedia/modules/php.rb +35 -0
  280. data/lib/mediawiktory/wikipedia/modules/phpfm.rb +42 -0
  281. data/lib/mediawiktory/wikipedia/modules/prefixsearch.rb +72 -0
  282. data/lib/mediawiktory/wikipedia/modules/projectpages.rb +58 -0
  283. data/lib/mediawiktory/wikipedia/modules/projects.rb +29 -0
  284. data/lib/mediawiktory/wikipedia/modules/protectedtitles.rb +106 -0
  285. data/lib/mediawiktory/wikipedia/modules/querypage.rb +51 -0
  286. data/lib/mediawiktory/wikipedia/modules/random.rb +71 -0
  287. data/lib/mediawiktory/wikipedia/modules/rawfm.rb +29 -0
  288. data/lib/mediawiktory/wikipedia/modules/recentchanges.rb +170 -0
  289. data/lib/mediawiktory/wikipedia/modules/redirects.rb +77 -0
  290. data/lib/mediawiktory/wikipedia/modules/references.rb +30 -0
  291. data/lib/mediawiktory/wikipedia/modules/revisions.rb +198 -0
  292. data/lib/mediawiktory/wikipedia/modules/search.rb +125 -0
  293. data/lib/mediawiktory/wikipedia/modules/siteinfo.rb +70 -0
  294. data/lib/mediawiktory/wikipedia/modules/siteviews.rb +43 -0
  295. data/lib/mediawiktory/wikipedia/modules/stashimageinfo.rb +85 -0
  296. data/lib/mediawiktory/wikipedia/modules/tags.rb +51 -0
  297. data/lib/mediawiktory/wikipedia/modules/templates.rb +77 -0
  298. data/lib/mediawiktory/wikipedia/modules/tokens.rb +35 -0
  299. data/lib/mediawiktory/wikipedia/modules/transcludedin.rb +77 -0
  300. data/lib/mediawiktory/wikipedia/modules/transcodestatus.rb +22 -0
  301. data/lib/mediawiktory/wikipedia/modules/unreadnotificationpages.rb +50 -0
  302. data/lib/mediawiktory/wikipedia/modules/usercontribs.rb +155 -0
  303. data/lib/mediawiktory/wikipedia/modules/userinfo.rb +43 -0
  304. data/lib/mediawiktory/wikipedia/modules/users.rb +82 -0
  305. data/lib/mediawiktory/wikipedia/modules/videoinfo.rb +143 -0
  306. data/lib/mediawiktory/wikipedia/modules/watchlist.rb +158 -0
  307. data/lib/mediawiktory/wikipedia/modules/watchlistraw.rb +122 -0
  308. data/lib/mediawiktory/wikipedia/modules/wbentityusage.rb +77 -0
  309. data/lib/mediawiktory/wikipedia/modules/wblistentityusage.rb +77 -0
  310. data/lib/mediawiktory/wikipedia/modules/wikibase.rb +35 -0
  311. data/lib/mediawiktory/wikipedia/modules/wikisets.rb +58 -0
  312. data/lib/mediawiktory/wikipedia/modules/xml.rb +37 -0
  313. data/lib/mediawiktory/wikipedia/modules/xmlfm.rb +44 -0
  314. data/lib/mediawiktory/wikipedia/response.rb +122 -0
  315. data/lib/nokogiri/more.rb +12 -12
  316. data/mediawiktory.gemspec +4 -0
  317. metadata +350 -257
  318. data/bin/mediawiktory +0 -13
  319. data/doc/mediawiki_api_types.md +0 -14
  320. data/examples/query.rb +0 -15
  321. data/examples/query_generator.rb +0 -15
  322. data/lib/faraday/naive_cache.rb +0 -40
  323. data/lib/mediawiktory/action.rb +0 -61
  324. data/lib/mediawiktory/generated/abusefiltercheckmatch.rb +0 -9
  325. data/lib/mediawiktory/generated/abusefilterchecksyntax.rb +0 -6
  326. data/lib/mediawiktory/generated/abusefilterevalexpression.rb +0 -6
  327. data/lib/mediawiktory/generated/abusefilters.rb +0 -12
  328. data/lib/mediawiktory/generated/abusefilterunblockautopromote.rb +0 -8
  329. data/lib/mediawiktory/generated/abuselog.rb +0 -14
  330. data/lib/mediawiktory/generated/actions_mixin.rb +0 -352
  331. data/lib/mediawiktory/generated/addstudents.rb +0 -9
  332. data/lib/mediawiktory/generated/allcategories.rb +0 -15
  333. data/lib/mediawiktory/generated/alldeletedrevisions.rb +0 -28
  334. data/lib/mediawiktory/generated/allfileusages.rb +0 -14
  335. data/lib/mediawiktory/generated/allimages.rb +0 -23
  336. data/lib/mediawiktory/generated/alllinks.rb +0 -15
  337. data/lib/mediawiktory/generated/allmessages.rb +0 -19
  338. data/lib/mediawiktory/generated/allpages.rb +0 -21
  339. data/lib/mediawiktory/generated/allredirects.rb +0 -15
  340. data/lib/mediawiktory/generated/allrevisions.rb +0 -24
  341. data/lib/mediawiktory/generated/alltransclusions.rb +0 -15
  342. data/lib/mediawiktory/generated/allusers.rb +0 -18
  343. data/lib/mediawiktory/generated/antispoof.rb +0 -6
  344. data/lib/mediawiktory/generated/authmanagerinfo.rb +0 -10
  345. data/lib/mediawiktory/generated/babel.rb +0 -7
  346. data/lib/mediawiktory/generated/backlinks.rb +0 -14
  347. data/lib/mediawiktory/generated/betafeatures.rb +0 -7
  348. data/lib/mediawiktory/generated/block.rb +0 -20
  349. data/lib/mediawiktory/generated/blocks.rb +0 -16
  350. data/lib/mediawiktory/generated/bouncehandler.rb +0 -7
  351. data/lib/mediawiktory/generated/categories.rb +0 -12
  352. data/lib/mediawiktory/generated/categoryinfo.rb +0 -7
  353. data/lib/mediawiktory/generated/categorymembers.rb +0 -23
  354. data/lib/mediawiktory/generated/categorytree.rb +0 -7
  355. data/lib/mediawiktory/generated/centralauthtoken.rb +0 -5
  356. data/lib/mediawiktory/generated/centralnoticechoicedata.rb +0 -7
  357. data/lib/mediawiktory/generated/centralnoticelogs.rb +0 -11
  358. data/lib/mediawiktory/generated/centralnoticequerycampaign.rb +0 -6
  359. data/lib/mediawiktory/generated/changeauthenticationdata.rb +0 -10
  360. data/lib/mediawiktory/generated/checktoken.rb +0 -8
  361. data/lib/mediawiktory/generated/checkuser.rb +0 -14
  362. data/lib/mediawiktory/generated/checkuserlog.rb +0 -13
  363. data/lib/mediawiktory/generated/cirrus-config-dump.rb +0 -5
  364. data/lib/mediawiktory/generated/cirrus-mapping-dump.rb +0 -5
  365. data/lib/mediawiktory/generated/cirrus-settings-dump.rb +0 -5
  366. data/lib/mediawiktory/generated/clearhasmsg.rb +0 -6
  367. data/lib/mediawiktory/generated/clientlogin.rb +0 -15
  368. data/lib/mediawiktory/generated/compare.rb +0 -11
  369. data/lib/mediawiktory/generated/contenttranslation.rb +0 -12
  370. data/lib/mediawiktory/generated/contenttranslationcorpora.rb +0 -8
  371. data/lib/mediawiktory/generated/contenttranslationlangtrend.rb +0 -8
  372. data/lib/mediawiktory/generated/contenttranslationstats.rb +0 -5
  373. data/lib/mediawiktory/generated/contenttranslationsuggestions.rb +0 -11
  374. data/lib/mediawiktory/generated/contributors.rb +0 -12
  375. data/lib/mediawiktory/generated/coordinates.rb +0 -12
  376. data/lib/mediawiktory/generated/createaccount.rb +0 -15
  377. data/lib/mediawiktory/generated/cspreport.rb +0 -8
  378. data/lib/mediawiktory/generated/cxconfiguration.rb +0 -7
  379. data/lib/mediawiktory/generated/cxdelete.rb +0 -10
  380. data/lib/mediawiktory/generated/cxpublish.rb +0 -15
  381. data/lib/mediawiktory/generated/cxpublishedtranslations.rb +0 -9
  382. data/lib/mediawiktory/generated/cxsave.rb +0 -14
  383. data/lib/mediawiktory/generated/cxsuggestionlist.rb +0 -12
  384. data/lib/mediawiktory/generated/cxtoken.rb +0 -7
  385. data/lib/mediawiktory/generated/cxtranslatorstats.rb +0 -6
  386. data/lib/mediawiktory/generated/delete.rb +0 -15
  387. data/lib/mediawiktory/generated/deletedrevisions.rb +0 -23
  388. data/lib/mediawiktory/generated/deletedrevs.rb +0 -20
  389. data/lib/mediawiktory/generated/deleteeducation.rb +0 -10
  390. data/lib/mediawiktory/generated/deleteglobalaccount.rb +0 -9
  391. data/lib/mediawiktory/generated/duplicatefiles.rb +0 -10
  392. data/lib/mediawiktory/generated/echomarkread.rb +0 -11
  393. data/lib/mediawiktory/generated/echomarkseen.rb +0 -9
  394. data/lib/mediawiktory/generated/edit.rb +0 -35
  395. data/lib/mediawiktory/generated/editmassmessagelist.rb +0 -10
  396. data/lib/mediawiktory/generated/emailuser.rb +0 -11
  397. data/lib/mediawiktory/generated/embeddedin.rb +0 -13
  398. data/lib/mediawiktory/generated/enlist.rb +0 -13
  399. data/lib/mediawiktory/generated/expandtemplates.rb +0 -16
  400. data/lib/mediawiktory/generated/extlinks.rb +0 -11
  401. data/lib/mediawiktory/generated/extracts.rb +0 -13
  402. data/lib/mediawiktory/generated/exturlusage.rb +0 -13
  403. data/lib/mediawiktory/generated/fancycaptchareload.rb +0 -5
  404. data/lib/mediawiktory/generated/featuredfeed.rb +0 -8
  405. data/lib/mediawiktory/generated/featureusage.rb +0 -10
  406. data/lib/mediawiktory/generated/feedcontributions.rb +0 -16
  407. data/lib/mediawiktory/generated/feedrecentchanges.rb +0 -22
  408. data/lib/mediawiktory/generated/feedwatchlist.rb +0 -14
  409. data/lib/mediawiktory/generated/filearchive.rb +0 -15
  410. data/lib/mediawiktory/generated/filerepoinfo.rb +0 -7
  411. data/lib/mediawiktory/generated/filerevert.rb +0 -10
  412. data/lib/mediawiktory/generated/fileusage.rb +0 -11
  413. data/lib/mediawiktory/generated/flagconfig.rb +0 -5
  414. data/lib/mediawiktory/generated/flagged.rb +0 -5
  415. data/lib/mediawiktory/generated/gadgetcategories.rb +0 -8
  416. data/lib/mediawiktory/generated/gadgets.rb +0 -11
  417. data/lib/mediawiktory/generated/geosearch.rb +0 -17
  418. data/lib/mediawiktory/generated/gettingstartedgetpages.rb +0 -9
  419. data/lib/mediawiktory/generated/globalallusers.rb +0 -14
  420. data/lib/mediawiktory/generated/globalblock.rb +0 -13
  421. data/lib/mediawiktory/generated/globalblocks.rb +0 -14
  422. data/lib/mediawiktory/generated/globalgroups.rb +0 -7
  423. data/lib/mediawiktory/generated/globalusage.rb +0 -10
  424. data/lib/mediawiktory/generated/globaluserinfo.rb +0 -8
  425. data/lib/mediawiktory/generated/globaluserrights.rb +0 -13
  426. data/lib/mediawiktory/generated/graph.rb +0 -8
  427. data/lib/mediawiktory/generated/help.rb +0 -10
  428. data/lib/mediawiktory/generated/imageinfo.rb +0 -20
  429. data/lib/mediawiktory/generated/imagerotate.rb +0 -5
  430. data/lib/mediawiktory/generated/images.rb +0 -10
  431. data/lib/mediawiktory/generated/imageusage.rb +0 -14
  432. data/lib/mediawiktory/generated/import.rb +0 -16
  433. data/lib/mediawiktory/generated/info.rb +0 -10
  434. data/lib/mediawiktory/generated/iwbacklinks.rb +0 -12
  435. data/lib/mediawiktory/generated/iwlinks.rb +0 -13
  436. data/lib/mediawiktory/generated/jsonconfig.rb +0 -9
  437. data/lib/mediawiktory/generated/jsondata.rb +0 -6
  438. data/lib/mediawiktory/generated/langbacklinks.rb +0 -12
  439. data/lib/mediawiktory/generated/langlinks.rb +0 -14
  440. data/lib/mediawiktory/generated/languagesearch.rb +0 -7
  441. data/lib/mediawiktory/generated/linkaccount.rb +0 -14
  442. data/lib/mediawiktory/generated/links.rb +0 -11
  443. data/lib/mediawiktory/generated/linkshere.rb +0 -11
  444. data/lib/mediawiktory/generated/liststudents.rb +0 -9
  445. data/lib/mediawiktory/generated/logevents.rb +0 -19
  446. data/lib/mediawiktory/generated/login.rb +0 -11
  447. data/lib/mediawiktory/generated/logout.rb +0 -5
  448. data/lib/mediawiktory/generated/managetags.rb +0 -12
  449. data/lib/mediawiktory/generated/mapdata.rb +0 -9
  450. data/lib/mediawiktory/generated/massmessage.rb +0 -10
  451. data/lib/mediawiktory/generated/mergehistory.rb +0 -13
  452. data/lib/mediawiktory/generated/mmsites.rb +0 -6
  453. data/lib/mediawiktory/generated/mobileview.rb +0 -22
  454. data/lib/mediawiktory/generated/mostviewed.rb +0 -9
  455. data/lib/mediawiktory/generated/move.rb +0 -19
  456. data/lib/mediawiktory/generated/mystashedfiles.rb +0 -9
  457. data/lib/mediawiktory/generated/notifications.rb +0 -22
  458. data/lib/mediawiktory/generated/oath.rb +0 -7
  459. data/lib/mediawiktory/generated/oathvalidate.rb +0 -9
  460. data/lib/mediawiktory/generated/oldreviewedpages.rb +0 -15
  461. data/lib/mediawiktory/generated/opensearch.rb +0 -12
  462. data/lib/mediawiktory/generated/options.rb +0 -12
  463. data/lib/mediawiktory/generated/ores.rb +0 -6
  464. data/lib/mediawiktory/generated/pageassessments.rb +0 -9
  465. data/lib/mediawiktory/generated/pageimages.rb +0 -11
  466. data/lib/mediawiktory/generated/pagepropnames.rb +0 -8
  467. data/lib/mediawiktory/generated/pageprops.rb +0 -8
  468. data/lib/mediawiktory/generated/pageswithprop.rb +0 -11
  469. data/lib/mediawiktory/generated/pageterms.rb +0 -8
  470. data/lib/mediawiktory/generated/pagetriageaction.rb +0 -11
  471. data/lib/mediawiktory/generated/pagetriagelist.rb +0 -21
  472. data/lib/mediawiktory/generated/pagetriagestats.rb +0 -10
  473. data/lib/mediawiktory/generated/pagetriagetagging.rb +0 -13
  474. data/lib/mediawiktory/generated/pagetriagetemplate.rb +0 -7
  475. data/lib/mediawiktory/generated/pageviews.rb +0 -9
  476. data/lib/mediawiktory/generated/paraminfo.rb +0 -11
  477. data/lib/mediawiktory/generated/parse.rb +0 -36
  478. data/lib/mediawiktory/generated/parsoid-batch.rb +0 -6
  479. data/lib/mediawiktory/generated/patrol.rb +0 -10
  480. data/lib/mediawiktory/generated/prefixsearch.rb +0 -10
  481. data/lib/mediawiktory/generated/projectpages.rb +0 -10
  482. data/lib/mediawiktory/generated/projects.rb +0 -7
  483. data/lib/mediawiktory/generated/protect.rb +0 -16
  484. data/lib/mediawiktory/generated/protectedtitles.rb +0 -14
  485. data/lib/mediawiktory/generated/purge.rb +0 -15
  486. data/lib/mediawiktory/generated/query.rb +0 -20
  487. data/lib/mediawiktory/generated/querypage.rb +0 -9
  488. data/lib/mediawiktory/generated/random.rb +0 -11
  489. data/lib/mediawiktory/generated/recentchanges.rb +0 -21
  490. data/lib/mediawiktory/generated/redirects.rb +0 -11
  491. data/lib/mediawiktory/generated/references.rb +0 -7
  492. data/lib/mediawiktory/generated/refresheducation.rb +0 -9
  493. data/lib/mediawiktory/generated/removeauthenticationdata.rb +0 -8
  494. data/lib/mediawiktory/generated/resetpassword.rb +0 -9
  495. data/lib/mediawiktory/generated/review.rb +0 -10
  496. data/lib/mediawiktory/generated/reviewactivity.rb +0 -10
  497. data/lib/mediawiktory/generated/revisiondelete.rb +0 -15
  498. data/lib/mediawiktory/generated/revisions.rb +0 -26
  499. data/lib/mediawiktory/generated/rollback.rb +0 -14
  500. data/lib/mediawiktory/generated/rsd.rb +0 -5
  501. data/lib/mediawiktory/generated/sanitize-mapdata.rb +0 -8
  502. data/lib/mediawiktory/generated/scribunto-console.rb +0 -10
  503. data/lib/mediawiktory/generated/search.rb +0 -16
  504. data/lib/mediawiktory/generated/setglobalaccountstatus.rb +0 -12
  505. data/lib/mediawiktory/generated/setnotificationtimestamp.rb +0 -18
  506. data/lib/mediawiktory/generated/setpagelanguage.rb +0 -12
  507. data/lib/mediawiktory/generated/shortenurl.rb +0 -7
  508. data/lib/mediawiktory/generated/siteinfo.rb +0 -11
  509. data/lib/mediawiktory/generated/sitematrix.rb +0 -12
  510. data/lib/mediawiktory/generated/siteviews.rb +0 -8
  511. data/lib/mediawiktory/generated/spamblacklist.rb +0 -6
  512. data/lib/mediawiktory/generated/stabilize.rb +0 -12
  513. data/lib/mediawiktory/generated/stashedit.rb +0 -16
  514. data/lib/mediawiktory/generated/stashimageinfo.rb +0 -12
  515. data/lib/mediawiktory/generated/strikevote.rb +0 -10
  516. data/lib/mediawiktory/generated/tag.rb +0 -14
  517. data/lib/mediawiktory/generated/tags.rb +0 -9
  518. data/lib/mediawiktory/generated/templatedata.rb +0 -12
  519. data/lib/mediawiktory/generated/templates.rb +0 -11
  520. data/lib/mediawiktory/generated/thank.rb +0 -9
  521. data/lib/mediawiktory/generated/titleblacklist.rb +0 -9
  522. data/lib/mediawiktory/generated/tokens.rb +0 -6
  523. data/lib/mediawiktory/generated/transcludedin.rb +0 -11
  524. data/lib/mediawiktory/generated/transcodereset.rb +0 -9
  525. data/lib/mediawiktory/generated/transcodestatus.rb +0 -5
  526. data/lib/mediawiktory/generated/ulslocalization.rb +0 -6
  527. data/lib/mediawiktory/generated/unblock.rb +0 -12
  528. data/lib/mediawiktory/generated/undelete.rb +0 -13
  529. data/lib/mediawiktory/generated/unlinkaccount.rb +0 -8
  530. data/lib/mediawiktory/generated/unreadnotificationpages.rb +0 -9
  531. data/lib/mediawiktory/generated/upload.rb +0 -24
  532. data/lib/mediawiktory/generated/usercontribs.rb +0 -19
  533. data/lib/mediawiktory/generated/userinfo.rb +0 -8
  534. data/lib/mediawiktory/generated/userrights.rb +0 -13
  535. data/lib/mediawiktory/generated/users.rb +0 -11
  536. data/lib/mediawiktory/generated/validatepassword.rb +0 -10
  537. data/lib/mediawiktory/generated/videoinfo.rb +0 -20
  538. data/lib/mediawiktory/generated/visualeditor.rb +0 -13
  539. data/lib/mediawiktory/generated/visualeditoredit.rb +0 -23
  540. data/lib/mediawiktory/generated/watch.rb +0 -16
  541. data/lib/mediawiktory/generated/watchlist.rb +0 -20
  542. data/lib/mediawiktory/generated/watchlistraw.rb +0 -16
  543. data/lib/mediawiktory/generated/wbentityusage.rb +0 -11
  544. data/lib/mediawiktory/generated/wblistentityusage.rb +0 -11
  545. data/lib/mediawiktory/generated/webapp-manifest.rb +0 -5
  546. data/lib/mediawiktory/generated/wikibase.rb +0 -7
  547. data/lib/mediawiktory/generated/wikilove.rb +0 -13
  548. data/lib/mediawiktory/generated/wikisets.rb +0 -10
  549. data/lib/mediawiktory/generated/zeroconfig.rb +0 -7
  550. data/lib/mediawiktory/mw_module.rb +0 -324
  551. data/lib/mediawiktory/page.rb +0 -50
  552. data/lib/mediawiktory/query.rb +0 -58
  553. data/script/data/api.yaml +0 -40414
  554. data/script/lib/api.rb +0 -14
  555. data/script/lib/module.rb +0 -132
  556. data/script/lib/parameter.rb +0 -133
  557. data/script/parse_api.rb +0 -21
  558. data/test/cache.rb +0 -15
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './client'
4
+ require_relative './actions'
5
+
6
+ # Wrapper for [Wikipedia](https://en.wikipedia.org/wiki/Main_Page) API.
7
+ #
8
+ # _Generated from https://en.wikipedia.org/w/api.php at May 09, 2017 by MediaWiktory 0.1.0._
9
+ #
10
+ # It also can be used for access to any other MediaWiki site, but some of actions could be
11
+ # non-existent/outdated.
12
+ #
13
+ # See {MediaWiktory::Wikipedia::Api} for usage.
14
+ #
15
+ module MediaWiktory::Wikipedia
16
+ # Base API class for [Wikipedia](https://en.wikipedia.org/wiki/Main_Page).
17
+ #
18
+ # Example of usage:
19
+ #
20
+ # ```ruby
21
+ # # For Wikipedia
22
+ # api = MediaWiktory::Wikipedia::Api.new
23
+ # api.some_action.some_param(value).other_param(*more_values).perform
24
+ # # => returns raw response of MediaWiki API
25
+ # api.some_action.some_param(value).other_param(*more_values).response
26
+ # # => returns an instance of Response, parsed from JSON
27
+ #
28
+ # # For any other site:
29
+ # api = MediaWiktory::Wikipedia::Api.new('https://some.site/w/api.php')
30
+ # # ...the same as above
31
+ # ```
32
+ #
33
+ # {Actions} module lists all available API actions and refers to corresponding classes and
34
+ # their options.
35
+ #
36
+ # See also {Response} for working with return values and {Actions::Base} for working with actions.
37
+ #
38
+ class Api
39
+ # @private
40
+ attr_reader :client, :defaults
41
+
42
+ # @private
43
+ CLIENT_OPTIONS = %i[user_agent ua].freeze
44
+
45
+ # @param url [String] Source URL for this API, by default "".
46
+ # Note that most of MediaWiki installations have source URL at `/w/api.php`, but some are
47
+ # just `/api.php`, others use `/wiki/api.php` and so on.
48
+ #
49
+ # @param defaults [Hash] Default options for all API queries. Default param values also can be
50
+ # set by subsequent {Actions::Base} methods, like `api.some_action.json(callback: 'mycallbackname')...`
51
+ # @option defaults [Symbol] user_agent User-Agent header for underlying client.
52
+ # @option defaults [Symbol] format The format of the output. Selecting an option includes tweaking methods from corresponding module: See {Actions::Base#format}
53
+ # @option defaults [Integer] maxlag Maximum lag can be used when MediaWiki is installed on a database replicated cluster. To save actions causing any more site replication lag, this parameter can make the client wait until the replication lag is less than the specified value. In case of excessive lag, error code maxlag is returned with a message like Waiting for $host: $lag seconds lagged.See Manual: Maxlag parameter for more information. See {Actions::Base#maxlag}
54
+ # @option defaults [Integer] smaxage Set the s-maxage HTTP cache control header to this many seconds. Errors are never cached. See {Actions::Base#smaxage}
55
+ # @option defaults [Integer] maxage Set the max-age HTTP cache control header to this many seconds. Errors are never cached. See {Actions::Base#maxage}
56
+ # @option defaults [String] assert Verify the user is logged in if set to user, or has the bot user right if bot. One of "user", "bot". See {Actions::Base#assert}
57
+ # @option defaults [String] assertuser Verify the current user is the named user. See {Actions::Base#assertuser}
58
+ # @option defaults [String] requestid Any value given here will be included in the response. May be used to distinguish requests. See {Actions::Base#requestid}
59
+ # @option defaults [true, false] servedby Include the hostname that served the request in the results. See {Actions::Base#servedby}
60
+ # @option defaults [true, false] curtimestamp Include the current timestamp in the result. See {Actions::Base#curtimestamp}
61
+ # @option defaults [true, false] responselanginfo Include the languages used for uselang and errorlang in the result. See {Actions::Base#responselanginfo}
62
+ # @option defaults [String] origin When accessing the API using a cross-domain AJAX request (CORS), set this to the originating domain. This must be included in any pre-flight request, and therefore must be part of the request URI (not the POST body). See {Actions::Base#origin}
63
+ # @option defaults [String] uselang Language to use for message translations. action=query&meta=siteinfo with siprop=languages returns a list of language codes, or specify user to use the current user's language preference, or specify content to use this wiki's content language. See {Actions::Base#uselang}
64
+ # @option defaults [String] errorformat Format to use for warning and error text output. One of " plaintext" ( Wikitext with HTML tags removed and entities replaced), " wikitext" ( Unparsed wikitext), " html" ( HTML), " raw" ( Message key and parameters), " none" ( No text output, only the error codes), " bc" ( Format used prior to MediaWiki 1.29. errorlang and errorsuselocal are ignored). See {Actions::Base#errorformat}
65
+ # @option defaults [String] errorlang Language to use for warnings and errors. action=query&meta=siteinfo with siprop=languages returns a list of language codes, or specify content to use this wiki's content language, or specify uselang to use the same value as the uselang parameter. See {Actions::Base#errorlang}
66
+ # @option defaults [true, false] errorsuselocal If given, error texts will use locally-customized messages from the MediaWiki namespace. See {Actions::Base#errorsuselocal}
67
+ # @option defaults [String] centralauthtoken When accessing the API using a cross-domain AJAX request (CORS), use this to authenticate as the current SUL user. Use action=centralauthtoken on this wiki to retrieve the token, before making the CORS request. Each token may only be used once, and expires after 10 seconds. This should be included in any pre-flight request, and therefore should be included in the request URI (not the POST body). See {Actions::Base#centralauthtoken}
68
+ #
69
+ def initialize(url = 'https://en.wikipedia.org/w/api.php', **defaults)
70
+ client_options, @defaults = defaults.partition { |k, _| CLIENT_OPTIONS.include?(k) }.map(&:to_h)
71
+ @client = Client.new(url, **client_options)
72
+ end
73
+
74
+ def inspect
75
+ "#<#{self.class.name}(#{@client.url})>"
76
+ end
77
+
78
+ include MediaWiktory::Wikipedia::Actions
79
+ end
80
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable'
4
+ require 'faraday'
5
+ require 'faraday_middleware'
6
+
7
+ module MediaWiktory::Wikipedia
8
+ # Internal low-level client class, used by {Api}.
9
+ #
10
+ # Uses [Faraday](https://github.com/lostisland/faraday) library inside (and will expose it's settings
11
+ # in future).
12
+ #
13
+ # You should not use it directly, all you need is in {Api}.
14
+ class Client
15
+ # Default MediaWiktory User-Agent header.
16
+ #
17
+ # You can set yours as an option to {#initialize}
18
+ UA = 'MediaWiktory/0.1.0 '\
19
+ '(https://github.com/molybdenum-99/mediawiktory; zverok.offline@gmail.com)'
20
+
21
+ class << self
22
+ # User agent getter/setter.
23
+ #
24
+ # Default value is {UA}.
25
+ #
26
+ # You can also use per-instance option, see {#initialize}
27
+ attr_accessor :user_agent
28
+ end
29
+
30
+ attr_reader :url
31
+
32
+ def initialize(url, **options)
33
+ @url = Addressable::URI.parse(url)
34
+ @options = options
35
+ @faraday = Faraday.new(url) do |f|
36
+ f.request :url_encoded
37
+ f.use FaradayMiddleware::FollowRedirects, limit: 5
38
+ f.adapter Faraday.default_adapter
39
+ end
40
+ @faraday.headers.merge!(headers)
41
+ end
42
+
43
+ def user_agent
44
+ @options[:user_agent] || @options[:ua] || self.class.user_agent || UA
45
+ end
46
+
47
+ def get(params)
48
+ @faraday.get('', params).body
49
+ end
50
+
51
+ def post(params)
52
+ @faraday.post('', params).body
53
+ end
54
+
55
+ private
56
+
57
+ def headers
58
+ {'User-Agent' => user_agent}
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MediaWiktory::Wikipedia
4
+ module Modules
5
+ # Show details of the abuse filters.
6
+ #
7
+ # The "submodule" (MediaWiki API term) is included in action after setting some param, providing
8
+ # additional tweaking for this param. Example (for {MediaWiktory::Wikipedia::Actions::Query} and
9
+ # its submodules):
10
+ #
11
+ # ```ruby
12
+ # api.query # returns Actions::Query
13
+ # .prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
14
+ # .limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
15
+ # ```
16
+ #
17
+ # All submodule's parameters are documented as its public methods, see below.
18
+ #
19
+ module Abusefilters
20
+
21
+ # The filter ID to start enumerating from.
22
+ #
23
+ # @param value [Integer]
24
+ # @return [self]
25
+ def startid(value)
26
+ merge(abfstartid: value.to_s)
27
+ end
28
+
29
+ # The filter ID to stop enumerating at.
30
+ #
31
+ # @param value [Integer]
32
+ # @return [self]
33
+ def endid(value)
34
+ merge(abfendid: value.to_s)
35
+ end
36
+
37
+ # In which direction to enumerate:
38
+ #
39
+ # @param value [String] One of "newer" (List oldest first. Note: abfstart has to be before abfend), "older" (List newest first (default). Note: abfstart has to be later than abfend).
40
+ # @return [self]
41
+ def dir(value)
42
+ _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}"
43
+ end
44
+
45
+ # @private
46
+ def _dir(value)
47
+ defined?(super) && super || ["newer", "older"].include?(value.to_s) && merge(abfdir: value.to_s)
48
+ end
49
+
50
+ # Show only filters which meet these criteria.
51
+ #
52
+ # @param values [Array<String>] Allowed values: "enabled", "!enabled", "deleted", "!deleted", "private", "!private".
53
+ # @return [self]
54
+ def show(*values)
55
+ values.inject(self) { |res, val| res._show(val) or fail ArgumentError, "Unknown value for show: #{val}" }
56
+ end
57
+
58
+ # @private
59
+ def _show(value)
60
+ defined?(super) && super || ["enabled", "!enabled", "deleted", "!deleted", "private", "!private"].include?(value.to_s) && merge(abfshow: value.to_s, replace: false)
61
+ end
62
+
63
+ # The maximum number of filters to list.
64
+ #
65
+ # @param value [Integer, "max"]
66
+ # @return [self]
67
+ def limit(value)
68
+ merge(abflimit: value.to_s)
69
+ end
70
+
71
+ # Which properties to get.
72
+ #
73
+ # @param values [Array<String>] Allowed values: "id", "description", "pattern", "actions", "hits", "comments", "lasteditor", "lastedittime", "status", "private".
74
+ # @return [self]
75
+ def prop(*values)
76
+ values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
77
+ end
78
+
79
+ # @private
80
+ def _prop(value)
81
+ defined?(super) && super || ["id", "description", "pattern", "actions", "hits", "comments", "lasteditor", "lastedittime", "status", "private"].include?(value.to_s) && merge(abfprop: value.to_s, replace: false)
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MediaWiktory::Wikipedia
4
+ module Modules
5
+ # Show events that were caught by one of the abuse filters.
6
+ #
7
+ # The "submodule" (MediaWiki API term) is included in action after setting some param, providing
8
+ # additional tweaking for this param. Example (for {MediaWiktory::Wikipedia::Actions::Query} and
9
+ # its submodules):
10
+ #
11
+ # ```ruby
12
+ # api.query # returns Actions::Query
13
+ # .prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
14
+ # .limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
15
+ # ```
16
+ #
17
+ # All submodule's parameters are documented as its public methods, see below.
18
+ #
19
+ module Abuselog
20
+
21
+ # The timestamp to start enumerating from.
22
+ #
23
+ # @param value [Time]
24
+ # @return [self]
25
+ def start(value)
26
+ merge(aflstart: value.iso8601)
27
+ end
28
+
29
+ # The timestamp to stop enumerating at.
30
+ #
31
+ # @param value [Time]
32
+ # @return [self]
33
+ def end(value)
34
+ merge(aflend: value.iso8601)
35
+ end
36
+
37
+ # In which direction to enumerate:
38
+ #
39
+ # @param value [String] One of "newer" (List oldest first. Note: aflstart has to be before aflend), "older" (List newest first (default). Note: aflstart has to be later than aflend).
40
+ # @return [self]
41
+ def dir(value)
42
+ _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}"
43
+ end
44
+
45
+ # @private
46
+ def _dir(value)
47
+ defined?(super) && super || ["newer", "older"].include?(value.to_s) && merge(afldir: value.to_s)
48
+ end
49
+
50
+ # Show only entries done by a given user or IP address.
51
+ #
52
+ # @param value [String]
53
+ # @return [self]
54
+ def user(value)
55
+ merge(afluser: value.to_s)
56
+ end
57
+
58
+ # Show only entries occurring on a given page.
59
+ #
60
+ # @param value [String]
61
+ # @return [self]
62
+ def title(value)
63
+ merge(afltitle: value.to_s)
64
+ end
65
+
66
+ # Show only entries that were caught by a given filter ID.
67
+ #
68
+ # @param values [Array<String>]
69
+ # @return [self]
70
+ def filter(*values)
71
+ values.inject(self) { |res, val| res._filter(val) }
72
+ end
73
+
74
+ # @private
75
+ def _filter(value)
76
+ merge(aflfilter: value.to_s, replace: false)
77
+ end
78
+
79
+ # The maximum amount of entries to list.
80
+ #
81
+ # @param value [Integer, "max"]
82
+ # @return [self]
83
+ def limit(value)
84
+ merge(afllimit: value.to_s)
85
+ end
86
+
87
+ # Which properties to get.
88
+ #
89
+ # @param values [Array<String>] Allowed values: "ids", "filter", "user", "ip", "title", "action", "details", "result", "timestamp", "hidden", "revid".
90
+ # @return [self]
91
+ def prop(*values)
92
+ values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
93
+ end
94
+
95
+ # @private
96
+ def _prop(value)
97
+ defined?(super) && super || ["ids", "filter", "user", "ip", "title", "action", "details", "result", "timestamp", "hidden", "revid"].include?(value.to_s) && merge(aflprop: value.to_s, replace: false)
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MediaWiktory::Wikipedia
4
+ module Modules
5
+ # Enumerate all categories.
6
+ #
7
+ # The "submodule" (MediaWiki API term) is included in action after setting some param, providing
8
+ # additional tweaking for this param. Example (for {MediaWiktory::Wikipedia::Actions::Query} and
9
+ # its submodules):
10
+ #
11
+ # ```ruby
12
+ # api.query # returns Actions::Query
13
+ # .prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
14
+ # .limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
15
+ # ```
16
+ #
17
+ # All submodule's parameters are documented as its public methods, see below.
18
+ #
19
+ module Allcategories
20
+
21
+ # The category to start enumerating from.
22
+ #
23
+ # @param value [String]
24
+ # @return [self]
25
+ def from(value)
26
+ merge(acfrom: value.to_s)
27
+ end
28
+
29
+ # When more results are available, use this to continue.
30
+ #
31
+ # @param value [String]
32
+ # @return [self]
33
+ def continue(value)
34
+ merge(accontinue: value.to_s)
35
+ end
36
+
37
+ # The category to stop enumerating at.
38
+ #
39
+ # @param value [String]
40
+ # @return [self]
41
+ def to(value)
42
+ merge(acto: value.to_s)
43
+ end
44
+
45
+ # Search for all category titles that begin with this value.
46
+ #
47
+ # @param value [String]
48
+ # @return [self]
49
+ def prefix(value)
50
+ merge(acprefix: value.to_s)
51
+ end
52
+
53
+ # Direction to sort in.
54
+ #
55
+ # @param value [String] One of "ascending", "descending".
56
+ # @return [self]
57
+ def dir(value)
58
+ _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}"
59
+ end
60
+
61
+ # @private
62
+ def _dir(value)
63
+ defined?(super) && super || ["ascending", "descending"].include?(value.to_s) && merge(acdir: value.to_s)
64
+ end
65
+
66
+ # Only return categories with at least this many members.
67
+ #
68
+ # @param value [Integer]
69
+ # @return [self]
70
+ def min(value)
71
+ merge(acmin: value.to_s)
72
+ end
73
+
74
+ # Only return categories with at most this many members.
75
+ #
76
+ # @param value [Integer]
77
+ # @return [self]
78
+ def max(value)
79
+ merge(acmax: value.to_s)
80
+ end
81
+
82
+ # How many categories to return.
83
+ #
84
+ # @param value [Integer, "max"]
85
+ # @return [self]
86
+ def limit(value)
87
+ merge(aclimit: value.to_s)
88
+ end
89
+
90
+ # Which properties to get:
91
+ #
92
+ # @param values [Array<String>] Allowed values: "size" (Adds number of pages in the category), "hidden" (Tags categories that are hidden with __HIDDENCAT__).
93
+ # @return [self]
94
+ def prop(*values)
95
+ values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
96
+ end
97
+
98
+ # @private
99
+ def _prop(value)
100
+ defined?(super) && super || ["size", "hidden"].include?(value.to_s) && merge(acprop: value.to_s, replace: false)
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,213 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MediaWiktory::Wikipedia
4
+ module Modules
5
+ # List all deleted revisions by a user or in a namespace.
6
+ #
7
+ # The "submodule" (MediaWiki API term) is included in action after setting some param, providing
8
+ # additional tweaking for this param. Example (for {MediaWiktory::Wikipedia::Actions::Query} and
9
+ # its submodules):
10
+ #
11
+ # ```ruby
12
+ # api.query # returns Actions::Query
13
+ # .prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
14
+ # .limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
15
+ # ```
16
+ #
17
+ # All submodule's parameters are documented as its public methods, see below.
18
+ #
19
+ module Alldeletedrevisions
20
+
21
+ # Which properties to get for each revision:
22
+ #
23
+ # @param values [Array<String>] Allowed values: "ids" (The ID of the revision), "flags" (Revision flags (minor)), "timestamp" (The timestamp of the revision), "user" (User that made the revision), "userid" (User ID of the revision creator), "size" (Length (bytes) of the revision), "sha1" (SHA-1 (base 16) of the revision), "contentmodel" (Content model ID of the revision), "comment" (Comment by the user for the revision), "parsedcomment" (Parsed comment by the user for the revision), "content" (Text of the revision), "tags" (Tags for the revision), "parsetree" (The XML parse tree of revision content (requires content model wikitext)).
24
+ # @return [self]
25
+ def prop(*values)
26
+ values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
27
+ end
28
+
29
+ # @private
30
+ def _prop(value)
31
+ defined?(super) && super || ["ids", "flags", "timestamp", "user", "userid", "size", "sha1", "contentmodel", "comment", "parsedcomment", "content", "tags", "parsetree"].include?(value.to_s) && merge(adrprop: value.to_s, replace: false)
32
+ end
33
+
34
+ # Limit how many revisions will be returned.
35
+ #
36
+ # @param value [Integer, "max"]
37
+ # @return [self]
38
+ def limit(value)
39
+ merge(adrlimit: value.to_s)
40
+ end
41
+
42
+ # Expand templates in revision content (requires adrprop=content).
43
+ #
44
+ # @return [self]
45
+ def expandtemplates()
46
+ merge(adrexpandtemplates: 'true')
47
+ end
48
+
49
+ # Generate XML parse tree for revision content (requires adrprop=content; replaced by adrprop=parsetree).
50
+ #
51
+ # @return [self]
52
+ def generatexml()
53
+ merge(adrgeneratexml: 'true')
54
+ end
55
+
56
+ # Parse revision content (requires adrprop=content). For performance reasons, if this option is used, adrlimit is enforced to 1.
57
+ #
58
+ # @return [self]
59
+ def parse()
60
+ merge(adrparse: 'true')
61
+ end
62
+
63
+ # Only retrieve the content of this section number.
64
+ #
65
+ # @param value [String]
66
+ # @return [self]
67
+ def section(value)
68
+ merge(adrsection: value.to_s)
69
+ end
70
+
71
+ # Revision ID to diff each revision to. Use prev, next and cur for the previous, next and current revision respectively.
72
+ #
73
+ # @param value [String]
74
+ # @return [self]
75
+ def diffto(value)
76
+ merge(adrdiffto: value.to_s)
77
+ end
78
+
79
+ # Text to diff each revision to. Only diffs a limited number of revisions. Overrides adrdiffto. If adrsection is set, only that section will be diffed against this text.
80
+ #
81
+ # @param value [String]
82
+ # @return [self]
83
+ def difftotext(value)
84
+ merge(adrdifftotext: value.to_s)
85
+ end
86
+
87
+ # Perform a pre-save transform on the text before diffing it. Only valid when used with adrdifftotext.
88
+ #
89
+ # @return [self]
90
+ def difftotextpst()
91
+ merge(adrdifftotextpst: 'true')
92
+ end
93
+
94
+ # Serialization format used for adrdifftotext and expected for output of content.
95
+ #
96
+ # @param value [String] One of "application/json", "text/x-wiki", "text/javascript", "text/css", "text/plain".
97
+ # @return [self]
98
+ def contentformat(value)
99
+ _contentformat(value) or fail ArgumentError, "Unknown value for contentformat: #{value}"
100
+ end
101
+
102
+ # @private
103
+ def _contentformat(value)
104
+ defined?(super) && super || ["application/json", "text/x-wiki", "text/javascript", "text/css", "text/plain"].include?(value.to_s) && merge(adrcontentformat: value.to_s)
105
+ end
106
+
107
+ # Only list revisions by this user.
108
+ #
109
+ # @param value [String]
110
+ # @return [self]
111
+ def user(value)
112
+ merge(adruser: value.to_s)
113
+ end
114
+
115
+ # Only list pages in this namespace.
116
+ #
117
+ # @param values [Array<String>] Allowed values: "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".
118
+ # @return [self]
119
+ def namespace(*values)
120
+ values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, "Unknown value for namespace: #{val}" }
121
+ end
122
+
123
+ # @private
124
+ def _namespace(value)
125
+ 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(adrnamespace: value.to_s, replace: false)
126
+ end
127
+
128
+ # The timestamp to start enumerating from.
129
+ #
130
+ # @param value [Time]
131
+ # @return [self]
132
+ def start(value)
133
+ merge(adrstart: value.iso8601)
134
+ end
135
+
136
+ # The timestamp to stop enumerating at.
137
+ #
138
+ # @param value [Time]
139
+ # @return [self]
140
+ def end(value)
141
+ merge(adrend: value.iso8601)
142
+ end
143
+
144
+ # In which direction to enumerate:
145
+ #
146
+ # @param value [String] One of "newer" (List oldest first. Note: adrstart has to be before adrend), "older" (List newest first (default). Note: adrstart has to be later than adrend).
147
+ # @return [self]
148
+ def dir(value)
149
+ _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}"
150
+ end
151
+
152
+ # @private
153
+ def _dir(value)
154
+ defined?(super) && super || ["newer", "older"].include?(value.to_s) && merge(adrdir: value.to_s)
155
+ end
156
+
157
+ # Start listing at this title.
158
+ #
159
+ # @param value [String]
160
+ # @return [self]
161
+ def from(value)
162
+ merge(adrfrom: value.to_s)
163
+ end
164
+
165
+ # Stop listing at this title.
166
+ #
167
+ # @param value [String]
168
+ # @return [self]
169
+ def to(value)
170
+ merge(adrto: value.to_s)
171
+ end
172
+
173
+ # Search for all page titles that begin with this value.
174
+ #
175
+ # @param value [String]
176
+ # @return [self]
177
+ def prefix(value)
178
+ merge(adrprefix: value.to_s)
179
+ end
180
+
181
+ # Don't list revisions by this user.
182
+ #
183
+ # @param value [String]
184
+ # @return [self]
185
+ def excludeuser(value)
186
+ merge(adrexcludeuser: value.to_s)
187
+ end
188
+
189
+ # Only list revisions tagged with this tag.
190
+ #
191
+ # @param value [String]
192
+ # @return [self]
193
+ def tag(value)
194
+ merge(adrtag: value.to_s)
195
+ end
196
+
197
+ # When more results are available, use this to continue.
198
+ #
199
+ # @param value [String]
200
+ # @return [self]
201
+ def continue(value)
202
+ merge(adrcontinue: value.to_s)
203
+ end
204
+
205
+ # When being used as a generator, generate titles rather than revision IDs.
206
+ #
207
+ # @return [self]
208
+ def generatetitles()
209
+ merge(adrgeneratetitles: 'true')
210
+ end
211
+ end
212
+ end
213
+ end