Sha256: 3bad3660b4226b18501983972a6249fdb6135b9d291831cf1f6204e1492de303

Contents?: true

Size: 1.15 KB

Versions: 22

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module Doorkeeper
  module GrantFlow
    class Flow
      attr_reader :name, :grant_type_matches, :grant_type_strategy,
                  :response_type_matches, :response_type_strategy,
                  :response_mode_matches

      def initialize(name, **options)
        @name = name
        @grant_type_matches = options[:grant_type_matches]
        @grant_type_strategy = options[:grant_type_strategy]
        @response_type_matches = options[:response_type_matches]
        @response_type_strategy = options[:response_type_strategy]
        @response_mode_matches = options[:response_mode_matches]
      end

      def handles_grant_type?
        grant_type_matches.present?
      end

      def handles_response_type?
        response_type_matches.present?
      end

      def matches_grant_type?(value)
        grant_type_matches === value
      end

      def matches_response_type?(value)
        response_type_matches === value
      end

      def default_response_mode
        response_mode_matches[0]
      end

      def matches_response_mode?(value)
        response_mode_matches.include?(value)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
doorkeeper-5.8.1 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.8.0 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.7.1 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.7.0 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.9 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.8 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.7 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.6 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.5 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.4 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.3 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.2 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.1 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.0 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.0.rc2 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.6.0.rc1 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.5.4 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.5.3 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.5.2 lib/doorkeeper/grant_flow/flow.rb
doorkeeper-5.5.1 lib/doorkeeper/grant_flow/flow.rb