Class: Whatsapp::Messages::Interactive::ReplyButtons::Button
- Inherits:
-
Object
- Object
- Whatsapp::Messages::Interactive::ReplyButtons::Button
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/ruby/whatsapp/messages/interactive/reply_buttons/button.rb
Defined Under Namespace
Modules: Defaults
Instance Attribute Summary collapse
Class Method Summary collapse
-
.serialize(id:, title:) ⇒ Hash
Serialized representation of the Button.
Instance Method Summary collapse
-
#initialize(id:, title:) ⇒ Button
constructor
A new instance of Button.
-
#serialize ⇒ Hash
Serialized representation of the Button.
Constructor Details
#initialize(id:, title:) ⇒ Button
Returns a new instance of Button.
30 31 32 33 34 35 |
# File 'lib/ruby/whatsapp/messages/interactive/reply_buttons/button.rb', line 30 def initialize(id:, title:) @id = id @title = title validate! end |
Instance Attribute Details
#id ⇒ String
18 19 20 |
# File 'lib/ruby/whatsapp/messages/interactive/reply_buttons/button.rb', line 18 def id @id end |
#title ⇒ String
22 23 24 |
# File 'lib/ruby/whatsapp/messages/interactive/reply_buttons/button.rb', line 22 def title @title end |
Class Method Details
.serialize(id:, title:) ⇒ Hash
Returns Serialized representation of the Button. @raise [ActiveModel::ValidationError] if validation fails.
40 41 42 |
# File 'lib/ruby/whatsapp/messages/interactive/reply_buttons/button.rb', line 40 def serialize(id:, title:) new(id:, title:).serialize end |