Class: Whatsapp::Webhook::PhoneNumberQualityUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/whatsapp/webhook/phone_number_quality_update.rb

Overview

Business phone throughput/quality level changes.

Best-effort schema: Meta's public docs describe this field in one line with no published JSON example. Validate against a real payload (App Dashboard "send test payload") before relying on these attribute names in production. Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(display_phone_number:, event:, current_limit:) ⇒ PhoneNumberQualityUpdate

Returns a new instance of PhoneNumberQualityUpdate.



24
25
26
27
28
# File 'lib/ruby/whatsapp/webhook/phone_number_quality_update.rb', line 24

def initialize(display_phone_number:, event:, current_limit:)
  @display_phone_number = display_phone_number
  @event = event
  @current_limit = current_limit
end

Instance Attribute Details

#current_limitString?

Returns e.g. "TIER_50", "TIER_250", "TIER_1K".

Returns:

  • (String, nil)

    e.g. "TIER_50", "TIER_250", "TIER_1K".



22
23
24
# File 'lib/ruby/whatsapp/webhook/phone_number_quality_update.rb', line 22

def current_limit
  @current_limit
end

#display_phone_numberString?

Returns:

  • (String, nil)


14
15
16
# File 'lib/ruby/whatsapp/webhook/phone_number_quality_update.rb', line 14

def display_phone_number
  @display_phone_number
end

#eventString?

Returns e.g. "UPGRADE", "DOWNGRADE".

Returns:

  • (String, nil)

    e.g. "UPGRADE", "DOWNGRADE".



18
19
20
# File 'lib/ruby/whatsapp/webhook/phone_number_quality_update.rb', line 18

def event
  @event
end

Class Method Details

.deserialize(data) ⇒ PhoneNumberQualityUpdate

Parameters:

  • data (Hash)

    The raw value hash.

Returns:



33
34
35
36
37
38
39
40
41
# File 'lib/ruby/whatsapp/webhook/phone_number_quality_update.rb', line 33

def deserialize(data)
  data ||= {}

  new(
    display_phone_number: data["display_phone_number"],
    event: data["event"],
    current_limit: data["current_limit"]
  )
end