Class: Samsara::Types::LastKnownLocationResponseResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::LastKnownLocationResponseResponseBody
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#id ⇒ Long
readonly
The unique ID of the address.
-
#latitude ⇒ Float
readonly
Latitude of a location.
-
#longitude ⇒ Float
readonly
Longitude of a location.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::LastKnownLocationResponseResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(id: OMIT, latitude: OMIT, longitude: OMIT, additional_properties: nil) ⇒ Samsara::Types::LastKnownLocationResponseResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, latitude: OMIT, longitude: OMIT, additional_properties: nil) ⇒ Samsara::Types::LastKnownLocationResponseResponseBody
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#id ⇒ Long (readonly)
Returns 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 |
#latitude ⇒ Float (readonly)
Returns 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 |
#longitude ⇒ Float (readonly)
Returns 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
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
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_json ⇒ 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 |