This is an unofficial ruby client for the Github API. The end goal is a complete, simple, and intuitive ruby API for all things Github.
This is an unofficial ruby client for the Github API. The end goal is a complete, simple, and intuitive ruby API for all things Github.
This is an unofficial ruby client for the GitHub API. The end goal is a complete, simple, and intuitive ruby API for all things Github.
Instantiate the client with basic auth:
gh = Ghee.basic_auth("rauhryan","password")Instantiate the client with auth token:
gh = Ghee.access_token("1234oijgakjioewj1o4oij")Create an OAuth access token:
user_name, password, scopes = "rauhryan", "secret", ["user","repo"]
token = Ghee.create_token(user_name, password, scopes)Create a client for github enterprise
gh = Ghee.access_token("your_token","https://foo.com")
gh = Ghee.basic_auth("your_user", "your_pass", "https://foo.com")List a user's gists:
gh.user('jonmagic').gistsList authenticated users gists:
gh.gistsList all public gists:
gh.gists.publicList the authenticated user's starred gists:
gh.gists.starredGet a single gist:
gist_id = "1393990"
gh.gists(gist_id)Create a gist (see docs for all possible params):
gh.gists.create({
:description => 'Ghee'
:public => true,
:files => {
'file1.txt' => {
:content => 'buttah yo bread'
}
}
})Edit a gist:
gh.gists("1393990").patch({
:files => {
'gistfile1.md' => {
:content => 'clarified I say'
}
}
})Star a gist:
gh.gists("1393990").starUnstar a gist:
gh.gists("1393990").unstarCheck if a gist is starred:
gh.gists("1393990").starred?Delete a gist:
gh.gists("1393990").destroyList comments for a gist:
gh.gists("1382919").commentsGet a single gist comment:
gh.gists.comments("1231414")Create a single gist comment:
gh.gists.comments("1231414").create({
:body => "new body"
})Patch a single gist comment:
gh.gists.comments("1231414").patch({
:body => "new body"
})Delete a comment for a gist:
gh.gists.comments("1231441").destroyGet a single repo:
gh.repos("rauhryan", "ghee")List pull requests on a repo (see List pull requests )
gh.repos("rauhryan", "ghee").pulls
gh.repos("rauhryan", "ghee").pulls({
:state => "closed" # optional
})Get a single pull request on a repo (see Get a single pull request )
gh.repos("rauhryan", "ghee").pulls(1097)Create a pull request (see Create a pull request )
gh.repos("rauhryan", "ghee").pulls.create({
:title=>"take my awesome code!",
:body=>"This code is so awesome. Let me tell you why...",
:base=>"master",
:head=>"octocat:awesomebranch"
})Update a pull request (see Update a pull request )
gh.repos("rauhryan", "ghee").pulls(1097).patch({:title=>"New title", :body=>"New body", :state=>"closed"})List commits on a pull request (see List commits a pull request )
gh.repos("rauhryan", "ghee").pulls(1097).commitsList files on a pull request (see List files a pull request )
gh.repos("rauhryan", "ghee").pulls(1097).filesGet if a pull request has been merged (see Get if a pull request has been merged )
gh.repos("rauhryan", "ghee").pulls(1097).merged? #=> trueMerge a pull request (see Merge a pull request )
gh.repos("rauhryan", "ghee").pulls(1097).merge!
gh.repos("rauhryan", "ghee").pulls(1097).merge!("It's like hitting the Merge Button(TM)")List commits on a repo:
gh.repos("rauhryan", "ghee").commits
gh.repos("rauhryan", "ghee").commits({
:sha => "awesome_branch" # optional
})
gh.repos("rauhryan", "ghee").commits( {
:path => "/path/to/file" # only commits containing this path
})Get a single commit:
gh.repos("rauhryan", "ghee").commits("sha")List commit comments for a repo:
gh.repos("rauhryan", "ghee").commentsList comments for a single commit:
gh.repos("rauhryan", "ghee").commits("sha").commentsCreate a commit comment:
gh.repos("rauhryan", "ghee").commits("sha").comments.create({
:body => "sweet codez yo!", #required
:commit_id => "sha", #required
:line => 123, #required
:path => "/path/to/file", #required
:position => 4 #required
})Get a single commit comment:
gh.repos("rauhryan", "ghee").comments(123)Update a commit comment:
gh.repos("rauhryan", "ghee").comments(123).patch(:body => "new text")Destroy a commit comment:
gh.repos("rauhryan", "ghee").comments(123).destroyCompare two commits:
gh.repos("rauhryan", "ghee").compare("basesha","headsha")List a repos collaborators:
gh.repos("rauhryan", "ghee").collaboratorsGet a single collaborator:
gh.repos("rauhryan", "ghee").collaborators("herp") # => false
gh.repos("rauhryan", "ghee").collaborators("jonmagic") # => trueAdd a collaborator:
gh.repos("rauhryan", "ghee").collaborators.add("herp") # => trueRemove a collaborator:
gh.repos("rauhryan", "ghee").collaborators.remove("herp") # => trueList the hooks for a repo:
gh.repos("rauhryan", "ghee").forks
gh.repos("rauhryan", "ghee").forks(:sort => "newest") # => `newest`, `oldest`, `watchers`Create a fork:
gh.repos("rauhryan", "ghee").forks.create # => forks the repo to the authenticated userList the keys for a repo:
gh.repos("rauhryan", "ghee").keysGet a single key for a repo:
gh.repos("rauhryan", "ghee").keys(123)Create a key for a repo:
gh.repos("rauhryan", "ghee").keys.create({
:title => "customer deploy key",
:key => "ssh-rsa AAA ..."
})Update a key for a repo:
gh.repos("rauhryan", "ghee").keys.patch({
:title => "customer deploy key",
:key => "ssh-rsa AAA ..."
})Destroy a key for a repo:
gh.repos("rauhryan", "ghee").keys(123).destroy # => trueGet the hooks for a repo:
gh.repos("rauhryan", "ghee").hooksGet a single hook for a repo:
gh.repos("rauhryan", "ghee").hooks(12)Create a hook for a repo: (see docs for all possible params):
gh.repos("rauhryan", "ghee").hooks.create({
:name => "web",
:config => {:url => "http://huboard.com/webhook"}
})Update a hook for a repo: (see docs for all possible params):
gh.repos("rauhryan", "ghee").hooks(12).patch({
:name => "web",
:config => {:url => "http://huboard.com/webhook"}
})Destroy a hook for a repo:
gh.repos("rauhryan", "ghee").hooks(1).destoryGet the downloads for a repo:
gh.repos("rauhryan", "ghee").downloadsGet a single download for a repo:
gh.repos("rauhryan", "ghee").downloads(12)Create a download for a repo:
gh.repos("rauhryan", "ghee").downloads.create("/path/to/file","description")Destroy a download for a repo:
gh.repos("rauhryan", "ghee").downloads(12).destroyList watchers for a repo:
gh.repos("rauhryan", "ghee").watchersList repos being watched:
gh.user.watched
gh.users("jonmagic").watchedCheck if you are watching a repo:
gh.user.watching? "rauhryan", "huboard"Watch a repo:
gh.user.watch "rauhryan", "huboard"Unwatch a repo:
gh.user.watch! "rauhryan", "huboard"Get the milestones for a repo:
gh.repos("rauhryan", "ghee").milestonesGet a single milestone for a repo:
gh.repos("rauhryan", "ghee").milestones(12)Create a milestone for a repo: (see docs for all possible params):
gh.repos("rauhryan", "ghee").milestones.create({
:title => "Remove the suck!",
:description => "I found this suck, remove it please"
})Update a milestone for a repo: (see docs for all possible params):
gh.repos("rauhryan", "ghee").milestones(12).patch({
:description => "I found this suck, remove it please"
})Destroy a milestone for a repo:
gh.repos("rauhryan", "ghee").milestones(1).destoryGet the issues for a repo:
gh.repos("rauhryan", "ghee").issuesGet a single issue for a repo:
gh.repos("rauhryan", "ghee").issues(12)Create an issue for a repo: (see docs for all possible params):
gh.repos("rauhryan", "ghee").issues.create({
:title => "Remove the suck!",
:body => "I found this suck, remove it please"
})Update an issue for a repo: (see docs for all possible params):
gh.repos("rauhryan", "ghee").issues(12).patch({
:body => "I found this suck, remove it please"
})Close an issue for a repo:
gh.repos("rauhryan", "ghee").issues(12).closeGet the closed issues for a repo:
gh.repos("rauhryan", "ghee").issues(12).closedGet the comments for an issue:
gh.repos("rauhryan", "ghee").issues(12).commentsGet a single comment for an issue
gh.repos("rauhryan", "ghee").issues.comments(482910)Create a comment for an issue:
gh.repos("rauhryan", "ghee").issues(12).comments.create({:body => "hey i'll help fix that suck"})Update a single comment for an issue
gh.repos("rauhryan", "ghee").issues.comments(482910).patch({:body =>
"nevermind I can't figure it out"})Destroy a comment for an issue
gh.repos("rauhryan", "ghee").issues.comments(482910).destroyGet a list of orgs for the current user:
gh.orgsGet a specific org:
gh.orgs("huboard")Patch an organization:(see docs for all possible params):
gh.orgs("huboard").patch({ :company => "awesome company" })Get a list of repos for an org:
gh.orgs("huboard").reposNotes: see above for all the available api methods for repos
Get a list of teams for an org:
gh.orgs("huboard").teamsGet a single team for an org:
gh.orgs("huboard").teams(110234)Create team for an org:
gh.orgs("huboard").teams.create :name => "awesome_developers"Patch a team for an org:
gh.orgs("huboard").teams(110234).patch :name => "junior_developers"Delete a team for an org:
gh.orgs("huboard").teams(110234).deleteGet a list of members for a team:
gh.orgs("huboard").teams(110234).membersAdd a member to a team:
gh.orgs("huboard").teams(110234).members.add("rauhryan")Remove a member from a team:
gh.orgs("huboard").teams(110234).members.remove("rauhryan")Get a single team:
gh.team(110234)Create a team:
gh.team.create :name => "awesome_developers"Patch a team:
gh.team(110234).patch :name => "junior_developers"Delete a team:
gh.team(110234).deleteGet a list of members for a team:
gh.team(110234).membersAdd a member to a team:
gh.team(110234).members.add("rauhryan")Remove a member from a team:
gh.team(110234).members.remove("rauhryan")Get a single user:
gh.users('jonmagic')Get the authenticated user:
gh.userUpdate authenticated user ([see docs for all po
No open issues yet, or sync has not completed.