Skip to content

Instantly share code, notes, and snippets.

@moro
Created January 4, 2012 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moro/1558264 to your computer and use it in GitHub Desktop.
Save moro/1558264 to your computer and use it in GitHub Desktop.
sending PATCH request to GH API v3
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)
}
@moro
Copy link
Author

moro commented Jan 4, 2012

see line 17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment