Class: Moogle::Commands::FindTargets

Inherits:
Object
  • Object
show all
Includes:
Serf::Command
Defined in:
lib/moogle/commands/find_targets.rb

Instance Method Summary collapse

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/moogle/commands/find_targets.rb', line 16

def call
  target_model = opts :target_model, Moogle::Target
  representer = opts :representer, Moogle::TargetRepresenter

  targets = target_model.all owner_ref: request.owner_ref

  return targets.map{ |t| t.extend representer }
rescue => e
  e.extend Moogle::Error
  raise e
end