Class: Whatsapp::Webhook::Message::Contacts::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/whatsapp/webhook/message/contacts/email.rb

Overview

An email entry within an inbound contact card.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email:, type: nil) ⇒ Email

Returns a new instance of Email.



17
18
19
20
# File 'lib/ruby/whatsapp/webhook/message/contacts/email.rb', line 17

def initialize(email:, type: nil)
  @email = email
  @type = type
end

Instance Attribute Details

#emailString?

Returns:

  • (String, nil)


11
12
13
# File 'lib/ruby/whatsapp/webhook/message/contacts/email.rb', line 11

def email
  @email
end

#typeString?

Returns:

  • (String, nil)


15
16
17
# File 'lib/ruby/whatsapp/webhook/message/contacts/email.rb', line 15

def type
  @type
end

Class Method Details

.deserialize(data) ⇒ Email

Parameters:

  • data (Hash)

    A raw emails[] entry.

Returns:



25
26
27
28
29
# File 'lib/ruby/whatsapp/webhook/message/contacts/email.rb', line 25

def deserialize(data)
  data ||= {}

  new(email: data["email"], type: data["type"])
end