Module: Goat::StateSrvClient
- Defined in:
- lib/goat/state-srv.rb
Class Method Summary collapse
- .component_updated(txn, pgid, update) ⇒ Object
- .components_updated(txn, pgid, updates) ⇒ Object
- .configure(opts = {}) ⇒ Object
- .fetch_component(id) ⇒ Object
- .live_components(cls, spec) ⇒ Object
- .register_page(pgid, cs) ⇒ Object
- .send_message(type, m, sync = false) ⇒ Object
Class Method Details
.component_updated(txn, pgid, update) ⇒ Object
26 27 28 |
# File 'lib/goat/state-srv.rb', line 26 def self.component_updated(txn, pgid, update) components_updated(txn, pgid, [update]) end |
.components_updated(txn, pgid, updates) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/goat/state-srv.rb', line 30 def self.components_updated(txn, pgid, updates) ('components_updated', 'txn' => txn, 'pgid' => pgid, 'updates' => updates.map(&:to_hash) ) end |
.configure(opts = {}) ⇒ Object
3 4 5 6 |
# File 'lib/goat/state-srv.rb', line 3 def self.configure(opts={}) # TODO implement fully EM.next_tick { StateSrvConnection.connect } end |
.fetch_component(id) ⇒ Object
21 22 23 24 |
# File 'lib/goat/state-srv.rb', line 21 def self.fetch_component(id) resp = ('fetch_component', {'id' => id}, true) ComponentSkeleton.from_hash(JSON.load(resp)['response']) end |
.live_components(cls, spec) ⇒ Object
16 17 18 19 |
# File 'lib/goat/state-srv.rb', line 16 def self.live_components(cls, spec) resp = ('live_components', {'class' => cls, 'spec' => spec}, true) JSON.load(resp)['response'].map{|h| ComponentSkeleton.from_hash(h)} end |
.register_page(pgid, cs) ⇒ Object
12 13 14 |
# File 'lib/goat/state-srv.rb', line 12 def self.register_page(pgid, cs) ('register_page', 'pgid' => pgid, 'components' => cs.map(&:to_hash)) end |
.send_message(type, m, sync = false) ⇒ Object
8 9 10 |
# File 'lib/goat/state-srv.rb', line 8 def self.(type, m, sync=false) StateSrvConnection.(type, m, sync) end |