Module: Mmi::ModrinthApi

Defined in:
lib/mmi/modrinth_api.rb

Constant Summary collapse

BASE_URL =
URI('https://api.modrinth.com/v2/')

Class Method Summary collapse

Class Method Details

.project_versions(mod_slug, loader: nil, game_version: nil) ⇒ Object



9
10
11
# File 'lib/mmi/modrinth_api.rb', line 9

def project_versions(mod_slug, loader: nil, game_version: nil)
	JSON.parse((BASE_URL + "project/#{mod_slug}/version?#{URI.encode_www_form(loaders: (%Q{["#{loader}"]} if loader), game_versions: (%Q{["#{game_version}"]} if game_version))}").open.read)
end