Class: CommandTower::Messaging::Contract::Mappers::DeliveryAttemptMapper

Inherits:
Object
  • Object
show all
Defined in:
app/services/command_tower/messaging/contract/mappers/delivery_attempt_mapper.rb

Class Method Summary collapse

Class Method Details

.to_result(attempt, attempt_number:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/command_tower/messaging/contract/mappers/delivery_attempt_mapper.rb', line 8

def self.to_result(attempt, attempt_number:)
  return nil if attempt.nil?

  Results::DeliveryAttemptResult.new(
    id: attempt.id,
    status: attempt.status,
    started_at: attempt.started_at,
    finished_at: attempt.finished_at,
    error_code: attempt.error_code,
    error_class: attempt.error_class,
    normalized_provider_status: attempt.normalized_provider_status,
    provider_message_id: attempt.provider_message_id,
    attempt_number:,
  ).freeze
end