Class: GitDataCommits
- Inherits:
-
Object
- Object
- GitDataCommits
- Defined in:
- lib/github/gitdata/gitdata_commits.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
Returns the value of attribute github.
Instance Method Summary collapse
- #createCommit(repo, message, tree, parents, authorName = nil, authorEmail = nil, authorDate = nil, committerName = nil, committerEmail = nil, commiterDate = nil, user = nil) ⇒ Object
- #getCommit(repo, sha, user = nil) ⇒ Object
-
#initialize(github) ⇒ GitDataCommits
constructor
A new instance of GitDataCommits.
Constructor Details
#initialize(github) ⇒ GitDataCommits
Returns a new instance of GitDataCommits.
4 5 6 |
# File 'lib/github/gitdata/gitdata_commits.rb', line 4 def initialize(github) @github = github end |
Instance Attribute Details
#github ⇒ Object
Returns the value of attribute github.
2 3 4 |
# File 'lib/github/gitdata/gitdata_commits.rb', line 2 def github @github end |
Instance Method Details
#createCommit(repo, message, tree, parents, authorName = nil, authorEmail = nil, authorDate = nil, committerName = nil, committerEmail = nil, commiterDate = nil, user = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/github/gitdata/gitdata_commits.rb', line 14 def createCommit(repo, , tree, parents, =nil, =nil, =nil, committerName=nil, committerEmail=nil, commiterDate=nil, user=nil) username = user == nil ? @github.username : user = { :name => , :email => , :date => , } = @github.removeEmptyParams() committer = { :name => committerName, :email => committerEmail, :date => commiterDate } committer = @github.removeEmptyParams(committer) params = { :message => , :author => , :committer => committer, :parents => parents, :tree => tree } params = @github.removeEmptyParams(params) data = params.to_json @github.post( 'repos/%s/%s/git/commits' % [username, repo], data) end |
#getCommit(repo, sha, user = nil) ⇒ Object
8 9 10 11 12 |
# File 'lib/github/gitdata/gitdata_commits.rb', line 8 def getCommit(repo, sha, user=nil) username = user == nil ? @github.username : user @github.get( 'repos/%s/%s/git/commits/%s' % [username, repo, sha]) end |