Skip to content

Instantly share code, notes, and snippets.

@shutingrz
Last active October 13, 2016 11:55
Show Gist options
  • Save shutingrz/adc388e2890522affa84a129487c68d9 to your computer and use it in GitHub Desktop.
Save shutingrz/adc388e2890522affa84a129487c68d9 to your computer and use it in GitHub Desktop.
require 'net/http'
require 'uri'
require 'openssl'
def write(msg)
token = '' # token
url = URI.parse('https://notify-api.line.me/api/notify')
req = Net::HTTP::Post.new(url.path)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
req['Authorization'] = 'Bearer ' + token
req.set_form_data({'message' => msg}, ';')
http.start do |h|
http.request(req)
end
end
write("5秒かぞえま~すwww")
for num in 1..5 do
write(num)
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment