mirror of
https://github.com/mii443/rbot.git
synced 2025-09-02 15:09:41 +00:00
Added "shorten" command
This commit is contained in:
@ -27,4 +27,14 @@ def get_json(location, limit = 10)
|
||||
puts [uri.to_s, e.class, e].join(" : ")
|
||||
# handle error
|
||||
end
|
||||
end
|
||||
|
||||
def post_json(location, json)
|
||||
uri = URI.parse(location)
|
||||
https = Net::HTTP.new(uri.host, uri.port)
|
||||
https.use_ssl = true
|
||||
req = Net::HTTP::Post.new(uri.request_uri)
|
||||
req["Content-Type"] = "application/json"
|
||||
req.body = json
|
||||
return https.request(req)
|
||||
end
|
Reference in New Issue
Block a user