trabajo-afectivo/lib/import/base.rb

64 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2022-01-01 13:38:12 +00:00
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
module Import
class Base
# Checks if the backend is active.
#
# @example
# Import::ExampleBackend.active?
# #=> true
#
# return [Boolean]
def self.active?
true
end
# Checks if the backend is able to get queued by the Scheduler.
#
# @example
# Import::ExampleBackend.queueable?
# #=> true
#
# return [Boolean]
def self.queueable?
true
end
# Checks if the backend is able to get rescheduled in case the Scheduler
# got (re-)started while this ImportJob was running. Defaults to false.
#
# @example
# instance = Import::LDAP.new(import_job)
# instance.reschedule?(delayed_job)
# #=> false
#
# return [false]
def reschedule?(_delayed_job)
false
end
# Initializes a new instance with a stored reference to the ImportJob.
#
# @example
# instance = Import::ExampleBackend.new(import_job)
#
# return [Import::ExampleBackend]
def initialize(import_job)
@import_job = import_job
end
# Starts the life or dry run import of the backend.
#
# @example
# instance = Import::ExampleBackend.new(import_job)
#
# @raise [RuntimeError] Raised if the implementation of this mandatory method is missing
#
# return [nil]
def start
2021-05-25 12:30:12 +00:00
raise "Missing implementation of the 'start' method."
end
end
end