Skip to content

Instantly share code, notes, and snippets.

@kavu
Created June 13, 2011 17:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kavu/1023207 to your computer and use it in GitHub Desktop.
Save kavu/1023207 to your computer and use it in GitHub Desktop.
Net::HTTP::Patch
require 'net/http'
require 'json'
class Net::HTTP::Patch < Net::HTTPRequest
METHOD = 'PATCH'
REQUEST_HAS_BODY = true
RESPONSE_HAS_BODY = true
end
url = URI.parse('https://api.github.com/user')
req = Net::HTTP::Patch.new(url.path)
req.add_field("Authorization","token MY OAUTH TOKEN HERE")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
res = http.start { |h| h.request req, {:bio => "Some test bio"}.to_json }
puts res.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment