Class: Pinnable::ResolvePin

Inherits:
Object
  • Object
show all
Defined in:
app/services/pinnable/resolve_pin.rb

Overview

Moves a pin along its task lifecycle (open -> resolved/wont_fix and back), stamping who completed it and when, then emitting the host’s audit event. Reopening clears the completion stamps so the task reads as live again.

Constant Summary collapse

COMPLETED =
%w[resolved wont_fix].freeze

Instance Method Summary collapse

Constructor Details

#initialize(pin:, by:, status:) ⇒ ResolvePin

Returns a new instance of ResolvePin.



8
9
10
11
12
# File 'app/services/pinnable/resolve_pin.rb', line 8

def initialize(pin:, by:, status:)
  @pin = pin
  @by = by
  @status = status.to_s
end

Instance Method Details

#callObject



14
15
16
17
18
# File 'app/services/pinnable/resolve_pin.rb', line 14

def call
  pin.update!(status:, **completion)
  Pinnable.config.audit.call(pin, status.to_sym, by)
  pin
end