Class: Whatsapp::Webhook::Message::Location
- Inherits:
-
Base
- Object
- Base
- Whatsapp::Webhook::Message::Location
show all
- Defined in:
- lib/ruby/whatsapp/webhook/message/location.rb
Overview
An inbound shared location.
Instance Attribute Summary collapse
Attributes inherited from Base
#context, #from, #id, #referral, #timestamp, #type
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
common_attributes
Constructor Details
#initialize(latitude:, longitude:, name: nil, address: nil, **base_attributes) ⇒ Location
Returns a new instance of Location.
24
25
26
27
28
29
30
31
|
# File 'lib/ruby/whatsapp/webhook/message/location.rb', line 24
def initialize(latitude:, longitude:, name: nil, address: nil, **base_attributes)
super(**base_attributes)
@latitude = latitude
@longitude = longitude
@name = name
@address = address
end
|
Instance Attribute Details
#address ⇒ String?
22
23
24
|
# File 'lib/ruby/whatsapp/webhook/message/location.rb', line 22
def address
@address
end
|
#latitude ⇒ Float?
10
11
12
|
# File 'lib/ruby/whatsapp/webhook/message/location.rb', line 10
def latitude
@latitude
end
|
#longitude ⇒ Float?
14
15
16
|
# File 'lib/ruby/whatsapp/webhook/message/location.rb', line 14
def longitude
@longitude
end
|
#name ⇒ String?
18
19
20
|
# File 'lib/ruby/whatsapp/webhook/message/location.rb', line 18
def name
@name
end
|
Class Method Details
.deserialize(data) ⇒ Location
36
37
38
39
40
41
42
43
44
|
# File 'lib/ruby/whatsapp/webhook/message/location.rb', line 36
def deserialize(data)
new(
latitude: data.dig("location", "latitude"),
longitude: data.dig("location", "longitude"),
name: data.dig("location", "name"),
address: data.dig("location", "address"),
**common_attributes(data)
)
end
|