Sha256: 0dfc7c214da806c1be427e39fcf5428b27025279123cb2eb4bab8db2a36bfa90

Contents?: true

Size: 849 Bytes

Versions: 6

Compression:

Stored size: 849 Bytes

Contents

# frozen_string_literal: true

require 'googleauth'

# Object structuring the credentials retrieved for the Google API's
module BrowseEverything
  module Auth
    module Google
      class Credentials < ::Google::Auth::UserRefreshCredentials
        # Ensures that every call to retrieve an access token does *not* require an HTTP request
        # @see Google::Auth::UserRefreshCredentials#fetch_access_token
        # @param options [Hash] the access token values
        def fetch_access_token(options = {})
          return build_token_hash if access_token
          super(options)
        end

        private

        # Structure a hash from existing access token values (usually cached within a Cookie)
        # @return [Hash]
        def build_token_hash
          { 'access_token' => access_token }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
browse-everything-1.5.0 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.4.0 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.3.0 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.2.0 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.1.2 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.1.1 lib/browse_everything/auth/google/credentials.rb