Class: Whatsapp::BusinessPhoneNumber::Profile::Details

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/whatsapp/business_phone_number/profile/details.rb

Overview

The business profile returned by Get.

Every field arrives only when asked for via fields, so every attribute tolerates being absent. Nothing is validated or normalized on the way in — this is read-side data, and a vertical Meta adds later must still round-trip untouched. Compare against Verticals::ALL rather than expecting this class to have rejected an unknown value, the same reasoning as Account::Details' statuses and MessageTemplates::Response::Node's raw components. Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/reference/whatsapp-business-phone-number/whatsapp-business-profile-api

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(messaging_product: nil, about: nil, address: nil, description: nil, email: nil, profile_picture_url: nil, websites: nil, vertical: nil) ⇒ Details

Returns a new instance of Details.

Parameters:

  • messaging_product (String, nil) (defaults to: nil)
  • about (String, nil) (defaults to: nil)
  • address (String, nil) (defaults to: nil)
  • description (String, nil) (defaults to: nil)
  • email (String, nil) (defaults to: nil)
  • profile_picture_url (String, nil) (defaults to: nil)
  • websites (Array<String>, nil) (defaults to: nil)
  • vertical (String, nil) (defaults to: nil)


56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 56

def initialize(messaging_product: nil, about: nil, address: nil, description: nil,
  email: nil, profile_picture_url: nil, websites: nil, vertical: nil)
  @messaging_product = messaging_product
  @about = about
  @address = address
  @description = description
  @email = email
  @profile_picture_url = profile_picture_url
  @websites = websites
  @vertical = vertical
end

Instance Attribute Details

#aboutString?

Returns The text shown in the profile's About section.

Returns:

  • (String, nil)

    The text shown in the profile's About section.



22
23
24
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 22

def about
  @about
end

#addressString?

Returns The business's physical address.

Returns:

  • (String, nil)

    The business's physical address.



26
27
28
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 26

def address
  @address
end

#descriptionString?

Returns The business description.

Returns:

  • (String, nil)

    The business description.



30
31
32
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 30

def description
  @description
end

#emailString?

Returns The business's contact email address.

Returns:

  • (String, nil)

    The business's contact email address.



34
35
36
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 34

def email
  @email
end

#messaging_productString?

Returns The messaging service, always "whatsapp" in practice.

Returns:

  • (String, nil)

    The messaging service, always "whatsapp" in practice.



18
19
20
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 18

def messaging_product
  @messaging_product
end

#profile_picture_urlString?

Returns The URL of the profile picture.

Returns:

  • (String, nil)

    The URL of the profile picture.



38
39
40
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 38

def profile_picture_url
  @profile_picture_url
end

#verticalString?

Returns One of Verticals::ALL, as sent by Meta.

Returns:



46
47
48
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 46

def vertical
  @vertical
end

#websitesArray<String>?

Returns The business's website URLs.

Returns:

  • (Array<String>, nil)

    The business's website URLs.



42
43
44
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 42

def websites
  @websites
end

Class Method Details

.deserialize(response) ⇒ Details

Parameters:

  • response (Hash, nil)

    The parsed response body, envelope included.

Returns:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/ruby/whatsapp/business_phone_number/profile/details.rb', line 71

def deserialize(response)
  profile = unwrap(response)

  new(
    messaging_product: profile["messaging_product"],
    about: profile["about"],
    address: profile["address"],
    description: profile["description"],
    email: profile["email"],
    profile_picture_url: profile["profile_picture_url"],
    websites: profile["websites"],
    vertical: profile["vertical"]
  )
end