Sha256: a44d245850dce8ee2fe4eeecc2d91a3d5fcac0cbc65ba3078804bc3988af3581
Contents?: true
Size: 772 Bytes
Versions: 7
Compression:
Stored size: 772 Bytes
Contents
require "pastebinrb/version" require "pastebinrb/expiration" require 'net/http' module Pastebinrb class Pastebin BASE_URL = "https://pastebin.com" attr_reader :devkey def initialize( devkey ) @devkey = devkey end def paste_content( content, **options ) params = { :api_dev_key => @devkey, :api_option => "paste", :api_paste_name => options[:title], :api_paste_format => options[:format], :api_paste_expire_date => options[:expire_delay], :api_paste_code => content } Net::HTTP.post_form(URI.parse("#{BASE_URL}/api/api_post.php"), params).body end def get_raw(link) Net::HTTP.get_response(URI.parse("#{BASE_URL}/raw/#{link[/[\w]+$/]}")).body end end end
Version data entries
7 entries across 7 versions & 1 rubygems