Class: Samsara::Types::FuelLevelTriggerDetailsObjectRequestBody

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

Overview

Details specific to Fuel Level Percentage

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fuel_level_percent:, min_duration_milliseconds:, operation:, additional_properties: nil) ⇒ Samsara::Types::FuelLevelTriggerDetailsObjectRequestBody

Parameters:

  • fuel_level_percent (Long)

    The fuel level percentage threshold value.

  • min_duration_milliseconds (Long)

    The number of milliseconds the trigger needs to stay active before alerting.

  • operation (String)

    How to evaluate the threshold. Valid values: ‘LESS`

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(fuel_level_percent:, min_duration_milliseconds:, operation:, additional_properties: nil)
  @fuel_level_percent = fuel_level_percent
  @min_duration_milliseconds = min_duration_milliseconds
  @operation = operation
  @additional_properties = additional_properties
  @_field_set = { "fuelLevelPercent": fuel_level_percent, "minDurationMilliseconds": min_duration_milliseconds, "operation": operation }
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



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

def additional_properties
  @additional_properties
end

#fuel_level_percentLong (readonly)

Returns The fuel level percentage threshold value.

Returns:

  • (Long)

    The fuel level percentage threshold value.



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

def fuel_level_percent
  @fuel_level_percent
end

#min_duration_millisecondsLong (readonly)

Returns The number of milliseconds the trigger needs to stay active before alerting.

Returns:

  • (Long)

    The number of milliseconds the trigger needs to stay active before alerting.



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

def min_duration_milliseconds
  @min_duration_milliseconds
end

#operationString (readonly)

Returns How to evaluate the threshold. Valid values: ‘LESS`.

Returns:

  • (String)

    How to evaluate the threshold. Valid values: ‘LESS`



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

def operation
  @operation
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/samsara_api/types/fuel_level_trigger_details_object_request_body.rb', line 40

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  fuel_level_percent = parsed_json["fuelLevelPercent"]
  min_duration_milliseconds = parsed_json["minDurationMilliseconds"]
  operation = parsed_json["operation"]
  new(
    fuel_level_percent: fuel_level_percent,
    min_duration_milliseconds: min_duration_milliseconds,
    operation: operation,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


66
67
68
69
70
# File 'lib/samsara_api/types/fuel_level_trigger_details_object_request_body.rb', line 66

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


57
58
59
# File 'lib/samsara_api/types/fuel_level_trigger_details_object_request_body.rb', line 57

def to_json
  @_field_set&.to_json
end