Exception: Crm::Errors::InvalidKeys

Inherits:
ClientError show all
Defined in:
lib/crm/errors.rb

Overview

InvalidKeys is raised if a create or update request contains unknown attributes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, validation_errors = {}) ⇒ InvalidKeys

Returns a new instance of InvalidKeys.



111
112
113
114
115
# File 'lib/crm/errors.rb', line 111

def initialize(message = nil, validation_errors = {})
  super("#{message} #{validation_errors.map{ |h| h['message'] }.to_sentence}.")

  @validation_errors = validation_errors
end

Instance Attribute Details

#validation_errorsArray<Hash{String => String}> (readonly)

Returns the list of validation errors. The items in the list are hashes consisting of a code (always unknown), the invalid attribute name and an English translation (message).

Examples:

[
  {
    "attribute" => "foo",
    "code" => "unknown",
    "message" => "foo is unknown",
  },
]

Returns:

  • (Array<Hash{String => String}>)


109
110
111
# File 'lib/crm/errors.rb', line 109

def validation_errors
  @validation_errors
end