trabajo-afectivo/lib/sequencer/unit/import/kayako/time_entry/mapping.rb

39 lines
910 B
Ruby
Raw Normal View History

2022-01-01 13:38:12 +00:00
# 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