Class: Samsara::Types::GetResponseWorkflowConfigurationObjectResponseBody

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

Parameters:



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

#actionsArray<Samsara::Types::ActionObjectResponseBody> (readonly)

Returns An array of actions.

Returns:



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

def actions
  @actions
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    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_timeString (readonly)

Returns The time the configuration was created in RFC 3339 format.

Returns:

  • (String)

    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_idsHash{String => String} (readonly)

Returns A map of external ids.

Returns:

  • (Hash{String => String})

    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

#idString (readonly)

Returns The unqiue Samsara id of the alert configuration.

Returns:

  • (String)

    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_enabledBoolean (readonly)

Returns Whether the alert is enabled or not.

Returns:

  • (Boolean)

    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_timeString (readonly)

Returns The time the configuration was last modified in RFC 3339 format.

Returns:

  • (String)

    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

#nameString (readonly)

Returns The custom name of the configuration.

Returns:

  • (String)

    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_settingsSamsara::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

#scopeSamsara::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

#triggersArray<Samsara::Types::WorkflowTriggerObjectResponseBody> (readonly)

Returns An array of triggers.

Returns:



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

Parameters:

  • json_object (String)

Returns:



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

Parameters:

  • obj (Object)

Returns:

  • (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_jsonString

Returns:

  • (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