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

Version Path
ring-sqa-0.4.3 lib/ring/sqa/paste.rb
ring-sqa-0.4.2 lib/ring/sqa/paste.rb
ring-sqa-0.4.1 lib/ring/sqa/paste.rb
ring-sqa-0.3.1 lib/ring/sqa/paste.rb
ring-sqa-0.3.0 lib/ring/sqa/paste.rb
ring-sqa-0.2.2 lib/ring/sqa/paste.rb
ring-sqa-0.2.1 lib/ring/sqa/paste.rb
ring-sqa-0.2.0 lib/ring/sqa/paste.rb
ring-sqa-0.1.12 lib/ring/sqa/paste.rb
ring-sqa-0.1.11 lib/ring/sqa/paste.rb
ring-sqa-0.1.10 lib/ring/sqa/paste.rb
ring-sqa-0.1.9 lib/ring/sqa/paste.rb
ring-sqa-0.1.8 lib/ring/sqa/paste.rb
ring-sqa-0.1.7 lib/ring/sqa/paste.rb
ring-sqa-0.1.6 lib/ring/sqa/paste.rb
ring-sqa-0.1.5 lib/ring/sqa/paste.rb
ring-sqa-0.1.4 lib/ring/sqa/paste.rb
ring-sqa-0.1.3 lib/ring/sqa/paste.rb
ring-sqa-0.1.2 lib/ring/sqa/paste.rb
ring-sqa-0.1.1 lib/ring/sqa/paste.rb