Class: Incognia::Location
- Inherits:
-
Object
- Object
- Incognia::Location
- Defined in:
- lib/incognia_api/location.rb
Instance Attribute Summary collapse
-
#collected_at ⇒ Object
readonly
Returns the value of attribute collected_at.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
Instance Method Summary collapse
-
#initialize(latitude:, longitude:, collected_at: nil) ⇒ Location
constructor
A new instance of Location.
- #to_hash ⇒ Object
Constructor Details
#initialize(latitude:, longitude:, collected_at: nil) ⇒ Location
Returns a new instance of Location.
7 8 9 10 11 |
# File 'lib/incognia_api/location.rb', line 7 def initialize(latitude:, longitude:, collected_at: nil) @latitude = latitude @longitude = longitude @collected_at = collected_at end |
Instance Attribute Details
#collected_at ⇒ Object (readonly)
Returns the value of attribute collected_at.
5 6 7 |
# File 'lib/incognia_api/location.rb', line 5 def collected_at @collected_at end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
5 6 7 |
# File 'lib/incognia_api/location.rb', line 5 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/incognia_api/location.rb', line 5 def longitude @longitude end |
Instance Method Details
#to_hash ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/incognia_api/location.rb', line 13 def to_hash location = { latitude: latitude, longitude: longitude, collected_at: collected_at.respond_to?(:to_datetime) ? collected_at.to_datetime.rfc3339 : collected_at, }.compact location end |