Class: Samsara::Types::CurrentDutyStatus

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

Overview

The current HOS status type and time the driver started being in this status.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hos_status_type: OMIT, additional_properties: nil) ⇒ Samsara::Types::CurrentDutyStatus

Parameters:

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

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
# File 'lib/samsara_api/types/current_duty_status.rb', line 29

def initialize(hos_status_type: OMIT, additional_properties: nil)
  @hos_status_type = hos_status_type if hos_status_type != OMIT
  @additional_properties = additional_properties
  @_field_set = { "hosStatusType": hos_status_type }.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



16
17
18
# File 'lib/samsara_api/types/current_duty_status.rb', line 16

def additional_properties
  @additional_properties
end

#hos_status_type ⇒ Object (readonly)

sleeperBed, driving, onDuty, yardMove, personalConveyance.



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

def hos_status_type
  @hos_status_type
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



40
41
42
43
44
45
# File 'lib/samsara_api/types/current_duty_status.rb', line 40

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  hos_status_type = parsed_json["hosStatusType"]
  new(hos_status_type: hos_status_type, additional_properties: struct)
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


58
59
60
# File 'lib/samsara_api/types/current_duty_status.rb', line 58

def self.validate_raw(obj:)
  obj.hos_status_type&.is_a?(Samsara::Types::CurrentDutyStatusHosStatusType) != false || raise("Passed value for field obj.hos_status_type is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


49
50
51
# File 'lib/samsara_api/types/current_duty_status.rb', line 49

def to_json
  @_field_set&.to_json
end