Class: Fuselage::Tree
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#path ⇒ Object
Returns the value of attribute path.
-
#sha ⇒ Object
Returns the value of attribute sha.
-
#tree ⇒ Object
Returns the value of attribute tree.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Base
Class Method Summary collapse
-
.create(repo, tree_hashes = [], options = {}) ⇒ Object
Create a tree.
-
.find(repo, sha, user = nil) ⇒ Object
Find a tree.
- .find_recursive(repo, sha, user = nil) ⇒ Object
Methods inherited from Base
delete_method, get, #initialize, post
Constructor Details
This class inherits a constructor from Fuselage::Base
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
4 5 6 |
# File 'lib/fuselage/tree.rb', line 4 def mode @mode end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/fuselage/tree.rb', line 4 def path @path end |
#sha ⇒ Object
Returns the value of attribute sha.
4 5 6 |
# File 'lib/fuselage/tree.rb', line 4 def sha @sha end |
#tree ⇒ Object
Returns the value of attribute tree.
4 5 6 |
# File 'lib/fuselage/tree.rb', line 4 def tree @tree end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/fuselage/tree.rb', line 4 def url @url end |
Class Method Details
.create(repo, tree_hashes = [], options = {}) ⇒ Object
Create a tree
Tree Hash:
:path => 'file',
:mode => '100644', refer to http://developer.github.com/v3/git/trees/ for modes.
:type => 'commit', values: 'commit', 'tree', and 'blob'.
:sha => '45f6d8e74e145b910be4e15f67ef3892fe7abb26'
or
:content => 'Some UTF-8 Encoded Content'
Options:
:type, values: 'commit', 'tree', and 'blob'. default is commit
:tagger
:name
:date
:email
39 40 41 42 43 44 |
# File 'lib/fuselage/tree.rb', line 39 def self.create(repo, tree_hashes=[], ={}) raise AuthenticationRequired unless Api.authenticated params = {:tree => tree_hashes }.merge() user = User.current.login Tree.new(post("/repos/#{user}/#{repo}/git/trees", params)) end |
.find(repo, sha, user = nil) ⇒ Object
Find a tree
examples:
Tree.find('cockpit', '45f6d8e74e145b910be4e15f67ef3892fe7abb26')
10 11 12 13 14 |
# File 'lib/fuselage/tree.rb', line 10 def self.find(repo, sha, user=nil) raise AuthenticationRequired unless Api.authenticated user ||= User.current.login Commit.new(get("/repos/#{user}/#{repo}/git/trees/#{sha}")) end |
.find_recursive(repo, sha, user = nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/fuselage/tree.rb', line 16 def self.find_recursive(repo, sha, user=nil) raise AuthenticationRequired unless Api.authenticated user ||= User.current.login Commit.new(get("/repos/#{user}/#{repo}/git/trees/#{sha}", {:recursive => 1})) end |