Exception: StateMachines::IntegrationNotFound

Inherits:
Error
  • Object
show all
Defined in:
lib/state_machines/error.rb

Overview

An invalid integration was specified

Instance Attribute Summary

Attributes inherited from Error

#object

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ IntegrationNotFound

Returns a new instance of IntegrationNotFound.


16
17
18
# File 'lib/state_machines/error.rb', line 16

def initialize(name)
  super(nil, "#{name.inspect} is an invalid integration. #{error_message}")
end

Instance Method Details

#error_messageObject


32
33
34
35
36
37
38
# File 'lib/state_machines/error.rb', line 32

def error_message
  if Integrations.list.size.zero?
    no_integrations
  else
    valid_integrations
  end
end

#no_integrationsObject


28
29
30
# File 'lib/state_machines/error.rb', line 28

def no_integrations
  'No integrations registered'
end

#valid_integrationsObject


20
21
22
# File 'lib/state_machines/error.rb', line 20

def valid_integrations
  "Valid integrations are: #{valid_integrations_name}"
end

#valid_integrations_nameObject


24
25
26
# File 'lib/state_machines/error.rb', line 24

def valid_integrations_name
  Integrations.list.collect(&:integration_name)
end