Class: BitbucketClient
- Inherits:
-
Object
- Object
- BitbucketClient
- Includes:
- HTTParty
- Defined in:
- lib/pronto/clients/bitbucket_client.rb
Instance Method Summary collapse
- #approve_pull_request(slug, pull_id) ⇒ Object
- #commit_comments(slug, sha) ⇒ Object
- #create_commit_comment(slug, sha, body, path, position) ⇒ Object
- #create_pull_comment(slug, pull_id, body, path, position) ⇒ Object
-
#initialize(username, password) ⇒ BitbucketClient
constructor
A new instance of BitbucketClient.
- #pull_comments(slug, pull_id) ⇒ Object
- #pull_requests(slug) ⇒ Object
- #unapprove_pull_request(slug, pull_id) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ BitbucketClient
Returns a new instance of BitbucketClient.
5 6 7 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 5 def initialize(username, password) self.class.basic_auth(username, password) end |
Instance Method Details
#approve_pull_request(slug, pull_id) ⇒ Object
32 33 34 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 32 def approve_pull_request(slug, pull_id) self.class.post("#{pull_request_api(slug)}/pullrequests/#{pull_id}/approve") end |
#commit_comments(slug, sha) ⇒ Object
9 10 11 12 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 9 def commit_comments(slug, sha) response = get("/#{slug}/changesets/#{sha}/comments") openstruct(response) end |
#create_commit_comment(slug, sha, body, path, position) ⇒ Object
14 15 16 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 14 def create_commit_comment(slug, sha, body, path, position) post("/#{slug}/changesets/#{sha}/comments", body, path, position) end |
#create_pull_comment(slug, pull_id, body, path, position) ⇒ Object
28 29 30 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 28 def create_pull_comment(slug, pull_id, body, path, position) post("/#{slug}/pullrequests/#{pull_id}/comments", body, path, position) end |
#pull_comments(slug, pull_id) ⇒ Object
18 19 20 21 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 18 def pull_comments(slug, pull_id) response = get("/#{slug}/pullrequests/#{pull_id}/comments") openstruct(response) end |
#pull_requests(slug) ⇒ Object
23 24 25 26 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 23 def pull_requests(slug) response = get("#{pull_request_api(slug)}/pullrequests?state=OPEN") openstruct(response['values']) end |
#unapprove_pull_request(slug, pull_id) ⇒ Object
36 37 38 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 36 def unapprove_pull_request(slug, pull_id) self.class.delete("#{pull_request_api(slug)}/pullrequests/#{pull_id}/approve") end |