Class: Whatsapp::Messages::Location
- Defined in:
- lib/ruby/whatsapp/messages/location.rb
Overview
Location messages allow you to send a location's latitude and longitude coordinates to a WhatsApp user. Source: https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/location-messages
Defined Under Namespace
Modules: Defaults
Instance Attribute Summary collapse
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(latitude:, longitude:, name: nil, address: nil) ⇒ Location
constructor
A new instance of Location.
-
#serialize ⇒ Hash
Serializes the location message to a hash format suitable for the WhatsApp API.
Constructor Details
#initialize(latitude:, longitude:, name: nil, address: nil) ⇒ Location
Returns a new instance of Location.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ruby/whatsapp/messages/location.rb', line 37 def initialize(latitude:, longitude:, name: nil, address: nil, **) super(**) @latitude = latitude @longitude = longitude @name = name @address = address validate! end |
Instance Attribute Details
#address ⇒ String?
26 27 28 |
# File 'lib/ruby/whatsapp/messages/location.rb', line 26 def address @address end |
#latitude ⇒ Float
14 15 16 |
# File 'lib/ruby/whatsapp/messages/location.rb', line 14 def latitude @latitude end |
#longitude ⇒ Float
18 19 20 |
# File 'lib/ruby/whatsapp/messages/location.rb', line 18 def longitude @longitude end |
#name ⇒ String?
22 23 24 |
# File 'lib/ruby/whatsapp/messages/location.rb', line 22 def name @name end |