Class: Whatsapp::Messages::Interactive::UrlButton
- Defined in:
- lib/ruby/whatsapp/messages/interactive/url_button.rb
Overview
Interactive call-to-action (CTA) URL button message. Maps a URL to a button so the raw URL does not have to appear in the message body. Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/interactive-cta-url-messages
Defined Under Namespace
Modules: Defaults
Instance Attribute Summary collapse
Class Method Summary collapse
-
.serialize(**url_button) ⇒ Hash
Serialized representation of the URL button.
Instance Method Summary collapse
-
#initialize(name:, display_text:, url:) ⇒ UrlButton
constructor
A new instance of UrlButton.
-
#serialize ⇒ Hash
Serialized representation of the URL button.
Constructor Details
#initialize(name:, display_text:, url:) ⇒ UrlButton
Returns a new instance of UrlButton.
33 34 35 36 37 38 39 |
# File 'lib/ruby/whatsapp/messages/interactive/url_button.rb', line 33 def initialize(name:, display_text:, url:) @name = name @display_text = display_text @url = url validate! end |
Instance Attribute Details
#display_text ⇒ String
21 22 23 |
# File 'lib/ruby/whatsapp/messages/interactive/url_button.rb', line 21 def display_text @display_text end |
#name ⇒ String
17 18 19 |
# File 'lib/ruby/whatsapp/messages/interactive/url_button.rb', line 17 def name @name end |
#url ⇒ String
25 26 27 |
# File 'lib/ruby/whatsapp/messages/interactive/url_button.rb', line 25 def url @url end |
Class Method Details
.serialize(**url_button) ⇒ Hash
Returns Serialized representation of the URL button.
43 44 45 |
# File 'lib/ruby/whatsapp/messages/interactive/url_button.rb', line 43 def serialize(**) new(**).serialize end |
Instance Method Details
#serialize ⇒ Hash
Returns Serialized representation of the URL button.
49 50 51 52 53 54 |
# File 'lib/ruby/whatsapp/messages/interactive/url_button.rb', line 49 def serialize { name:, parameters:, } end |