Class: DcmgrResource::Base
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- DcmgrResource::Base
- Defined in:
- app/models/dcmgr_resource/base.rb
Direct Known Subclasses
Account, HostPool, Image, Instance, InstanceSpec, SecurityGroup, SshKeyPair, StoragePool, Volume, VolumeSnapshot
Constant Summary collapse
- @@debug =
false
Class Method Summary collapse
- .get_resource_state_count(resources, state) ⇒ Object
-
.set_debug(debug = true) ⇒ Object
If headers are not defined in a given subclass, then obtain headers from the superclass.
- .total_resource ⇒ Object
Class Method Details
.get_resource_state_count(resources, state) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/dcmgr_resource/base.rb', line 24 def get_resource_state_count(resources, state) resource_count = 0 unless resources.empty? resources.each do |item| if item.state == state resource_count += 1; end end end resource_count end |
.set_debug(debug = true) ⇒ Object
If headers are not defined in a given subclass, then obtain headers from the superclass.
20 21 22 |
# File 'app/models/dcmgr_resource/base.rb', line 20 def set_debug(debug = true) @@debug = debug end |
.total_resource ⇒ Object
13 14 15 16 |
# File 'app/models/dcmgr_resource/base.rb', line 13 def total_resource result = self.find(:first,:params => {:start => 0,:limit => 1}) result.owner_total end |