Class: Fog::Rackspace::Monitoring::Checks

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/monitoring/checks.rb

Instance Method Summary collapse

Instance Method Details

#allObject



13
14
15
16
17
# File 'lib/fog/rackspace/models/monitoring/checks.rb', line 13

def all
  requires :entity
  data = service.list_checks(entity.identity).body['values']
  load(data)
end

#create(attributes = {}) ⇒ Object



32
33
34
35
# File 'lib/fog/rackspace/models/monitoring/checks.rb', line 32

def create(attributes = {})
  requires :entity unless attributes[:entity]
  super({ :entity => entity }.merge!(attributes))
end

#get(check_id) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/fog/rackspace/models/monitoring/checks.rb', line 19

def get(check_id)
  requires :entity
  data = service.get_check(entity.identity, check_id).body
  new(data)
rescue Fog::Rackspace::Monitoring::NotFound
  nil
end

#new(attributes = {}) ⇒ Object



27
28
29
30
# File 'lib/fog/rackspace/models/monitoring/checks.rb', line 27

def new(attributes = {})
  requires :entity unless attributes[:entity]
  super({ :entity => entity }.merge!(attributes))
end