Class: Whatsapp::BusinessPhoneNumber::Profile::Get

Inherits:
Object
  • Object
show all
Extended by:
Transport, ResponseHandling
Defined in:
lib/ruby/whatsapp/business_phone_number/profile/get.rb

Overview

Reads a business profile: its about text, description, contact details, websites, industry vertical, and profile picture. Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/reference/whatsapp-business-phone-number/whatsapp-business-profile-api

Defined Under Namespace

Modules: Defaults, Fields

Constant Summary

Constants included from ResponseHandling

ResponseHandling::MAX_ERROR_BODY

Class Method Summary collapse

Class Method Details

.call(client: Client.new, fields: nil) ⇒ Details

Examples:

Read everything Meta publishes for the profile

Get.call(fields: Get::Fields::ALL)

Parameters:

Returns:

Raises:

  • (Error)

    if no phone number ID is configured, or the request fails.



44
45
46
47
48
49
50
51
# File 'lib/ruby/whatsapp/business_phone_number/profile/get.rb', line 44

def call(client: Client.new, fields: nil)
  params = fields ? { fields: Array(fields).join(",") } : {}
  response = client.connection.get(edge_path(client, Defaults::EDGE), params:)

  Details.deserialize(
    parse_json(handle_response!(response, error_class: Error, action: "get business profile details"))
  )
end