Class: DCloud::Image
Instance Attribute Summary
Attributes inherited from BaseModel
Instance Method Summary collapse
-
#initialize(client, uri, xml = nil) ⇒ Image
constructor
A new instance of Image.
- #load_payload(xml) ⇒ Object
- #to_plain ⇒ Object
Methods inherited from BaseModel
attribute, build_reader, #id, xml_tag_name
Constructor Details
#initialize(client, uri, xml = nil) ⇒ Image
Returns a new instance of Image.
31 32 33 |
# File 'lib/dcloud/image.rb', line 31 def initialize(client, uri, xml=nil) super( client, uri, xml ) end |
Instance Method Details
#load_payload(xml) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/dcloud/image.rb', line 35 def load_payload(xml) super( xml ) unless xml.nil? @description = xml.text( 'description' ) @owner_id = xml.text( 'owner_id' ) @name = xml.text( 'name' ) @architecture = xml.text( 'architecture' ) end end |
#to_plain ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/dcloud/image.rb', line 45 def to_plain sprintf("%-10s | %-20s | %-6s | %-20s | %15s", self.id[0,10], self.name ? self.name[0, 20]: 'unknown', self.architecture[0,6], self.description[0,20], self.owner_id[0,15] ) end |