Class: Samsara::Types::HosViolationDayObjectResponseBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(end_time:, start_time:, additional_properties: nil) ⇒ Samsara::Types::HosViolationDayObjectResponseBody

Parameters:

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

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
# File 'lib/samsara_api/types/hos_violation_day_object_response_body.rb', line 28

def initialize(end_time:, start_time:, additional_properties: nil)
  @end_time = end_time
  @start_time = start_time
  @additional_properties = additional_properties
  @_field_set = { "endTime": end_time, "startTime": start_time }
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



15
16
17
# File 'lib/samsara_api/types/hos_violation_day_object_response_body.rb', line 15

def additional_properties
  @additional_properties
end

#end_time ⇒ Object (readonly)

is determined by the driver's ELD start hour (00:00 or 12:00)



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

def end_time
  @end_time
end

#start_time ⇒ Object (readonly)

This is determined by the driver's ELD start hour (00:00 or 12:00)



13
14
15
# File 'lib/samsara_api/types/hos_violation_day_object_response_body.rb', line 13

def start_time
  @start_time
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  end_time = parsed_json["endTime"]
  start_time = parsed_json["startTime"]
  new(
    end_time: end_time,
    start_time: start_time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


61
62
63
64
# File 'lib/samsara_api/types/hos_violation_day_object_response_body.rb', line 61

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

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


52
53
54
# File 'lib/samsara_api/types/hos_violation_day_object_response_body.rb', line 52

def to_json
  @_field_set&.to_json
end