Class: Lita::GoogleUser
- Inherits:
-
Object
- Object
- Lita::GoogleUser
- Defined in:
- lib/lita/google_user.rb
Overview
A google apps user
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_login_at ⇒ Object
readonly
Returns the value of attribute last_login_at.
-
#ou_path ⇒ Object
readonly
Returns the value of attribute ou_path.
Class Method Summary collapse
Instance Method Summary collapse
- #admin? ⇒ Boolean
- #delegated_admin? ⇒ Boolean
-
#initialize(id:, full_name:, email:, suspended:, created_at:, last_login_at:, ou_path:, admin:, delegated_admin:, two_factor_enabled:, two_factor_enforced:) ⇒ GoogleUser
constructor
A new instance of GoogleUser.
- #path ⇒ Object
- #suspended? ⇒ Boolean
- #to_s ⇒ Object
- #two_factor_enabled? ⇒ Boolean
- #two_factor_enforced? ⇒ Boolean
Constructor Details
#initialize(id:, full_name:, email:, suspended:, created_at:, last_login_at:, ou_path:, admin:, delegated_admin:, two_factor_enabled:, two_factor_enforced:) ⇒ GoogleUser
Returns a new instance of GoogleUser.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/lita/google_user.rb', line 4 def created_at @created_at end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/lita/google_user.rb', line 4 def email @email end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
4 5 6 |
# File 'lib/lita/google_user.rb', line 4 def full_name @full_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/lita/google_user.rb', line 4 def id @id end |
#last_login_at ⇒ Object (readonly)
Returns the value of attribute last_login_at.
4 5 6 |
# File 'lib/lita/google_user.rb', line 4 def last_login_at @last_login_at end |
#ou_path ⇒ Object (readonly)
Returns the value of attribute ou_path.
4 5 6 |
# File 'lib/lita/google_user.rb', line 4 def ou_path @ou_path end |
Class Method Details
.from_api_user(user) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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 |
Instance Method Details
#admin? ⇒ Boolean
40 41 42 |
# File 'lib/lita/google_user.rb', line 40 def admin? @admin end |
#delegated_admin? ⇒ Boolean
44 45 46 |
# File 'lib/lita/google_user.rb', line 44 def delegated_admin? @delegated_admin end |
#path ⇒ Object
48 49 50 51 52 53 54 |
# 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? ⇒ Boolean
56 57 58 |
# File 'lib/lita/google_user.rb', line 56 def suspended? @suspended end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/lita/google_user.rb', line 36 def to_s @email end |
#two_factor_enabled? ⇒ Boolean
60 61 62 |
# File 'lib/lita/google_user.rb', line 60 def two_factor_enabled? @two_factor_enabled end |
#two_factor_enforced? ⇒ Boolean
64 65 66 |
# File 'lib/lita/google_user.rb', line 64 def two_factor_enforced? @two_factor_enforced end |