Class: Samsara::Types::HosClocks

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

Overview

for more information on HOS rules.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(break_: OMIT, cycle: OMIT, drive: OMIT, shift: OMIT, additional_properties: nil) ⇒ Samsara::Types::HosClocks

Parameters:



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

def initialize(break_: OMIT, cycle: OMIT, drive: OMIT, shift: OMIT, additional_properties: nil)
  @break_ = break_ if break_ != OMIT
  @cycle = cycle if cycle != OMIT
  @drive = drive if drive != OMIT
  @shift = shift if shift != OMIT
  @additional_properties = additional_properties
  @_field_set = { "break": break_, "cycle": cycle, "drive": drive, "shift": shift }.reject do | _k, v |
  v == OMIT
end
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



24
25
26
# File 'lib/samsara_api/types/hos_clocks.rb', line 24

def additional_properties
  @additional_properties
end

#break_Samsara::Types::HosBreak (readonly)



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

def break_
  @break_
end

#cycleSamsara::Types::HosCycle (readonly)



18
19
20
# File 'lib/samsara_api/types/hos_clocks.rb', line 18

def cycle
  @cycle
end

#driveSamsara::Types::HosDrive (readonly)



20
21
22
# File 'lib/samsara_api/types/hos_clocks.rb', line 20

def drive
  @drive
end

#shiftSamsara::Types::HosShift (readonly)



22
23
24
# File 'lib/samsara_api/types/hos_clocks.rb', line 22

def shift
  @shift
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/samsara_api/types/hos_clocks.rb', line 51

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["break"].nil?
    break_ = parsed_json["break"].to_json
    break_ = Samsara::Types::HosBreak.from_json(json_object: break_)
  else
    break_ = nil
  end
  unless parsed_json["cycle"].nil?
    cycle = parsed_json["cycle"].to_json
    cycle = Samsara::Types::HosCycle.from_json(json_object: cycle)
  else
    cycle = nil
  end
  unless parsed_json["drive"].nil?
    drive = parsed_json["drive"].to_json
    drive = Samsara::Types::HosDrive.from_json(json_object: drive)
  else
    drive = nil
  end
  unless parsed_json["shift"].nil?
    shift = parsed_json["shift"].to_json
    shift = Samsara::Types::HosShift.from_json(json_object: shift)
  else
    shift = nil
  end
  new(
    break_: break_,
    cycle: cycle,
    drive: drive,
    shift: shift,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


98
99
100
101
102
103
# File 'lib/samsara_api/types/hos_clocks.rb', line 98

def self.validate_raw(obj:)
  obj.break_.nil? || Samsara::Types::HosBreak.validate_raw(obj: obj.break_)
  obj.cycle.nil? || Samsara::Types::HosCycle.validate_raw(obj: obj.cycle)
  obj.drive.nil? || Samsara::Types::HosDrive.validate_raw(obj: obj.drive)
  obj.shift.nil? || Samsara::Types::HosShift.validate_raw(obj: obj.shift)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


89
90
91
# File 'lib/samsara_api/types/hos_clocks.rb', line 89

def to_json
  @_field_set&.to_json
end