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

Webhook create method returning false negative #111

Closed
abury opened this issue Jun 28, 2017 · 4 comments
Closed

Webhook create method returning false negative #111

abury opened this issue Jun 28, 2017 · 4 comments

Comments

@abury
Copy link
Contributor

abury commented Jun 28, 2017

Hey guys/gals

Really enjoying the updated library! Thanks for your time building it :)

Found a small (potential) bug. I'm calling create on the webhook client and it's working (verified the webhook is created) however it's returning false without throwing any exception.

If I get time I'll look into it and submit a PR, but for now just thought I'd raise it :)

Thanks!

Aron

@abury
Copy link
Contributor Author

abury commented Jun 28, 2017

Checked out the code and thought I saw the reason:

def create(domain, action, url = '')
  res = @client.post("domains/#{domain}/webhooks", id: action, url: url)
  res.to_h['webhook'] == url && res.to_h[message] == 'Webhook has been created'
end

According to the API docs at https://documentation.mailgun.com/en/latest/api-webhooks.html#examples the 2nd check should be

  res.to_h['webhook']['url']== url && res.to_h[message] == 'Webhook has been created'

The VCR cassette is correct, but the 'webhook_spec' success is a bit misleading because it's not testing the webhook wrapper. It would be best to test the webhook spec directly, but I'm guessing this is more of a broader issue :)

I'll submit a PR with the fix

@pirogoeth
Copy link
Contributor

Hey, thanks for the PR - I've merged it! I'll try and cut another release in a few days when I get some time to tackle some other bugs as well. Thanks a bunch!

@abury
Copy link
Contributor Author

abury commented Jul 1, 2017

Thanks, @pirogoeth! If I get time I'd love to help build out more of the library as we're going to be using it more heavily at GymLeads going forward 👍

@pirogoeth
Copy link
Contributor

@abury That's great to hear! It would be awesome to have you on-board.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants