Module: MediaWiki::Query::Meta::FileRepoInfo
- Included in:
- Butt, MediaWiki::Query::Meta
- Defined in:
- lib/mediawiki/query/meta/filerepoinfo.rb
Overview
Instance Method Summary collapse
-
#get_filerepo_favicons ⇒ Hash<String, String>
Gets the repository names and their according favicon URLs.
-
#get_filerepo_names ⇒ Hash<String, String>
Returns an array of all the wiki’s file repository names.
-
#get_filerepo_rooturls ⇒ Hash<String, String>
Gets the root URLs for the file repositories.
-
#get_filerepo_thumburls ⇒ Hash<String, String>
Gets the repository names and their accoring thumbnail URLs.
-
#get_filerepo_urls ⇒ Hash<String, String>
Gets the repository names and their according URLs.
-
#get_filerepoinfo(prop) ⇒ Hash
Gets FileRepoInfo for the property.
-
#get_local_filerepos ⇒ Array<String>
Gets an array containing all local repositories.
-
#get_nonlocal_filerepos ⇒ Array<String>
Gets an array containing all repositories that aren’t local.
Instance Method Details
#get_filerepo_favicons ⇒ Hash<String, String>
Gets the repository names and their according favicon URLs.
77 78 79 80 81 82 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 77 def get_filerepo_favicons response = get_filerepoinfo('name|favicon') ret = {} response['query']['repos'].each { |h| ret[h['name']] = h['favicon'] } ret end |
#get_filerepo_names ⇒ Hash<String, String>
Returns an array of all the wiki’s file repository names.
23 24 25 26 27 28 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 23 def get_filerepo_names response = get_filerepoinfo('name|displayname') ret = {} response['query']['repos'].each { |h| ret[h['name']] = h['displayname'] } ret end |
#get_filerepo_rooturls ⇒ Hash<String, String>
Gets the root URLs for the file repositories.
33 34 35 36 37 38 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 33 def get_filerepo_rooturls response = get_filerepoinfo('name|rootUrl') ret = {} response['query']['repos'].each { |h| ret[h['name']] = h['rootUrl'] } ret end |
#get_filerepo_thumburls ⇒ Hash<String, String>
Gets the repository names and their accoring thumbnail URLs.
67 68 69 70 71 72 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 67 def get_filerepo_thumburls response = get_filerepoinfo('name|thumbUrl') ret = {} response['query']['repos'].each { |h| ret[h['name']] = h['thumbUrl'] } ret end |
#get_filerepo_urls ⇒ Hash<String, String>
Gets the repository names and their according URLs.
57 58 59 60 61 62 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 57 def get_filerepo_urls response = get_filerepoinfo('name|url') ret = {} response['query']['repos'].each { |h| ret[h['name']] = h['url'] } ret end |
#get_filerepoinfo(prop) ⇒ Hash
Gets FileRepoInfo for the property.
10 11 12 13 14 15 16 17 18 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 10 def get_filerepoinfo(prop) params = { action: 'query', meta: 'filerepoinfo', friprop: prop } post(params) end |
#get_local_filerepos ⇒ Array<String>
Gets an array containing all local repositories.
43 44 45 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 43 def get_local_filerepos get_filerepoinfo('name|local')['query']['repos'].select { |h| h.key?('local') }.collect { |h| h['name'] } end |
#get_nonlocal_filerepos ⇒ Array<String>
Gets an array containing all repositories that aren’t local.
50 51 52 |
# File 'lib/mediawiki/query/meta/filerepoinfo.rb', line 50 def get_nonlocal_filerepos get_filerepoinfo('name|local')['query']['repos'].reject { |h| h.key?('local') }.collect { |h| h['name'] } end |