Exception: GoCardlessPro::InvalidStateError

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

Overview

Thrown when the API returns an invalid state error

Constant Summary collapse

IDEMPOTENT_CREATION_CONFLICT =
'idempotent_creation_conflict'.freeze
CONFLICTING_RESOURCE_ID =
'conflicting_resource_id'.freeze

Instance Attribute Summary

Attributes inherited from Error

#error

Instance Method Summary collapse

Methods inherited from Error

#code, #documentation_url, #errors, #initialize, #message, #request_id, #to_s, #type

Constructor Details

This class inherits a constructor from GoCardlessPro::Error

Instance Method Details

#conflicting_resource_idObject



11
12
13
14
15
# File 'lib/gocardless_pro/error/invalid_state_error.rb', line 11

def conflicting_resource_id
  return unless idempotent_creation_conflict?

  idempotent_creation_conflict_error['links'][CONFLICTING_RESOURCE_ID]
end

#idempotent_creation_conflict?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/gocardless_pro/error/invalid_state_error.rb', line 7

def idempotent_creation_conflict?
  !idempotent_creation_conflict_error.nil?
end