diff options
-rwxr-xr-x | social | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -22,6 +22,20 @@ def post path, body puts(response.body, response.code) end +def get path + uri = URI.parse(File.join SOCIAL_URL, path) + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + header = { 'Accept' => 'text/plain' } + request = Net::HTTP::Get.new(uri.request_uri, header) + usr = File.read(".usr").chomp + pwd = File.read(".pwd").chomp + request.basic_auth(usr, pwd) + response = http.request(request) + # TODO return error if response.code > 400 + puts(response.code, response.body) +end + # cmd = ARGV.shift case ARGV.shift when "post" @@ -30,4 +44,6 @@ when "follow" post "follow", ARGV.join(" ") when "unfollow" post "unfollow", ARGV.join(" ") +when "inbox" + get "inbox" end |