Sha256: 73dd789d0f97d08c35945b7bece1092f77915a4f349fce498b0349badbdc7c54

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Doorkeeper
  module DeviceAuthorizationGrant
    module Rails
      class Routes
        class Mapping # rubocop:disable Style/Documentation
          # @return [Hash{Symbol => String}]
          attr_accessor :controllers

          # @return [Hash{Symbol => Symbol}]
          attr_accessor :as

          # @return [Array<Symbol>]
          attr_accessor :skips

          def initialize
            @controllers = {
              device_authorizations: 'doorkeeper/device_authorization_grant/device_authorizations',
              device_codes: 'doorkeeper/device_authorization_grant/device_codes'
            }

            @as = {
              device_authorizations: :device_authorizations,
              device_codes: :device_codes
            }

            @skips = []
          end

          # @param routes [Symbol]
          # @return [Hash]
          def [](routes)
            {
              controller: @controllers[routes],
              as: @as[routes]
            }
          end

          # @param controller [Symbol]
          # @return [Boolean]
          def skipped?(controller)
            @skips.include?(controller)
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
doorkeeper-device_authorization_grant-1.0.3 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb
doorkeeper-device_authorization_grant-1.0.2 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb
doorkeeper-device_authorization_grant-1.0.1 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb
doorkeeper-device_authorization_grant-1.0.0 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb
doorkeeper-device_authorization_grant-0.2.1 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb
doorkeeper-device_authorization_grant-0.2.0 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb
doorkeeper-device_authorization_grant-0.1.1 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb
doorkeeper-device_authorization_grant-0.1.0 lib/doorkeeper/device_authorization_grant/rails/routes/mapping.rb