Timestamp service configuration
Used by decidim-initiatives
.
Provide a class to generate a timestamp for a document. The instances of this class are initialized with a hash containing the :document key with the document to be timestamped as value. The instances respond to a timestamp public method with the timestamp.
An example class would be something like:
class MyTimestampService
attr_accessor :document
def initialize(args = {})
@document = args.fetch(:document)
end
def timestamp
# Code to generate timestamp
"My timestamp"
end
end
class MyTimestampService
attr_accessor :document
def initialize(args = {})
@document = args.fetch(:document)
end
def timestamp
# Actual code to add the timestamp
end
end
The arguments provided for the initialize method are:
-
document
- The document that needs to be timestamped
Then you will need to configure it with the help of Environment Variables:
export DECIDIM_TIMESTAMP_SERVICE="MyTimestampService"