Module: Bucketkit::Client::PullRequests

Included in:
Bucketkit::Client
Defined in:
lib/bucketkit/client/pull_requests.rb

Overview

Constant Summary collapse

API_ENDPOINT =
'api/2.0/repositories'.freeze

Instance Method Summary collapse

Instance Method Details

#approve_pull_request(repo, number, options = {}) ⇒ Object



33
34
35
# File 'lib/bucketkit/client/pull_requests.rb', line 33

def approve_pull_request(repo, number, options={})
  post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/approve", options
end

#create_pull_request(repo, title, source, destination, description, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/bucketkit/client/pull_requests.rb', line 11

def create_pull_request(repo, title, source, destination, description, options={})
  pull = {
      title: title,
      description: description,
      source: { branch: { name: source } },
      destination: { branch: { name: destination } }
  }
  post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests", options.merge(pull)
end

#decline_pull_request(repo, number, options = {}) ⇒ Object Also known as: reject_pull_request



54
55
56
# File 'lib/bucketkit/client/pull_requests.rb', line 54

def decline_pull_request(repo, number, options={})
  post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/decline", options
end

#delete_pull_request_approval(repo, number, options = {}) ⇒ Object



37
38
39
# File 'lib/bucketkit/client/pull_requests.rb', line 37

def delete_pull_request_approval(repo, number, options={})
  delete "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/approve", options
end

#merge_pull_request(repo, number, options = {}) ⇒ Object Also known as: accept_pull_request



49
50
51
# File 'lib/bucketkit/client/pull_requests.rb', line 49

def merge_pull_request(repo, number, options={})
  post "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/merge", options
end

#pull_request(repo, number, options = {}) ⇒ Object



25
26
27
# File 'lib/bucketkit/client/pull_requests.rb', line 25

def pull_request(repo, number, options={})
  get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}", options
end

#pull_request_activity(repo, number = nil, options = {}) ⇒ Object



45
46
47
# File 'lib/bucketkit/client/pull_requests.rb', line 45

def pull_request_activity(repo, number=nil, options={})
  get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/activity", options
end

#pull_request_comment(repo, number, comment_id, options = {}) ⇒ Object



63
64
65
# File 'lib/bucketkit/client/pull_requests.rb', line 63

def pull_request_comment(repo, number, comment_id, options={})
  get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/comments/#{comment_id}", options
end

#pull_request_comments(repo, number, options = {}) ⇒ Object



59
60
61
# File 'lib/bucketkit/client/pull_requests.rb', line 59

def pull_request_comments(repo, number, options={})
  get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/comments", options
end

#pull_request_commits(repo, number, options = {}) ⇒ Object



29
30
31
# File 'lib/bucketkit/client/pull_requests.rb', line 29

def pull_request_commits(repo, number, options={})
  paginate "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/commits", options
end

#pull_request_diff(repo, number, options = {}) ⇒ Object



41
42
43
# File 'lib/bucketkit/client/pull_requests.rb', line 41

def pull_request_diff(repo, number, options={})
  get "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}/diff", options
end

#pull_requests(repo, options = {}) ⇒ Object



7
8
9
# File 'lib/bucketkit/client/pull_requests.rb', line 7

def pull_requests(repo, options={})
  paginate "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests", options
end

#update_pull_request(repo, number, options) ⇒ Object



21
22
23
# File 'lib/bucketkit/client/pull_requests.rb', line 21

def update_pull_request(repo, number, options)
  patch "#{API_ENDPOINT}/#{Repository.new(repo)}/pullrequests/#{number}", options
end