Class: PleskLib::Actions::CreateAccount

Inherits:
Base
  • Object
show all
Defined in:
lib/plesk_lib/actions/create_account.rb

Direct Known Subclasses

CreateCustomer, CreateReseller

Instance Method Summary collapse

Methods inherited from Base

#execute_on

Instance Method Details

#analyse(xml_document) ⇒ Object



18
19
20
21
22
# File 'lib/plesk_lib/actions/create_account.rb', line 18

def analyse(xml_document)
  add_node = xml_document.root.locate('*/result').first
  @plesk_id = add_node.id.text.to_i
  @guid = add_node.guid.text
end

#build_gen_info(xml, account, tag_name = 'gen_info') ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/plesk_lib/actions/create_account.rb', line 2

def build_gen_info(xml, , tag_name = 'gen_info')
  xml.tag!(tag_name) {
    xml.cname(.company_name)
    xml.pname(.person_name)
    xml.(.) if ..present?
    xml.passwd(.password) if .password.present?
    xml.pcode(.pcode) if .postal_code.present?
    %w(status phone fax address city state email country).each do |attribute|
      value = .send(attribute)
      xml.tag!(attribute, value) if value.present?
    end
    xml.tag!('owner-id', .owner_id) if .owner_id.present?
  }
  return xml.target!
end