You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
439 B
17 lines
439 B
# frozen_string_literal: true |
|
|
|
module DeprecationConcern |
|
extend ActiveSupport::Concern |
|
|
|
class_methods do |
|
def deprecate_api(date, sunset: nil, **kwargs) |
|
deprecation_timestamp = "@#{date.to_datetime.to_i}" |
|
sunset = sunset&.to_date&.httpdate |
|
|
|
before_action(**kwargs) do |
|
response.headers['Deprecation'] = deprecation_timestamp |
|
response.headers['Sunset'] = sunset if sunset |
|
end |
|
end |
|
end |
|
end
|
|
|