Sha256: ded6cc331a5fe843fb722d754af08b2c6887066d77c539a578bab0ea143ca74e
Contents?: true
Size: 613 Bytes
Versions: 25
Compression:
Stored size: 613 Bytes
Contents
require 'net/http' module Ring class SQA class Paste def self.add string Paste.new.add string rescue => error "paste raised '#{error.class}' with message '#{error.message}'" end def add string, url=CFG.paste.url paste string, url end private 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 end end end
Version data entries
25 entries across 25 versions & 1 rubygems