Class: Samsara::Types::GetResponseWorkflowConfigurationObjectResponseBody
- Inherits:
-
Object
- Object
- Samsara::Types::GetResponseWorkflowConfigurationObjectResponseBody
- Defined in:
- lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb
Overview
The configuration of a alert.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#actions ⇒ Array<Samsara::Types::ActionObjectResponseBody>
readonly
An array of actions.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#created_at_time ⇒ String
readonly
The time the configuration was created in RFC 3339 format.
-
#external_ids ⇒ Hash{String => String}
readonly
A map of external ids.
-
#id ⇒ String
readonly
The unqiue Samsara id of the alert configuration.
-
#is_enabled ⇒ Boolean
readonly
Whether the alert is enabled or not.
-
#last_modified_at_time ⇒ String
readonly
The time the configuration was last modified in RFC 3339 format.
-
#name ⇒ String
readonly
The custom name of the configuration.
- #operational_settings ⇒ Samsara::Types::OperationalSettingsObjectResponseBody readonly
- #scope ⇒ Samsara::Types::ScopeObjectResponseBody readonly
-
#triggers ⇒ Array<Samsara::Types::WorkflowTriggerObjectResponseBody>
readonly
An array of triggers.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Samsara::Types::GetResponseWorkflowConfigurationObjectResponseBody
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(actions:, created_at_time:, external_ids: OMIT, id:, is_enabled:, last_modified_at_time:, name:, operational_settings: OMIT, scope:, triggers:, additional_properties: nil) ⇒ Samsara::Types::GetResponseWorkflowConfigurationObjectResponseBody constructor
- #to_json ⇒ String
Constructor Details
#initialize(actions:, created_at_time:, external_ids: OMIT, id:, is_enabled:, last_modified_at_time:, name:, operational_settings: OMIT, scope:, triggers:, additional_properties: nil) ⇒ Samsara::Types::GetResponseWorkflowConfigurationObjectResponseBody
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 53 def initialize(actions:, created_at_time:, external_ids: OMIT, id:, is_enabled:, last_modified_at_time:, name:, operational_settings: OMIT, scope:, triggers:, additional_properties: nil) @actions = actions @created_at_time = created_at_time @external_ids = external_ids if external_ids != OMIT @id = id @is_enabled = is_enabled @last_modified_at_time = last_modified_at_time @name = name @operational_settings = operational_settings if operational_settings != OMIT @scope = scope @triggers = triggers @additional_properties = additional_properties @_field_set = { "actions": actions, "createdAtTime": created_at_time, "externalIds": external_ids, "id": id, "isEnabled": is_enabled, "lastModifiedAtTime": last_modified_at_time, "name": name, "operationalSettings": operational_settings, "scope": scope, "triggers": triggers }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#actions ⇒ Array<Samsara::Types::ActionObjectResponseBody> (readonly)
Returns An array of actions.
14 15 16 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 14 def actions @actions end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
34 35 36 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 34 def additional_properties @additional_properties end |
#created_at_time ⇒ String (readonly)
Returns The time the configuration was created in RFC 3339 format.
16 17 18 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 16 def created_at_time @created_at_time end |
#external_ids ⇒ Hash{String => String} (readonly)
Returns A map of external ids.
18 19 20 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 18 def external_ids @external_ids end |
#id ⇒ String (readonly)
Returns The unqiue Samsara id of the alert configuration.
20 21 22 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 20 def id @id end |
#is_enabled ⇒ Boolean (readonly)
Returns Whether the alert is enabled or not.
22 23 24 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 22 def is_enabled @is_enabled end |
#last_modified_at_time ⇒ String (readonly)
Returns The time the configuration was last modified in RFC 3339 format.
24 25 26 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 24 def last_modified_at_time @last_modified_at_time end |
#name ⇒ String (readonly)
Returns The custom name of the configuration.
26 27 28 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 26 def name @name end |
#operational_settings ⇒ Samsara::Types::OperationalSettingsObjectResponseBody (readonly)
28 29 30 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 28 def operational_settings @operational_settings end |
#scope ⇒ Samsara::Types::ScopeObjectResponseBody (readonly)
30 31 32 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 30 def scope @scope end |
#triggers ⇒ Array<Samsara::Types::WorkflowTriggerObjectResponseBody> (readonly)
Returns An array of triggers.
32 33 34 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 32 def triggers @triggers end |
Class Method Details
.from_json(json_object:) ⇒ Samsara::Types::GetResponseWorkflowConfigurationObjectResponseBody
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 74 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) actions = parsed_json["actions"]&.map do | item | item = item.to_json Samsara::Types::ActionObjectResponseBody.from_json(json_object: item) end created_at_time = parsed_json["createdAtTime"] external_ids = parsed_json["externalIds"] id = parsed_json["id"] is_enabled = parsed_json["isEnabled"] last_modified_at_time = parsed_json["lastModifiedAtTime"] name = parsed_json["name"] unless parsed_json["operationalSettings"].nil? operational_settings = parsed_json["operationalSettings"].to_json operational_settings = Samsara::Types::OperationalSettingsObjectResponseBody.from_json(json_object: operational_settings) else operational_settings = nil end unless parsed_json["scope"].nil? scope = parsed_json["scope"].to_json scope = Samsara::Types::ScopeObjectResponseBody.from_json(json_object: scope) else scope = nil end triggers = parsed_json["triggers"]&.map do | item | item = item.to_json Samsara::Types::WorkflowTriggerObjectResponseBody.from_json(json_object: item) end new( actions: actions, created_at_time: created_at_time, external_ids: external_ids, id: id, is_enabled: is_enabled, last_modified_at_time: last_modified_at_time, name: name, operational_settings: operational_settings, scope: scope, triggers: triggers, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 130 def self.validate_raw(obj:) obj.actions.is_a?(Array) != false || raise("Passed value for field obj.actions is not the expected type, validation failed.") obj.created_at_time.is_a?(String) != false || raise("Passed value for field obj.created_at_time is not the expected type, validation failed.") obj.external_ids&.is_a?(Hash) != false || raise("Passed value for field obj.external_ids is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.is_enabled.is_a?(Boolean) != false || raise("Passed value for field obj.is_enabled is not the expected type, validation failed.") obj.last_modified_at_time.is_a?(String) != false || raise("Passed value for field obj.last_modified_at_time is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.operational_settings.nil? || Samsara::Types::OperationalSettingsObjectResponseBody.validate_raw(obj: obj.operational_settings) Samsara::Types::ScopeObjectResponseBody.validate_raw(obj: obj.scope) obj.triggers.is_a?(Array) != false || raise("Passed value for field obj.triggers is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
121 122 123 |
# File 'lib/samsara_api/types/get_response_workflow_configuration_object_response_body.rb', line 121 def to_json @_field_set&.to_json end |