class Ring::SQA::Paste
Public Class Methods
Source
# File lib/ring/sqa/paste.rb, line 7 def self.add string Paste.new.add string rescue => error "paste raised '#{error.class}' with message '#{error.message}'" end
Public Instance Methods
Source
# File lib/ring/sqa/paste.rb, line 13 def add string, url=CFG.paste.url paste string, url end
Private Instance Methods
Source
# File lib/ring/sqa/paste.rb, line 19 def paste string, url uri = URI.parse url http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == 'https' rslt = http.post uri.path, URI.encode_www_form([['content',string], ['ttl','604800']]) uri.path = rslt.fetch('location') uri.to_s end