Class: MessengerPlatform::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/messenger_platform/contact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Contact

Returns a new instance of Contact.



5
6
7
8
# File 'lib/messenger_platform/contact.rb', line 5

def initialize(hash)
  @id = hash[:id]
  @phone_number = hash[:phone_number]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/messenger_platform/contact.rb', line 3

def id
  @id
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



3
4
5
# File 'lib/messenger_platform/contact.rb', line 3

def phone_number
  @phone_number
end

Instance Method Details

#serializeObject



10
11
12
# File 'lib/messenger_platform/contact.rb', line 10

def serialize
  id.present? ? { id: id } : { phone_number: phone_number }
end