class PasteBin

Attributes

api_key[R]

Public Class Methods

new(api_key) click to toggle source
# File lib/pastey.rb, line 7
def initialize(api_key)
  @api_key = api_key
end

Public Instance Methods

send(file, name, format) click to toggle source
# File lib/pastey.rb, line 11
def send(file, name, format)
  Net::HTTP.post_form(
    URI.parse('http://pastebin.com/api/api_post.php'),
    {
      "api_paste_code" => file,
      "api_option" => "paste",
      "api_dev_key" => api_key,
      "api_paste_name" => name
    }
  ).body
end