Sha256: e98922177aefe32f168c2cdaa644300da170387faab761e8887d433f6182b0c8

Contents?: true

Size: 1.33 KB

Versions: 8

Compression:

Stored size: 1.33 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.to_i
      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.to_i
        d.hosting_type  = (xml).at('hosting_type').innerHTML
        d.outside_url   = (xml).at('outside_url').innerHTML
        d.passenger     = (xml).at('passenger').innerHTML.to_i
        d.path          = (xml).at('path').innerHTML
        d.php           = (xml).at('php').innerHTML
        d.php_fcgid     = (xml).at('php_fcgid').innerHTML.to_i
        d.security      = (xml).at('security').innerHTML.to_i
        d.user          = (xml).at('user').innerHTML
        d.www_or_not    = (xml).at('www_or_not').innerHTML
        d.xcache        = (xml).at('xcache').innerHTML.to_i
      end
      
      d
    end
    
    def short_home
      home.gsub(".Dreamy.com","")
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
jordan-brough-dreamy-0.5.1 lib/dreamy/domain.rb
sant0sk1-dreamy-0.3.0 lib/dreamy/domain.rb
sant0sk1-dreamy-0.4.1 lib/dreamy/domain.rb
sant0sk1-dreamy-0.5.0 lib/dreamy/domain.rb
sant0sk1-dreamy-0.5.1 lib/dreamy/domain.rb
dreamy-0.5.3 lib/dreamy/domain.rb
dreamy-0.5.2 lib/dreamy/domain.rb
dreamy-0.5.1 lib/dreamy/domain.rb