Created
October 30, 2011 01:45
-
-
Save runemadsen/1325353 to your computer and use it in GitHub Desktop.
Creating a repo via the Github API and HTTParty
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
class Github | |
include HTTParty | |
base_uri 'https://api.github.com' | |
end | |
Github.post("/user/repos", :query => { | |
:access_token => @token | |
}, | |
:body => { | |
:name => name, | |
:description => "Reop description", | |
:homepage => "http://mysite.com", | |
:public => true, | |
:has_issues => false, | |
:has_wiki => false, | |
:has_downloads => false | |
}.to_json) |
@uri sorry this came 2 years late..
For POST, PATCH, PUT, and DELETE requests, parameters not included in the URL should be encoded as JSON with a Content-Type of ‘application/json’:
according to github api
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why does body need the .to_json?