Create DomainCreate action

This commit is contained in:
Karl Erik Õunapuu 2020-12-08 12:00:04 +02:00
parent b683fe813c
commit ccef1053d9
No known key found for this signature in database
GPG key ID: C9DD647298A34764
6 changed files with 280 additions and 28 deletions

View file

@ -2,18 +2,21 @@ module Deserializers
module Xml
class Domain
attr_reader :frame
attr_reader :registrar
def initialize(frame)
def initialize(frame, registrar)
@frame = frame
@registrar = registrar
end
def call
attributes = {
name: if_present('name'),
registrar_id: current_user.registrar.id,
registrar_id: registrar,
registrant_id: if_present('registrant'),
reserved_pw: if_present('reserved > pw'),
period: Integer(frame.css('period').text, 1),
period_unit: parsed_frame.css('period').first ? parsed_frame.css('period').first[:unit] : 'y'
period: Integer(frame.css('period').text) || 1,
period_unit: frame.css('period').first ? frame.css('period').first[:unit] : 'y',
}
pw = frame.css('authInfo > pw').text