Class: PullReviewComments

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ PullReviewComments

Returns a new instance of PullReviewComments.



4
5
6
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 4

def initialize(github)
  @github = github
end

Instance Attribute Details

#githubObject

Returns the value of attribute github.



2
3
4
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 2

def github
  @github
end

Instance Method Details

#createComment(repo, id, body, commit_id, path, position, user = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 18

def createComment(repo, id, body, commit_id, path, position, user=nil)
  username = user == nil ? @github.username : user
  params = {
      :body => body,
      :commit_id => commit_id,
      :path => path,
      :position => position
  }
  data = params.to_json
  @github.post('repos/%s/%s/pulls/%s/comments' % [username, repo, id], data)
end

#createCommentResponse(repo, id, body, in_reply_to, user = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 30

def createCommentResponse(repo, id, body, in_reply_to, user=nil)
  username = user == nil ? @github.username : user
  params = {
      :body => body,
      :in_reply_to => in_reply_to
  }
  data = params.to_json
  @github.post('repos/%s/%s/pulls/%s/comments' % [username, repo, id], data)
end

#deleteComment(repo, id, user = nil) ⇒ Object



49
50
51
52
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 49

def deleteComment(repo, id, user=nil)
  username = user == nil ? @github.username : user
  @github.delete('repos/%s/%s/pulls/comments/%s' % [username, repo, id])
end

#editComment(repo, id, body, user = nil) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 40

def editComment(repo, id, body, user=nil)
  username = user == nil ? @github.username : user
  params = {
      :body => body
  }
  data = params.to_json
  @github.patch('repos/%s/%s/pulls/comments/%s' % [username, repo, id], data)
end

#getComment(repo, id, user = nil) ⇒ Object



8
9
10
11
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 8

def getComment(repo, id, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/pulls/comments/%s' % [username, repo, id])
end

#listComments(repo, id, user = nil) ⇒ Object



13
14
15
16
# File 'lib/github/pullreqs/pullreqs_reviewcomments.rb', line 13

def listComments(repo, id, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/pulls/%s/comments' % [username, repo, id])
end