Class: Luogu::AIUI
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.request(text: nil, uid: SecureRandom.hex(16)) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/luogu/aiui.rb', line 11 def request(text: nil, uid: SecureRandom.hex(16)) response = HTTP.post(config.request_url, json: { appid: config.id, appkey: config.key, uid: uid, text: text }) if response.code == 200 config.parse.call(response) else raise RequestError, response.body.to_s end end |