Class: Pronto::Gitlab
- Inherits:
-
Object
- Object
- Pronto::Gitlab
- Defined in:
- lib/pronto/gitlab.rb
Defined Under Namespace
Classes: Comment
Instance Method Summary collapse
- #commit_comments(sha) ⇒ Object
- #create_commit_comment(comment) ⇒ Object
-
#initialize(repo) ⇒ Gitlab
constructor
A new instance of Gitlab.
Constructor Details
#initialize(repo) ⇒ Gitlab
Returns a new instance of Gitlab.
3 4 5 6 |
# File 'lib/pronto/gitlab.rb', line 3 def initialize(repo) @repo = repo @comment_cache = {} end |
Instance Method Details
#commit_comments(sha) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/pronto/gitlab.rb', line 8 def commit_comments(sha) @comment_cache["#{sha}"] ||= begin client.commit_comments(slug, sha, per_page: 500).map do |comment| Comment.new(sha, comment.note, comment.path, comment.line) end end end |
#create_commit_comment(comment) ⇒ Object
16 17 18 19 20 |
# File 'lib/pronto/gitlab.rb', line 16 def create_commit_comment(comment) client.create_commit_comment(slug, comment.sha, comment.note, path: comment.path, line: comment.line, line_type: 'new') end |