Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Julian Coutu
authored and
Julian Coutu
committed
Dec 16, 2010
1 parent
b3b186f
commit d700a29
Showing
10 changed files
with
75 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module GitNetworkitis | ||
class Commit < Base | ||
base_uri 'https://github.com/' | ||
|
||
attr_accessor :parents, :author, :time, :id, :date, :gravatar, :space, :message, :login | ||
|
||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module GitNetworkitis | ||
class NetworkData < Base | ||
base_uri 'https://github.com/' | ||
|
||
attr_accessor :commits | ||
|
||
|
||
def find(options={}) | ||
if options.has_key?(:owner) & options.has_key?(:repo) & options.has_key?(:nethash) | ||
resp = self.class.get("/#{options[:owner]}/#{options[:repo]}/network_data_chunk?nethash=#{options[:nethash]}") | ||
json_result = JSON.parse(resp.body.to_s) | ||
result = Array.new | ||
json_result["commits"].each do |commit| | ||
result.push parse_attributes(commit, Commit.new(self.username, self.token)) | ||
end | ||
self.commits = result | ||
#This seems weird but what if later the api adds more data at this level? We could just return commits and change the name. | ||
return self | ||
end | ||
end | ||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
|
||
describe "Gitnetworkitis::Commit" do | ||
|
||
before :each do | ||
fake_responses | ||
end | ||
|
||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
|
||
describe "Gitnetworkitis::NetworkData" do | ||
|
||
before :each do | ||
fake_responses | ||
end | ||
|
||
context "find" do | ||
let(:network_meta){GitNetworkitis::NetworkData.new(@username, @token)} | ||
let(:test){network_meta.find({:owner=>"turingstudio", :repo => "loupe", :nethash => "26fb01d365a6f7ea57be92299803cae7b95ae25a"})} | ||
|
||
before :each do | ||
fake_responses | ||
|
||
end | ||
|
||
it "should set the commits array" do | ||
test.commits.should_not be_empty | ||
test.commits.first.parents.should be_empty | ||
test.commits.first.login.should == "stephenjudkins" | ||
end | ||
|
||
end | ||
end |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"spacemap":[[[0,109]],[[97,100],[88,96],[76,81],[50,75],[36,47],[31,35],[23,26]],[[80,97]]],"blocks":[{"name":"turingstudio","count":3,"start":0}],"nethash":"e6598cce6fa0d71a266dce9ed0c053f0efa016ae","focus":109,"dates":["2010-10-08","2010-10-11","2010-10-13","2010-10-14","2010-10-14","2010-10-15","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-26","2010-10-26","2010-10-26","2010-10-27","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-02","2010-11-02","2010-11-02","2010-11-02","2010-11-03","2010-11-03","2010-11-03","2010-11-03","2010-11-03","2010-11-04","2010-11-04","2010-11-05","2010-11-08","2010-11-08","2010-11-09","2010-11-09","2010-11-09","2010-11-09","2010-11-10","2010-11-11","2010-11-11","2010-11-11","2010-11-11","2010-11-12","2010-11-12","2010-11-15","2010-11-16","2010-11-16","2010-11-19","2010-11-19","2010-11-19","2010-11-19","2010-11-20","2010-11-20","2010-11-22","2010-11-22","2010-11-22","2010-11-22","2010-11-22","2010-11-22","2010-11-23","2010-11-23","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-29","2010-11-29","2010-11-29","2010-11-29","2010-11-29","2010-11-30","2010-11-30","2010-11-30","2010-11-30","2010-11-30","2010-12-01","2010-12-03","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-07","2010-12-07","2010-12-07","2010-12-08","2010-12-08","2010-12-08","2010-12-08","2010-12-09","2010-12-09","2010-12-09","2010-12-10","2010-12-14"],"users":[{"repo":"loupe","name":"turingstudio","heads":[{"name":"master","id":"fa84a5871029fb3f0921d566e6e6300b62632f8f"},{"name":"git_network_api","id":"c3aeb61e37f94bbb67c4f14b52c23b8e54d30d0e"},{"name":"test_branch_1","id":"c3aeb61e37f94bbb67c4f14b52c23b8e54d30d0e"}]}]} | ||
{"spacemap":[[[0,109]],[[97,100],[88,96],[76,81],[50,75],[36,47],[31,35],[23,26],[102,111]],[[80,97]]],"blocks":[{"name":"turingstudio","count":3,"start":0}],"nethash":"26fb01d365a6f7ea57be92299803cae7b95ae25a","focus":109,"dates":["2010-10-08","2010-10-11","2010-10-13","2010-10-14","2010-10-14","2010-10-15","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-25","2010-10-26","2010-10-26","2010-10-26","2010-10-27","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-01","2010-11-02","2010-11-02","2010-11-02","2010-11-02","2010-11-03","2010-11-03","2010-11-03","2010-11-03","2010-11-03","2010-11-04","2010-11-04","2010-11-05","2010-11-08","2010-11-08","2010-11-09","2010-11-09","2010-11-09","2010-11-09","2010-11-10","2010-11-11","2010-11-11","2010-11-11","2010-11-11","2010-11-12","2010-11-12","2010-11-15","2010-11-16","2010-11-16","2010-11-19","2010-11-19","2010-11-19","2010-11-19","2010-11-20","2010-11-20","2010-11-22","2010-11-22","2010-11-22","2010-11-22","2010-11-22","2010-11-22","2010-11-23","2010-11-23","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-24","2010-11-29","2010-11-29","2010-11-29","2010-11-29","2010-11-29","2010-11-30","2010-11-30","2010-11-30","2010-11-30","2010-11-30","2010-12-01","2010-12-03","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-06","2010-12-07","2010-12-07","2010-12-07","2010-12-08","2010-12-08","2010-12-08","2010-12-08","2010-12-09","2010-12-09","2010-12-09","2010-12-10","2010-12-14","2010-12-15","2010-12-15"],"users":[{"repo":"loupe","name":"turingstudio","heads":[{"name":"master","id":"fa84a5871029fb3f0921d566e6e6300b62632f8f"},{"name":"git_network_api","id":"bec7b23dc57b14d89fa2829e8c32a108a18e7248"},{"name":"test_branch_1","id":"c3aeb61e37f94bbb67c4f14b52c23b8e54d30d0e"}]}]} |
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