class Bot

Public Class Methods

new(slug, token) click to toggle source
# File lib/mebots.rb, line 17
def initialize(slug, token)
    @slug = slug
    @token = token
end

Public Instance Methods

get(endpoint) click to toggle source
# File lib/mebots.rb, line 22
def get(endpoint)
    uri = URI(@@HOST + @@API_ROOT + endpoint + "?token=#{@token}")

    Net::HTTP.start(uri.host, uri.port,
        :use_ssl => uri.scheme == "https") do |http|
        req = Net::HTTP::Get.new(uri)

        return JSON.parse(http.request(req).body)
    end
end
instance(group_id) click to toggle source
# File lib/mebots.rb, line 33
def instance(group_id)
    return Instance.new(get("bot/#{@slug}/instance/#{group_id}"))
end