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

#all(options = {}) ⇒ Object



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

def all(options={})
  requires :entity
  data = service.list_checks(entity.identity, options).body
  self.marker = data['metadata']['next_marker']

  load(data['values'])
end

#create(attributes = {}) ⇒ Object



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

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

#get(check_id) ⇒ Object



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

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



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

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