Class: MPI::Services::AddPersonResponseCreator

Inherits:
Object
  • Object
show all
Includes:
SentryLogging
Defined in:
lib/mpi/services/add_person_response_creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Constructor Details

#initialize(type:, response: nil, error: nil) ⇒ AddPersonResponseCreator

Returns a new instance of AddPersonResponseCreator.



13
14
15
16
17
# File 'lib/mpi/services/add_person_response_creator.rb', line 13

def initialize(type:, response: nil, error: nil)
  @type = type
  @response = response
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



11
12
13
# File 'lib/mpi/services/add_person_response_creator.rb', line 11

def error
  @error
end

#responseObject (readonly)

Returns the value of attribute response.



11
12
13
# File 'lib/mpi/services/add_person_response_creator.rb', line 11

def response
  @response
end

#typeObject (readonly)

Returns the value of attribute type.



11
12
13
# File 'lib/mpi/services/add_person_response_creator.rb', line 11

def type
  @type
end

Instance Method Details

#performObject



19
20
21
22
23
24
25
26
# File 'lib/mpi/services/add_person_response_creator.rb', line 19

def perform
  validations
  if failed_response?
    create_error_response
  else
    create_successful_response
  end
end