Class: Samsara::Types::OperationalSettingsObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::OperationalSettingsObjectResponseBody
- Defined in:
- lib/samsara_api/types/operational_settings_object_response_body.rb
Overview
Settings on when the alert should be operational.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#time_range_type ⇒ Samsara::Types::OperationalSettingsObjectResponseBodyTimeRangeType
readonly
The type of time ranges.
-
#time_ranges ⇒ Array<Samsara::Types::TimeRangeObjectResponseBody>
readonly
The time ranges this alert applies to.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::OperationalSettingsObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(time_range_type:, time_ranges:, additional_properties: nil) ⇒ Samsara::Types::OperationalSettingsObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(time_range_type:, time_ranges:, additional_properties: nil) ⇒ Samsara::Types::OperationalSettingsObjectResponseBody
27 28 29 30 31 32 |
# File 'lib/samsara_api/types/operational_settings_object_response_body.rb', line 27 def initialize(time_range_type:, time_ranges:, additional_properties: nil) @time_range_type = time_range_type @time_ranges = time_ranges @additional_properties = additional_properties @_field_set = { "timeRangeType": time_range_type, "timeRanges": time_ranges } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/samsara_api/types/operational_settings_object_response_body.rb', line 16 def additional_properties @additional_properties end |
#time_range_type ⇒ Samsara::Types::OperationalSettingsObjectResponseBodyTimeRangeType (readonly)
Returns The type of time ranges. Valid values: activeBetween, inactiveBetween.
12 13 14 |
# File 'lib/samsara_api/types/operational_settings_object_response_body.rb', line 12 def time_range_type @time_range_type end |
#time_ranges ⇒ Array<Samsara::Types::TimeRangeObjectResponseBody> (readonly)
Returns The time ranges this alert applies to.
14 15 16 |
# File 'lib/samsara_api/types/operational_settings_object_response_body.rb', line 14 def time_ranges @time_ranges end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::OperationalSettingsObjectResponseBody
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/samsara_api/types/operational_settings_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) time_range_type = parsed_json["timeRangeType"] time_ranges = parsed_json["timeRanges"]&.map do | item | item = item.to_json Samsara::Types::TimeRangeObjectResponseBody.from_json(json_object: item) end new( time_range_type: time_range_type, time_ranges: time_ranges, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
64 65 66 67 |
# File 'lib/samsara_api/types/operational_settings_object_response_body.rb', line 64 def self.validate_raw(obj:) obj.time_range_type.is_a?(Samsara::Types::OperationalSettingsObjectResponseBodyTimeRangeType) != false || raise("Passed value for field obj.time_range_type is not the expected type, validation failed.") obj.time_ranges.is_a?(Array) != false || raise("Passed value for field obj.time_ranges is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
55 56 57 |
# File 'lib/samsara_api/types/operational_settings_object_response_body.rb', line 55 def to_json @_field_set&.to_json end |