Sha256: 6669cfe5753e4588143f55fca3509475ec1b4923bbd41e0691f51ad9cb5844bf

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

module Dreamy
  class Domain
    include EasyClassMaker

    attributes  :account_id, :domain, :fastcgi, :home, :hosting_type, :outside_url, :passenger,
                :path, :php, :php_fcgid, :security, :type, :unique_ip, :user, :www_or_not, :xcache

    def self.new_from_xml(xml)
      d = new
      
      d.account_id    = (xml).at('account_id').innerHTML
      d.domain        = (xml).at('domain').innerHTML
      d.home          = (xml).at('home').innerHTML
      d.type          = (xml).at('type').innerHTML
      d.unique_ip     = (xml).at('unique_ip').innerHTML
      
      if d.type == 'http'
        d.fastcgi       = (xml).at('fastcgi').innerHTML
        d.hosting_type  = (xml).at('hosting_type').innerHTML
        d.outside_url   = (xml).at('outside_url').innerHTML
        d.passenger     = (xml).at('passenger').innerHTML
        d.path          = (xml).at('path').innerHTML
        d.php           = (xml).at('php').innerHTML
        d.php_fcgid     = (xml).at('php_fcgid').innerHTML
        d.security      = (xml).at('security').innerHTML
        d.user          = (xml).at('user').innerHTML
        d.www_or_not    = (xml).at('www_or_not').innerHTML
        d.xcache        = (xml).at('xcache').innerHTML
      end
      
      d
    end
    
    def short_home
      home.gsub(".Dreamy.com","")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sant0sk1-dreamy-0.2.4 lib/dreamy/domain.rb