Class: Whatsapp::Webhook::Message::Sticker

Inherits:
Media
  • Object
show all
Defined in:
lib/ruby/whatsapp/webhook/message/sticker.rb

Overview

An inbound sticker message.

Instance Attribute Summary collapse

Attributes inherited from Media

#caption, #media_id, #mime_type, #sha256

Attributes inherited from Base

#context, #from, #id, #referral, #timestamp, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Media

media_attributes

Methods inherited from Base

common_attributes

Constructor Details

#initialize(animated: nil, **media_and_base_attributes) ⇒ Sticker

Returns a new instance of Sticker.



12
13
14
15
16
# File 'lib/ruby/whatsapp/webhook/message/sticker.rb', line 12

def initialize(animated: nil, **media_and_base_attributes)
  super(**media_and_base_attributes)

  @animated = animated
end

Instance Attribute Details

#animatedBoolean?

Returns:

  • (Boolean, nil)


10
11
12
# File 'lib/ruby/whatsapp/webhook/message/sticker.rb', line 10

def animated
  @animated
end

Class Method Details

.deserialize(data) ⇒ Sticker

Parameters:

  • data (Hash)

    The raw message hash.

Returns:



21
22
23
24
25
26
27
# File 'lib/ruby/whatsapp/webhook/message/sticker.rb', line 21

def deserialize(data)
  new(
    animated: data.dig("sticker", "animated"),
    **media_attributes(data, "sticker"),
    **common_attributes(data)
  )
end