Class: Pronto::Github
- Inherits:
-
Object
- Object
- Pronto::Github
- Defined in:
- lib/pronto/github.rb
Defined Under Namespace
Classes: Comment
Instance Method Summary collapse
- #commit_comments(sha) ⇒ Object
- #create_commit_comment(comment) ⇒ Object
- #create_pull_comment(comment) ⇒ Object
-
#initialize(repo) ⇒ Github
constructor
A new instance of Github.
- #pull_comments(sha) ⇒ Object
Constructor Details
Instance Method Details
#commit_comments(sha) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pronto/github.rb', line 19 def commit_comments(sha) @comment_cache["#{sha}"] ||= begin client.commit_comments(slug, sha).map do |comment| Comment.new(sha, comment.body, comment.path, comment.position) end end end |
#create_commit_comment(comment) ⇒ Object
27 28 29 30 |
# File 'lib/pronto/github.rb', line 27 def create_commit_comment(comment) client.create_commit_comment(slug, comment.sha, comment.body, comment.path, nil, comment.position) end |
#create_pull_comment(comment) ⇒ Object
32 33 34 35 36 |
# File 'lib/pronto/github.rb', line 32 def create_pull_comment(comment) client.create_pull_comment(slug, pull_id, comment.body, pull_sha || comment.sha, comment.path, comment.position) end |
#pull_comments(sha) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/pronto/github.rb', line 10 def pull_comments(sha) @comment_cache["#{pull_id}/#{sha}"] ||= begin client.pull_comments(slug, pull_id).map do |comment| Comment.new(sha, comment.body, comment.path, comment.position || comment.original_position) end end end |