Class: Renalware::Letters::Letter::PendingReview
Constant Summary
EVENTS_MAP
Class Method Summary
collapse
Instance Method Summary
collapse
#archive_recipients!, #archived?, #archived_by, #determine_counterpart_ccs, #effective_date, effective_date_sort, #find_cc_recipient_for_contact, for_event, #letter_event, #signed?, #subject?
#first_or_create_by!, #save_by, #save_by!, #update_by
Class Method Details
.policy_class ⇒ Object
8
9
10
|
# File 'app/models/renalware/letters/letter/pending_review.rb', line 8
def self.policy_class
PendingReviewLetterPolicy
end
|
Instance Method Details
#generate_archive(by:, presenter: default_presenter) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/models/renalware/letters/letter/pending_review.rb', line 29
def generate_archive(by:, presenter: default_presenter)
becomes!(Approved).tap do |letter|
letter.by = by
achived_letter_content = presenter.content
letter.build_archive(by: by, content: achived_letter_content, letter_id: id)
end
end
|
#reject(by:) ⇒ Object
17
18
19
|
# File 'app/models/renalware/letters/letter/pending_review.rb', line 17
def reject(by:)
becomes!(Draft).tap { |letter| letter.by = by }
end
|
#revise(params) ⇒ Object
12
13
14
15
|
# File 'app/models/renalware/letters/letter/pending_review.rb', line 12
def revise(params)
params = LetterParamsProcessor.new(patient).call(params)
self.attributes = params
end
|
#sign(by:) ⇒ Object
21
22
23
24
25
26
27
|
# File 'app/models/renalware/letters/letter/pending_review.rb', line 21
def sign(by:)
build_signature(user: by, signed_at: Time.current)
self.approved_by = by
self.approved_at = Time.current
self.by = by
self
end
|