Class: Reporter::Record::Location

Inherits:
Base
  • Object
show all
Defined in:
lib/reporter/record/location.rb

Overview

Public: A record of location information for a report.

The location dictionary is essentially a CoreLocation

CLLocation][1

object, with a [CLPlacemark] embedded. Refer

to the linked documentation for each class for details on their properties.

[1]: developer.apple.com/library/ios/documentation/

CoreLocation/Reference/CLLocation_Class/CLLocation/
CLLocation.html#//apple_ref/doc/uid/TP40007126

[2]: developer.apple.com/library/ios/documentation/

CoreLocation/Reference/CLPlacemark_class/Reference/
Reference.html#//apple_ref/doc/uid/TP40009574

Direct Known Subclasses

Response::Location

Instance Method Summary collapse

Methods inherited from Base

#==, #hash, #initialize

Constructor Details

This class inherits a constructor from Reporter::Record::Base

Instance Method Details

#courseObject

Public: The direction in which the device is traveling.

Course values are measured in degrees starting at due north and continuing clockwise around the compass. Thus, north is 0 degrees, east is 90 degrees, south is 180 degrees, and so on. Course values may not be available on all devices. A negative value indicates that the direction is invalid.

Returns a Float representing the course.


29
30
31
# File 'lib/reporter/record/location.rb', line 29

def course
  @course ||= @data["course"].to_f
end

#horizontal_accuracyObject

Public: The radius of uncertainty for the location, measured in

meters.

The location’s latitude and longitude identify the center of the circle, and this value indicates the radius of that circle. A negative value indicates that the location’s latitude and longitude are invalid.

Returns a Float representing the horizontal accuracy.


42
43
44
# File 'lib/reporter/record/location.rb', line 42

def horizontal_accuracy
  @horizontal_accuracy ||= @data["horizontalAccuracy"].to_f
end

#latitudeObject

Public: The latitude in degrees.

Positive values indicate latitudes north of the equator. Negative values indicate latitudes south of the equator.

Returns a Float representing the latitude.


52
53
54
# File 'lib/reporter/record/location.rb', line 52

def latitude
  @latitude ||= @data["latitude"].to_f
end

#longitudeObject

Public: The longitude in degrees.

Measurements are relative to the zero meridian, with positive values extending east of the meridian and negative values extending west of the meridian.

Returns a Float representing the longitude.


63
64
65
# File 'lib/reporter/record/location.rb', line 63

def longitude
  @longitude ||= @data["longitude"].to_f
end

#speedObject

Public: The instantaneous speed of the device in meters per

second.

This value reflects the instantaneous speed of the device in the direction of its current heading. A negative value indicates an invalid speed. Because the actual speed can change many times between the delivery of subsequent location events, you should use this property for informational purposes only.

Returns a Float representing the speed.


77
78
79
# File 'lib/reporter/record/location.rb', line 77

def speed
  @speed ||= @data["speed"].to_f
end

#timestampObject

Public: The time at which this location was determined.

Returns a DateTime representing the time.


84
85
86
# File 'lib/reporter/record/location.rb', line 84

def timestamp
  @timestamp ||= DateTime.iso8601 @data["timestamp"]
end

#vertical_accuracyObject

Public: The accuracy of the altitude value in meters.

The value in the altitude property could be plus or minus the value indicated by this property. A negative value indicates that the altitude value is invalid.

Determining the vertical accuracy requires a device with GPS capabilities. Thus, on some earlier iOS-based devices, this property always contains a negative value.

Returns a Float representing the vertical accuracy.


99
100
101
# File 'lib/reporter/record/location.rb', line 99

def vertical_accuracy
  @vertical_accuracy ||= @data["verticalAccuracy"].to_f
end