Class: Supabase::Auth::Types::Session
- Inherits:
-
Struct
- Object
- Struct
- Supabase::Auth::Types::Session
- Defined in:
- lib/supabase/auth/types.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#expires_in ⇒ Object
Returns the value of attribute expires_in.
-
#provider_refresh_token ⇒ Object
Returns the value of attribute provider_refresh_token.
-
#provider_token ⇒ Object
Returns the value of attribute provider_token.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#token_type ⇒ Object
Returns the value of attribute token_type.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def access_token @access_token end |
#expires_at ⇒ Object
Returns the value of attribute expires_at
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def expires_at @expires_at end |
#expires_in ⇒ Object
Returns the value of attribute expires_in
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def expires_in @expires_in end |
#provider_refresh_token ⇒ Object
Returns the value of attribute provider_refresh_token
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def provider_refresh_token @provider_refresh_token end |
#provider_token ⇒ Object
Returns the value of attribute provider_token
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def provider_token @provider_token end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def refresh_token @refresh_token end |
#token_type ⇒ Object
Returns the value of attribute token_type
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def token_type @token_type end |
#user ⇒ Object
Returns the value of attribute user
150 151 152 |
# File 'lib/supabase/auth/types.rb', line 150 def user @user end |
Class Method Details
.from_hash(hash) ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/supabase/auth/types.rb', line 161 def self.from_hash(hash) return nil if hash.nil? expires_at = hash["expires_at"] || hash[:expires_at] expires_in = hash["expires_in"] || hash[:expires_in] if expires_in && !expires_at expires_at = Time.now.round.to_i + expires_in.to_i end expires_at = expires_at.to_i if expires_at new( provider_token: hash["provider_token"] || hash[:provider_token], provider_refresh_token: hash["provider_refresh_token"] || hash[:provider_refresh_token], access_token: hash["access_token"] || hash[:access_token], refresh_token: hash["refresh_token"] || hash[:refresh_token], token_type: hash["token_type"] || hash[:token_type], expires_in: hash["expires_in"] || hash[:expires_in], expires_at: expires_at, user: User.from_hash(hash["user"] || hash[:user]) ) end |