Created
June 25, 2014 11:34
-
-
Save peterberkenbosch/8746707ff2f0b5e0a86a to your computer and use it in GitHub Desktop.
Sample scheduler & filter
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
Spree::Wombat::Config.configure do |config| | |
config.connection_token = ENV["HUB_TOKEN"] | |
config.connection_id = ENV["HUB_STORE_ID"] | |
config.push_objects = ["Spree::Order", "Spree::Shipment"] | |
config.payload_builder = { | |
"Spree::Order" => {serializer: 'Spree::Wombat::OrderSerializer', root: 'orders', filter: 'complete' }, | |
"Spree::Shipment" => {serializer: 'DemoShipmentSerializer', root: 'shipments' } | |
} | |
end | |
#in this sample the 'filter :complete' will call Spree::Order.complete scope before timestamp check and pushing. |
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
scheduler: bundle exec ./push_it_scheduler.rb |
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
# https://github.com/jmettraux/rufus-scheduler | |
#!/usr/bin/env ruby | |
## run this from Procfile to push data to wombat periodically | |
require 'rufus-scheduler' | |
scheduler = Rufus::Scheduler.new | |
scheduler.every '10s' do | |
system 'rake wombat:push_it' | |
end | |
scheduler.join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment