Class: Firebase::Admin::Auth::UserRecord

Inherits:
UserInfo
  • Object
show all
Defined in:
lib/firebase/admin/auth/user_record.rb

Overview

A Firebase User account

Instance Method Summary collapse

Methods inherited from UserInfo

#display_name, #email, #initialize, #phone_number, #photo_url, #to_h

Constructor Details

This class inherits a constructor from Firebase::Admin::Auth::UserInfo

Instance Method Details

#custom_claimsObject

Gets any custom claims set on this user account.



57
58
59
60
61
# File 'lib/firebase/admin/auth/user_record.rb', line 57

def custom_claims
  claims = @data["customAttributes"]
  parsed = JSON.parse(claims) unless claims.nil?
  parsed if parsed.is_a?(Hash) && !parsed.empty?
end

#disabled?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/firebase/admin/auth/user_record.rb', line 24

def disabled?
  !!@data["disabled"]
end

#email_verified?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/firebase/admin/auth/user_record.rb', line 20

def email_verified?
  !!@data["emailVerified"]
end

#provider_dataArray of UserInfo

Gets a list of (UserInfo) instances.

Each object represents an identity from an identity provider that is linked to this user.

Returns:



51
52
53
54
# File 'lib/firebase/admin/auth/user_record.rb', line 51

def provider_data
  providers = @data["providerUserInfo"] || []
  providers.to_a.map { |p| UserInfo.new(p) }
end

#provider_idObject

Gets the id of the identity provider.

Always firebase for user accounts.



16
17
18
# File 'lib/firebase/admin/auth/user_record.rb', line 16

def provider_id
  "firebase"
end

#tenant_idObject

Returns the tenant ID of this user.

Raises:

  • (NotImplementedError)


64
65
66
# File 'lib/firebase/admin/auth/user_record.rb', line 64

def tenant_id
  raise NotImplementedError
end

#tokens_valid_after_timestampNumeric

Note:

truncated to 1 second accuracy.

Gets the time, in milliseconds since the epoch, before which tokens are invalid.

Returns:

  • (Numeric)

    Timestamp in milliseconds since the epoch, truncated to the second. All tokens issued before that time are considered revoked.

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/firebase/admin/auth/user_record.rb', line 35

def tokens_valid_after_timestamp
  raise NotImplementedError
end

#uidObject

Gets the ID of this user.



9
10
11
# File 'lib/firebase/admin/auth/user_record.rb', line 9

def uid
  @data["localId"]
end

#user_metadataUserMetadata

Gets additional metadata associated with this user.

Returns:

  • (UserMetadata)

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/firebase/admin/auth/user_record.rb', line 42

def 
  raise NotImplementedError
end