Class: Samsara::Types::LastKnownLocationResponseResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/samsara_api/types/last_known_location_response_response_body.rb

Overview

The most recent location information for the device.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: OMIT, latitude: OMIT, longitude: OMIT, additional_properties: nil) ⇒ Samsara::Types::LastKnownLocationResponseResponseBody

Parameters:

  • id (Long) (defaults to: OMIT)

    The unique ID of the address.

  • latitude (Float) (defaults to: OMIT)

    Latitude of a location.

  • longitude (Float) (defaults to: OMIT)

    Longitude of a location.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
34
35
36
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 28

def initialize(id: OMIT, latitude: OMIT, longitude: OMIT, additional_properties: nil)
  @id = id if id != OMIT
  @latitude = latitude if latitude != OMIT
  @longitude = longitude if longitude != OMIT
  @additional_properties = additional_properties
  @_field_set = { "id": id, "latitude": latitude, "longitude": longitude }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



16
17
18
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 16

def additional_properties
  @additional_properties
end

#idLong (readonly)

Returns The unique ID of the address.

Returns:

  • (Long)

    The unique ID of the address.



10
11
12
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 10

def id
  @id
end

#latitudeFloat (readonly)

Returns Latitude of a location.

Returns:

  • (Float)

    Latitude of a location.



12
13
14
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 12

def latitude
  @latitude
end

#longitudeFloat (readonly)

Returns Longitude of a location.

Returns:

  • (Float)

    Longitude of a location.



14
15
16
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 14

def longitude
  @longitude
end

Class Method Details

.from_json(json_object:) ⇒ Samsara::Types::LastKnownLocationResponseResponseBody

Parameters:

  • json_object (String)

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 42

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  id = parsed_json["id"]
  latitude = parsed_json["latitude"]
  longitude = parsed_json["longitude"]
  new(
    id: id,
    latitude: latitude,
    longitude: longitude,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


67
68
69
70
71
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 67

def self.validate_raw(obj:)
  obj.id&.is_a?(Long) != false || raise("Passed value for field obj.id 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)


58
59
60
# File 'lib/samsara_api/types/last_known_location_response_response_body.rb', line 58

def to_json
  @_field_set&.to_json
end