Class: GitHub::API
- Inherits:
-
Object
- Object
- GitHub::API
- Defined in:
- lib/ruby-github.rb
Constant Summary collapse
- BASE_URL =
"http://github.com/api/v1/json"
Class Method Summary collapse
-
.commit(user, repository, commit) ⇒ Object
Fetches a single commit for a repository.
-
.commits(user, repository, branch = "master") ⇒ Object
Fetches the commits for a given repository.
- .repository(user, repository) ⇒ Object
-
.user(user) ⇒ Object
Fetches information about the specified user name.
Class Method Details
.commit(user, repository, commit) ⇒ Object
Fetches a single commit for a repository.
29 30 31 32 |
# File 'lib/ruby-github.rb', line 29 def self.commit(user,repository,commit) url = BASE_URL + "/#{user}/#{repository}/commit/#{commit}" GitHub::Commit.new(JSON.parse(open(url).read).merge(:user => user, :repository => repository)) end |
.commits(user, repository, branch = "master") ⇒ Object
Fetches the commits for a given repository.
17 18 19 20 21 22 |
# File 'lib/ruby-github.rb', line 17 def self.commits(user,repository,branch="master") url = BASE_URL + "/#{user}/#{repository}/commits/#{branch}" JSON.parse(open(url).read)["commits"].collect{ |c| GitHub::Commit.new(c.merge(:user => user, :repository => repository)) } end |