Class: MyApiClient::ErrorHandling::Generator

Inherits:
ServiceAbstract show all
Defined in:
lib/my_api_client/error_handling/generator.rb

Overview

Generates an error handler proc (or symbol)

Constant Summary collapse

ARGUMENTS =
%i[instance response status_code headers json with raise block].freeze

Instance Method Summary collapse

Methods inherited from ServiceAbstract

call

Constructor Details

#initialize(**options) ⇒ Proc?

Returns the error handler as “Proc”. If no error occurs, return ‘nil`.

Parameters:

  • options (Hash)

    Options for this generator

  • instance (Hash)

    a customizable set of options

  • response (Hash)

    a customizable set of options

  • status_code (Hash)

    a customizable set of options

  • headers (Hash)

    a customizable set of options

  • json (Hash)

    a customizable set of options

  • with (Hash)

    a customizable set of options

  • raise (Hash)

    a customizable set of options

  • block (Hash)

    a customizable set of options



30
31
32
33
# File 'lib/my_api_client/error_handling/generator.rb', line 30

def initialize(**options)
  options[:raise] ||= MyApiClient::Error
  verify_and_set_arguments(**options)
end