Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "typhoeus"
- require "json"
- require "./Constants"
- include Constants
- include Typhoeus
- class Gist
- def build_gist
- gist = { :description => "This is a test",
- :public => true,
- :files => { "file1.txt" => { :content => "Testing a sample string" } }
- }
- json = JSON.pretty_generate(gist)
- puts json
- return json
- end
- def send_gist(gist)
- url = BASE_URL + "/gists"
- request = Request.new(url, :username => USERNAME,
- :password => PASSWORD,
- :method => :post,
- :body => gist)
- puts request.params
- hydra = Hydra.hydra
- hydra.queue(request)
- hydra.run
- response = request.response
- puts response.body
- end
- end
- gist = Gist.new
- gist.send_gist(gist.build_gist)
Add Comment
Please, Sign In to add comment