Sha256: 1ce3e184d900f7fb4147b092b9cbe2f5f55e808b49c42c48ba33f179b34fc2f2

Contents?: true

Size: 640 Bytes

Versions: 26

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

module LHS
  module OAuth
    extend ActiveSupport::Concern

    included do
      prepend_before_action :lhs_store_oauth_access_token
    end

    private

    def lhs_store_oauth_access_token
      lhs_check_auto_oauth_enabled!
      LHS::Interceptors::AutoOauth::ThreadRegistry.access_token = instance_exec(&LHS.config.auto_oauth)
    end

    def lhs_check_auto_oauth_enabled!
      return if LHS.config.auto_oauth.present? && LHS.config.auto_oauth.is_a?(Proc)
      raise 'You have to enable LHS.config.auto_oauth by passing a proc returning an access token!'
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
lhs-26.2.0 lib/lhs/concerns/o_auth.rb
lhs-26.1.0 lib/lhs/concerns/o_auth.rb
lhs-26.0.1 lib/lhs/concerns/o_auth.rb
lhs-26.0.0 lib/lhs/concerns/o_auth.rb
lhs-25.2.0 lib/lhs/concerns/o_auth.rb
lhs-25.1.0 lib/lhs/concerns/o_auth.rb
lhs-25.0.4 lib/lhs/concerns/o_auth.rb
lhs-25.0.3 lib/lhs/concerns/o_auth.rb
lhs-25.0.2 lib/lhs/concerns/o_auth.rb
lhs-25.0.1 lib/lhs/concerns/o_auth.rb
lhs-25.0.0 lib/lhs/concerns/o_auth.rb
lhs-24.1.2 lib/lhs/concerns/o_auth.rb
lhs-24.1.1 lib/lhs/concerns/o_auth.rb
lhs-24.1.0 lib/lhs/concerns/o_auth.rb
lhs-24.1.0.pre.2 lib/lhs/concerns/o_auth.rb
lhs-24.1.0.pre.1 lib/lhs/concerns/o_auth.rb
lhs-24.0.0 lib/lhs/concerns/o_auth.rb
lhs-23.0.2 lib/lhs/concerns/o_auth.rb
lhs-23.0.1 lib/lhs/concerns/o_auth.rb
lhs-23.0.0 lib/lhs/concerns/o_auth.rb