Class: ForemanNetbox::SyncHost::SyncDevice::Validate

Inherits:
Object
  • Object
show all
Includes:
Interactor
Defined in:
app/interactors/foreman_netbox/sync_host/sync_device/validate.rb

Instance Method Summary collapse

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
# File 'app/interactors/foreman_netbox/sync_host/sync_device/validate.rb', line 9

def call
  validator = ForemanNetbox::DeviceContract.new.call(netbox_params)

  return if validator.success?

  message = validator.errors
                     .messages
                     .map { |m| "#{m.path} #{m.text}" }
                     .to_sentence
  context.fail!(error: _('Invalid Device parameters: %s') % message)
end