Class: Samsara::Types::ScheduledMaintenanceOdometerTriggerDetailsObjectResponseBody

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

Overview

Details specific to Scheduled Maintenance by Odometer

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(due_in_meters:, schedule_id:, additional_properties: nil) ⇒ Samsara::Types::ScheduledMaintenanceOdometerTriggerDetailsObjectResponseBody

Parameters:

  • due_in_meters (Long)

    Alert when vehicle odometer has this many meters left until maintenance is due.

  • schedule_id (String)

    The id of the maintenance schedule.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



25
26
27
28
29
30
# File 'lib/samsara_api/types/scheduled_maintenance_odometer_trigger_details_object_response_body.rb', line 25

def initialize(due_in_meters:, schedule_id:, additional_properties: nil)
  @due_in_meters = due_in_meters
  @schedule_id = schedule_id
  @additional_properties = additional_properties
  @_field_set = { "dueInMeters": due_in_meters, "scheduleId": schedule_id }
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



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

def additional_properties
  @additional_properties
end

#due_in_metersLong (readonly)

Returns Alert when vehicle odometer has this many meters left until maintenance is due.

Returns:

  • (Long)

    Alert when vehicle odometer has this many meters left until maintenance is due.



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

def due_in_meters
  @due_in_meters
end

#schedule_idString (readonly)

Returns The id of the maintenance schedule.

Returns:

  • (String)

    The id of the maintenance schedule.



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

def schedule_id
  @schedule_id
end

Class Method Details

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



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/samsara_api/types/scheduled_maintenance_odometer_trigger_details_object_response_body.rb', line 36

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  due_in_meters = parsed_json["dueInMeters"]
  schedule_id = parsed_json["scheduleId"]
  new(
    due_in_meters: due_in_meters,
    schedule_id: schedule_id,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


60
61
62
63
# File 'lib/samsara_api/types/scheduled_maintenance_odometer_trigger_details_object_response_body.rb', line 60

def self.validate_raw(obj:)
  obj.due_in_meters.is_a?(Long) != false || raise("Passed value for field obj.due_in_meters is not the expected type, validation failed.")
  obj.schedule_id.is_a?(String) != false || raise("Passed value for field obj.schedule_id is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end