[#10799] reorder methods A->Z

This commit is contained in:
Mathieu Magnin 2024-09-26 15:13:51 +02:00
parent 2bf773b0b7
commit 99a1b68185
No known key found for this signature in database
GPG key ID: 8DCAFC82D7BA654E

View file

@ -7,6 +7,7 @@ module APIEntrepriseTokenConcern
included do
validates :api_entreprise_token, jwt_token: true, allow_blank: true
before_save :set_api_entreprise_token_expires_at, if: :will_save_change_to_api_entreprise_token?
def api_entreprise_role?(role)
@ -17,10 +18,6 @@ module APIEntrepriseTokenConcern
self[:api_entreprise_token].presence || Rails.application.secrets.api_entreprise[:key]
end
def has_custom_api_entreprise_token?
self[:api_entreprise_token].present?
end
def api_entreprise_token_expired?
APIEntrepriseToken.new(api_entreprise_token).expired?
end
@ -29,6 +26,10 @@ module APIEntrepriseTokenConcern
api_entreprise_token_expires_at && api_entreprise_token_expires_at <= SOON_TO_EXPIRE_DELAY.from_now
end
def has_custom_api_entreprise_token?
self[:api_entreprise_token].present?
end
def set_api_entreprise_token_expires_at
self.api_entreprise_token_expires_at = has_custom_api_entreprise_token? ? APIEntrepriseToken.new(api_entreprise_token).expiration : nil
end