Class: Samsara::Types::EventLocationResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::EventLocationResponseBody
- Defined in:
- lib/samsara_api/types/event_location_response_body.rb
Overview
Information about a location when the vehicle was stopped.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#latitude ⇒ Float
readonly
Latitude of the event.
-
#longitude ⇒ Float
readonly
Longitude of the event.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(latitude: OMIT, longitude: OMIT, additional_properties: nil) ⇒ Samsara::Types::EventLocationResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(latitude: OMIT, longitude: OMIT, additional_properties: nil) ⇒ Samsara::Types::EventLocationResponseBody
25 26 27 28 29 30 31 32 |
# File 'lib/samsara_api/types/event_location_response_body.rb', line 25 def initialize(latitude: OMIT, longitude: OMIT, additional_properties: nil) @latitude = latitude if latitude != OMIT @longitude = longitude if longitude != OMIT @additional_properties = additional_properties @_field_set = { "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.
14 15 16 |
# File 'lib/samsara_api/types/event_location_response_body.rb', line 14 def additional_properties @additional_properties end |
#latitude ⇒ Float (readonly)
Returns Latitude of the event.
10 11 12 |
# File 'lib/samsara_api/types/event_location_response_body.rb', line 10 def latitude @latitude end |
#longitude ⇒ Float (readonly)
Returns Longitude of the event.
12 13 14 |
# File 'lib/samsara_api/types/event_location_response_body.rb', line 12 def longitude @longitude end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::EventLocationResponseBody
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/samsara_api/types/event_location_response_body.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) latitude = parsed_json["latitude"] longitude = parsed_json["longitude"] new( latitude: latitude, longitude: longitude, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
60 61 62 63 |
# File 'lib/samsara_api/types/event_location_response_body.rb', line 60 def self.validate_raw(obj:) 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
51 52 53 |
# File 'lib/samsara_api/types/event_location_response_body.rb', line 51 def to_json @_field_set&.to_json end |