Sha256: 069fb88a131584b28659b1801f51c6c7e807eab7eb3fb4237f6161f52b1433a3

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'devise'
require 'active_support/concern'
require_relative 'api/configuration'
require_relative 'api/version'
require_relative 'api/controllers/helpers'
require_relative 'api/responses/error_response'
require_relative 'api/responses/token_response'
require_relative 'api/generators/install_generator'

# rubocop:disable Style/ClassVars
module Devise
  mattr_accessor :api
  @@api = Devise::Api::Configuration.new

  module Models
    module Api
      extend ActiveSupport::Concern

      included do
        has_many :access_tokens,
                 class_name: Devise.api.config.base_token_model,
                 dependent: :destroy,
                 as: :resource_owner
      end

      class_methods do
        def supported_devise_modules
          devise_modules.inquiry
        end
      end
    end
  end

  module Api; end

  add_module :api,
             strategy: false,
             controller: :tokens,
             route: { api: %i[revoke refresh sign_up sign_in info] }
end
# rubocop:enable Style/ClassVars

ActiveSupport.on_load(:action_controller) do
  include Devise::Api::Controllers::Helpers
end

require_relative 'api/token'
require_relative 'api/rails/engine'
require_relative 'api/rails/routes'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise-api-0.2.0 lib/devise/api.rb
devise-api-0.1.3 lib/devise/api.rb
devise-api-0.1.2 lib/devise/api.rb
devise-api-0.1.1 lib/devise/api.rb