Class: Samsara::Types::AmbientTemperatureDetailsObjectRequestBody

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

Overview

Details specific to Ambient Temperature.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cargo_is_full: OMIT, doors_are_closed: OMIT, min_duration_milliseconds:, operation:, temperature_celcius:, additional_properties: nil) ⇒ Samsara::Types::AmbientTemperatureDetailsObjectRequestBody

Parameters:

  • temperature_celcius (Long)

    The temperature in Celcius threshold value.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(cargo_is_full: OMIT, doors_are_closed: OMIT, min_duration_milliseconds:, operation:, temperature_celcius:, additional_properties: nil)
  @cargo_is_full = cargo_is_full if cargo_is_full != OMIT
  @doors_are_closed = doors_are_closed if doors_are_closed != OMIT
  @min_duration_milliseconds = min_duration_milliseconds
  @operation = operation
  @temperature_celcius = temperature_celcius
  @additional_properties = additional_properties
  @_field_set = { "cargoIsFull": cargo_is_full, "doorsAreClosed": doors_are_closed, "minDurationMilliseconds": min_duration_milliseconds, "operation": operation, "temperatureCelcius": temperature_celcius }.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



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

def additional_properties
  @additional_properties
end

#cargo_is_fullBoolean (readonly)

Returns Whether the cargo is full.

Returns:

  • (Boolean)

    Whether the cargo is full.



11
12
13
# File 'lib/samsara_api/types/ambient_temperature_details_object_request_body.rb', line 11

def cargo_is_full
  @cargo_is_full
end

#doors_are_closedBoolean (readonly)

Returns Whether the doors are closed.

Returns:

  • (Boolean)

    Whether the doors are closed.



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

def doors_are_closed
  @doors_are_closed
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.



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

def min_duration_milliseconds
  @min_duration_milliseconds
end

#operationObject (readonly)

‘OUTSIDE_RANGE`



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

def operation
  @operation
end

#temperature_celciusLong (readonly)

Returns The temperature in Celcius threshold value.

Returns:

  • (Long)

    The temperature in Celcius threshold value.



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

def temperature_celcius
  @temperature_celcius
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/samsara_api/types/ambient_temperature_details_object_request_body.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  cargo_is_full = parsed_json["cargoIsFull"]
  doors_are_closed = parsed_json["doorsAreClosed"]
  min_duration_milliseconds = parsed_json["minDurationMilliseconds"]
  operation = parsed_json["operation"]
  temperature_celcius = parsed_json["temperatureCelcius"]
  new(
    cargo_is_full: cargo_is_full,
    doors_are_closed: doors_are_closed,
    min_duration_milliseconds: min_duration_milliseconds,
    operation: operation,
    temperature_celcius: temperature_celcius,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


83
84
85
86
87
88
89
# File 'lib/samsara_api/types/ambient_temperature_details_object_request_body.rb', line 83

def self.validate_raw(obj:)
  obj.cargo_is_full&.is_a?(Boolean) != false || raise("Passed value for field obj.cargo_is_full is not the expected type, validation failed.")
  obj.doors_are_closed&.is_a?(Boolean) != false || raise("Passed value for field obj.doors_are_closed 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?(Samsara::Types::AmbientTemperatureDetailsObjectRequestBodyOperation) != false || raise("Passed value for field obj.operation is not the expected type, validation failed.")
  obj.temperature_celcius.is_a?(Long) != false || raise("Passed value for field obj.temperature_celcius is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


74
75
76
# File 'lib/samsara_api/types/ambient_temperature_details_object_request_body.rb', line 74

def to_json
  @_field_set&.to_json
end