rendered paste body#!/usr/bin/ruby
require 'net/http'
class PasteBin
attr_reader :file
attr_reader :code
def initialize(file)
@file = file
@code = nil
end
def getCode
File.open(@file, "r") do |file|
file.each_line { |line| @code = "#@code" + line }
end
end
def sendCode
Net::HTTP.start('pastebin.ca') do |http|
@response = http.post("/new.php", "content=#@code&description=&type=1&expiry=&name=&s=Submit+Post")
end
end
def getLink
puts @response
#puts(@reaponse.slice(/!\http\:\/\/pastebin\.ca\//))
end
end
paste = PasteBin.new(ARGV[0])
paste.getCode
paste.sendCode
paste.getLink