Class: Samsara::Types::SpeedingIntervalLocationResponseResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::SpeedingIntervalLocationResponseResponseBody
- Defined in:
- lib/samsara_api/types/speeding_interval_location_response_response_body.rb
Overview
Location object of the closest location point to the interval.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#accuracy_meters ⇒ Object
readonly
is not available.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #address ⇒ Samsara::Types::AddressResponseResponseBody readonly
-
#heading_degrees ⇒ Long
readonly
Heading of the asset in degrees.
-
#latitude ⇒ Float
readonly
Latitude of the closest location point to the interval.
-
#longitude ⇒ Float
readonly
Longitude of the closest location point to the interval.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::SpeedingIntervalLocationResponseResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(accuracy_meters: OMIT, address:, heading_degrees:, latitude:, longitude:, additional_properties: nil) ⇒ Samsara::Types::SpeedingIntervalLocationResponseResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(accuracy_meters: OMIT, address:, heading_degrees:, latitude:, longitude:, additional_properties: nil) ⇒ Samsara::Types::SpeedingIntervalLocationResponseResponseBody
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 37 def initialize(accuracy_meters: OMIT, address:, heading_degrees:, latitude:, longitude:, additional_properties: nil) @accuracy_meters = accuracy_meters if accuracy_meters != OMIT @address = address @heading_degrees = heading_degrees @latitude = latitude @longitude = longitude @additional_properties = additional_properties @_field_set = { "accuracyMeters": accuracy_meters, "address": address, "headingDegrees": heading_degrees, "latitude": latitude, "longitude": longitude }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#accuracy_meters ⇒ Object (readonly)
is not available.
12 13 14 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 12 def accuracy_meters @accuracy_meters end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
22 23 24 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 22 def additional_properties @additional_properties end |
#address ⇒ Samsara::Types::AddressResponseResponseBody (readonly)
14 15 16 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 14 def address @address end |
#heading_degrees ⇒ Long (readonly)
Returns Heading of the asset in degrees. May be 0 if the asset is not moving.
16 17 18 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 16 def heading_degrees @heading_degrees end |
#latitude ⇒ Float (readonly)
Returns Latitude of the closest location point to the interval.
18 19 20 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 18 def latitude @latitude end |
#longitude ⇒ Float (readonly)
Returns Longitude of the closest location point to the interval.
20 21 22 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 20 def longitude @longitude end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::SpeedingIntervalLocationResponseResponseBody
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 53 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) accuracy_meters = parsed_json["accuracyMeters"] unless parsed_json["address"].nil? address = parsed_json["address"].to_json address = Samsara::Types::AddressResponseResponseBody.from_json(json_object: address) else address = nil end heading_degrees = parsed_json["headingDegrees"] latitude = parsed_json["latitude"] longitude = parsed_json["longitude"] new( accuracy_meters: accuracy_meters, address: address, heading_degrees: heading_degrees, latitude: latitude, longitude: longitude, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
88 89 90 91 92 93 94 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 88 def self.validate_raw(obj:) obj.accuracy_meters&.is_a?(Float) != false || raise("Passed value for field obj.accuracy_meters is not the expected type, validation failed.") Samsara::Types::AddressResponseResponseBody.validate_raw(obj: obj.address) obj.heading_degrees.is_a?(Long) != false || raise("Passed value for field obj.heading_degrees is not the expected type, validation failed.") obj.latitude.is_a?(Float) != false || raise("Passed value for field obj.latitude is not the expected type, validation failed.") obj.longitude.is_a?(Float) != false || raise("Passed value for field obj.longitude is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
79 80 81 |
# File 'lib/samsara_api/types/speeding_interval_location_response_response_body.rb', line 79 def to_json @_field_set&.to_json end |