mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Move actions to own namespace
This commit is contained in:
parent
115cefc0cf
commit
d7f01f24a2
19 changed files with 27 additions and 26 deletions
|
@ -59,7 +59,7 @@ module Actions
|
|||
end
|
||||
|
||||
def maybe_attach_legal_doc
|
||||
Actions::BaseAction.attach_legal_doc_to_new(contact, legal_document, domain: false)
|
||||
::Actions::BaseAction.attach_legal_doc_to_new(contact, legal_document, domain: false)
|
||||
end
|
||||
|
||||
def commit
|
|
@ -23,7 +23,7 @@ module Actions
|
|||
end
|
||||
|
||||
def maybe_attach_legal_doc
|
||||
Actions::BaseAction.maybe_attach_legal_doc(contact, legal_document)
|
||||
::Actions::BaseAction.maybe_attach_legal_doc(contact, legal_document)
|
||||
end
|
||||
|
||||
def commit
|
|
@ -42,7 +42,7 @@ module Actions
|
|||
end
|
||||
|
||||
def maybe_attach_legal_doc
|
||||
Actions::BaseAction.maybe_attach_legal_doc(contact, legal_document)
|
||||
::Actions::BaseAction.maybe_attach_legal_doc(contact, legal_document)
|
||||
end
|
||||
|
||||
def maybe_update_ident
|
|
@ -178,7 +178,7 @@ module Actions
|
|||
end
|
||||
|
||||
def maybe_attach_legal_doc
|
||||
Actions::BaseAction.attach_legal_doc_to_new(domain, params[:legal_document], domain: true)
|
||||
::Actions::BaseAction.attach_legal_doc_to_new(domain, params[:legal_document], domain: true)
|
||||
end
|
||||
|
||||
def process_auction_and_disputes
|
|
@ -23,7 +23,7 @@ module Actions
|
|||
end
|
||||
|
||||
def maybe_attach_legal_doc
|
||||
Actions::BaseAction.attach_legal_doc_to_new(domain, params[:legal_document], domain: true)
|
||||
::Actions::BaseAction.attach_legal_doc_to_new(domain, params[:legal_document], domain: true)
|
||||
end
|
||||
|
||||
def verify_not_discarded
|
|
@ -14,7 +14,7 @@ module Actions
|
|||
assign_new_registrant if params[:registrant]
|
||||
assign_relational_modifications
|
||||
assign_requested_statuses
|
||||
Actions::BaseAction.maybe_attach_legal_doc(domain, params[:legal_document])
|
||||
::Actions::BaseAction.maybe_attach_legal_doc(domain, params[:legal_document])
|
||||
|
||||
commit
|
||||
end
|
|
@ -23,7 +23,7 @@ module Epp
|
|||
|
||||
@contact = Epp::Contact.new(params[:parsed_frame], current_user.registrar)
|
||||
collected_data = ::Deserializers::Xml::ContactCreate.new(params[:parsed_frame])
|
||||
action = Actions::ContactCreate.new(@contact, collected_data.legal_document,
|
||||
action = ::Actions::ContactCreate.new(@contact, collected_data.legal_document,
|
||||
collected_data.ident)
|
||||
|
||||
action_call_response(action: action)
|
||||
|
@ -33,7 +33,7 @@ module Epp
|
|||
authorize! :update, @contact, @password
|
||||
|
||||
collected_data = ::Deserializers::Xml::ContactUpdate.new(params[:parsed_frame])
|
||||
action = Actions::ContactUpdate.new(@contact,
|
||||
action = ::Actions::ContactUpdate.new(@contact,
|
||||
collected_data.contact,
|
||||
collected_data.legal_document,
|
||||
collected_data.ident,
|
||||
|
@ -44,7 +44,7 @@ module Epp
|
|||
|
||||
def delete
|
||||
authorize! :delete, @contact, @password
|
||||
action = Actions::ContactDelete.new(@contact, params[:legal_document])
|
||||
action = ::Actions::ContactDelete.new(@contact, params[:legal_document])
|
||||
unless action.call
|
||||
handle_errors(@contact)
|
||||
return
|
||||
|
|
|
@ -32,7 +32,7 @@ module Epp
|
|||
registrar_id = current_user.registrar.id
|
||||
@domain = Epp::Domain.new
|
||||
data = ::Deserializers::Xml::DomainCreate.new(params[:parsed_frame], registrar_id).call
|
||||
action = Actions::DomainCreate.new(@domain, data)
|
||||
action = ::Actions::DomainCreate.new(@domain, data)
|
||||
|
||||
action.call ? render_epp_response('/epp/domains/create') : handle_errors(@domain)
|
||||
end
|
||||
|
@ -43,7 +43,7 @@ module Epp
|
|||
registrar_id = current_user.registrar.id
|
||||
update_params = ::Deserializers::Xml::DomainUpdate.new(params[:parsed_frame],
|
||||
registrar_id).call
|
||||
action = Actions::DomainUpdate.new(@domain, update_params, false)
|
||||
action = ::Actions::DomainUpdate.new(@domain, update_params, false)
|
||||
(handle_errors(@domain) and return) unless action.call
|
||||
|
||||
pending = @domain.epp_pending_update.present?
|
||||
|
@ -54,7 +54,7 @@ module Epp
|
|||
authorize!(:delete, @domain, @password)
|
||||
frame = params[:parsed_frame]
|
||||
delete_params = ::Deserializers::Xml::DomainDelete.new(frame).call
|
||||
action = Actions::DomainDelete.new(@domain, delete_params, current_user.registrar)
|
||||
action = ::Actions::DomainDelete.new(@domain, delete_params, current_user.registrar)
|
||||
|
||||
(handle_errors(@domain) and return) unless action.call
|
||||
|
||||
|
@ -77,7 +77,7 @@ module Epp
|
|||
registrar_id = current_user.registrar.id
|
||||
renew_params = ::Deserializers::Xml::Domain.new(params[:parsed_frame],
|
||||
registrar_id).call
|
||||
action = Actions::DomainRenew.new(@domain, renew_params, current_user.registrar)
|
||||
action = ::Actions::DomainRenew.new(@domain, renew_params, current_user.registrar)
|
||||
if action.call
|
||||
render_epp_response '/epp/domains/renew'
|
||||
else
|
||||
|
|
|
@ -35,7 +35,7 @@ module Repp
|
|||
desc 'Create a new contact'
|
||||
def create
|
||||
@contact = Epp::Contact.new(contact_params_with_address, current_user.registrar, epp: false)
|
||||
action = Actions::ContactCreate.new(@contact, params[:legal_document],
|
||||
action = ::Actions::ContactCreate.new(@contact, params[:legal_document],
|
||||
contact_ident_params)
|
||||
|
||||
unless action.call
|
||||
|
@ -49,7 +49,7 @@ module Repp
|
|||
api :PUT, '/repp/v1/contacts/:contact_code'
|
||||
desc 'Update existing contact'
|
||||
def update
|
||||
action = Actions::ContactUpdate.new(@contact, contact_params_with_address(required: false),
|
||||
action = ::Actions::ContactUpdate.new(@contact, contact_params_with_address(required: false),
|
||||
params[:legal_document],
|
||||
contact_ident_params(required: false), current_user)
|
||||
|
||||
|
@ -64,7 +64,7 @@ module Repp
|
|||
api :DELETE, '/repp/v1/contacts/:contact_code'
|
||||
desc 'Delete a specific contact'
|
||||
def destroy
|
||||
action = Actions::ContactDelete.new(@contact, params[:legal_document])
|
||||
action = ::Actions::ContactDelete.new(@contact, params[:legal_document])
|
||||
unless action.call
|
||||
handle_errors(@contact)
|
||||
return
|
||||
|
|
|
@ -39,7 +39,7 @@ module Repp
|
|||
|
||||
def cta(action = 'add')
|
||||
params[:contacts].each { |c| c[:action] = action }
|
||||
action = Actions::DomainUpdate.new(@domain, contact_create_params, false)
|
||||
action = ::Actions::DomainUpdate.new(@domain, contact_create_params, false)
|
||||
|
||||
# rubocop:disable Style/AndOr
|
||||
handle_errors(@domain) and return unless action.call
|
||||
|
|
|
@ -38,7 +38,7 @@ module Repp
|
|||
|
||||
def cta(action = 'add')
|
||||
params[:dns_keys].each { |n| n[:action] = action }
|
||||
action = Actions::DomainUpdate.new(@domain, dnssec_params, false)
|
||||
action = ::Actions::DomainUpdate.new(@domain, dnssec_params, false)
|
||||
|
||||
# rubocop:disable Style/AndOr
|
||||
(handle_errors(@domain) and return) unless action.call
|
||||
|
|
|
@ -14,7 +14,7 @@ module Repp
|
|||
end
|
||||
def create
|
||||
params[:nameservers].each { |n| n[:action] = 'add' }
|
||||
action = Actions::DomainUpdate.new(@domain, nameserver_params, current_user)
|
||||
action = ::Actions::DomainUpdate.new(@domain, nameserver_params, current_user)
|
||||
|
||||
unless action.call
|
||||
handle_errors(@domain)
|
||||
|
@ -28,7 +28,7 @@ module Repp
|
|||
desc 'Delete specific nameserver from domain'
|
||||
def destroy
|
||||
nameserver = { nameservers: [{ hostname: params[:id], action: 'rem' }] }
|
||||
action = Actions::DomainUpdate.new(@domain, nameserver, false)
|
||||
action = ::Actions::DomainUpdate.new(@domain, nameserver, false)
|
||||
|
||||
unless action.call
|
||||
handle_errors(@domain)
|
||||
|
|
|
@ -10,7 +10,7 @@ module Repp
|
|||
param :transfer_code, String, required: true, desc: 'Renew period. Month (m) or year (y)'
|
||||
end
|
||||
def create
|
||||
action = Actions::DomainTransfer.new(@domain, transfer_params[:transfer][:transfer_code],
|
||||
action = ::Actions::DomainTransfer.new(@domain, transfer_params[:transfer][:transfer_code],
|
||||
current_user.registrar)
|
||||
|
||||
unless action.call
|
||||
|
|
|
@ -55,7 +55,7 @@ module Repp
|
|||
def create
|
||||
authorize!(:create, Epp::Domain)
|
||||
@domain = Epp::Domain.new
|
||||
action = Actions::DomainCreate.new(@domain, domain_create_params)
|
||||
action = ::Actions::DomainCreate.new(@domain, domain_create_params)
|
||||
|
||||
# rubocop:disable Style/AndOr
|
||||
handle_errors(@domain) and return unless action.call
|
||||
|
@ -76,7 +76,7 @@ module Repp
|
|||
param :auth_info, String, required: false, desc: 'New authorization code'
|
||||
end
|
||||
def update
|
||||
action = Actions::DomainUpdate.new(@domain, params[:domain], false)
|
||||
action = ::Actions::DomainUpdate.new(@domain, params[:domain], false)
|
||||
|
||||
unless action.call
|
||||
handle_errors(@domain)
|
||||
|
@ -122,7 +122,7 @@ module Repp
|
|||
desc: 'Whether to ask registrant verification or not'
|
||||
end
|
||||
def destroy
|
||||
action = Actions::DomainDelete.new(@domain, params, current_user.registrar)
|
||||
action = ::Actions::DomainDelete.new(@domain, params, current_user.registrar)
|
||||
|
||||
# rubocop:disable Style/AndOr
|
||||
handle_errors(@domain) and return unless action.call
|
||||
|
@ -141,7 +141,7 @@ module Repp
|
|||
|
||||
def initiate_transfer(transfer)
|
||||
domain = Epp::Domain.find_or_initialize_by(name: transfer[:domain_name])
|
||||
action = Actions::DomainTransfer.new(domain, transfer[:transfer_code],
|
||||
action = ::Actions::DomainTransfer.new(domain, transfer[:transfer_code],
|
||||
current_user.registrar)
|
||||
|
||||
if action.call
|
||||
|
|
|
@ -25,7 +25,7 @@ module Domains
|
|||
frame = frame_json ? frame_json.with_indifferent_access : {}
|
||||
assign_domain_update_meta
|
||||
|
||||
Actions::DomainUpdate.new(domain, frame, true).call
|
||||
::Actions::DomainUpdate.new(domain, frame, true).call
|
||||
end
|
||||
|
||||
def assign_domain_update_meta
|
||||
|
|
|
@ -38,6 +38,7 @@ module DomainNameRegistry
|
|||
config.autoload_paths += Dir[Rails.root.join('app', 'models', '**/')]
|
||||
config.autoload_paths += Dir[Rails.root.join('app', 'lib', '**/')]
|
||||
config.autoload_paths += Dir[Rails.root.join('app', 'interactions', '**/')]
|
||||
config.autoload_paths += Dir[Rails.root.join('app', 'actions', '**/')]
|
||||
config.eager_load_paths << config.root.join('lib', 'validators')
|
||||
config.eager_load_paths << config.root.join('app', 'lib')
|
||||
config.watchable_dirs['lib'] = %i[rb]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue