require 'bukin/utils' require 'json' # BukGet api # Docs: http://bukget.org/pages/docs/API3.html class Bukin::Bukget attr_reader :url def initialize(url = 'http://api.bukget.org') @url = url end def api_url "#{url}/3" end def download(name, version, server) server = 'bukkit' if server == 'craftbukkit' url = "#{api_url}/plugins/#{server}/#{name}/#{version}/download" download_file(url, true) end def info(name, version, server) server = 'bukkit' if server == 'craftbukkit' url = "#{api_url}/plugins/#{server}/#{name}/#{version}" JSON.parse(open(url).read) end end