Class: Whatsapp::Messages::Address
- Defined in:
- lib/ruby/whatsapp/messages/address.rb
Overview
Address messages prompt a WhatsApp user to provide or confirm a delivery address. This feature is only available for businesses based in India (IN) and Singapore (SG). Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/address-messages
Despite being a distinct message type in this library, address messages are sent over the wire as interactive messages (type: "interactive", interactive.type: "address_message").
Defined Under Namespace
Instance Attribute Summary collapse
-
#body ⇒ String
The message body text shown above the address form.
-
#country ⇒ String
Country code.
-
#footer ⇒ String?
Optional footer text.
-
#saved_addresses ⇒ Array<Hash>
Previously saved addresses the user can select from.
-
#values ⇒ Hash?
Pre-filled address field values shown in the form.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(body:, country:, footer: nil, values: nil, saved_addresses: []) ⇒ Address
constructor
A new instance of Address.
-
#serialize ⇒ Hash
Serializes the address message to a hash format suitable for the WhatsApp API.
Constructor Details
#initialize(body:, country:, footer: nil, values: nil, saved_addresses: []) ⇒ Address
Returns a new instance of Address.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ruby/whatsapp/messages/address.rb', line 55 def initialize(body:, country:, footer: nil, values: nil, saved_addresses: [], **) super(**) @body = body @footer = @country = country @values = values @saved_addresses = saved_addresses validate! end |
Instance Attribute Details
#body ⇒ String
Returns The message body text shown above the address form.
27 28 29 |
# File 'lib/ruby/whatsapp/messages/address.rb', line 27 def body @body end |
#country ⇒ String
Returns Country code. One of IN (India) or SG (Singapore).
35 36 37 |
# File 'lib/ruby/whatsapp/messages/address.rb', line 35 def country @country end |
#footer ⇒ String?
Returns Optional footer text.
31 32 33 |
# File 'lib/ruby/whatsapp/messages/address.rb', line 31 def @footer end |
#saved_addresses ⇒ Array<Hash>
Returns Previously saved addresses the user can select from.
43 44 45 |
# File 'lib/ruby/whatsapp/messages/address.rb', line 43 def saved_addresses @saved_addresses end |
#values ⇒ Hash?
Returns Pre-filled address field values shown in the form.
39 40 41 |
# File 'lib/ruby/whatsapp/messages/address.rb', line 39 def values @values end |