Class: Renalware::Letters::RecipientParamsProcessor

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/letters/recipient_params_processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(patient) ⇒ RecipientParamsProcessor

Returns a new instance of RecipientParamsProcessor.



11
12
13
# File 'app/models/renalware/letters/recipient_params_processor.rb', line 11

def initialize(patient)
  @patient = patient
end

Instance Method Details

#call(params) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/renalware/letters/recipient_params_processor.rb', line 15

def call(params)
  params =
    if can_have_contact_as_addressee?(params)
      params = put_contact_as_addressee(params)
      translate_keep_flag_to_nested_attributes_destroy_flag(params)
    else
      clear_addressee(params)
    end

  remove_addressee_id(params)
end