Class: WhatsappSdk::Resource::Contact

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(addresses:, birthday:, emails:, name:, org:, phones:, urls:) ⇒ Contact

Returns a new instance of Contact.



8
9
10
11
12
13
14
15
16
# File 'lib/whatsapp_sdk/resource/contact.rb', line 8

def initialize(addresses:, birthday:, emails:, name:, org:, phones:, urls:)
  @addresses = addresses
  @birthday = birthday
  @emails = emails
  @name = name
  @org = org
  @phones = phones
  @urls = urls
end

Instance Attribute Details

#addressesObject

Returns the value of attribute addresses.



6
7
8
# File 'lib/whatsapp_sdk/resource/contact.rb', line 6

def addresses
  @addresses
end

#birthdayObject

Returns the value of attribute birthday.



6
7
8
# File 'lib/whatsapp_sdk/resource/contact.rb', line 6

def birthday
  @birthday
end

#emailsObject

Returns the value of attribute emails.



6
7
8
# File 'lib/whatsapp_sdk/resource/contact.rb', line 6

def emails
  @emails
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/whatsapp_sdk/resource/contact.rb', line 6

def name
  @name
end

#orgObject

Returns the value of attribute org.



6
7
8
# File 'lib/whatsapp_sdk/resource/contact.rb', line 6

def org
  @org
end

#phonesObject

Returns the value of attribute phones.



6
7
8
# File 'lib/whatsapp_sdk/resource/contact.rb', line 6

def phones
  @phones
end

#urlsObject

Returns the value of attribute urls.



6
7
8
# File 'lib/whatsapp_sdk/resource/contact.rb', line 6

def urls
  @urls
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/whatsapp_sdk/resource/contact.rb', line 18

def to_h
  {
    addresses: addresses.map(&:to_h),
    birthday: birthday,
    emails: emails.map(&:to_h),
    name: name.to_h,
    org: org.to_h,
    phones: phones.map(&:to_h),
    urls: urls.map(&:to_h)
  }
end