Class: Whatsapp::Webhook::Message::Contacts::Url

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

Overview

A URL entry within an inbound contact card.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, type: nil) ⇒ Url

Returns a new instance of Url.



17
18
19
20
# File 'lib/ruby/whatsapp/webhook/message/contacts/url.rb', line 17

def initialize(url:, type: nil)
  @url = url
  @type = type
end

Instance Attribute Details

#typeString?

Returns:

  • (String, nil)


15
16
17
# File 'lib/ruby/whatsapp/webhook/message/contacts/url.rb', line 15

def type
  @type
end

#urlString?

Returns:

  • (String, nil)


11
12
13
# File 'lib/ruby/whatsapp/webhook/message/contacts/url.rb', line 11

def url
  @url
end

Class Method Details

.deserialize(data) ⇒ Url

Parameters:

  • data (Hash)

    A raw urls[] entry.

Returns:



25
26
27
28
29
# File 'lib/ruby/whatsapp/webhook/message/contacts/url.rb', line 25

def deserialize(data)
  data ||= {}

  new(url: data["url"], type: data["type"])
end