engine/lib/locomotive/hosting/bushido/hooks.rb

26 lines
577 B
Ruby
Raw Normal View History

require 'bushido'
module Locomotive
module Hosting
module Bushido
module Enabler
module ClassMethods
def subscribe_to_events
::Bushido::Data.listen('app.claimed') do |event|
Locomotive.log "Saving #{Account.first.inspect} with incoming data #{event.inspect}"
account = Account.first
account.email = event['data'].try(:[], 'email')
account.name = account.email.split('@').first
account.save
end
end
end
end
end
end
end