Module: Dashboarder::Dashboard
- Defined in:
- lib/dashboarder/dashboard.rb
Class Method Summary collapse
- .compose(name, instrument_names) ⇒ Object
- .create!(name, instrument_names) ⇒ Object
- .get(name) ⇒ Object
Class Method Details
.compose(name, instrument_names) ⇒ Object
11 12 13 |
# File 'lib/dashboarder/dashboard.rb', line 11 def self.compose(name, instrument_names) get(name) || create!(name, instrument_names) end |
.create!(name, instrument_names) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/dashboarder/dashboard.rb', line 3 def self.create!(name, instrument_names) instrument_ids = instrument_names.map do |d| i = Instrument.get(d) || raise("Instrument #{name} not defined yet") i['id'] end Dashboarder.api.post('/v1/dashboards', { :name => name, :instruments => instrument_ids }) end |
.get(name) ⇒ Object
15 16 17 |
# File 'lib/dashboarder/dashboard.rb', line 15 def self.get(name) Dashboarder.api.get('/v1/dashboards', :query => {:name => name})['dashboards'].first end |