Sha256: d3a324059fbe892c7ff979dba82cdb45f78a60a7c6f167465277ed4c47b9fd68
Contents?: true
Size: 1.63 KB
Versions: 7
Compression:
Stored size: 1.63 KB
Contents
module Dreamy class PrivateServer include EasyClassMaker attributes :account_id, :name, :type, :memory, :start_date 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 def self.settings_from_xml(xml) settings = {} (xml/:data).each do |d| settings[(d).at('setting').innerHTML] = (d).at('value').innerHTML end settings end 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 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 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 end end
Version data entries
7 entries across 7 versions & 3 rubygems