Class: Kennel::Models::Dash
Constant Summary
Constants inherited from Base
Base::LOCK, Base::READONLY_ATTRIBUTES
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
- #diff(actual) ⇒ Object
-
#initialize(project, *args) ⇒ Dash
constructor
A new instance of Dash.
- #url(id) ⇒ Object
Methods inherited from Base
defaults, inherited, #kennel_id, #name, settings, #tracking_id, validate_setting_exists
Methods included from SubclassTracking
#recursive_subclasses, #subclasses
Constructor Details
#initialize(project, *args) ⇒ Dash
Returns a new instance of Dash.
17 18 19 20 |
# File 'lib/kennel/models/dash.rb', line 17 def initialize(project, *args) @project = project super(*args) end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
15 16 17 |
# File 'lib/kennel/models/dash.rb', line 15 def project @project end |
Class Method Details
.api_resource ⇒ Object
22 23 24 |
# File 'lib/kennel/models/dash.rb', line 22 def self.api_resource "dash" end |
Instance Method Details
#as_json ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/kennel/models/dash.rb', line 26 def as_json return @json if @json @json = { id: id, title: "#{title}#{LOCK}", description: description, read_only: false, template_variables: render_template_variables, graphs: render_graphs } validate_json(@json) @json end |
#diff(actual) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/kennel/models/dash.rb', line 42 def diff(actual) actual.delete :resource actual.delete :created_by actual[:template_variables] ||= [] actual[:graphs].each do |g| g[:definition].delete(:status) g[:definition][:requests].each { |r| r.delete(:aggregator) } end super end |
#url(id) ⇒ Object
53 54 55 |
# File 'lib/kennel/models/dash.rb', line 53 def url(id) Utils.path_to_url "/dash/#{id}" end |