Class: Deltacloud::BaseModel
- Inherits:
-
Object
- Object
- Deltacloud::BaseModel
show all
- Defined in:
- lib/deltacloud/models/base_model.rb
Direct Known Subclasses
Address, Blob, Bucket, Firewall, FirewallRule, HardwareProfile, Image, Instance, InstanceProfile, Key, LoadBalancer, LoadBalancer::Listener, Metric, Provider, Realm, StorageSnapshot, StorageVolume
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(init = nil) ⇒ BaseModel
Returns a new instance of BaseModel.
22
23
24
25
26
27
28
29
|
# File 'lib/deltacloud/models/base_model.rb', line 22
def initialize(init=nil)
if ( init )
@id=init[:id]
init.each{|k,v|
self.send( "#{k}=", v ) if ( self.respond_to?( "#{k}=" ) )
}
end
end
|
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
20
21
22
|
# File 'lib/deltacloud/models/base_model.rb', line 20
def description
@description
end
|
#name ⇒ Object
Returns the value of attribute name.
20
21
22
|
# File 'lib/deltacloud/models/base_model.rb', line 20
def name
@name
end
|
Class Method Details
.attr_accessor(*vars) ⇒ Object
31
32
33
34
35
|
# File 'lib/deltacloud/models/base_model.rb', line 31
def self.attr_accessor(*vars)
@attributes ||= [:id]
@attributes.concat vars
super
end
|
.attributes ⇒ Object
37
38
39
|
# File 'lib/deltacloud/models/base_model.rb', line 37
def self.attributes
@attributes
end
|
Instance Method Details
#attributes ⇒ Object
41
42
43
|
# File 'lib/deltacloud/models/base_model.rb', line 41
def attributes
self.class.attributes
end
|
#id ⇒ Object
45
46
47
|
# File 'lib/deltacloud/models/base_model.rb', line 45
def id
@id
end
|
#to_entity ⇒ Object
49
50
51
|
# File 'lib/deltacloud/models/base_model.rb', line 49
def to_entity
self.class.name.downcase
end
|