blob: b212aed38f99503b79781cc51f1d7c9574297413 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://localhost:4568/login")
header = {'Content-Type': 'text/json'}
print "Username: "; un = gets.strip
print "Ticket: "; t = gets.strip
login = {
"username": un,
"ticket": t
}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = login.to_json
response = http.request(request)
puts response.body
|