Class: CommandTower::Messaging::RecipientReadiness::IdentityFacts

Inherits:
Data
  • Object
show all
Defined in:
app/services/command_tower/messaging/recipient_readiness/identity_facts.rb

Overview

Bounded identity facts for readiness. Schema reflection for phone support stays here until Identity ships canonical phone fields.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#email_presentObject (readonly)

Returns the value of attribute email_present

Returns:

  • (Object)

    the current value of email_present



8
9
10
# File 'app/services/command_tower/messaging/recipient_readiness/identity_facts.rb', line 8

def email_present
  @email_present
end

#email_supportedObject (readonly)

Returns the value of attribute email_supported

Returns:

  • (Object)

    the current value of email_supported



8
9
10
# File 'app/services/command_tower/messaging/recipient_readiness/identity_facts.rb', line 8

def email_supported
  @email_supported
end

#email_validatedObject (readonly)

Returns the value of attribute email_validated

Returns:

  • (Object)

    the current value of email_validated



8
9
10
# File 'app/services/command_tower/messaging/recipient_readiness/identity_facts.rb', line 8

def email_validated
  @email_validated
end

#phone_number_validatedObject (readonly)

Returns the value of attribute phone_number_validated

Returns:

  • (Object)

    the current value of phone_number_validated



8
9
10
# File 'app/services/command_tower/messaging/recipient_readiness/identity_facts.rb', line 8

def phone_number_validated
  @phone_number_validated
end

#phone_presentObject (readonly)

Returns the value of attribute phone_present

Returns:

  • (Object)

    the current value of phone_present



8
9
10
# File 'app/services/command_tower/messaging/recipient_readiness/identity_facts.rb', line 8

def phone_present
  @phone_present
end

#phone_supportedObject (readonly)

Returns the value of attribute phone_supported

Returns:

  • (Object)

    the current value of phone_supported



8
9
10
# File 'app/services/command_tower/messaging/recipient_readiness/identity_facts.rb', line 8

def phone_supported
  @phone_supported
end

Class Method Details

.for_user(user) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/command_tower/messaging/recipient_readiness/identity_facts.rb', line 16

def self.for_user(user)
  phone_supported = phone_capability_exposed?(user)

  new(
    email_supported: true,
    email_present: user.email.to_s.strip.present?,
    email_validated: !!user.email_validated,
    phone_supported:,
    phone_present: phone_supported && phone_value_present?(user),
    phone_number_validated: phone_supported && !!read_phone_validated(user),
  ).freeze
end