class Ring::SQA::Paste

Public Class Methods

add(string) click to toggle 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

add(string, url=CFG.paste.url) click to toggle source
# File lib/ring/sqa/paste.rb, line 13
def add string, url=CFG.paste.url
  paste string, url
end

Private Instance Methods

paste(string, url) click to toggle 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