Class: CarvoyantAPI::Waypoint

Inherits:
Object
  • Object
show all
Defined in:
lib/carvoyant_api/resources/waypoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = {})
  @timestamp = Time.parse(attributes[:timestamp])
  @latitude = attributes[:latitude].to_f
  @longitude = attributes[:longitude].to_f
end

Instance Attribute Details

#latitudeObject (readonly)

Returns the value of attribute latitude.



2
3
4
# File 'lib/carvoyant_api/resources/waypoint.rb', line 2

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



2
3
4
# File 'lib/carvoyant_api/resources/waypoint.rb', line 2

def longitude
  @longitude
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



2
3
4
# File 'lib/carvoyant_api/resources/waypoint.rb', line 2

def timestamp
  @timestamp
end

Instance Method Details

#to_sObject



10
11
12
# File 'lib/carvoyant_api/resources/waypoint.rb', line 10

def to_s
  "#{@latitude}, #{@longitude}"
end