Class: Octopi::Tree

Inherits:
Base
  • Object
show all
Defined in:
lib/octopi/tree.rb

Constant Summary

Constant Summary

Constants inherited from Base

Base::VALID

Instance Attribute Summary collapse

Attributes inherited from Base

#api

Class Method Summary collapse

Methods inherited from Base

#error=, #initialize, #property, #save

Constructor Details

This class inherits a constructor from Octopi::Base

Instance Attribute Details

#mime_typeObject

Returns the value of attribute mime_type



3
4
5
# File 'lib/octopi/tree.rb', line 3

def mime_type
  @mime_type
end

#modeObject

Returns the value of attribute mode



3
4
5
# File 'lib/octopi/tree.rb', line 3

def mode
  @mode
end

#nameObject

Returns the value of attribute name



3
4
5
# File 'lib/octopi/tree.rb', line 3

def name
  @name
end

#repositoryObject

Returns the value of attribute repository



3
4
5
# File 'lib/octopi/tree.rb', line 3

def repository
  @repository
end

#shaObject

Returns the value of attribute sha



3
4
5
# File 'lib/octopi/tree.rb', line 3

def sha
  @sha
end

#sizeObject

Returns the value of attribute size



3
4
5
# File 'lib/octopi/tree.rb', line 3

def size
  @size
end

#typeObject

Returns the value of attribute type



3
4
5
# File 'lib/octopi/tree.rb', line 3

def type
  @type
end

#userObject

Returns the value of attribute user



3
4
5
# File 'lib/octopi/tree.rb', line 3

def user
  @user
end

Class Method Details

.find(options) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/octopi/tree.rb', line 5

def self.find(options)
  ensure_hash(options)
  user, repo = gather_details(options)
  route = "/tree/show/#{user}/#{repo}/#{options[:sha]}"
  trees = Api.api.get(route)["tree"].map do |tree| 
    Tree.new(tree.merge(:user => user, :repository => repo))
  end
  TreeSet.new(trees)
end