mediawiktory 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dokaz +1 -0
- data/.rubocop_todo.yml +16 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +10 -4
- data/CONTRIBUTING.md +6 -9
- data/README.md +153 -72
- data/bin/mediawiktory-gen +35 -0
- data/lib/media_wiktory.rb +2 -0
- data/lib/mediawiktory.rb +13 -14
- data/lib/mediawiktory/generator.rb +107 -0
- data/lib/mediawiktory/generator/api.rb +75 -0
- data/lib/mediawiktory/generator/module.rb +105 -0
- data/lib/mediawiktory/generator/param.rb +271 -0
- data/lib/mediawiktory/generator/renderable.rb +59 -0
- data/lib/mediawiktory/generator/templates/_action_method.erb +20 -0
- data/lib/mediawiktory/generator/templates/_module_in_param_docs.erb +2 -0
- data/lib/mediawiktory/generator/templates/_param_impl_boolean.erb +1 -0
- data/lib/mediawiktory/generator/templates/_param_impl_enum.erb +1 -0
- data/lib/mediawiktory/generator/templates/_param_impl_enum_of_modules.erb +1 -0
- data/lib/mediawiktory/generator/templates/_param_impl_string.erb +1 -0
- data/lib/mediawiktory/generator/templates/_param_impl_timestamp.erb +1 -0
- data/lib/mediawiktory/generator/templates/_param_method.erb +14 -0
- data/lib/mediawiktory/generator/templates/action.rb.erb +204 -0
- data/lib/mediawiktory/generator/templates/action_class.rb.erb +30 -0
- data/lib/mediawiktory/generator/templates/actions.rb.erb +31 -0
- data/lib/mediawiktory/generator/templates/api.rb.erb +65 -0
- data/lib/mediawiktory/{client.rb → generator/templates/client.rb.erb} +24 -10
- data/lib/mediawiktory/generator/templates/module_class.rb.erb +22 -0
- data/lib/mediawiktory/generator/templates/response.rb.erb +122 -0
- data/lib/mediawiktory/version.rb +4 -2
- data/lib/mediawiktory/wikipedia/actions.rb +2296 -0
- data/lib/mediawiktory/wikipedia/actions/abusefiltercheckmatch.rb +55 -0
- data/lib/mediawiktory/wikipedia/actions/abusefilterchecksyntax.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/abusefilterevalexpression.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/abusefilterunblockautopromote.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/addstudents.rb +52 -0
- data/lib/mediawiktory/wikipedia/actions/antispoof.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/base.rb +351 -0
- data/lib/mediawiktory/wikipedia/actions/block.rb +132 -0
- data/lib/mediawiktory/wikipedia/actions/bouncehandler.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/categorytree.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/centralauthtoken.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/centralnoticechoicedata.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/centralnoticequerycampaign.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/changeauthenticationdata.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/checktoken.rb +52 -0
- data/lib/mediawiktory/wikipedia/actions/cirrus-config-dump.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/cirrus-mapping-dump.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/cirrus-settings-dump.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/clearhasmsg.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/clientlogin.rb +86 -0
- data/lib/mediawiktory/wikipedia/actions/compare.rb +71 -0
- data/lib/mediawiktory/wikipedia/actions/createaccount.rb +86 -0
- data/lib/mediawiktory/wikipedia/actions/cspreport.rb +38 -0
- data/lib/mediawiktory/wikipedia/actions/cxconfiguration.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/cxdelete.rb +55 -0
- data/lib/mediawiktory/wikipedia/actions/cxpublish.rb +95 -0
- data/lib/mediawiktory/wikipedia/actions/cxsave.rb +87 -0
- data/lib/mediawiktory/wikipedia/actions/cxsuggestionlist.rb +81 -0
- data/lib/mediawiktory/wikipedia/actions/cxtoken.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/delete.rb +103 -0
- data/lib/mediawiktory/wikipedia/actions/deleteeducation.rb +65 -0
- data/lib/mediawiktory/wikipedia/actions/deleteglobalaccount.rb +47 -0
- data/lib/mediawiktory/wikipedia/actions/echomarkread.rb +77 -0
- data/lib/mediawiktory/wikipedia/actions/echomarkseen.rb +57 -0
- data/lib/mediawiktory/wikipedia/actions/edit.rb +266 -0
- data/lib/mediawiktory/wikipedia/actions/editmassmessagelist.rb +65 -0
- data/lib/mediawiktory/wikipedia/actions/emailuser.rb +62 -0
- data/lib/mediawiktory/wikipedia/actions/enlist.rb +89 -0
- data/lib/mediawiktory/wikipedia/actions/expandtemplates.rb +129 -0
- data/lib/mediawiktory/wikipedia/actions/fancycaptchareload.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/featuredfeed.rb +57 -0
- data/lib/mediawiktory/wikipedia/actions/feedcontributions.rb +121 -0
- data/lib/mediawiktory/wikipedia/actions/feedrecentchanges.rb +159 -0
- data/lib/mediawiktory/wikipedia/actions/feedwatchlist.rb +108 -0
- data/lib/mediawiktory/wikipedia/actions/filerevert.rb +55 -0
- data/lib/mediawiktory/wikipedia/actions/flagconfig.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/globalblock.rb +76 -0
- data/lib/mediawiktory/wikipedia/actions/globaluserrights.rb +94 -0
- data/lib/mediawiktory/wikipedia/actions/graph.rb +47 -0
- data/lib/mediawiktory/wikipedia/actions/help.rb +64 -0
- data/lib/mediawiktory/wikipedia/actions/imagerotate.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/import.rb +116 -0
- data/lib/mediawiktory/wikipedia/actions/jsonconfig.rb +60 -0
- data/lib/mediawiktory/wikipedia/actions/jsondata.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/languagesearch.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/linkaccount.rb +79 -0
- data/lib/mediawiktory/wikipedia/actions/liststudents.rb +63 -0
- data/lib/mediawiktory/wikipedia/actions/login.rb +55 -0
- data/lib/mediawiktory/wikipedia/actions/logout.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/managetags.rb +80 -0
- data/lib/mediawiktory/wikipedia/actions/massmessage.rb +55 -0
- data/lib/mediawiktory/wikipedia/actions/mergehistory.rb +79 -0
- data/lib/mediawiktory/wikipedia/actions/mobileview.rb +170 -0
- data/lib/mediawiktory/wikipedia/actions/move.rb +131 -0
- data/lib/mediawiktory/wikipedia/actions/oathvalidate.rb +47 -0
- data/lib/mediawiktory/wikipedia/actions/opensearch.rb +105 -0
- data/lib/mediawiktory/wikipedia/actions/options.rb +80 -0
- data/lib/mediawiktory/wikipedia/actions/pagetriageaction.rb +67 -0
- data/lib/mediawiktory/wikipedia/actions/pagetriagelist.rb +142 -0
- data/lib/mediawiktory/wikipedia/actions/pagetriagestats.rb +59 -0
- data/lib/mediawiktory/wikipedia/actions/pagetriagetagging.rb +83 -0
- data/lib/mediawiktory/wikipedia/actions/pagetriagetemplate.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/paraminfo.rb +91 -0
- data/lib/mediawiktory/wikipedia/actions/parse.rb +286 -0
- data/lib/mediawiktory/wikipedia/actions/parsoid-batch.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/patrol.rb +60 -0
- data/lib/mediawiktory/wikipedia/actions/protect.rb +121 -0
- data/lib/mediawiktory/wikipedia/actions/purge.rb +155 -0
- data/lib/mediawiktory/wikipedia/actions/query.rb +325 -0
- data/lib/mediawiktory/wikipedia/actions/refresheducation.rb +57 -0
- data/lib/mediawiktory/wikipedia/actions/removeauthenticationdata.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/resetpassword.rb +47 -0
- data/lib/mediawiktory/wikipedia/actions/review.rb +54 -0
- data/lib/mediawiktory/wikipedia/actions/reviewactivity.rb +60 -0
- data/lib/mediawiktory/wikipedia/actions/revisiondelete.rb +125 -0
- data/lib/mediawiktory/wikipedia/actions/rollback.rb +96 -0
- data/lib/mediawiktory/wikipedia/actions/rsd.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/sanitize-mapdata.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/scribunto-console.rb +62 -0
- data/lib/mediawiktory/wikipedia/actions/setglobalaccountstatus.rb +81 -0
- data/lib/mediawiktory/wikipedia/actions/setnotificationtimestamp.rb +180 -0
- data/lib/mediawiktory/wikipedia/actions/setpagelanguage.rb +81 -0
- data/lib/mediawiktory/wikipedia/actions/shortenurl.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/sitematrix.rb +91 -0
- data/lib/mediawiktory/wikipedia/actions/spamblacklist.rb +36 -0
- data/lib/mediawiktory/wikipedia/actions/stabilize.rb +76 -0
- data/lib/mediawiktory/wikipedia/actions/stashedit.rb +113 -0
- data/lib/mediawiktory/wikipedia/actions/strikevote.rb +60 -0
- data/lib/mediawiktory/wikipedia/actions/tag.rb +117 -0
- data/lib/mediawiktory/wikipedia/actions/templatedata.rb +148 -0
- data/lib/mediawiktory/wikipedia/actions/thank.rb +47 -0
- data/lib/mediawiktory/wikipedia/actions/titleblacklist.rb +51 -0
- data/lib/mediawiktory/wikipedia/actions/tokens.rb +36 -0
- data/lib/mediawiktory/wikipedia/actions/transcodereset.rb +47 -0
- data/lib/mediawiktory/wikipedia/actions/ulslocalization.rb +31 -0
- data/lib/mediawiktory/wikipedia/actions/unblock.rb +76 -0
- data/lib/mediawiktory/wikipedia/actions/undelete.rb +99 -0
- data/lib/mediawiktory/wikipedia/actions/unlinkaccount.rb +39 -0
- data/lib/mediawiktory/wikipedia/actions/upload.rb +172 -0
- data/lib/mediawiktory/wikipedia/actions/userrights.rb +107 -0
- data/lib/mediawiktory/wikipedia/actions/validatepassword.rb +55 -0
- data/lib/mediawiktory/wikipedia/actions/visualeditor.rb +96 -0
- data/lib/mediawiktory/wikipedia/actions/visualeditoredit.rb +164 -0
- data/lib/mediawiktory/wikipedia/actions/watch.rb +164 -0
- data/lib/mediawiktory/wikipedia/actions/webapp-manifest.rb +25 -0
- data/lib/mediawiktory/wikipedia/actions/wikilove.rb +79 -0
- data/lib/mediawiktory/wikipedia/actions/zeroconfig.rb +44 -0
- data/lib/mediawiktory/wikipedia/api.rb +80 -0
- data/lib/mediawiktory/wikipedia/client.rb +61 -0
- data/lib/mediawiktory/wikipedia/modules/abusefilters.rb +85 -0
- data/lib/mediawiktory/wikipedia/modules/abuselog.rb +101 -0
- data/lib/mediawiktory/wikipedia/modules/allcategories.rb +104 -0
- data/lib/mediawiktory/wikipedia/modules/alldeletedrevisions.rb +213 -0
- data/lib/mediawiktory/wikipedia/modules/allfileusages.rb +95 -0
- data/lib/mediawiktory/wikipedia/modules/allimages.rb +183 -0
- data/lib/mediawiktory/wikipedia/modules/alllinks.rb +108 -0
- data/lib/mediawiktory/wikipedia/modules/allmessages.rb +143 -0
- data/lib/mediawiktory/wikipedia/modules/allpages.rb +182 -0
- data/lib/mediawiktory/wikipedia/modules/allredirects.rb +108 -0
- data/lib/mediawiktory/wikipedia/modules/allrevisions.rb +181 -0
- data/lib/mediawiktory/wikipedia/modules/alltransclusions.rb +108 -0
- data/lib/mediawiktory/wikipedia/modules/allusers.rb +141 -0
- data/lib/mediawiktory/wikipedia/modules/authmanagerinfo.rb +63 -0
- data/lib/mediawiktory/wikipedia/modules/babel.rb +30 -0
- data/lib/mediawiktory/wikipedia/modules/backlinks.rb +100 -0
- data/lib/mediawiktory/wikipedia/modules/betafeatures.rb +30 -0
- data/lib/mediawiktory/wikipedia/modules/blocks.rb +127 -0
- data/lib/mediawiktory/wikipedia/modules/categories.rb +90 -0
- data/lib/mediawiktory/wikipedia/modules/categoryinfo.rb +30 -0
- data/lib/mediawiktory/wikipedia/modules/categorymembers.rb +183 -0
- data/lib/mediawiktory/wikipedia/modules/centralnoticelogs.rb +70 -0
- data/lib/mediawiktory/wikipedia/modules/checkuser.rb +83 -0
- data/lib/mediawiktory/wikipedia/modules/checkuserlog.rb +83 -0
- data/lib/mediawiktory/wikipedia/modules/contenttranslation.rb +83 -0
- data/lib/mediawiktory/wikipedia/modules/contenttranslationcorpora.rb +50 -0
- data/lib/mediawiktory/wikipedia/modules/contenttranslationlangtrend.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/contenttranslationstats.rb +22 -0
- data/lib/mediawiktory/wikipedia/modules/contenttranslationsuggestions.rb +70 -0
- data/lib/mediawiktory/wikipedia/modules/contributors.rb +90 -0
- data/lib/mediawiktory/wikipedia/modules/coordinates.rb +80 -0
- data/lib/mediawiktory/wikipedia/modules/cxpublishedtranslations.rb +54 -0
- data/lib/mediawiktory/wikipedia/modules/cxtranslatorstats.rb +30 -0
- data/lib/mediawiktory/wikipedia/modules/deletedrevisions.rb +169 -0
- data/lib/mediawiktory/wikipedia/modules/deletedrevs.rb +148 -0
- data/lib/mediawiktory/wikipedia/modules/duplicatefiles.rb +58 -0
- data/lib/mediawiktory/wikipedia/modules/embeddedin.rb +93 -0
- data/lib/mediawiktory/wikipedia/modules/extlinks.rb +66 -0
- data/lib/mediawiktory/wikipedia/modules/extracts.rb +81 -0
- data/lib/mediawiktory/wikipedia/modules/exturlusage.rb +92 -0
- data/lib/mediawiktory/wikipedia/modules/featureusage.rb +59 -0
- data/lib/mediawiktory/wikipedia/modules/filearchive.rb +104 -0
- data/lib/mediawiktory/wikipedia/modules/filerepoinfo.rb +35 -0
- data/lib/mediawiktory/wikipedia/modules/fileusage.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/flagged.rb +22 -0
- data/lib/mediawiktory/wikipedia/modules/g-allcategories.rb +91 -0
- data/lib/mediawiktory/wikipedia/modules/g-alldeletedrevisions.rb +200 -0
- data/lib/mediawiktory/wikipedia/modules/g-allfileusages.rb +82 -0
- data/lib/mediawiktory/wikipedia/modules/g-allimages.rb +170 -0
- data/lib/mediawiktory/wikipedia/modules/g-alllinks.rb +95 -0
- data/lib/mediawiktory/wikipedia/modules/g-allpages.rb +182 -0
- data/lib/mediawiktory/wikipedia/modules/g-allredirects.rb +95 -0
- data/lib/mediawiktory/wikipedia/modules/g-allrevisions.rb +168 -0
- data/lib/mediawiktory/wikipedia/modules/g-alltransclusions.rb +95 -0
- data/lib/mediawiktory/wikipedia/modules/g-backlinks.rb +100 -0
- data/lib/mediawiktory/wikipedia/modules/g-categories.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/g-categorymembers.rb +170 -0
- data/lib/mediawiktory/wikipedia/modules/g-contenttranslation.rb +83 -0
- data/lib/mediawiktory/wikipedia/modules/g-contenttranslationsuggestions.rb +70 -0
- data/lib/mediawiktory/wikipedia/modules/g-deletedrevisions.rb +156 -0
- data/lib/mediawiktory/wikipedia/modules/g-duplicatefiles.rb +58 -0
- data/lib/mediawiktory/wikipedia/modules/g-embeddedin.rb +93 -0
- data/lib/mediawiktory/wikipedia/modules/g-exturlusage.rb +79 -0
- data/lib/mediawiktory/wikipedia/modules/g-fileusage.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/g-geosearch.rb +116 -0
- data/lib/mediawiktory/wikipedia/modules/g-gettingstartedgetpages.rb +46 -0
- data/lib/mediawiktory/wikipedia/modules/g-images.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/g-imageusage.rb +100 -0
- data/lib/mediawiktory/wikipedia/modules/g-iwbacklinks.rb +67 -0
- data/lib/mediawiktory/wikipedia/modules/g-langbacklinks.rb +67 -0
- data/lib/mediawiktory/wikipedia/modules/g-links.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/g-linkshere.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/g-mostviewed.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/g-oldreviewedpages.rb +114 -0
- data/lib/mediawiktory/wikipedia/modules/g-pageswithprop.rb +59 -0
- data/lib/mediawiktory/wikipedia/modules/g-prefixsearch.rb +72 -0
- data/lib/mediawiktory/wikipedia/modules/g-projectpages.rb +58 -0
- data/lib/mediawiktory/wikipedia/modules/g-protectedtitles.rb +93 -0
- data/lib/mediawiktory/wikipedia/modules/g-querypage.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/g-random.rb +71 -0
- data/lib/mediawiktory/wikipedia/modules/g-recentchanges.rb +157 -0
- data/lib/mediawiktory/wikipedia/modules/g-redirects.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/g-revisions.rb +185 -0
- data/lib/mediawiktory/wikipedia/modules/g-search.rb +112 -0
- data/lib/mediawiktory/wikipedia/modules/g-templates.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/g-transcludedin.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/g-watchlist.rb +145 -0
- data/lib/mediawiktory/wikipedia/modules/g-watchlistraw.rb +109 -0
- data/lib/mediawiktory/wikipedia/modules/g-wblistentityusage.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/gadgetcategories.rb +48 -0
- data/lib/mediawiktory/wikipedia/modules/gadgets.rb +75 -0
- data/lib/mediawiktory/wikipedia/modules/geosearch.rb +129 -0
- data/lib/mediawiktory/wikipedia/modules/gettingstartedgetpages.rb +46 -0
- data/lib/mediawiktory/wikipedia/modules/globalallusers.rb +106 -0
- data/lib/mediawiktory/wikipedia/modules/globalblocks.rb +106 -0
- data/lib/mediawiktory/wikipedia/modules/globalgroups.rb +35 -0
- data/lib/mediawiktory/wikipedia/modules/globalusage.rb +58 -0
- data/lib/mediawiktory/wikipedia/modules/globaluserinfo.rb +43 -0
- data/lib/mediawiktory/wikipedia/modules/imageinfo.rb +142 -0
- data/lib/mediawiktory/wikipedia/modules/images.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/imageusage.rb +100 -0
- data/lib/mediawiktory/wikipedia/modules/info.rb +69 -0
- data/lib/mediawiktory/wikipedia/modules/iwbacklinks.rb +80 -0
- data/lib/mediawiktory/wikipedia/modules/iwlinks.rb +87 -0
- data/lib/mediawiktory/wikipedia/modules/json.rb +57 -0
- data/lib/mediawiktory/wikipedia/modules/jsonfm.rb +64 -0
- data/lib/mediawiktory/wikipedia/modules/langbacklinks.rb +80 -0
- data/lib/mediawiktory/wikipedia/modules/langlinks.rb +95 -0
- data/lib/mediawiktory/wikipedia/modules/links.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/linkshere.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/logevents.rb +151 -0
- data/lib/mediawiktory/wikipedia/modules/mapdata.rb +46 -0
- data/lib/mediawiktory/wikipedia/modules/mmsites.rb +30 -0
- data/lib/mediawiktory/wikipedia/modules/mostviewed.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/mystashedfiles.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/none.rb +22 -0
- data/lib/mediawiktory/wikipedia/modules/notifications.rb +174 -0
- data/lib/mediawiktory/wikipedia/modules/oath.rb +30 -0
- data/lib/mediawiktory/wikipedia/modules/oldreviewedpages.rb +114 -0
- data/lib/mediawiktory/wikipedia/modules/ores.rb +22 -0
- data/lib/mediawiktory/wikipedia/modules/pageassessments.rb +45 -0
- data/lib/mediawiktory/wikipedia/modules/pageimages.rb +72 -0
- data/lib/mediawiktory/wikipedia/modules/pagepropnames.rb +38 -0
- data/lib/mediawiktory/wikipedia/modules/pageprops.rb +43 -0
- data/lib/mediawiktory/wikipedia/modules/pageswithprop.rb +72 -0
- data/lib/mediawiktory/wikipedia/modules/pageterms.rb +43 -0
- data/lib/mediawiktory/wikipedia/modules/pageviews.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/php.rb +35 -0
- data/lib/mediawiktory/wikipedia/modules/phpfm.rb +42 -0
- data/lib/mediawiktory/wikipedia/modules/prefixsearch.rb +72 -0
- data/lib/mediawiktory/wikipedia/modules/projectpages.rb +58 -0
- data/lib/mediawiktory/wikipedia/modules/projects.rb +29 -0
- data/lib/mediawiktory/wikipedia/modules/protectedtitles.rb +106 -0
- data/lib/mediawiktory/wikipedia/modules/querypage.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/random.rb +71 -0
- data/lib/mediawiktory/wikipedia/modules/rawfm.rb +29 -0
- data/lib/mediawiktory/wikipedia/modules/recentchanges.rb +170 -0
- data/lib/mediawiktory/wikipedia/modules/redirects.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/references.rb +30 -0
- data/lib/mediawiktory/wikipedia/modules/revisions.rb +198 -0
- data/lib/mediawiktory/wikipedia/modules/search.rb +125 -0
- data/lib/mediawiktory/wikipedia/modules/siteinfo.rb +70 -0
- data/lib/mediawiktory/wikipedia/modules/siteviews.rb +43 -0
- data/lib/mediawiktory/wikipedia/modules/stashimageinfo.rb +85 -0
- data/lib/mediawiktory/wikipedia/modules/tags.rb +51 -0
- data/lib/mediawiktory/wikipedia/modules/templates.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/tokens.rb +35 -0
- data/lib/mediawiktory/wikipedia/modules/transcludedin.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/transcodestatus.rb +22 -0
- data/lib/mediawiktory/wikipedia/modules/unreadnotificationpages.rb +50 -0
- data/lib/mediawiktory/wikipedia/modules/usercontribs.rb +155 -0
- data/lib/mediawiktory/wikipedia/modules/userinfo.rb +43 -0
- data/lib/mediawiktory/wikipedia/modules/users.rb +82 -0
- data/lib/mediawiktory/wikipedia/modules/videoinfo.rb +143 -0
- data/lib/mediawiktory/wikipedia/modules/watchlist.rb +158 -0
- data/lib/mediawiktory/wikipedia/modules/watchlistraw.rb +122 -0
- data/lib/mediawiktory/wikipedia/modules/wbentityusage.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/wblistentityusage.rb +77 -0
- data/lib/mediawiktory/wikipedia/modules/wikibase.rb +35 -0
- data/lib/mediawiktory/wikipedia/modules/wikisets.rb +58 -0
- data/lib/mediawiktory/wikipedia/modules/xml.rb +37 -0
- data/lib/mediawiktory/wikipedia/modules/xmlfm.rb +44 -0
- data/lib/mediawiktory/wikipedia/response.rb +122 -0
- data/lib/nokogiri/more.rb +12 -12
- data/mediawiktory.gemspec +4 -0
- metadata +350 -257
- data/bin/mediawiktory +0 -13
- data/doc/mediawiki_api_types.md +0 -14
- data/examples/query.rb +0 -15
- data/examples/query_generator.rb +0 -15
- data/lib/faraday/naive_cache.rb +0 -40
- data/lib/mediawiktory/action.rb +0 -61
- data/lib/mediawiktory/generated/abusefiltercheckmatch.rb +0 -9
- data/lib/mediawiktory/generated/abusefilterchecksyntax.rb +0 -6
- data/lib/mediawiktory/generated/abusefilterevalexpression.rb +0 -6
- data/lib/mediawiktory/generated/abusefilters.rb +0 -12
- data/lib/mediawiktory/generated/abusefilterunblockautopromote.rb +0 -8
- data/lib/mediawiktory/generated/abuselog.rb +0 -14
- data/lib/mediawiktory/generated/actions_mixin.rb +0 -352
- data/lib/mediawiktory/generated/addstudents.rb +0 -9
- data/lib/mediawiktory/generated/allcategories.rb +0 -15
- data/lib/mediawiktory/generated/alldeletedrevisions.rb +0 -28
- data/lib/mediawiktory/generated/allfileusages.rb +0 -14
- data/lib/mediawiktory/generated/allimages.rb +0 -23
- data/lib/mediawiktory/generated/alllinks.rb +0 -15
- data/lib/mediawiktory/generated/allmessages.rb +0 -19
- data/lib/mediawiktory/generated/allpages.rb +0 -21
- data/lib/mediawiktory/generated/allredirects.rb +0 -15
- data/lib/mediawiktory/generated/allrevisions.rb +0 -24
- data/lib/mediawiktory/generated/alltransclusions.rb +0 -15
- data/lib/mediawiktory/generated/allusers.rb +0 -18
- data/lib/mediawiktory/generated/antispoof.rb +0 -6
- data/lib/mediawiktory/generated/authmanagerinfo.rb +0 -10
- data/lib/mediawiktory/generated/babel.rb +0 -7
- data/lib/mediawiktory/generated/backlinks.rb +0 -14
- data/lib/mediawiktory/generated/betafeatures.rb +0 -7
- data/lib/mediawiktory/generated/block.rb +0 -20
- data/lib/mediawiktory/generated/blocks.rb +0 -16
- data/lib/mediawiktory/generated/bouncehandler.rb +0 -7
- data/lib/mediawiktory/generated/categories.rb +0 -12
- data/lib/mediawiktory/generated/categoryinfo.rb +0 -7
- data/lib/mediawiktory/generated/categorymembers.rb +0 -23
- data/lib/mediawiktory/generated/categorytree.rb +0 -7
- data/lib/mediawiktory/generated/centralauthtoken.rb +0 -5
- data/lib/mediawiktory/generated/centralnoticechoicedata.rb +0 -7
- data/lib/mediawiktory/generated/centralnoticelogs.rb +0 -11
- data/lib/mediawiktory/generated/centralnoticequerycampaign.rb +0 -6
- data/lib/mediawiktory/generated/changeauthenticationdata.rb +0 -10
- data/lib/mediawiktory/generated/checktoken.rb +0 -8
- data/lib/mediawiktory/generated/checkuser.rb +0 -14
- data/lib/mediawiktory/generated/checkuserlog.rb +0 -13
- data/lib/mediawiktory/generated/cirrus-config-dump.rb +0 -5
- data/lib/mediawiktory/generated/cirrus-mapping-dump.rb +0 -5
- data/lib/mediawiktory/generated/cirrus-settings-dump.rb +0 -5
- data/lib/mediawiktory/generated/clearhasmsg.rb +0 -6
- data/lib/mediawiktory/generated/clientlogin.rb +0 -15
- data/lib/mediawiktory/generated/compare.rb +0 -11
- data/lib/mediawiktory/generated/contenttranslation.rb +0 -12
- data/lib/mediawiktory/generated/contenttranslationcorpora.rb +0 -8
- data/lib/mediawiktory/generated/contenttranslationlangtrend.rb +0 -8
- data/lib/mediawiktory/generated/contenttranslationstats.rb +0 -5
- data/lib/mediawiktory/generated/contenttranslationsuggestions.rb +0 -11
- data/lib/mediawiktory/generated/contributors.rb +0 -12
- data/lib/mediawiktory/generated/coordinates.rb +0 -12
- data/lib/mediawiktory/generated/createaccount.rb +0 -15
- data/lib/mediawiktory/generated/cspreport.rb +0 -8
- data/lib/mediawiktory/generated/cxconfiguration.rb +0 -7
- data/lib/mediawiktory/generated/cxdelete.rb +0 -10
- data/lib/mediawiktory/generated/cxpublish.rb +0 -15
- data/lib/mediawiktory/generated/cxpublishedtranslations.rb +0 -9
- data/lib/mediawiktory/generated/cxsave.rb +0 -14
- data/lib/mediawiktory/generated/cxsuggestionlist.rb +0 -12
- data/lib/mediawiktory/generated/cxtoken.rb +0 -7
- data/lib/mediawiktory/generated/cxtranslatorstats.rb +0 -6
- data/lib/mediawiktory/generated/delete.rb +0 -15
- data/lib/mediawiktory/generated/deletedrevisions.rb +0 -23
- data/lib/mediawiktory/generated/deletedrevs.rb +0 -20
- data/lib/mediawiktory/generated/deleteeducation.rb +0 -10
- data/lib/mediawiktory/generated/deleteglobalaccount.rb +0 -9
- data/lib/mediawiktory/generated/duplicatefiles.rb +0 -10
- data/lib/mediawiktory/generated/echomarkread.rb +0 -11
- data/lib/mediawiktory/generated/echomarkseen.rb +0 -9
- data/lib/mediawiktory/generated/edit.rb +0 -35
- data/lib/mediawiktory/generated/editmassmessagelist.rb +0 -10
- data/lib/mediawiktory/generated/emailuser.rb +0 -11
- data/lib/mediawiktory/generated/embeddedin.rb +0 -13
- data/lib/mediawiktory/generated/enlist.rb +0 -13
- data/lib/mediawiktory/generated/expandtemplates.rb +0 -16
- data/lib/mediawiktory/generated/extlinks.rb +0 -11
- data/lib/mediawiktory/generated/extracts.rb +0 -13
- data/lib/mediawiktory/generated/exturlusage.rb +0 -13
- data/lib/mediawiktory/generated/fancycaptchareload.rb +0 -5
- data/lib/mediawiktory/generated/featuredfeed.rb +0 -8
- data/lib/mediawiktory/generated/featureusage.rb +0 -10
- data/lib/mediawiktory/generated/feedcontributions.rb +0 -16
- data/lib/mediawiktory/generated/feedrecentchanges.rb +0 -22
- data/lib/mediawiktory/generated/feedwatchlist.rb +0 -14
- data/lib/mediawiktory/generated/filearchive.rb +0 -15
- data/lib/mediawiktory/generated/filerepoinfo.rb +0 -7
- data/lib/mediawiktory/generated/filerevert.rb +0 -10
- data/lib/mediawiktory/generated/fileusage.rb +0 -11
- data/lib/mediawiktory/generated/flagconfig.rb +0 -5
- data/lib/mediawiktory/generated/flagged.rb +0 -5
- data/lib/mediawiktory/generated/gadgetcategories.rb +0 -8
- data/lib/mediawiktory/generated/gadgets.rb +0 -11
- data/lib/mediawiktory/generated/geosearch.rb +0 -17
- data/lib/mediawiktory/generated/gettingstartedgetpages.rb +0 -9
- data/lib/mediawiktory/generated/globalallusers.rb +0 -14
- data/lib/mediawiktory/generated/globalblock.rb +0 -13
- data/lib/mediawiktory/generated/globalblocks.rb +0 -14
- data/lib/mediawiktory/generated/globalgroups.rb +0 -7
- data/lib/mediawiktory/generated/globalusage.rb +0 -10
- data/lib/mediawiktory/generated/globaluserinfo.rb +0 -8
- data/lib/mediawiktory/generated/globaluserrights.rb +0 -13
- data/lib/mediawiktory/generated/graph.rb +0 -8
- data/lib/mediawiktory/generated/help.rb +0 -10
- data/lib/mediawiktory/generated/imageinfo.rb +0 -20
- data/lib/mediawiktory/generated/imagerotate.rb +0 -5
- data/lib/mediawiktory/generated/images.rb +0 -10
- data/lib/mediawiktory/generated/imageusage.rb +0 -14
- data/lib/mediawiktory/generated/import.rb +0 -16
- data/lib/mediawiktory/generated/info.rb +0 -10
- data/lib/mediawiktory/generated/iwbacklinks.rb +0 -12
- data/lib/mediawiktory/generated/iwlinks.rb +0 -13
- data/lib/mediawiktory/generated/jsonconfig.rb +0 -9
- data/lib/mediawiktory/generated/jsondata.rb +0 -6
- data/lib/mediawiktory/generated/langbacklinks.rb +0 -12
- data/lib/mediawiktory/generated/langlinks.rb +0 -14
- data/lib/mediawiktory/generated/languagesearch.rb +0 -7
- data/lib/mediawiktory/generated/linkaccount.rb +0 -14
- data/lib/mediawiktory/generated/links.rb +0 -11
- data/lib/mediawiktory/generated/linkshere.rb +0 -11
- data/lib/mediawiktory/generated/liststudents.rb +0 -9
- data/lib/mediawiktory/generated/logevents.rb +0 -19
- data/lib/mediawiktory/generated/login.rb +0 -11
- data/lib/mediawiktory/generated/logout.rb +0 -5
- data/lib/mediawiktory/generated/managetags.rb +0 -12
- data/lib/mediawiktory/generated/mapdata.rb +0 -9
- data/lib/mediawiktory/generated/massmessage.rb +0 -10
- data/lib/mediawiktory/generated/mergehistory.rb +0 -13
- data/lib/mediawiktory/generated/mmsites.rb +0 -6
- data/lib/mediawiktory/generated/mobileview.rb +0 -22
- data/lib/mediawiktory/generated/mostviewed.rb +0 -9
- data/lib/mediawiktory/generated/move.rb +0 -19
- data/lib/mediawiktory/generated/mystashedfiles.rb +0 -9
- data/lib/mediawiktory/generated/notifications.rb +0 -22
- data/lib/mediawiktory/generated/oath.rb +0 -7
- data/lib/mediawiktory/generated/oathvalidate.rb +0 -9
- data/lib/mediawiktory/generated/oldreviewedpages.rb +0 -15
- data/lib/mediawiktory/generated/opensearch.rb +0 -12
- data/lib/mediawiktory/generated/options.rb +0 -12
- data/lib/mediawiktory/generated/ores.rb +0 -6
- data/lib/mediawiktory/generated/pageassessments.rb +0 -9
- data/lib/mediawiktory/generated/pageimages.rb +0 -11
- data/lib/mediawiktory/generated/pagepropnames.rb +0 -8
- data/lib/mediawiktory/generated/pageprops.rb +0 -8
- data/lib/mediawiktory/generated/pageswithprop.rb +0 -11
- data/lib/mediawiktory/generated/pageterms.rb +0 -8
- data/lib/mediawiktory/generated/pagetriageaction.rb +0 -11
- data/lib/mediawiktory/generated/pagetriagelist.rb +0 -21
- data/lib/mediawiktory/generated/pagetriagestats.rb +0 -10
- data/lib/mediawiktory/generated/pagetriagetagging.rb +0 -13
- data/lib/mediawiktory/generated/pagetriagetemplate.rb +0 -7
- data/lib/mediawiktory/generated/pageviews.rb +0 -9
- data/lib/mediawiktory/generated/paraminfo.rb +0 -11
- data/lib/mediawiktory/generated/parse.rb +0 -36
- data/lib/mediawiktory/generated/parsoid-batch.rb +0 -6
- data/lib/mediawiktory/generated/patrol.rb +0 -10
- data/lib/mediawiktory/generated/prefixsearch.rb +0 -10
- data/lib/mediawiktory/generated/projectpages.rb +0 -10
- data/lib/mediawiktory/generated/projects.rb +0 -7
- data/lib/mediawiktory/generated/protect.rb +0 -16
- data/lib/mediawiktory/generated/protectedtitles.rb +0 -14
- data/lib/mediawiktory/generated/purge.rb +0 -15
- data/lib/mediawiktory/generated/query.rb +0 -20
- data/lib/mediawiktory/generated/querypage.rb +0 -9
- data/lib/mediawiktory/generated/random.rb +0 -11
- data/lib/mediawiktory/generated/recentchanges.rb +0 -21
- data/lib/mediawiktory/generated/redirects.rb +0 -11
- data/lib/mediawiktory/generated/references.rb +0 -7
- data/lib/mediawiktory/generated/refresheducation.rb +0 -9
- data/lib/mediawiktory/generated/removeauthenticationdata.rb +0 -8
- data/lib/mediawiktory/generated/resetpassword.rb +0 -9
- data/lib/mediawiktory/generated/review.rb +0 -10
- data/lib/mediawiktory/generated/reviewactivity.rb +0 -10
- data/lib/mediawiktory/generated/revisiondelete.rb +0 -15
- data/lib/mediawiktory/generated/revisions.rb +0 -26
- data/lib/mediawiktory/generated/rollback.rb +0 -14
- data/lib/mediawiktory/generated/rsd.rb +0 -5
- data/lib/mediawiktory/generated/sanitize-mapdata.rb +0 -8
- data/lib/mediawiktory/generated/scribunto-console.rb +0 -10
- data/lib/mediawiktory/generated/search.rb +0 -16
- data/lib/mediawiktory/generated/setglobalaccountstatus.rb +0 -12
- data/lib/mediawiktory/generated/setnotificationtimestamp.rb +0 -18
- data/lib/mediawiktory/generated/setpagelanguage.rb +0 -12
- data/lib/mediawiktory/generated/shortenurl.rb +0 -7
- data/lib/mediawiktory/generated/siteinfo.rb +0 -11
- data/lib/mediawiktory/generated/sitematrix.rb +0 -12
- data/lib/mediawiktory/generated/siteviews.rb +0 -8
- data/lib/mediawiktory/generated/spamblacklist.rb +0 -6
- data/lib/mediawiktory/generated/stabilize.rb +0 -12
- data/lib/mediawiktory/generated/stashedit.rb +0 -16
- data/lib/mediawiktory/generated/stashimageinfo.rb +0 -12
- data/lib/mediawiktory/generated/strikevote.rb +0 -10
- data/lib/mediawiktory/generated/tag.rb +0 -14
- data/lib/mediawiktory/generated/tags.rb +0 -9
- data/lib/mediawiktory/generated/templatedata.rb +0 -12
- data/lib/mediawiktory/generated/templates.rb +0 -11
- data/lib/mediawiktory/generated/thank.rb +0 -9
- data/lib/mediawiktory/generated/titleblacklist.rb +0 -9
- data/lib/mediawiktory/generated/tokens.rb +0 -6
- data/lib/mediawiktory/generated/transcludedin.rb +0 -11
- data/lib/mediawiktory/generated/transcodereset.rb +0 -9
- data/lib/mediawiktory/generated/transcodestatus.rb +0 -5
- data/lib/mediawiktory/generated/ulslocalization.rb +0 -6
- data/lib/mediawiktory/generated/unblock.rb +0 -12
- data/lib/mediawiktory/generated/undelete.rb +0 -13
- data/lib/mediawiktory/generated/unlinkaccount.rb +0 -8
- data/lib/mediawiktory/generated/unreadnotificationpages.rb +0 -9
- data/lib/mediawiktory/generated/upload.rb +0 -24
- data/lib/mediawiktory/generated/usercontribs.rb +0 -19
- data/lib/mediawiktory/generated/userinfo.rb +0 -8
- data/lib/mediawiktory/generated/userrights.rb +0 -13
- data/lib/mediawiktory/generated/users.rb +0 -11
- data/lib/mediawiktory/generated/validatepassword.rb +0 -10
- data/lib/mediawiktory/generated/videoinfo.rb +0 -20
- data/lib/mediawiktory/generated/visualeditor.rb +0 -13
- data/lib/mediawiktory/generated/visualeditoredit.rb +0 -23
- data/lib/mediawiktory/generated/watch.rb +0 -16
- data/lib/mediawiktory/generated/watchlist.rb +0 -20
- data/lib/mediawiktory/generated/watchlistraw.rb +0 -16
- data/lib/mediawiktory/generated/wbentityusage.rb +0 -11
- data/lib/mediawiktory/generated/wblistentityusage.rb +0 -11
- data/lib/mediawiktory/generated/webapp-manifest.rb +0 -5
- data/lib/mediawiktory/generated/wikibase.rb +0 -7
- data/lib/mediawiktory/generated/wikilove.rb +0 -13
- data/lib/mediawiktory/generated/wikisets.rb +0 -10
- data/lib/mediawiktory/generated/zeroconfig.rb +0 -7
- data/lib/mediawiktory/mw_module.rb +0 -324
- data/lib/mediawiktory/page.rb +0 -50
- data/lib/mediawiktory/query.rb +0 -58
- data/script/data/api.yaml +0 -40414
- data/script/lib/api.rb +0 -14
- data/script/lib/module.rb +0 -132
- data/script/lib/parameter.rb +0 -133
- data/script/parse_api.rb +0 -21
- data/test/cache.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4acc4a7df0501374b8379ed81b1bea96e8fb10f
|
4
|
+
data.tar.gz: 5be2d52f4efadfe7cb8e6fb1158ed742a67cb80e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2214253635d370f907cc5a137e5f0e6136125a2cee3798aff806579127ec25e3f930ccb8428e0f3c9acd33a000cdb16c96ed6503eae7c4621bfa6c1ab24f29dc
|
7
|
+
data.tar.gz: c3bcdbf656c22b2b63ea3587fbe3814f93837c1fcb8cbd3fa251c30358b95cf98f79046aa2af61bd9b002099f833fe754e9d47434150fcf9f44921aa512ab275
|
data/.dokaz
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require ./spec/dokaz_helpers.rb
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-05-06 16:11:16 +0300 using RuboCop version 0.48.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 5
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
12
|
+
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
13
|
+
#Style/MultilineMethodCallIndentation:
|
14
|
+
#Exclude:
|
15
|
+
#- 'lib/mediawiktory/generator/api.rb'
|
16
|
+
#- 'lib/mediawiktory/generator/renderable.rb'
|
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
# MediaWiktory Changelog
|
2
2
|
|
3
|
-
# 0.0
|
3
|
+
# 0.1.0 (2017-05-10)
|
4
|
+
|
5
|
+
* First mature release;
|
6
|
+
* Change of API wrapper approach and allow to generate several different API wrappers;
|
7
|
+
* Specs & docs.
|
8
|
+
|
9
|
+
# 0.0.3 (2017-03-18)
|
4
10
|
|
5
11
|
* Regenerated Wikipedia wrapper in correspondence to current API version;
|
6
12
|
* Preparing to independent wrappers concept.
|
7
13
|
|
8
|
-
# 0.0.2 (21
|
14
|
+
# 0.0.2 (2015-12-21)
|
9
15
|
|
10
16
|
* `Page` class for grouping records in `Query::Response`;
|
11
17
|
* `User-Agent` header support;
|
@@ -13,10 +19,10 @@
|
|
13
19
|
* Correct behavior on empty pagelist when using generator (@smostovoy);
|
14
20
|
* Raise on errors in response (@smostovoy);
|
15
21
|
* Access to warnings in response (@smostovoy);
|
16
|
-
* Domain redirects transparent handling,
|
22
|
+
* Domain redirects transparent handling,
|
17
23
|
http://en.wikipedia.org -> https://en.wikipedia.org (@smostovoy).
|
18
24
|
|
19
|
-
# 0.0.1 (30
|
25
|
+
# 0.0.1 (2015-11-30)
|
20
26
|
|
21
27
|
Initial!
|
22
28
|
|
data/CONTRIBUTING.md
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
# Contributing to MediaWiktory
|
2
2
|
|
3
|
-
Currently, MediaWiktory at early stages of development (aka "young yet
|
4
|
-
|
5
|
-
[GitHub Issues](https://github.com/molybdenum-99/mediawiktory/issues) and
|
3
|
+
Currently, MediaWiktory at early stages of development (aka "young yet useful"). Currenty problems
|
4
|
+
and roadmap can be found at [GitHub Issues](https://github.com/molybdenum-99/mediawiktory/issues) and
|
6
5
|
are grouped into milestones.
|
7
6
|
|
8
7
|
Therefore, the big picture of "what next" is:
|
9
|
-
* more documentation for generated MediaWiki wrappers (both YARD and
|
10
|
-
on-the-fly accessible from code);
|
11
8
|
* more validations and cleaner errors;
|
12
|
-
*
|
9
|
+
* gfaceful handling of logging in, cookies and tokens;
|
10
|
+
* support of "old" docs format (think wikia.com).
|
13
11
|
|
14
|
-
You can join MediaWiktory development by usual fork-commit-pull request
|
15
|
-
|
16
|
-
with it.
|
12
|
+
You can join MediaWiktory development by usual fork-commit-pull request process, or by providing
|
13
|
+
your own cases and problems you'd like to solve with it.
|
data/README.md
CHANGED
@@ -1,102 +1,183 @@
|
|
1
1
|
# MediaWiktory, The MediaWiki Client
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/mediawiktory.svg)](http://badge.fury.io/rb/mediawiktory)
|
4
|
+
[![Build Status](https://travis-ci.org/molybdenum-99/mediawiktory.svg?branch=master)](https://travis-ci.org/molybdenum-99/mediawiktory)
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
**MediaWiktory** is a MediaWiki (think Wikipedia, Wiktionary and others) API client. It is the only
|
7
|
+
client that allows (almost) full access to MediaWiki API powers without loosing of Ruby powers.
|
8
|
+
|
9
|
+
No, seriously.
|
10
|
+
|
11
|
+
[MediaWiki API](https://www.mediawiki.org/wiki/API:Main_page) currently is very powerful and
|
12
|
+
full-featured (thought not very easy to use). Things like "fetch first 50 pages from that category
|
13
|
+
alongside with their revision history and interwiki links and mediafile stats" are typically done
|
9
14
|
with one carefully constructed request and return lots of useful information.
|
10
15
|
|
11
16
|
Yes, there already are [several](https://www.mediawiki.org/wiki/API:Client_code#Ruby)
|
12
17
|
API clients for Ruby, including ["official" one](https://github.com/wikimedia/mediawiki-ruby-api).
|
13
|
-
Typical approach for all of them is thick wrapper around some functionality
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
*
|
20
|
-
|
21
|
-
|
22
|
-
and possibilities;
|
23
|
-
* makes the wrapper reasonably thin, so you can always inspect raw responses
|
24
|
-
and raw request MediaWiktory will provide to the API;
|
25
|
-
* makes the wrapper reasonably smart, so things like "fetch next page for
|
26
|
-
this request" or "login with a token" are done with ease (but without
|
27
|
-
unnecessary "auto-magic", like fetching 500 pages of data without any
|
28
|
-
chance to control this);
|
29
|
-
* validates requests and simplifies parameters passing, while still
|
30
|
-
preserving abilitity to use any existing parameter and feature;
|
31
|
-
* it manages cookies and tokens for you, but can expose underlying
|
32
|
-
Faraday web client so the middleware can be added (like caching).
|
33
|
-
|
34
|
-
**Warning: Above is IDEAL state of the library. Current state, at
|
35
|
-
version 0.0.1 is far less impressive (yet already useful).**
|
36
|
-
|
37
|
-
## Structure and usage
|
38
|
-
|
39
|
-
MediaWiktory tries to resemble original API structure, but make its calls
|
40
|
-
more Ruby-ish. So, [Arel](https://github.com/rails/arel)-alike "chainable
|
41
|
-
query" approach is implemented.
|
42
|
-
|
43
|
-
Fast example:
|
44
|
-
|
45
|
-
**Goal**: fetch content for first 30 pages from category "Countries in
|
46
|
-
South America".
|
47
|
-
|
48
|
-
**Raw request** (split in lines for readability):
|
18
|
+
Typical approach for all of them is thick wrapper around some functionality (like "login and edit
|
19
|
+
pages" or "search and analyze pages"), and leave all the other cool things for generic `action` method
|
20
|
+
(at best), or without any coverage at all.
|
21
|
+
|
22
|
+
MediaWiktory, to the contrary is:
|
23
|
+
|
24
|
+
* **thin** wrapper...
|
25
|
+
* around **all** MediaWiki API features...
|
26
|
+
* making access to them available through idiomatic Ruby code, easy to use and clearly documented.
|
49
27
|
|
28
|
+
## Examples
|
29
|
+
|
30
|
+
**Example 1.** Fetching page's text and metadata:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
api = MediaWiktory::Wikipedia::Api.new
|
34
|
+
response = api.query. # "query" action is a basis for all pages/categories/meta receiving
|
35
|
+
titles('Argentina'). # query page titles: Argentina
|
36
|
+
prop(:info, :revisions). # query page properties: info, revisions
|
37
|
+
prop(:url, :content). # query those properties subproperties: full URL (from info) and content (from revisions)
|
38
|
+
response # perform query and parse it!
|
39
|
+
|
40
|
+
page = response['pages'].values.first
|
41
|
+
puts page['title']
|
42
|
+
# Prints:
|
43
|
+
# Argentina
|
44
|
+
puts page['fullurl']
|
45
|
+
# Prints:
|
46
|
+
# https://en.wikipedia.org/wiki/Argentina
|
47
|
+
puts page['revisions'].first['*'].slice(0..200) # first 200 chars of page contents
|
48
|
+
# Prints:
|
49
|
+
# {{other uses}}
|
50
|
+
# {{pp-semi|small=yes}}
|
51
|
+
# {{Use dmy dates|date=March 2017}}
|
52
|
+
# {{Coord|34|S|64|W|display=title}}
|
53
|
+
# {{Infobox country
|
54
|
+
# |coordinates = {{Coord|34|36|S|58|23|W|type:city}}
|
55
|
+
# |conventional_long_name = A
|
50
56
|
```
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
57
|
+
|
58
|
+
Note, that for using MediaWiktory API wrapper you need to understand the underlying API. While previous
|
59
|
+
experience might make you expect something like `api.page('Argentina').text`, in fact you should
|
60
|
+
use the `query` action, request page title 'Argentina', its `:revisions` property, its `:content`
|
61
|
+
subproperty—and voila, you have a _1-element list of revisions_ for the page and last revisions `'*'`
|
62
|
+
key has page's text.
|
63
|
+
|
64
|
+
The good news is all methods are documented at [RubyDoc.info](http://www.rubydoc.info/gems/mediawiktory).
|
65
|
+
Most of the time, the documentation has enough details, so you don't need to refer to MediaWiki
|
66
|
+
official docs.
|
67
|
+
|
68
|
+
**Example 2:** Editing the page (we are editing [Sandbox](https://en.wikipedia.org/wiki/Wikipedia:Sandbox)
|
69
|
+
here, which is safe, but be careful while experimenting, this code **really** replaces page's text!):
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
token = api.query.meta(:tokens).response.dig('tokens', 'csrftoken')
|
73
|
+
response = api.edit.title('Wikipedia:Sandbox').text("Test '''me''', MediaWiktory!").token(token).response
|
74
|
+
response.to_h
|
75
|
+
# => {"result"=>"Success", "pageid"=>16283969, "title"=>"Wikipedia:Sandbox", "contentmodel"=>"wikitext", "oldrevid"=>779502714, "newrevid"=>779502729, "newtimestamp"=>"2017-05-09T08:24:26Z"}
|
76
|
+
|
77
|
+
# This, without token, will raise:
|
78
|
+
api.edit.title('Wikipedia:Sandbox').text("Test '''me''', MediaWiktory without token!").response
|
79
|
+
# MediaWiktory::Wikipedia::Response::Error: The "token" parameter must be set.
|
58
80
|
```
|
59
81
|
|
60
|
-
**
|
61
|
-
on-the-fly, and without `gcm` and `rv` prefixes black magic:
|
82
|
+
**Example 3:** Fetching all "main" page images for the pages of category:
|
62
83
|
|
63
84
|
```ruby
|
64
|
-
|
85
|
+
response = api.query. # "query" action again
|
86
|
+
generator(:categorymembers). # instead of listing titles, we use "page list generator": all members of a category
|
87
|
+
title('Category:1960s_automobiles'). # ...of this category
|
88
|
+
prop(:pageimages).prop(:thumbnail). # and fetch "pageimages" property, its "thumbnail" sub-property
|
89
|
+
limit('max'). # limit to maximum number of pages available in one response
|
90
|
+
response
|
91
|
+
|
92
|
+
# You can fetch ALL of them with, it will be a lot:
|
93
|
+
# response = response.continue while response.continue?
|
94
|
+
|
95
|
+
response.to_h['pages'].values.each do |page|
|
96
|
+
puts "#{page['title']}: #{page.dig('thumbnail', 'source')}"
|
97
|
+
end
|
98
|
+
# AC Cobra: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Shelby_AC_427_Cobra_vl_blue.jpg/50px-Shelby_AC_427_Cobra_vl_blue.jpg
|
99
|
+
# Acadian (automobile):
|
100
|
+
# Alfa Romeo 33 Stradale: https://upload.wikimedia.org/wikipedia/commons/thumb/e/eb/1968_Alfa_Romeo_Tipo_33_Stradale.jpg/50px-1968_Alfa_Romeo_Tipo_33_Stradale.jpg
|
101
|
+
# Alfa Romeo 105/115 Series Coupés: https://upload.wikimedia.org/wikipedia/commons/thumb/8/81/Alfa_Romeo_GT_1300_Junior.jpg/50px-Alfa_Romeo_GT_1300_Junior.jpg
|
102
|
+
# Alfa Romeo 1750 Berlina: https://upload.wikimedia.org/wikipedia/commons/thumb/2/20/Alfa_Romeo_1750_berlina_grey-front.JPG/50px-Alfa_Romeo_1750_berlina_grey-front.JPG
|
103
|
+
# Alfa Romeo 2000: https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/Alfa_2000_touring_spider.JPG/50px-Alfa_2000_touring_spider.JPG
|
104
|
+
# Alfa Romeo 2600: https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/Alfa-Romeo_2600-Spider-Touring.JPG/50px-Alfa-Romeo_2600-Spider-Touring.JPG
|
105
|
+
# ...
|
106
|
+
```
|
107
|
+
|
108
|
+
## Usage
|
65
109
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
110
|
+
```
|
111
|
+
gem install mediawiktory
|
112
|
+
```
|
113
|
+
|
114
|
+
There are a lot of popular installations of MediaWiki besides Wikipedia. All of them are having
|
115
|
+
different versions installed with different features enabled and custom extensions turned on.
|
116
|
+
|
117
|
+
To catch with this multitude of features, MediaWiktory provides two ways of usage.
|
71
118
|
|
72
|
-
|
73
|
-
response.continue! while response.can_continue?
|
119
|
+
### 1. Use default wrapper, generated from English Wikipedia:
|
74
120
|
|
75
|
-
|
76
|
-
|
121
|
+
```ruby
|
122
|
+
require 'mediawiktory'
|
123
|
+
api = MediaWiktory::Wikipedia::Api.new # => English Wikipedia
|
124
|
+
# or
|
125
|
+
api = MediaWiktory::Wikipedia::Api.new('http://some.site/w/api.php') # => any other MediaWiki
|
77
126
|
```
|
78
127
|
|
79
|
-
|
80
|
-
|
128
|
+
...and wonder through docs of [MediaWiktory::Wikipedia::Api](http://www.rubydoc.info/gems/mediawiktory/MediaWiktory/Wikipedia/Api)
|
129
|
+
class to understand what you can do.
|
130
|
+
|
131
|
+
### 2. Custom wrapper generation.
|
132
|
+
```
|
133
|
+
mediawiktory-gen -u http://some.site/w/api.php --path lib/path/to/wrapper --namespace My::Wrapper
|
134
|
+
```
|
135
|
+
This will generate `My::Wrapper::Api` class and a lot of other classes wrapping all actions and
|
136
|
+
modules of target APIs. The generated code is **independent** of MediaWiktory (so you can exclude it
|
137
|
+
from your runtime), and depends only on `addressable`, `faraday` and `faraday_middleware` gems.
|
81
138
|
|
82
|
-
|
83
|
-
example, above statement definitely **wants** to look like
|
139
|
+
The usage of custom wrapper is basically the same:
|
84
140
|
|
85
141
|
```ruby
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
limit(30).
|
90
|
-
prop(revisions: :content).
|
91
|
-
perform
|
142
|
+
require 'path/to/wrapper/api'
|
143
|
+
api = My::Wrapper::Api.new
|
144
|
+
api.query # .and.so.on
|
92
145
|
```
|
93
146
|
|
94
|
-
|
147
|
+
You need custom wrapper if:
|
148
|
+
|
149
|
+
* you want to have the exact list of features your site has: for example, with Wikia sites, most of
|
150
|
+
generic functionality (like query and edit) will work, but most of fancy modern Wikipedia actions
|
151
|
+
will fail with "unknown action";
|
152
|
+
* your target site has some custom actions and modules: for example, most informative Wikidata actions
|
153
|
+
are custom ones, like [wbgetentities](https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities),
|
154
|
+
they are not present in default wrapper;
|
155
|
+
* you want to catch up with some edge Wikipedia features; Wikipedia wrapper is generated on gem
|
156
|
+
release, but Wikipedia's API changes everyday with new small and large exerimental features.
|
157
|
+
|
158
|
+
**Generator limitations:** Wrapper is generated from [HTML docs of API](en.wikipedia.org/w/api.php),
|
159
|
+
but currently generator can't process old MediaWiki versions ASCII docs format, which, unfortunately,
|
160
|
+
is stil in use on [Wikia](https://marvel.wikia.com/api.php), for example. It is subject to further
|
161
|
+
development, as some "old" installations of MediaWiki provide pretty useful content and a lot of
|
162
|
+
custom modules.
|
163
|
+
|
164
|
+
If you integrate wrapper generated by MediaWiktory into some other library, you should note that:
|
165
|
+
|
166
|
+
* All generated code is documented in YARD format, Markdown markup flavour;
|
167
|
+
* If you use Rubocop, you will find some "good code" practices broken in generated code, because it
|
168
|
+
is hard to follow them in large code generation.
|
169
|
+
|
170
|
+
## Roadmap
|
171
|
+
|
172
|
+
* Expose underlying Faraday client for fine-tuning;
|
173
|
+
* Handle cookies automatically (for logging in);
|
174
|
+
* Handle file uploads (should be done as multipart, use appropriate Faraday middleware);
|
175
|
+
* Add parser for outdated ASCII docs.
|
95
176
|
|
96
177
|
## Authors
|
97
178
|
|
98
179
|
* [Victor Shepelev](https://zverok.github.io) [@zverok](https://github.com/zverok);
|
99
|
-
*
|
180
|
+
* Serhiy Mostovyi [@smostovoy](https://github.com/smostovoy).
|
100
181
|
|
101
182
|
## License
|
102
183
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
options = {}
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner =
|
8
|
+
"Usage: mediawiktory-gen [options]\n\n"\
|
9
|
+
"Generates MediaWiki API wrapper Ruby code for specified site in specified folder and namespace.\n"\
|
10
|
+
"Note that all previous content of the folder will be removed.\n\n"\
|
11
|
+
|
12
|
+
opts.on("-uURL", "--url=URL", "Source URL for option parsing. Typically it is http://some.domain/w/api.php.") do |u|
|
13
|
+
options[:url] = u
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on("-nNAMESPACE", "--name=NAMESPACE", "Namespace which should include all the newly-generated classes and modules.") do |n|
|
17
|
+
options[:namespace] = n
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-pPATH", "--path=PATH", "Path where to store new modules and classes. Note that there would be dozens of them, and that previous content of the folder will be removed.") do |p|
|
21
|
+
options[:path] = p
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on("-h", "--help", "Prints this help") do
|
25
|
+
puts opts
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
end.parse!
|
29
|
+
|
30
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
31
|
+
require_relative '../lib/mediawiktory/generator'
|
32
|
+
|
33
|
+
MediaWiktory::Generator
|
34
|
+
.new(options[:url])
|
35
|
+
.generate(path: options[:path], namespace: options[:namespace])
|
data/lib/media_wiktory.rb
CHANGED
data/lib/mediawiktory.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
|
2
|
-
require 'faraday'
|
3
|
-
require 'faraday_middleware'
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
3
|
+
# MediaWiktory is wrapper and wrapper generator for [MediaWiki API](https://www.mediawiki.org/wiki/API:Main_page).
|
4
|
+
#
|
5
|
+
# There are two ways of using MediaWiktory:
|
6
|
+
#
|
7
|
+
# 1. Either to generate your own wrapper (see {file:README.md} for explanations why and how to do it), or
|
8
|
+
# 2. By using default wrapper, generated from recent Wikipedia docs, see {MediaWiktory::Wikipedia::Api}.
|
9
|
+
# Note, that most of basic features (like "query some pages") of default wrapper could be used
|
10
|
+
# with **any** MediaWiki installation, but more advanced features could work differently. Please
|
11
|
+
# refer to {file:README.md} for more detailed explanation of those matters.
|
12
|
+
#
|
5
13
|
module MediaWiktory
|
6
|
-
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
Dir[File.expand_path('../mediawiktory/generated/*.rb', __FILE__)].each do |gen|
|
11
|
-
require gen
|
12
|
-
end
|
13
|
-
|
14
|
-
%w[query].each do |mod|
|
15
|
-
require_relative "mediawiktory/#{mod}"
|
16
|
-
end
|
14
|
+
require_relative 'mediawiktory/version'
|
15
|
+
require_relative 'mediawiktory/wikipedia/api'
|
17
16
|
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'nokogiri' # FIXME: catch if unavailable
|
4
|
+
require 'nokogiri/more'
|
5
|
+
require 'hashie'
|
6
|
+
require 'addressable'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'pp'
|
9
|
+
require 'mediawiktory/version'
|
10
|
+
|
11
|
+
require_relative 'generator/renderable'
|
12
|
+
|
13
|
+
# @private
|
14
|
+
class Object
|
15
|
+
# Just a loosy implementation of Ruby 2.3's `&.` operator
|
16
|
+
# It is used only in generator and will not pollute your scopes.
|
17
|
+
def _n
|
18
|
+
self
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# @private
|
23
|
+
class NilClass
|
24
|
+
class BlackHole
|
25
|
+
def method_missing(*) # rubocop:disable Style/MethodMissing
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def _n
|
31
|
+
BlackHole.new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
module MediaWiktory
|
36
|
+
# @private
|
37
|
+
# Used only by mediawiktory-gen, should not be necessary to read :)
|
38
|
+
class Generator
|
39
|
+
class BaseAction
|
40
|
+
def initialize(api)
|
41
|
+
@api = api
|
42
|
+
end
|
43
|
+
|
44
|
+
include Renderable
|
45
|
+
|
46
|
+
def main_template
|
47
|
+
'action.rb'
|
48
|
+
end
|
49
|
+
|
50
|
+
def main
|
51
|
+
@api.main
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class Client
|
56
|
+
include Renderable
|
57
|
+
|
58
|
+
def main_template
|
59
|
+
'client.rb'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Response
|
64
|
+
include Renderable
|
65
|
+
|
66
|
+
def main_template
|
67
|
+
'response.rb'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def initialize(url)
|
72
|
+
@api = Api.from_url(url)
|
73
|
+
@url = url
|
74
|
+
end
|
75
|
+
|
76
|
+
def generate(path:, namespace:)
|
77
|
+
opts = {
|
78
|
+
namespace: namespace,
|
79
|
+
version: VERSION,
|
80
|
+
source: @url,
|
81
|
+
friendly_date: Time.now.strftime('%B %d, %Y')
|
82
|
+
}
|
83
|
+
FileUtils.rm_rf path
|
84
|
+
FileUtils.mkdir_p path
|
85
|
+
|
86
|
+
BaseAction.new(@api).render_to(File.join(path, 'actions/base.rb'), opts)
|
87
|
+
Client.new.render_to(File.join(path, 'client.rb'), opts)
|
88
|
+
Response.new.render_to(File.join(path, 'response.rb'), opts)
|
89
|
+
|
90
|
+
@api.render_to(File.join(path, 'api.rb'), opts)
|
91
|
+
@api.render_to(File.join(path, 'actions.rb'), opts.merge(template: 'actions.rb'))
|
92
|
+
@api.actions.each do |a|
|
93
|
+
a.render_to(File.join(path, "actions/#{a.name}.rb"), opts)
|
94
|
+
end
|
95
|
+
@api.non_actions.each do |a|
|
96
|
+
a.render_to(
|
97
|
+
File.join(path, "modules/#{a.name}.rb"),
|
98
|
+
opts.merge(template: 'module_class.rb')
|
99
|
+
)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
require_relative 'generator/api'
|
106
|
+
require_relative 'generator/param'
|
107
|
+
require_relative 'generator/module'
|