Class: Pronto::Github

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/github.rb

Defined Under Namespace

Classes: Comment

Instance Method Summary collapse

Constructor Details

#initializeGithub

Returns a new instance of Github.



3
4
5
# File 'lib/pronto/github.rb', line 3

def initialize
  @comment_cache = {}
end

Instance Method Details

#commit_comments(repo, sha) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/pronto/github.rb', line 15

def commit_comments(repo, sha)
  @comment_cache["#{repo}/#{sha}"] ||= begin
    client.commit_comments(repo, sha).map do |comment|
      Comment.new(repo, sha, comment.body, comment.path, comment.position)
    end
  end
end

#create_commit_comment(repo, sha, comment) ⇒ Object



23
24
25
26
# File 'lib/pronto/github.rb', line 23

def create_commit_comment(repo, sha, comment)
  client.create_commit_comment(repo, sha, comment.body, comment.path,
                               nil, comment.position)
end

#create_pull_comment(repo, sha, comment) ⇒ Object



28
29
30
31
# File 'lib/pronto/github.rb', line 28

def create_pull_comment(repo, sha, comment)
  client.create_pull_comment(repo, pull_id, comment.body, sha, comment.path,
                             comment.position)
end

#pull_comments(repo, sha) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/pronto/github.rb', line 7

def pull_comments(repo, sha)
  @comment_cache["#{repo}/#{pull_id}/#{sha}"] ||= begin
    client.pull_comments(repo, pull_id).map do |comment|
      Comment.new(repo, sha, comment.body, comment.path, comment.position)
    end
  end
end