Class: Whatsapp::Webhook::TemplateCategoryUpdate

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

Overview

Template category changes and re-categorization corrections.

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(message_template_id:, message_template_name:, message_template_language:, previous_category:, new_category:, correct_category: nil) ⇒ TemplateCategoryUpdate

Returns a new instance of TemplateCategoryUpdate.



36
37
38
39
40
41
42
43
44
# File 'lib/ruby/whatsapp/webhook/template_category_update.rb', line 36

def initialize(message_template_id:, message_template_name:, message_template_language:,
  previous_category:, new_category:, correct_category: nil)
  @message_template_id = message_template_id
  @message_template_name = message_template_name
  @message_template_language = message_template_language
  @previous_category = previous_category
  @new_category = new_category
  @correct_category = correct_category
end

Instance Attribute Details

#correct_categoryString?

Returns:

  • (String, nil)


34
35
36
# File 'lib/ruby/whatsapp/webhook/template_category_update.rb', line 34

def correct_category
  @correct_category
end

#message_template_idInteger?

Returns:

  • (Integer, nil)


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

def message_template_id
  @message_template_id
end

#message_template_languageString?

Returns:

  • (String, nil)


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

def message_template_language
  @message_template_language
end

#message_template_nameString?

Returns:

  • (String, nil)


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

def message_template_name
  @message_template_name
end

#new_categoryString?

Returns:

  • (String, nil)


30
31
32
# File 'lib/ruby/whatsapp/webhook/template_category_update.rb', line 30

def new_category
  @new_category
end

#previous_categoryString?

Returns:

  • (String, nil)


26
27
28
# File 'lib/ruby/whatsapp/webhook/template_category_update.rb', line 26

def previous_category
  @previous_category
end

Class Method Details

.deserialize(data) ⇒ TemplateCategoryUpdate

Parameters:

  • data (Hash)

    The raw value hash.

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/ruby/whatsapp/webhook/template_category_update.rb', line 49

def deserialize(data)
  data ||= {}

  new(
    message_template_id: data["message_template_id"],
    message_template_name: data["message_template_name"],
    message_template_language: data["message_template_language"],
    previous_category: data["previous_category"],
    new_category: data["new_category"],
    correct_category: data["correct_category"]
  )
end