Class: BitbucketClient
- Inherits:
-
Object
- Object
- BitbucketClient
- Includes:
- HTTParty
- Defined in:
- lib/pronto/clients/bitbucket_client.rb
Instance Method Summary collapse
- #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
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
#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
29 30 31 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 29 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 27 |
# File 'lib/pronto/clients/bitbucket_client.rb', line 23 def pull_requests(slug) base = 'https://api.bitbucket.org/2.0/repositories' response = get("#{base}/#{slug}/pullrequests?state=OPEN") openstruct(response['values']) end |