Exception: SpookAndPay::Transaction::InvalidActionError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/spook_and_pay/transaction.rb

Overview

An error thrown when attempting to perform an action that is not allowed given a transaction’s status.

Instance Method Summary collapse

Constructor Details

#initialize(id, action, status) ⇒ InvalidActionError

Returns a new instance of InvalidActionError.

Parameters:

  • String

    id

  • Symbol

    action

  • Symbol

    status



26
27
28
29
30
# File 'lib/spook_and_pay/transaction.rb', line 26

def initialize(id, action, status)
  @id     = id
  @action = action
  @status = status
end

Instance Method Details

#to_sObject

Human readable message.

Returns:

  • String



35
36
37
# File 'lib/spook_and_pay/transaction.rb', line 35

def to_s
  "Cannot perform the action '#{@action}' for transaction '#{@id}' while in status '#{@status}'"
end