Class: Untied::Consumer::Sync::UntiedGeneralObserver
- Inherits:
-
ObserverHelper
- Object
- Observer
- ObserverHelper
- Untied::Consumer::Sync::UntiedGeneralObserver
- Defined in:
- lib/untied-consumer-sync/untied_general_observer.rb
Overview
Observes all entities listed on config file
Instance Method Summary collapse
- #after_create(payload) ⇒ Object
- #after_destroy(payload) ⇒ Object
- #after_update(payload) ⇒ Object
-
#initialize ⇒ UntiedGeneralObserver
constructor
A new instance of UntiedGeneralObserver.
Methods inherited from ObserverHelper
#config, #create_proxy, #destroy_proxy, #update_proxy
Constructor Details
#initialize ⇒ UntiedGeneralObserver
Returns a new instance of UntiedGeneralObserver.
6 7 8 9 10 11 12 |
# File 'lib/untied-consumer-sync/untied_general_observer.rb', line 6 def initialize super elements = self.config.values.collect {|v| v['name'].underscore.to_sym } args = elements << {:from => Sync.config.service_name } self.class.observe(*args) end |
Instance Method Details
#after_create(payload) ⇒ Object
14 15 16 17 |
# File 'lib/untied-consumer-sync/untied_general_observer.rb', line 14 def after_create(payload) kind = payload.keys[0] self.create_proxy(kind, payload.values[0]) end |
#after_destroy(payload) ⇒ Object
24 25 26 27 |
# File 'lib/untied-consumer-sync/untied_general_observer.rb', line 24 def after_destroy(payload) kind = payload.keys[0] self.destroy_proxy(kind, payload.values[0]) end |
#after_update(payload) ⇒ Object
19 20 21 22 |
# File 'lib/untied-consumer-sync/untied_general_observer.rb', line 19 def after_update(payload) kind = payload.keys[0] self.update_proxy(kind, payload.values[0]) end |