Class: Whatsapp::Webhook::MessageTemplateStatusUpdate

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

Overview

Template status modifications — approved, rejected, flagged, paused, or disabled by Meta. 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:, event:, reason: nil) ⇒ MessageTemplateStatusUpdate

Returns a new instance of MessageTemplateStatusUpdate.



29
30
31
32
33
34
35
# File 'lib/ruby/whatsapp/webhook/message_template_status_update.rb', line 29

def initialize(message_template_id:, message_template_name:, message_template_language:, event:, reason: nil)
  @message_template_id = message_template_id
  @message_template_name = message_template_name
  @message_template_language = message_template_language
  @event = event
  @reason = reason
end

Instance Attribute Details

#eventString?

Returns e.g. "APPROVED", "REJECTED", "FLAGGED", "PAUSED", "DISABLED".

Returns:

  • (String, nil)

    e.g. "APPROVED", "REJECTED", "FLAGGED", "PAUSED", "DISABLED".



23
24
25
# File 'lib/ruby/whatsapp/webhook/message_template_status_update.rb', line 23

def event
  @event
end

#message_template_idInteger?

Returns:

  • (Integer, nil)


11
12
13
# File 'lib/ruby/whatsapp/webhook/message_template_status_update.rb', line 11

def message_template_id
  @message_template_id
end

#message_template_languageString?

Returns:

  • (String, nil)


19
20
21
# File 'lib/ruby/whatsapp/webhook/message_template_status_update.rb', line 19

def message_template_language
  @message_template_language
end

#message_template_nameString?

Returns:

  • (String, nil)


15
16
17
# File 'lib/ruby/whatsapp/webhook/message_template_status_update.rb', line 15

def message_template_name
  @message_template_name
end

#reasonString?

Returns:

  • (String, nil)


27
28
29
# File 'lib/ruby/whatsapp/webhook/message_template_status_update.rb', line 27

def reason
  @reason
end

Class Method Details

.deserialize(data) ⇒ MessageTemplateStatusUpdate

Parameters:

  • data (Hash)

    The raw value hash.

Returns:



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ruby/whatsapp/webhook/message_template_status_update.rb', line 40

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"],
    event: data["event"],
    reason: data["reason"]
  )
end