Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks api #103

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Hooks api #103

wants to merge 10 commits into from

Conversation

falexandrou
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.908% when pulling c099a4d on falexandrou:hooks-api into 4f8b64a on hirakiuc:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.866% when pulling 08ba235 on falexandrou:hooks-api into 4f8b64a on hirakiuc:master.

@hirakiuc hirakiuc added the api label Dec 11, 2016
@hirakiuc hirakiuc added this to the v1.4.0 milestone Dec 11, 2016
@hirakiuc
Copy link
Owner

hirakiuc commented Jan 8, 2017

I'll check this after merging #102. 👍

# Send 'DELETE a hook for a repository' request
# @see https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/hooks/%7Buid%7D#delete
#
# @param options [Hash] The attributes to update
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this comment should be fixed. 🤔

#
# @param options [Hash] The attributes to update
# @return [Tinybucket::Model::Hook]
def update(hook, options = {})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method require hook param comment just like here.

#
# @param options [Hash] The attributes to update
# @return [Boolean]
def delete(hook, options = {})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method require hook param comment just like here.

# @param branch [String]
# @param options [Hash]
# @return [Tinybucket::Model::Hook]
def find(branch, options = {})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According this code, I think that branch argument should be renamed to hook. 🤔

Copy link
Owner

@hirakiuc hirakiuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just add some comments, right now. 📝

And I'll test this pull request after some days.

@falexandrou
Copy link
Contributor Author

Pushed updates regarding your comments. Feel free to review whenever you can

@hirakiuc
Copy link
Owner

I created a script to test each hooks API with real test repository on Bitbucket.

And I found these points.

(1) Bitbucket pipeline webhook can fetch via Repository#hooks, but can't fetch via Repository#hook.

Always Tinybucket::Error::NotFound raised when I fetch the hook via Repository#hook API.

I think this may be a Bitbucket API issue... 🤔

(2) I can't create my new hook via Repository#hooks#create.

Always error raised. 😳

# access_token is replaced with "my_access_token"
D, [2017-01-28T10:00:09.787664 #65829] DEBUG -- : [api.bitbucket.org] POST /2.0/repositories/altabjpworks/sandbox/hooks?access_token=my_access_token (0.812 s)
E, [2017-01-28T10:00:09.787773 #65829] ERROR -- : Invalid response code:500
/Users/hirakiuc/repos/src/github.com/hirakiuc/tinybucket/lib/tinybucket/response/handler.rb:18:in `on_complete': POST https://api.bitbucket.org/2.0/repositories/altabjpworks/sandbox/hooks?access_token=my_access_token 500 {"type": "error", "error": {"message": "No JSON object could be decoded", "id": "c66366d84f584274a08d01549ad95cb5"}} (Tinybucket::Error::ServiceError)

It looks like that the format of request parameter is invalid.

Can you create new hook to your Bitbucket repository via new Repository#hooks#create API?

@falexandrou
Copy link
Contributor Author

This looks like a bitbucket issue. in the past i managed to avoid these errors by explicitly setting the Content-Type header to application/json. Will check this though

@hirakiuc hirakiuc modified the milestones: v1.4.0, v1.5.0 Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants