Created
March 8, 2014 04:02
-
-
Save mrpunkin/9425143 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FooJob = Struct.new(:shop_id) do | |
| def perform | |
| ## code ## | |
| end | |
| include ShopifyJobHooks | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ShopifyJobHooks | |
| extend ActiveSupport::Concern | |
| included do | |
| attr_accessor :shop | |
| alias_method :_perform, :perform | |
| def perform | |
| self.shop = Shop.find(shop_id) | |
| shop.session do | |
| sleep ShopifyAPI.credit_used | |
| _perform | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment