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

Allow specifying namespace for webhooks jobs #463

Merged
merged 1 commit into from
Sep 18, 2017

Conversation

kdonovan
Copy link
Contributor

This tweak allow specifying a namespace for the webhook jobs.

Rationale: I'm trying to build a generic ecommerce app, keeping in mind that I may expand to support non-Shopify stores in the future. With that in mind, I've namespaced my ShopifyApp webhook jobs under jobs/shopify/xxx_job.rb, but despite mounting ShopifyApp under '/shopify', the webhook controller was always raising ShopifyApp::MissingWebhookJobError because it was hardcoded to assume the webhook job names were in the top-level namespace.

Copy link
Contributor

@kevinhughes27 kevinhughes27 left a comment

Choose a reason for hiding this comment

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

LGTM. Can you add a note in the changelog and see if there is a section in the README where it makes sense to add a note about this.

@kdonovan kdonovan force-pushed the namespace_webhook_jobs branch from 1b4b40d to 1679842 Compare September 2, 2017 15:28
@kdonovan
Copy link
Contributor Author

kdonovan commented Sep 2, 2017

Yep! Updated the readme and added a CHANGELOG line as well.

@kdonovan
Copy link
Contributor Author

kdonovan commented Sep 3, 2017

Actually, please hold on the merge on this -- I'm exploring a tweak. I'll comment again when it's good to go.

@kdonovan kdonovan force-pushed the namespace_webhook_jobs branch from 1679842 to 32b93f8 Compare September 3, 2017 16:07
@kdonovan
Copy link
Contributor Author

kdonovan commented Sep 3, 2017

OK - this is good to go now.

In order to support plural namespaces (e.g. shopify/webhooks/xxx_job) I had to merge the paths first, then call classify (the previous implementation singularized the namespace before searching for the job).

@kevinhughes27
Copy link
Contributor

Can you add a test?

@kdonovan kdonovan force-pushed the namespace_webhook_jobs branch from 32b93f8 to 548e007 Compare September 18, 2017 14:48
@kdonovan
Copy link
Contributor Author

Yep! Tests added.

@kevinhughes27
Copy link
Contributor

Awesome thanks ❤️

@kevinhughes27 kevinhughes27 merged commit edf1e5f into Shopify:master Sep 18, 2017
@kdonovan kdonovan deleted the namespace_webhook_jobs branch September 18, 2017 15:36
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.

3 participants