Class: CarvoyantAPI::Waypoint
- Inherits:
-
Object
- Object
- CarvoyantAPI::Waypoint
- Defined in:
- lib/carvoyant_api/resources/waypoint.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Waypoint
constructor
A new instance of Waypoint.
- #to_s ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Waypoint
Returns a new instance of Waypoint.
4 5 6 7 8 |
# File 'lib/carvoyant_api/resources/waypoint.rb', line 4 def initialize(attributes = {}) = Time.parse(attributes[:timestamp]) @latitude = attributes[:latitude].to_f @longitude = attributes[:longitude].to_f end |
Instance Attribute Details
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
2 3 4 |
# File 'lib/carvoyant_api/resources/waypoint.rb', line 2 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
2 3 4 |
# File 'lib/carvoyant_api/resources/waypoint.rb', line 2 def longitude @longitude end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
2 3 4 |
# File 'lib/carvoyant_api/resources/waypoint.rb', line 2 def end |
Instance Method Details
#to_s ⇒ Object
10 11 12 |
# File 'lib/carvoyant_api/resources/waypoint.rb', line 10 def to_s "#{@latitude}, #{@longitude}" end |