spree / spree_wombat

Connect your Spree Commerce storefront to Wombat
BSD 3-Clause "New" or "Revised" License
31 stars 53 forks source link

Push to Wombat automatically #36

Closed rovitulli closed 10 years ago

rovitulli commented 10 years ago

Sorry for the beginner question, but is there any way to push to wombat automatically, just after order turns "complete"?

I've added the code bellow in my initializer, but it didn't work. Is that the right way, or this method will only work if I use a background job queuing system?

Spree::Wombat::Config[:push_objects].each do |object| Spree::Wombat::Client.push_batches(object) end

Thanks,

peterberkenbosch commented 10 years ago

Hi @rovitulli you can decorate the order like this: https://gist.github.com/peterberkenbosch/b0b1de271c990a04eb1c you only need to add the logic on the state check yourself.

rovitulli commented 10 years ago

Amazing! Thank you, very much.