Class: BitbucketServerClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/pronto/clients/bitbucket_server_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(username, password, endpoint) ⇒ BitbucketServerClient

Returns a new instance of BitbucketServerClient.



4
5
6
7
8
# File 'lib/pronto/clients/bitbucket_server_client.rb', line 4

def initialize(username, password, endpoint)
  self.class.base_uri(endpoint)
  self.class.basic_auth(username, password)
  @headers = { 'Content-Type' => 'application/json' }
end

Instance Method Details

#create_pull_comment(slug, pull_id, body, path, position) ⇒ Object



20
21
22
23
# File 'lib/pronto/clients/bitbucket_server_client.rb', line 20

def create_pull_comment(slug, pull_id, body, path, position)
  url = "#{pull_requests_url(slug)}/#{pull_id}/comments"
  post(url, body, path, position)
end

#pull_comments(slug, pull_id) ⇒ Object



10
11
12
13
14
# File 'lib/pronto/clients/bitbucket_server_client.rb', line 10

def pull_comments(slug, pull_id)
  url = "#{pull_requests_url(slug)}/#{pull_id}/activities"
  response = paged_request(url)
  response.select { |activity| activity.action == 'COMMENTED' }
end

#pull_requests(slug) ⇒ Object



16
17
18
# File 'lib/pronto/clients/bitbucket_server_client.rb', line 16

def pull_requests(slug)
  paged_request(pull_requests_url(slug), state: 'OPEN')
end