Encurtar URL com Ruby

PHOTO EMBED

Sun Jun 05 2022 15:28:39 GMT+0000 (Coordinated Universal Time)

Saved by @canas #ruby

require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://dink.ga/api/criarURL")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = "{\n\t\"url\": \"https://example.com\"\n}"

response = http.request(request)
puts response.read_body
content_copyCOPY