Class: Privatepaste
Instance Method Summary collapse
- #get_raw ⇒ Object
-
#initialize(options) ⇒ Privatepaste
constructor
A new instance of Privatepaste.
- #paste ⇒ Object
Constructor Details
#initialize(options) ⇒ Privatepaste
Returns a new instance of Privatepaste.
13 14 15 |
# File 'lib/privatepaste.rb', line 13 def initialize() = end |
Instance Method Details
#get_raw ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/privatepaste.rb', line 33 def get_raw ["secure_paste_key"] = "" if ! ["secure_paste_key"] url = "https://privatepaste.com/" + "download/" + ["link"].split("/")[3] + "/" + ["secure_paste_key"] clnt = HTTPClient.new(:agent_name => 'ruby privatepaste gem') clnt.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE clnt.get_content(url) end |
#paste ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/privatepaste.rb', line 17 def paste if .has_key?("paste_content") if ["paste_content"] == "-" ["paste_content"] = $stdin.read else File.open(["paste_content"]) do |file| ["paste_content"] = file.read end end end clnt = HTTPClient.new clnt.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE res = clnt.post("https://privatepaste.com/save", ).header['location'][0] "https://privatepaste.com" + res end |