Method: WeBee::Enterprise.create

Defined in:
lib/webee.rb

.create(attributes = {}) ⇒ Object

may raise Exception if recuest is not successful



772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
# File 'lib/webee.rb', line 772

def self.create(attributes = {})
  xm = Builder::XmlMarkup.new
  xm.enterprise {
    xm.name attributes[:name]
    xm.cpuSoft(attributes[:cpu_soft] || "0")
    xm.cpuHard(attributes[:cpu_hard] || "0")
    xm.vlanSoft(attributes[:vlan_soft] || "0")
    xm.vlanHard(attributes[:vlan_hard] || "0")
    xm.ramSoft(attributes[:ram_soft] || "0")
    xm.ramHard(attributes[:ram_hard] || "0")
    xm.repositorySoft(attributes[:repository_soft] || "0")  
    xm.repositoryHard(attributes[:repository_hard] || "0") 
    xm.publicIpsSoft(attributes[:public_ip_soft] || "0" ) 
    xm.publicIpsHard(attributes[:public_ip_hard] || "0" ) 
    xm.hdSoft(attributes[:hd_soft] || "0")
    xm.hdHard(attributes[:hd_hard] || "0")
    xm.storageSoft(attributes[:storage_soft] || "0")
    xm.storageHard(attributes[:storage_hard] || "0")
  }
  res = RestClient.post(Api.url + '/admin/enterprises', xm.target!, :content_type => :xml)
  Enterprise.parse(res)
end