Class: Whatsapp::Webhook::Message::Audio
- Defined in:
- lib/ruby/whatsapp/webhook/message/audio.rb
Overview
An inbound audio message (voice note or audio clip).
Constant Summary
Constants included from ResponseHandling
ResponseHandling::MAX_ERROR_BODY
Instance Attribute Summary collapse
-
#voice ⇒ Boolean?
Whether this was recorded as a voice note.
Attributes inherited from Media
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(voice: nil, **media_and_base_attributes) ⇒ Audio
constructor
A new instance of Audio.
Methods inherited from Media
#delete, #download, #get_url, #upload
Constructor Details
#initialize(voice: nil, **media_and_base_attributes) ⇒ Audio
Returns a new instance of Audio.
12 13 14 15 16 |
# File 'lib/ruby/whatsapp/webhook/message/audio.rb', line 12 def initialize(voice: nil, **media_and_base_attributes) super(**media_and_base_attributes) @voice = voice end |
Instance Attribute Details
#voice ⇒ Boolean?
Returns Whether this was recorded as a voice note.
10 11 12 |
# File 'lib/ruby/whatsapp/webhook/message/audio.rb', line 10 def voice @voice end |
Class Method Details
.deserialize(data) ⇒ Audio
21 22 23 |
# File 'lib/ruby/whatsapp/webhook/message/audio.rb', line 21 def deserialize(data) new(voice: data.dig("audio", "voice"), **media_attributes(data, "audio"), **common_attributes(data)) end |