Class: DCloud::Realm
Instance Attribute Summary
Attributes inherited from BaseModel
Instance Method Summary collapse
-
#initialize(client, uri, xml = nil) ⇒ Realm
constructor
A new instance of Realm.
- #load_payload(xml = nil) ⇒ Object
- #to_plain ⇒ Object
Methods inherited from BaseModel
attribute, build_reader, #id, xml_tag_name
Constructor Details
#initialize(client, uri, xml = nil) ⇒ Realm
Returns a new instance of Realm.
29 30 31 |
# File 'lib/dcloud/realm.rb', line 29 def initialize(client, uri, xml=nil) super( client, uri, xml ) end |
Instance Method Details
#load_payload(xml = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/dcloud/realm.rb', line 33 def load_payload(xml=nil) super(xml) unless xml.nil? @name = xml.text( 'name' ) @state = xml.text( 'state' ) @limit = xml.text( 'limit' ) if ( @limit.nil? || @limit == '' ) @limit = :unlimited else @limit = @limit.to_f end end end |
#to_plain ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/dcloud/realm.rb', line 47 def to_plain sprintf("%-10s | %-15s | %-5s | %10s GB", self.id[0, 10], self.name[0, 15], self.state[0,5], self.limit.to_s[0,10] ) end |