Class: PleskKit::CustomerAccount
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- PleskKit::CustomerAccount
- Defined in:
- app/models/plesk_kit/customer_account.rb
Instance Method Summary collapse
- #analyse(response_string, server_id) ⇒ Object
-
#pack_this(shell) ⇒ Object
Creates Object & Packet.
- #provision_in_plesk ⇒ Object
Instance Method Details
#analyse(response_string, server_id) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/models/plesk_kit/customer_account.rb', line 45 def analyse response_string, server_id xml = REXML::Document.new(response_string) status = xml.root.elements['//status'].text if xml.root.elements['//status'].present? if status == "error" code = xml.root.elements['//errcode'].text = xml.root.elements['//errtext'].text raise "#{code}: #{}" else plesk_id = xml.root.elements['//id'].text if xml.root.elements['//id'].present? self.server_id = server_id end #self.save return self # TODO save plesk_id end |
#pack_this(shell) ⇒ Object
Creates Object & Packet
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/plesk_kit/customer_account.rb', line 19 def pack_this shell xml = shell xml.instruct! xml.packet(:version => '1.6.3.5') { xml.customer { xml.add{ xml.gen_info{ xml.cname(self.cname) xml.pname(self.pname) xml.login(self.login) xml.passwd(self.passwd) #xml.status(status ? 0 : 1) #xml.phone(phone) #xml.fax(fax) #xml.address(address) #xml.city(city) #xml.state(state) #xml.pcode(pcode) #xml.country(country) } } } } return xml.target! end |
#provision_in_plesk ⇒ Object
9 10 11 12 |
# File 'app/models/plesk_kit/customer_account.rb', line 9 def provision_in_plesk PleskKit::Communicator.pack_and_play_with_customer_or_reseller self true end |