Sha256: f1d4d8a46e1d216bdc76182506da0e5be612fba3e093bdfa968cdcd78a67dec3

Contents?: true

Size: 859 Bytes

Versions: 8

Compression:

Stored size: 859 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

8 entries across 8 versions & 1 rubygems

Version Path
browse-everything-1.1.0 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.0.2 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.0.1 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.0.0 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.0.0.rc2 lib/browse_everything/auth/google/credentials.rb
browse-everything-1.0.0.rc1 lib/browse_everything/auth/google/credentials.rb
browse-everything-0.16.1 lib/browse_everything/auth/google/credentials.rb
browse-everything-0.16.0 lib/browse_everything/auth/google/credentials.rb