Class: Overwatch::Resource
- Inherits:
-
Object
- Object
- Overwatch::Resource
- Includes:
- DataMapper::Resource, Collection::Attributes
- Defined in:
- lib/overwatch/collection/models/resource.rb
Instance Method Summary collapse
- #last_update ⇒ Object
-
#previous_update ⇒ Object
after :create, :schedule_no_data_check.
-
#regenerate_api_key ⇒ Object
def run_checks Resque.enqueue(CheckRun, self.id.to_s) end.
Methods included from Collection::Attributes
#attribute_keys, #average, #first, #from_dotted_hash, #function, #is_a_number?, #last, #max, #median, #min, #sub_attributes, #top_level_attributes, #values_for, #values_with_dates_for
Instance Method Details
#last_update ⇒ Object
26 27 28 |
# File 'lib/overwatch/collection/models/resource.rb', line 26 def last_update snapshots[-1] end |
#previous_update ⇒ Object
after :create, :schedule_no_data_check
22 23 24 |
# File 'lib/overwatch/collection/models/resource.rb', line 22 def previous_update snapshots[-2] end |
#regenerate_api_key ⇒ Object
def run_checks
Resque.enqueue(CheckRun, self.id.to_s)
end
def schedule_no_data_check
Resque.enqueue_in(5.minutes, NoDataCheck, self)
end
38 39 40 41 |
# File 'lib/overwatch/collection/models/resource.rb', line 38 def regenerate_api_key generate_api_key self.save end |