Created
January 4, 2012 03:05
-
-
Save moro/1558264 to your computer and use it in GitHub Desktop.
sending PATCH request to GH API v3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pp' | |
require 'json' | |
require 'net/https' | |
https = Net::HTTP.new('api.github.com', 443) | |
https.use_ssl = true | |
https.ca_path = '/etc/ssl/certs' | |
https.verify_mode = OpenSSL::SSL::VERIFY_PEER | |
https.verify_depth = 5 | |
https.start { | |
req = Net::HTTP::Post.new('/repos/myorg/secret/issues/42') | |
req.basic_auth 'me', 'my-password' | |
req.content_type = 'application/json' | |
req.body = JSON.dump( | |
_method: 'PATCH', | |
labels: ['DONE'], | |
) | |
response = https.request(req) | |
pp JSON.parse(response.body) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see line 17.