Skip to content

Add more webhooks support#82

Merged
eikes merged 5 commits into
masterfrom
webhooks
Mar 22, 2022
Merged

Add more webhooks support#82
eikes merged 5 commits into
masterfrom
webhooks

Conversation

@eikes

@eikes eikes commented Mar 21, 2022

Copy link
Copy Markdown
Collaborator

Webhooks require a validation of the x-signature HTTP header which is implemented here.

Additionally a helper class to convert the incoming webhook event into a Ioki::Webhooks::Model model is provided.

@eikes
eikes marked this pull request as ready for review March 21, 2022 11:33
@eikes
eikes requested review from A5308Y and rmehner March 21, 2022 11:33

@A5308Y A5308Y left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM I especially appreciate the addition to the Readme.

I just had a thought about camelize, but it's fine for me as well if you keep the current version.


private

def camelize(term)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if it would make sense to copy the Rails' implementation as that's what I'd expect most people using the gem are familiar with. Otherwise there might be subtle differences.

See https://apidock.com/rails/v6.1.3.1/String/camelize. Rails 7's is harder to read in my opinion: https://github.com/rails/rails/blob/de53ba56cab69fb9707785a397a59ac4aaee9d6f/activesupport/lib/active_support/inflector/methods.rb#L96.

Maybe it would also be nice to extract the function to a module as camelize is a concept that makes sense for all parts of the app.

What do you think @eikes?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is in fact copied from rails 7 here: https://github.com/rails/rails/blob/de53ba56cab69fb9707785a397a59ac4aaee9d6f/activesupport/lib/active_support/inflector/methods.rb#L69

But I had to remove everything related to inflections. Finally I had to replace the $1 and $2, because rubocop didn't like that.

In general though, I'd prefer to use ActiveSupport, but I was told not to. What are your thoughts on using integrating ActiveSupport? It would let us remove some reimplementations like this and everyone uses it anyways...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Huh. I looked at that method as well and didn't recognise it. Odd. I'd personally be Ok with ActiveSupport, but was also told not to use it and I'd stick with that. I think the next best option would be to have a module for "the stuff copied from Rails" with some comments and links to the original source.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK, let's create a Ioki::Support module after merging this!

Comment thread README.md Outdated
Co-authored-by: Andreas Hellwig <a5308y@gmail.com>
@eikes
eikes merged commit 065eec6 into master Mar 22, 2022
@eikes
eikes deleted the webhooks branch March 22, 2022 12:14
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

Successfully merging this pull request may close these issues.

2 participants