Class: Dreamy::PrivateServer
- Inherits:
-
Object
- Object
- Dreamy::PrivateServer
- Includes:
- EasyClassMaker
- Defined in:
- lib/dreamy/private_server.rb
Class Method Summary collapse
- .new_from_xml(xml) ⇒ Object
- .pending_from_xml(xml) ⇒ Object
- .settings_from_xml(xml) ⇒ Object
- .size_from_xml(xml) ⇒ Object
- .usage_from_xml(xml) ⇒ Object
Methods included from EasyClassMaker
Class Method Details
.new_from_xml(xml) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/dreamy/private_server.rb', line 7 def self.new_from_xml(xml) ps = new ps.account_id = (xml).at('account_id').innerHTML.to_i ps.name = (xml).at('ps').innerHTML ps.type = (xml).at('type').innerHTML ps.memory = (xml).at('memory_mb').innerHTML.to_i ps.start_date = (xml).at('start_date').innerHTML ps end |
.pending_from_xml(xml) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/dreamy/private_server.rb', line 43 def self.pending_from_xml(xml) pending = {} pending["account_id"] = (xml).at('account_id').innerHTML pending["ip"] = (xml).at('ip').innerHTML pending["type"] = (xml).at('type').innerHTML pending["stamp"] = (xml).at('stamp').innerHTML pending end |
.settings_from_xml(xml) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/dreamy/private_server.rb', line 17 def self.settings_from_xml(xml) settings = {} (xml/:data).each do |d| settings[(d).at('setting').innerHTML] = (d).at('value').innerHTML end settings end |
.size_from_xml(xml) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/dreamy/private_server.rb', line 25 def self.size_from_xml(xml) size = {} size["memory_mb"] = (xml).at('memory_mb').innerHTML.to_i size["monthly_cost"] = (xml).at('monthly_cost').innerHTML.to_f size["period_cost"] = (xml).at('period_cost').innerHTML.to_f size["period_seconds"] = (xml).at('period_seconds').innerHTML.to_i size["stamp"] = (xml).at('stamp').innerHTML size end |
.usage_from_xml(xml) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/dreamy/private_server.rb', line 35 def self.usage_from_xml(xml) usage = {} usage["load"] = (xml).at('load').innerHTML.to_f usage["memory_mb"] = (xml).at('memory_mb').innerHTML.to_i usage["stamp"] = (xml).at('stamp').innerHTML usage end |