Class: Whatsapp::Messages::Contacts::Phone
- Inherits:
-
Object
- Object
- Whatsapp::Messages::Contacts::Phone
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ruby/whatsapp/messages/contacts/phone.rb
Overview
Represents a phone number entry in a contact message.
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(phone:, type: nil, wa_id: nil) ⇒ Phone
constructor
A new instance of Phone.
-
#serialize ⇒ Hash
The serialized phone payload.
Constructor Details
#initialize(phone:, type: nil, wa_id: nil) ⇒ Phone
Returns a new instance of Phone.
40 41 42 43 44 45 46 |
# File 'lib/ruby/whatsapp/messages/contacts/phone.rb', line 40 def initialize(phone:, type: nil, wa_id: nil) @phone = phone @type = type @wa_id = wa_id validate! end |
Instance Attribute Details
#phone ⇒ String
23 24 25 |
# File 'lib/ruby/whatsapp/messages/contacts/phone.rb', line 23 def phone @phone end |
#type ⇒ String?
27 28 29 |
# File 'lib/ruby/whatsapp/messages/contacts/phone.rb', line 27 def type @type end |
#wa_id ⇒ String?
31 32 33 |
# File 'lib/ruby/whatsapp/messages/contacts/phone.rb', line 31 def wa_id @wa_id end |
Instance Method Details
#serialize ⇒ Hash
Returns The serialized phone payload.
49 50 51 52 53 54 55 |
# File 'lib/ruby/whatsapp/messages/contacts/phone.rb', line 49 def serialize { phone:, type:, wa_id:, }.compact end |