class Lita::GoogleUser

A google apps user

Attributes

created_at[R]
email[R]
full_name[R]
id[R]
last_login_at[R]
ou_path[R]

Public Class Methods

from_api_user(user) click to toggle source
# File lib/lita/google_user.rb, line 6
def self.from_api_user(user)
  GoogleUser.new(
    id: user.id,
    full_name: user.name.full_name,
    email: user.primary_email,
    suspended: user.suspended,
    created_at: user.creation_time,
    last_login_at: user.last_login_time,
    ou_path: user.org_unit_path,
    admin: user.is_admin,
    delegated_admin: user.is_delegated_admin,
    two_factor_enabled: user.is_enrolled_in2_sv,
    two_factor_enforced: user.is_enforced_in2_sv,
  )
end
new(id:, full_name:, email:, suspended:, created_at:, last_login_at:, ou_path:, admin:, delegated_admin:, two_factor_enabled:, two_factor_enforced:) click to toggle source
# File lib/lita/google_user.rb, line 22
def initialize(id:, full_name:, email:, suspended:, created_at:, last_login_at:, ou_path:, admin:, delegated_admin:, two_factor_enabled:, two_factor_enforced:)
  @id = id
  @email = email
  @full_name = full_name
  @suspended = suspended
  @created_at = created_at
  @last_login_at = last_login_at
  @ou_path = ou_path
  @admin = admin
  @delegated_admin = delegated_admin
  @two_factor_enabled = two_factor_enabled
  @two_factor_enforced = two_factor_enforced
end

Public Instance Methods

admin?() click to toggle source
# File lib/lita/google_user.rb, line 40
def admin?
  @admin
end
delegated_admin?() click to toggle source
# File lib/lita/google_user.rb, line 44
def delegated_admin?
  @delegated_admin
end
path() click to toggle source
# File lib/lita/google_user.rb, line 48
def path
  if @ou_path.end_with?("/")
    "#{@ou_path}#{@email}"
  else
    "#{@ou_path}/#{@email}"
  end
end
suspended?() click to toggle source
# File lib/lita/google_user.rb, line 56
def suspended?
  @suspended
end
to_s() click to toggle source
# File lib/lita/google_user.rb, line 36
def to_s
  @email
end
two_factor_enabled?() click to toggle source
# File lib/lita/google_user.rb, line 60
def two_factor_enabled?
  @two_factor_enabled
end
two_factor_enforced?() click to toggle source
# File lib/lita/google_user.rb, line 64
def two_factor_enforced?
  @two_factor_enforced
end