Class: Samsara::Types::GetWorkflowIncidentResponseObjectResponseBody

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conditions:, configuration_id:, happened_at_time:, incident_url:, is_resolved:, resolved_at_time: OMIT, updated_at_time:, additional_properties: nil) ⇒ Samsara::Types::GetWorkflowIncidentResponseObjectResponseBody

Parameters:

  • conditions (Array<Samsara::Types::WorkflowIncidentConditionObjectResponseBody>)

    An array of conditions associated with the incident.

  • configuration_id (String)

    Unique ID of the alert configuration.

  • happened_at_time (String)

    Time and date that the alert incident occurred in RFC 3339 format.

  • incident_url (String)

    Url of alert incident in the cloud dashboard.

  • is_resolved (Boolean)

    Indicates whether the incident is resolved or not.

  • resolved_at_time (String) (defaults to: OMIT)

    Time and date that the alert incident was resolved in RFC 3339 format.

  • updated_at_time (String)

    Time and date that the alert incident updated in RFC 3339 format.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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

def initialize(conditions:, configuration_id:, happened_at_time:, incident_url:, is_resolved:, resolved_at_time: OMIT, updated_at_time:, additional_properties: nil)
  @conditions = conditions
  @configuration_id = configuration_id
  @happened_at_time = happened_at_time
  @incident_url = incident_url
  @is_resolved = is_resolved
  @resolved_at_time = resolved_at_time if resolved_at_time != OMIT
  @updated_at_time = updated_at_time
  @additional_properties = additional_properties
  @_field_set = { "conditions": conditions, "configurationId": configuration_id, "happenedAtTime": happened_at_time, "incidentUrl": incident_url, "isResolved": is_resolved, "resolvedAtTime": resolved_at_time, "updatedAtTime": updated_at_time }.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



24
25
26
# File 'lib/samsara_api/types/get_workflow_incident_response_object_response_body.rb', line 24

def additional_properties
  @additional_properties
end

#conditionsArray<Samsara::Types::WorkflowIncidentConditionObjectResponseBody> (readonly)

Returns An array of conditions associated with the incident.

Returns:



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

def conditions
  @conditions
end

#configuration_idString (readonly)

Returns Unique ID of the alert configuration.

Returns:

  • (String)

    Unique ID of the alert configuration.



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

def configuration_id
  @configuration_id
end

#happened_at_timeString (readonly)

Returns Time and date that the alert incident occurred in RFC 3339 format.

Returns:

  • (String)

    Time and date that the alert incident occurred in RFC 3339 format.



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

def happened_at_time
  @happened_at_time
end

#incident_urlString (readonly)

Returns Url of alert incident in the cloud dashboard.

Returns:

  • (String)

    Url of alert incident in the cloud dashboard.



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

def incident_url
  @incident_url
end

#is_resolvedBoolean (readonly)

Returns Indicates whether the incident is resolved or not.

Returns:

  • (Boolean)

    Indicates whether the incident is resolved or not.



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

def is_resolved
  @is_resolved
end

#resolved_at_timeString (readonly)

Returns Time and date that the alert incident was resolved in RFC 3339 format.

Returns:

  • (String)

    Time and date that the alert incident was resolved in RFC 3339 format.



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

def resolved_at_time
  @resolved_at_time
end

#updated_at_timeString (readonly)

Returns Time and date that the alert incident updated in RFC 3339 format.

Returns:

  • (String)

    Time and date that the alert incident updated in RFC 3339 format.



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

def updated_at_time
  @updated_at_time
end

Class Method Details

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

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/samsara_api/types/get_workflow_incident_response_object_response_body.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  conditions = parsed_json["conditions"]&.map do | item |
  item = item.to_json
  Samsara::Types::WorkflowIncidentConditionObjectResponseBody.from_json(json_object: item)
end
  configuration_id = parsed_json["configurationId"]
  happened_at_time = parsed_json["happenedAtTime"]
  incident_url = parsed_json["incidentUrl"]
  is_resolved = parsed_json["isResolved"]
  resolved_at_time = parsed_json["resolvedAtTime"]
  updated_at_time = parsed_json["updatedAtTime"]
  new(
    conditions: conditions,
    configuration_id: configuration_id,
    happened_at_time: happened_at_time,
    incident_url: incident_url,
    is_resolved: is_resolved,
    resolved_at_time: resolved_at_time,
    updated_at_time: updated_at_time,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


95
96
97
98
99
100
101
102
103
# File 'lib/samsara_api/types/get_workflow_incident_response_object_response_body.rb', line 95

def self.validate_raw(obj:)
  obj.conditions.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.")
  obj.configuration_id.is_a?(String) != false || raise("Passed value for field obj.configuration_id is not the expected type, validation failed.")
  obj.happened_at_time.is_a?(String) != false || raise("Passed value for field obj.happened_at_time is not the expected type, validation failed.")
  obj.incident_url.is_a?(String) != false || raise("Passed value for field obj.incident_url is not the expected type, validation failed.")
  obj.is_resolved.is_a?(Boolean) != false || raise("Passed value for field obj.is_resolved is not the expected type, validation failed.")
  obj.resolved_at_time&.is_a?(String) != false || raise("Passed value for field obj.resolved_at_time is not the expected type, validation failed.")
  obj.updated_at_time.is_a?(String) != false || raise("Passed value for field obj.updated_at_time is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


86
87
88
# File 'lib/samsara_api/types/get_workflow_incident_response_object_response_body.rb', line 86

def to_json
  @_field_set&.to_json
end