Sha256: 792d75119fd8d8b3c079f40b02a60265c604865609a29e482eb83bb5b01dfa31

Contents?: true

Size: 783 Bytes

Versions: 1

Compression:

Stored size: 783 Bytes

Contents

require 'bukin/utils'
require 'json'

# BukGet api
# Docs: http://bukget.org/pages/docs/API3.html
BUKGET_API = "http://api.bukget.org/3"

class Bukin::Bukget
    attr_accessor :api_url

    def initialize(url = BUKGET_API)
        @api_url = url
    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

    def resolve_version(name, version, server)
        info(name, version, server)['versions'][0]['version']
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bukin-0.1.0 lib/bukin/providers/bukget.rb