Class: Fog::Rackspace::Monitoring::Alarms
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::Rackspace::Monitoring::Alarms
- Defined in:
- lib/fog/rackspace/models/monitoring/alarms.rb
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
- #all ⇒ Object
- #create(attributes = {}) ⇒ Object
- #get(alarm_id) ⇒ Object
- #new(attributes = {}) ⇒ Object
Methods inherited from Collection
#clear, #destroy, #initialize, #inspect, #load, model, #model, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Method Details
#all ⇒ Object
13 14 15 16 17 |
# File 'lib/fog/rackspace/models/monitoring/alarms.rb', line 13 def all requires :entity data = service.list_alarms(entity.identity).body['values'] load(data) end |
#create(attributes = {}) ⇒ Object
32 33 34 35 |
# File 'lib/fog/rackspace/models/monitoring/alarms.rb', line 32 def create(attributes = {}) requires :entity super({ :entity => entity }.merge!(attributes)) end |
#get(alarm_id) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/models/monitoring/alarms.rb', line 19 def get(alarm_id) requires :entity data = service.get_alarm(entity.identity, alarm_id).body new(data) rescue Fog::Rackspace::Monitoring::NotFound nil end |
#new(attributes = {}) ⇒ Object
27 28 29 30 |
# File 'lib/fog/rackspace/models/monitoring/alarms.rb', line 27 def new(attributes = {}) requires :entity super({ :entity => entity }.merge!(attributes)) end |