Class: Samsara::Types::SpeedingIntervalLocationResponseResponseBody

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(accuracy_meters: OMIT, address:, heading_degrees:, latitude:, longitude:, additional_properties: nil) ⇒ Samsara::Types::SpeedingIntervalLocationResponseResponseBody

Parameters:

  • address (Samsara::Types::AddressResponseResponseBody)
  • heading_degrees (Long)

    Heading of the asset in degrees. May be 0 if the asset is not moving.

  • latitude (Float)

    Latitude of the closest location point to the interval.

  • longitude (Float)

    Longitude of the closest location point to the interval.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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_metersObject (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_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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

#addressSamsara::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_degreesLong (readonly)

Returns Heading of the asset in degrees. May be 0 if the asset is not moving.

Returns:

  • (Long)

    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

#latitudeFloat (readonly)

Returns Latitude of the closest location point to the interval.

Returns:

  • (Float)

    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

#longitudeFloat (readonly)

Returns Longitude of the closest location point to the interval.

Returns:

  • (Float)

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (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