mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 10:49:39 +02:00
Refactor EppDomain to subdir
This commit is contained in:
parent
f766fdc21b
commit
d9c750e7e2
2 changed files with 10 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
module Epp::DomainsHelper
|
module Epp::DomainsHelper
|
||||||
def create_domain
|
def create_domain
|
||||||
EppDomain.transaction do
|
Epp::EppDomain.transaction do
|
||||||
@domain = EppDomain.new(domain_create_params)
|
@domain = Epp::EppDomain.new(domain_create_params)
|
||||||
|
|
||||||
@domain.parse_and_attach_domain_dependencies(parsed_frame)
|
@domain.parse_and_attach_domain_dependencies(parsed_frame)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
def check_domain
|
def check_domain
|
||||||
ph = params_hash['epp']['command']['check']['check']
|
ph = params_hash['epp']['command']['check']['check']
|
||||||
@domains = EppDomain.check_availability(ph[:name])
|
@domains = Epp::EppDomain.check_availability(ph[:name])
|
||||||
render '/epp/domains/check'
|
render '/epp/domains/check'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ module Epp::DomainsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_domain
|
def update_domain
|
||||||
EppDomain.transaction do
|
Epp::EppDomain.transaction do
|
||||||
@domain = find_domain
|
@domain = find_domain
|
||||||
|
|
||||||
handle_errors(@domain) and return unless @domain
|
handle_errors(@domain) and return unless @domain
|
||||||
|
@ -98,15 +98,15 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
def domain_create_params
|
def domain_create_params
|
||||||
period = (@ph[:period].to_i == 0) ? 1 : @ph[:period].to_i
|
period = (@ph[:period].to_i == 0) ? 1 : @ph[:period].to_i
|
||||||
period_unit = EppDomain.parse_period_unit_from_frame(parsed_frame) || 'y'
|
period_unit = Epp::EppDomain.parse_period_unit_from_frame(parsed_frame) || 'y'
|
||||||
valid_to = Date.today + EppDomain.convert_period_to_time(period, period_unit)
|
valid_to = Date.today + Epp::EppDomain.convert_period_to_time(period, period_unit)
|
||||||
|
|
||||||
{
|
{
|
||||||
name: @ph[:name],
|
name: @ph[:name],
|
||||||
registrar_id: current_epp_user.registrar.try(:id),
|
registrar_id: current_epp_user.registrar.try(:id),
|
||||||
registered_at: Time.now,
|
registered_at: Time.now,
|
||||||
period: (@ph[:period].to_i == 0) ? 1 : @ph[:period].to_i,
|
period: (@ph[:period].to_i == 0) ? 1 : @ph[:period].to_i,
|
||||||
period_unit: EppDomain.parse_period_unit_from_frame(parsed_frame) || 'y',
|
period_unit: Epp::EppDomain.parse_period_unit_from_frame(parsed_frame) || 'y',
|
||||||
valid_from: Date.today,
|
valid_from: Date.today,
|
||||||
valid_to: valid_to
|
valid_to: valid_to
|
||||||
}
|
}
|
||||||
|
@ -152,8 +152,8 @@ module Epp::DomainsHelper
|
||||||
|
|
||||||
## SHARED
|
## SHARED
|
||||||
def find_domain(secure = { secure: true })
|
def find_domain(secure = { secure: true })
|
||||||
domain = EppDomain.find_by(name: @ph[:name], registrar: current_epp_user.registrar) if secure[:secure] == true
|
domain = Epp::EppDomain.find_by(name: @ph[:name], registrar: current_epp_user.registrar) if secure[:secure] == true
|
||||||
domain = EppDomain.find_by(name: @ph[:name]) if secure[:secure] == false
|
domain = Epp::EppDomain.find_by(name: @ph[:name]) if secure[:secure] == false
|
||||||
|
|
||||||
unless domain
|
unless domain
|
||||||
epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), value: { obj: 'name', val: @ph[:name] } }
|
epp_errors << { code: '2303', msg: I18n.t('errors.messages.epp_domain_not_found'), value: { obj: 'name', val: @ph[:name] } }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class EppDomain < Domain
|
class Epp::EppDomain < Domain
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
EPP_ATTR_MAP = {
|
EPP_ATTR_MAP = {
|
Loading…
Add table
Add a link
Reference in a new issue