Sha256: 03af40bb111a0c1d5f8afb102dfc294e19d9ec219a88504b1ee9687012267f04
Contents?: true
Size: 831 Bytes
Versions: 4
Compression:
Stored size: 831 Bytes
Contents
module Stitches module Deprecation # Indicate that a previously-deprecated endpoint is now gone def gone! head 410 end # Indicate that this endpoint is deprecated and will go away on the given date. # # gon_on: - date, as a string, when this endpoint will go away # block - the contents of the endpoint # # Example: # # def show # deprecated gone_on: "2019-04-09" do # render widgets: { Widget.find(params[:id]) } # end # end def deprecated(gone_on:,&block) response.set_header("Sunset",Date.parse(gone_on).in_time_zone("GMT").midnight.strftime("%a, %e %b %Y %H:%M:%S %Z")) Rails.logger.info("Deprecated endpoint #{request.method} #{request.fullpath} requested by #{current_user.id}") block.() end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
stitches-3.7.0 | lib/stitches/deprecation.rb |
stitches-3.6.1 | lib/stitches/deprecation.rb |
stitches-3.6.0 | lib/stitches/deprecation.rb |
stitches-3.6.0.RC1 | lib/stitches/deprecation.rb |