trabajo-afectivo/lib/sequencer/unit/import/kayako/time_entry/mapping.rb
2022-01-01 14:38:12 +01:00

38 lines
910 B
Ruby

# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
class Sequencer
class Unit
module Import
module Kayako
module TimeEntry
class Mapping < Sequencer::Unit::Base
include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
uses :resource, :id_map, :created_by_id
provides :action
def process
provide_mapped do
{
time_unit: time_unit,
ticket_id: ticket_id,
created_by_id: created_by_id,
}
end
end
private
def time_unit
resource['time_spent'].to_i / 60
end
def ticket_id
id_map['Ticket'][resource['case']['id']]
end
end
end
end
end
end
end