Sha256: 58fc3c5951c2a8f34cee4ae41f2513b70c6d6f317f356cc89366ac53beda2fa4

Contents?: true

Size: 498 Bytes

Versions: 3

Compression:

Stored size: 498 Bytes

Contents

module Spree
  class OauthApplication < Base
    include ::Doorkeeper::Orm::ActiveRecord::Mixins::Application

    self.table_name = 'spree_oauth_applications'

    before_validation :set_blank_for_redirect_uri

    # returns the last someone used this application
    #
    # @return [DateTime]
    def last_used_at
      access_tokens.order(:created_at).last&.created_at
    end

    private

    def set_blank_for_redirect_uri
      self.redirect_uri = '' if redirect_uri.nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_api-4.10.1 app/models/spree/oauth_application.rb
spree_api-4.10.0 app/models/spree/oauth_application.rb
spree_api-4.9.0 app/models/spree/oauth_application.rb