Skip to content

Instantly share code, notes, and snippets.

@moro
Created January 4, 2012 03:05
Show Gist options
  • Select an option

  • Save moro/1558264 to your computer and use it in GitHub Desktop.

Select an option

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

moro commented Jan 4, 2012

Copy link
Copy Markdown
Author

see line 17.

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