Class: Samsara::Types::EventLocationResponseBody

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Parameters:

  • latitude (Float) (defaults to: OMIT) —

    Latitude of the event.

  • longitude (Float) (defaults to: OMIT) —

    Longitude of the event.

  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



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.

Returns:

  • (OpenStruct) —

    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.

Returns:

  • (Float) —

    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.

Returns:

  • (Float) —

    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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

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

Returns:

  • (String)


51
52
53
# File 'lib/samsara_api/types/event_location_response_body.rb', line 51

def to_json
  @_field_set&.to_json
end