aboutsummaryrefslogtreecommitdiff
path: root/3.1/get_mail.rb
diff options
context:
space:
mode:
Diffstat (limited to '3.1/get_mail.rb')
-rwxr-xr-x3.1/get_mail.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/3.1/get_mail.rb b/3.1/get_mail.rb
new file mode 100755
index 0000000..b212aed
--- /dev/null
+++ b/3.1/get_mail.rb
@@ -0,0 +1,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