module MediaWiki::Query::Meta::FileRepoInfo

@see www.mediawiki.org/wiki/API:Filerepoinfo MediaWiki Filerepoinfo API Docs

Public Instance Methods

get_filerepo_favicons() click to toggle source

Gets the repository names and their according favicon URLs. @since 0.7.0 @return [Hash<String, String>] Names as the keys, with their favicons as the values.

# 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() click to toggle source

Returns an array of all the wiki's file repository names. @since 0.1.0 @return [Hash<String, String>] All wiki's file repository names. Keys are names, values are display names.

# 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() click to toggle source

Gets the root URLs for the file repositories. @since 0.7.0 @return [Hash<String, String>] A hash containing keys of the names, and values of the root URLs.

# 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() click to toggle source

Gets the repository names and their accoring thumbnail URLs. @since 0.7.0 @return [Hash<String, String>] Names as the keys, with their URLs as the values.

# 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() click to toggle source

Gets the repository names and their according URLs. @since 0.7.0 @return [Hash<String, String>] Names as the keys, with their URLs as the values.

# 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) click to toggle source

Gets FileRepoInfo for the property. @param prop [String] The friprop to get. @since 0.7.0 @return [Hash] The full parsed response.

# 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() click to toggle source

Gets an array containing all local repositories. @since 0.7.0 @return [Array<String>] All repository names that are marked as local.

# 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() click to toggle source

Gets an array containing all repositories that aren't local. @since 0.7.0 @return [Array<String>] All repositories that are not marked as local.

# 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