require "lwqzx/version" require 'rest-client' require 'json' module Lwqzx def self.auth(login,passwd) lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/core/jslogin.php" res = ::RestClient.post lurl,{login: login, password: passwd} hsh = ::JSON.parse(res.body) return {} if hsh["name"].empty? login = hsh["login"] name = hsh["name"] groups = hsh["user_group"] return {login: login, name: name, groups: groups} end end