Class: DCloud::BaseModel
- Inherits:
-
Object
show all
- Defined in:
- lib/dcloud/base_model.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(client, uri = nil, xml = nil) ⇒ BaseModel
Returns a new instance of BaseModel.
45
46
47
48
49
50
|
# File 'lib/dcloud/base_model.rb', line 45
def initialize(client, uri=nil, xml=nil)
@client = client
@uri = uri
@loaded = false
load_payload( xml )
end
|
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
43
44
45
|
# File 'lib/dcloud/base_model.rb', line 43
def uri
@uri
end
|
Class Method Details
.attribute(attr) ⇒ Object
30
31
32
|
# File 'lib/dcloud/base_model.rb', line 30
def self.attribute(attr)
build_reader attr
end
|
.build_reader(attr) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/dcloud/base_model.rb', line 34
def self.build_reader(attr)
eval "
def #{attr}
check_load_payload
@#{attr}
end
"
end
|
.xml_tag_name(name = nil) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/dcloud/base_model.rb', line 22
def self.xml_tag_name(name=nil)
unless ( name.nil? )
@xml_tag_name = name
end
@xml_tag_name || self.class.name.downcase.to_sym
end
|
Instance Method Details
#id ⇒ Object
52
53
54
55
|
# File 'lib/dcloud/base_model.rb', line 52
def id()
check_load_payload
@id
end
|