# typed: false # frozen_string_literal: true require 'active_support/core_ext/numeric/time' module Setsuzoku module Service module WebService module Credentials module OAuthCredential extend T::Sig extend T::Helpers abstract! # The application's client_id to o_auth with. # # @return [String] the client_id for o_auth. sig { abstract.returns(T.nilable(String)) } def client_id; end # The application's client_secret to o_auth with. # # @return [String] the client_secret for o_auth. sig { abstract.returns(T.nilable(String)) } def client_secret; end # The application's redirect url to handle an o_auth redirect # # @return [String] the redirect url. sig { abstract.returns(T.nilable(String)) } def redirect_url; end # The token to use for the credential. # # @return [String] the credential's token. sig{ abstract.returns(T.nilable(String)) } def token; end # The token to set for the credential. # # @return [String] the credential's token to set. # sig{ abstract.params(val: String).returns(T.nilable(String)) } def token=(val); end # The refresh token to use for the credential. # # @return [String] the credential's refresh token. sig{ abstract.returns(T.nilable(String)) } def refresh_token; end # The refresh token to set for the credential. # # @return [String] the credential's refresh token to set. # sig{ abstract.params(val: String).returns(T.nilable(String)) } def refresh_token=(val); end # The time the currently valid token expires on. # # @return [Datetime] the time the current token expires. sig{ abstract.returns(T.nilable(DateTime)) } def expires_on; end # The time to set for when the token expires on. # # @return [Datetime] the time to set for the current token's expiry. sig{ abstract.params(val: DateTime).returns(T.nilable(DateTime)) } def expires_on=(val); end # Stub an o_auth_credential-like instance. # # @return [Struct] a stubbed o_auth_credential-like struct. sig { returns(Struct) } def self.stub_credential s = Struct.new(:status, :settings, :client_id, :client_secret, :redirect_url, :token, :refresh_token, :expires_on) s.new('active', {'extension': 'test'}, 'stubbed_client_id', 'stubbed_client_secret', 'stubbed_redirect_url', 'stubbed_token', 'refresh_token', (Time.now + 30.days)) end end end end end end