Class: Samsara::Types::DutyStatusDurationObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::DutyStatusDurationObjectResponseBody
- Defined in:
- lib/samsara_api/types/duty_status_duration_object_response_body.rb
Overview
The currently applied duty status durations on the driver’s log.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#active_duration_ms ⇒ Long
readonly
Duration the driver was active for in the log period in milliseconds.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#drive_duration_ms ⇒ Long
readonly
Duration the driver was driving for in the log period in milliseconds.
-
#off_duty_duration_ms ⇒ Long
readonly
Duration the driver was off duty for in the log period in milliseconds.
-
#on_duty_duration_ms ⇒ Long
readonly
Duration the driver was on duty for in the log period in milliseconds.
-
#personal_conveyance_duration_ms ⇒ Object
readonly
milliseconds.
-
#sleeper_berth_duration_ms ⇒ Object
readonly
milliseconds.
-
#waiting_time_duration_ms ⇒ Long
readonly
Duration the driver was waiting for in the log period in milliseconds.
-
#yard_move_duration_ms ⇒ Object
readonly
milliseconds.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::DutyStatusDurationObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(active_duration_ms: OMIT, drive_duration_ms: OMIT, off_duty_duration_ms: OMIT, on_duty_duration_ms: OMIT, personal_conveyance_duration_ms: OMIT, sleeper_berth_duration_ms: OMIT, waiting_time_duration_ms: OMIT, yard_move_duration_ms: OMIT, additional_properties: nil) ⇒ Samsara::Types::DutyStatusDurationObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(active_duration_ms: OMIT, drive_duration_ms: OMIT, off_duty_duration_ms: OMIT, on_duty_duration_ms: OMIT, personal_conveyance_duration_ms: OMIT, sleeper_berth_duration_ms: OMIT, waiting_time_duration_ms: OMIT, yard_move_duration_ms: OMIT, additional_properties: nil) ⇒ Samsara::Types::DutyStatusDurationObjectResponseBody
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 49 def initialize(active_duration_ms: OMIT, drive_duration_ms: OMIT, off_duty_duration_ms: OMIT, on_duty_duration_ms: OMIT, personal_conveyance_duration_ms: OMIT, sleeper_berth_duration_ms: OMIT, waiting_time_duration_ms: OMIT, yard_move_duration_ms: OMIT, additional_properties: nil) @active_duration_ms = active_duration_ms if active_duration_ms != OMIT @drive_duration_ms = drive_duration_ms if drive_duration_ms != OMIT @off_duty_duration_ms = off_duty_duration_ms if off_duty_duration_ms != OMIT @on_duty_duration_ms = on_duty_duration_ms if on_duty_duration_ms != OMIT @personal_conveyance_duration_ms = personal_conveyance_duration_ms if personal_conveyance_duration_ms != OMIT @sleeper_berth_duration_ms = sleeper_berth_duration_ms if sleeper_berth_duration_ms != OMIT @waiting_time_duration_ms = waiting_time_duration_ms if waiting_time_duration_ms != OMIT @yard_move_duration_ms = yard_move_duration_ms if yard_move_duration_ms != OMIT @additional_properties = additional_properties @_field_set = { "activeDurationMs": active_duration_ms, "driveDurationMs": drive_duration_ms, "offDutyDurationMs": off_duty_duration_ms, "onDutyDurationMs": on_duty_duration_ms, "personalConveyanceDurationMs": personal_conveyance_duration_ms, "sleeperBerthDurationMs": sleeper_berth_duration_ms, "waitingTimeDurationMs": waiting_time_duration_ms, "yardMoveDurationMs": yard_move_duration_ms }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#active_duration_ms ⇒ Long (readonly)
Returns Duration the driver was active for in the log period in milliseconds.
10 11 12 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 10 def active_duration_ms @active_duration_ms end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
29 30 31 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 29 def additional_properties @additional_properties end |
#drive_duration_ms ⇒ Long (readonly)
Returns Duration the driver was driving for in the log period in milliseconds.
12 13 14 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 12 def drive_duration_ms @drive_duration_ms end |
#off_duty_duration_ms ⇒ Long (readonly)
Returns Duration the driver was off duty for in the log period in milliseconds.
14 15 16 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 14 def off_duty_duration_ms @off_duty_duration_ms end |
#on_duty_duration_ms ⇒ Long (readonly)
Returns Duration the driver was on duty for in the log period in milliseconds.
16 17 18 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 16 def on_duty_duration_ms @on_duty_duration_ms end |
#personal_conveyance_duration_ms ⇒ Object (readonly)
milliseconds.
19 20 21 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 19 def personal_conveyance_duration_ms @personal_conveyance_duration_ms end |
#sleeper_berth_duration_ms ⇒ Object (readonly)
milliseconds.
22 23 24 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 22 def sleeper_berth_duration_ms @sleeper_berth_duration_ms end |
#waiting_time_duration_ms ⇒ Long (readonly)
Returns Duration the driver was waiting for in the log period in milliseconds.
24 25 26 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 24 def waiting_time_duration_ms @waiting_time_duration_ms end |
#yard_move_duration_ms ⇒ Object (readonly)
milliseconds.
27 28 29 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 27 def yard_move_duration_ms @yard_move_duration_ms end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::DutyStatusDurationObjectResponseBody
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 67 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) active_duration_ms = parsed_json["activeDurationMs"] drive_duration_ms = parsed_json["driveDurationMs"] off_duty_duration_ms = parsed_json["offDutyDurationMs"] on_duty_duration_ms = parsed_json["onDutyDurationMs"] personal_conveyance_duration_ms = parsed_json["personalConveyanceDurationMs"] sleeper_berth_duration_ms = parsed_json["sleeperBerthDurationMs"] waiting_time_duration_ms = parsed_json["waitingTimeDurationMs"] yard_move_duration_ms = parsed_json["yardMoveDurationMs"] new( active_duration_ms: active_duration_ms, drive_duration_ms: drive_duration_ms, off_duty_duration_ms: off_duty_duration_ms, on_duty_duration_ms: on_duty_duration_ms, personal_conveyance_duration_ms: personal_conveyance_duration_ms, sleeper_berth_duration_ms: sleeper_berth_duration_ms, waiting_time_duration_ms: waiting_time_duration_ms, yard_move_duration_ms: yard_move_duration_ms, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 102 def self.validate_raw(obj:) obj.active_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.active_duration_ms is not the expected type, validation failed.") obj.drive_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.drive_duration_ms is not the expected type, validation failed.") obj.off_duty_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.off_duty_duration_ms is not the expected type, validation failed.") obj.on_duty_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.on_duty_duration_ms is not the expected type, validation failed.") obj.personal_conveyance_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.personal_conveyance_duration_ms is not the expected type, validation failed.") obj.sleeper_berth_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.sleeper_berth_duration_ms is not the expected type, validation failed.") obj.waiting_time_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.waiting_time_duration_ms is not the expected type, validation failed.") obj.yard_move_duration_ms&.is_a?(Long) != false || raise("Passed value for field obj.yard_move_duration_ms is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
93 94 95 |
# File 'lib/samsara_api/types/duty_status_duration_object_response_body.rb', line 93 def to_json @_field_set&.to_json end |