Class: Whatsapp::Messages::Contacts::Email
- Inherits:
-
Object
- Object
- Whatsapp::Messages::Contacts::Email
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ruby/whatsapp/messages/contacts/email.rb
Overview
Represents an email entry in a contact message.
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(email:, type: nil) ⇒ Email
constructor
A new instance of Email.
-
#serialize ⇒ Hash
The serialized email payload.
Constructor Details
#initialize(email:, type: nil) ⇒ Email
Returns a new instance of Email.
32 33 34 35 36 37 |
# File 'lib/ruby/whatsapp/messages/contacts/email.rb', line 32 def initialize(email:, type: nil) @email = email @type = type validate! end |
Instance Attribute Details
#email ⇒ String
20 21 22 |
# File 'lib/ruby/whatsapp/messages/contacts/email.rb', line 20 def email @email end |
#type ⇒ String?
24 25 26 |
# File 'lib/ruby/whatsapp/messages/contacts/email.rb', line 24 def type @type end |
Instance Method Details
#serialize ⇒ Hash
Returns The serialized email payload.
40 41 42 43 44 45 |
# File 'lib/ruby/whatsapp/messages/contacts/email.rb', line 40 def serialize { email:, type:, }.compact end |