class Rlsgem
Public Class Methods
cut(url)
click to toggle source
# File lib/rlsgem.rb, line 5 def self.cut(url) if !url return "Usage: Rlsgem.cut('http://some.long.web/site')" else postData = Net::HTTP.post_form(URI.parse('http://rls.io/u'), {'url'=>"#{url}"}) body = JSON.parse(postData.body) return body["url"] end end
paste_file(title, file)
click to toggle source
# File lib/rlsgem.rb, line 15 def self.paste_file(title, file) if !title || !file return "Usage: Rlsgem.paste_file('Awesome File', '/home/john/christmasgifts.rb')" else pasteData = File.read(file) postData = Net::HTTP.post_form(URI.parse('http://rls.io/p'), {'title'=>"#{title}",'content'=>"#{pasteData}"}) body = postData.body.gsub(/^...................................|...............................$/,'') return body end end