Class: ReposCommits
- Inherits:
-
Object
- Object
- ReposCommits
- Defined in:
- lib/github/repos/repos_commits.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
Returns the value of attribute github.
Instance Method Summary collapse
- #CompareCommits(repo, base, head, user = nil) ⇒ Object
- #createComment(repo, sha, body, line, path, position, user = nil) ⇒ Object
- #deleteComment(repo, id, user = nil) ⇒ Object
- #getCommit(repo, sha, user = nil) ⇒ Object
- #getSingleComment(repo, id, user = nil) ⇒ Object
-
#initialize(github) ⇒ ReposCommits
constructor
A new instance of ReposCommits.
- #listComments(repo, sha, user = nil) ⇒ Object
- #listCommits(repo, sha = nil, path = nil, user = nil) ⇒ Object
- #listRepoComments(repo, user = nil) ⇒ Object
- #updateComment(repo, id, body, user = nil) ⇒ Object
Constructor Details
#initialize(github) ⇒ ReposCommits
Returns a new instance of ReposCommits.
4 5 6 |
# File 'lib/github/repos/repos_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/repos/repos_commits.rb', line 2 def github @github end |
Instance Method Details
#CompareCommits(repo, base, head, user = nil) ⇒ Object
62 63 64 65 |
# File 'lib/github/repos/repos_commits.rb', line 62 def CompareCommits(repo, base, head, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/compare/%s...:%s' % [username, repo, base, head]) end |
#createComment(repo, sha, body, line, path, position, user = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/github/repos/repos_commits.rb', line 35 def createComment(repo, sha, body, line, path, position, user=nil) username = user == nil ? @github.username : user params = { :body => body, :commit_id => sha, :line => line, :path => path, :position => position } data = params.to_json @github.post('repos/%s/%s/commits/%s/comments' % [username, repo, sha], data) end |
#deleteComment(repo, id, user = nil) ⇒ Object
68 69 70 71 |
# File 'lib/github/repos/repos_commits.rb', line 68 def deleteComment(repo, id, user=nil) username = user == nil ? @github.username : user @github.delete('repos/%s/%s/comments/%s' % [username, repo, id]) end |
#getCommit(repo, sha, user = nil) ⇒ Object
20 21 22 23 |
# File 'lib/github/repos/repos_commits.rb', line 20 def getCommit(repo, sha, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/commits/%s' % [username, repo, sha]) end |
#getSingleComment(repo, id, user = nil) ⇒ Object
48 49 50 51 |
# File 'lib/github/repos/repos_commits.rb', line 48 def getSingleComment(repo, id, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/comment/%s' % [username, repo, id]) end |
#listComments(repo, sha, user = nil) ⇒ Object
30 31 32 33 |
# File 'lib/github/repos/repos_commits.rb', line 30 def listComments(repo, sha, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/comments/%s/comments' % [username, repo, sha]) end |
#listCommits(repo, sha = nil, path = nil, user = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/github/repos/repos_commits.rb', line 8 def listCommits(repo, sha=nil, path=nil, user=nil) username = user == nil ? @github.username : user params = { :sha => sha, :path => path } params = @github.removeEmptyParams(params) params = @github.parameterize(params) url = params ? 'repos/%s/%s/commits?%s' % [username, repo, params] : 'repos/%s/%s/commits' @github.get(url) end |
#listRepoComments(repo, user = nil) ⇒ Object
25 26 27 28 |
# File 'lib/github/repos/repos_commits.rb', line 25 def listRepoComments(repo, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/comments' % [username, repo]) end |
#updateComment(repo, id, body, user = nil) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/github/repos/repos_commits.rb', line 53 def updateComment(repo, id, body, user=nil) username = user == nil ? @github.username : user params = { :body => body } data = params.to_json @github.post('repos/%s/%s/comments/%s' % [username, repo, id], data) end |