class Pastebinrb::Pastebin

Constants

BASE_URL

Attributes

devkey[R]

Public Class Methods

new( devkey ) click to toggle source
# File lib/pastebinrb.rb, line 11
def initialize( devkey )
  @devkey = devkey
end

Public Instance Methods

get_raw(link) click to toggle source
# File lib/pastebinrb.rb, line 27
def get_raw(link)
  Net::HTTP.get_response(URI.parse("#{BASE_URL}/raw/#{link[/[\w]+$/]}")).body
end
paste_content( content, **options ) click to toggle source
# File lib/pastebinrb.rb, line 15
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