Class: Rdux::Action

Inherits:
ApplicationRecord
  • Object
show all
Includes:
Actionable
Defined in:
app/models/rdux/action.rb

Instance Method Summary collapse

Instance Method Details

#call(opts = {}) ⇒ Object



16
17
18
# File 'app/models/rdux/action.rb', line 16

def call(opts = {})
  perform_action(:call, up_payload, opts)
end

#downObject



27
28
29
30
31
32
33
# File 'app/models/rdux/action.rb', line 27

def down
  return false unless down_at.nil?
  return false unless can_down?

  perform_action(:down, down_payload, build_opts)
  update(down_at: Time.current)
end

#to_failed_actionObject



35
36
37
# File 'app/models/rdux/action.rb', line 35

def to_failed_action
  FailedAction.new(attributes.except('down_payload', 'down_at', 'rdux_action_id'))
end

#up(opts = {}) ⇒ Object



20
21
22
23
24
25
# File 'app/models/rdux/action.rb', line 20

def up(opts = {})
  return false if up_payload_sanitized
  return false unless down_at.nil?

  perform_action(:up, up_payload, opts)
end