Skip to content

Commit

Permalink
Adds branches attribute to network meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Coutu authored and Julian Coutu committed Dec 22, 2010
1 parent b6e28a7 commit 5d4c030
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/gitnetworkitis/network_data.rb
Expand Up @@ -4,7 +4,6 @@ class NetworkData < Base

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]}")
Expand Down
5 changes: 3 additions & 2 deletions lib/gitnetworkitis/network_meta.rb
Expand Up @@ -4,12 +4,13 @@ class NetworkMeta < Base

attr_accessor :spacemap, :blocks, :url, :nethash, :focus, :dates, :users, :branches


def find(options={})
if options.has_key?(:owner) & options.has_key?(:repo)
resp = self.class.get("/#{ options[:owner]}/#{ options[:repo]}/network_meta")
json_result = JSON.parse(resp.body.to_s)
parse_attributes(json_result, NetworkMeta.new(self.username, self.token))
branch = GitNetworkitis::Branch.new(@username, @token)
self.branches = branch.find_all({:owner=>options[:owner], :repo => options[:repo]})
parse_attributes(json_result, self)
end
end
end
Expand Down
5 changes: 5 additions & 0 deletions spec/network_meta_spec.rb
Expand Up @@ -40,5 +40,10 @@
test.spacemap.should_not == nil
test.spacemap.length.should == 3
end

it "should set branches to a collection of branches for a specific repo" do
test.branches.should_not == nil
test.branches.length.should == 3
end
end
end

0 comments on commit 5d4c030

Please sign in to comment.