Class: Fog::Terremark::Shared::Servers
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::Terremark::Shared::Servers
- Defined in:
- lib/fog/terremark/models/shared/servers.rb
Instance Attribute Summary
Attributes inherited from Collection
Instance Method Summary collapse
Methods inherited from Collection
#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #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
24 25 26 27 28 29 30 |
# File 'lib/fog/terremark/models/shared/servers.rb', line 24 def all data = [] service.get_vdc(vdc_id).body['ResourceEntities'].select do |entity| data << service.servers.get(entity["href"].split('/').last) end data end |
#get(server_id) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/fog/terremark/models/shared/servers.rb', line 32 def get(server_id) if server_id new(service.get_vapp(server_id).body) else nil end end |
#vdc_id ⇒ Object
40 41 42 |
# File 'lib/fog/terremark/models/shared/servers.rb', line 40 def vdc_id @vdc_id ||= service.default_vdc_id end |