Class: Whatsapp::MessageTemplates::Button::Otp::SupportedApp

Inherits:
Object
  • Object
show all
Includes:
ValueObject
Defined in:
lib/ruby/whatsapp/message_templates/button/otp/supported_app.rb

Overview

An Android app permitted to receive an autofilled one-time passcode.

Required for the ONE_TAP and ZERO_TAP OTP types: Meta matches the delivering app against these entries before handing over the code. Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/templates/authentication-templates/authentication-templates

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ValueObject

included

Constructor Details

#initialize(package_name:, signature_hash:) ⇒ SupportedApp

Returns a new instance of SupportedApp.

Parameters:

  • package_name (String)

    The Android package name.

  • signature_hash (String)

    The app's signing signature hash. @raise [ActiveModel::ValidationError] if validation fails.



29
30
31
32
33
34
# File 'lib/ruby/whatsapp/message_templates/button/otp/supported_app.rb', line 29

def initialize(package_name:, signature_hash:)
  @package_name = package_name
  @signature_hash = signature_hash

  validate!
end

Instance Attribute Details

#package_nameString

Returns:

  • (String)


17
18
19
# File 'lib/ruby/whatsapp/message_templates/button/otp/supported_app.rb', line 17

def package_name
  @package_name
end

#signature_hashString

Returns:

  • (String)


21
22
23
# File 'lib/ruby/whatsapp/message_templates/button/otp/supported_app.rb', line 21

def signature_hash
  @signature_hash
end

Instance Method Details

#serializeHash

Returns The serialized supported app.

Returns:

  • (Hash)

    The serialized supported app.



37
38
39
# File 'lib/ruby/whatsapp/message_templates/button/otp/supported_app.rb', line 37

def serialize
  { package_name:, signature_hash: }
end