Class: Courier::Automations::AutomationStepOption

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/automations/types/automation_step_option.rb

Class Method Summary collapse

Class Method Details

.from_json(json_object:) ⇒ Automations::AutomationStepOption

Deserialize a JSON object to an instance of AutomationStepOption

Parameters:

  • json_object (JSON)

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/trycourier/automations/types/automation_step_option.rb', line 19

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  begin
    Automations::AutomationCancelStep.validate_raw(obj: struct)
    return Automations::AutomationCancelStep.from_json(json_object: json_object)
  rescue StandardError
    # noop
  end
  begin
    Automations::AutomationDelayStep.validate_raw(obj: struct)
    return Automations::AutomationDelayStep.from_json(json_object: json_object)
  rescue StandardError
    # noop
  end
  begin
    Automations::AutomationInvokeStep.validate_raw(obj: struct)
    return Automations::AutomationInvokeStep.from_json(json_object: json_object)
  rescue StandardError
    # noop
  end
  begin
    Automations::AutomationSendStep.validate_raw(obj: struct)
    return Automations::AutomationSendStep.from_json(json_object: json_object)
  rescue StandardError
    # noop
  end
  begin
    Automations::AutomationV2SendStep.validate_raw(obj: struct)
    return Automations::AutomationV2SendStep.from_json(json_object: json_object)
  rescue StandardError
    # noop
  end
  begin
    Automations::AutomationSendListStep.validate_raw(obj: struct)
    return Automations::AutomationSendListStep.from_json(json_object: json_object)
  rescue StandardError
    # noop
  end
  begin
    Automations::AutomationUpdateProfileStep.validate_raw(obj: struct)
    return Automations::AutomationUpdateProfileStep.from_json(json_object: json_object)
  rescue StandardError
    # noop
  end
  struct
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
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
# File 'lib/trycourier/automations/types/automation_step_option.rb', line 70

def self.validate_raw(obj:)
  begin
    return Automations::AutomationCancelStep.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Automations::AutomationDelayStep.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Automations::AutomationInvokeStep.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Automations::AutomationSendStep.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Automations::AutomationV2SendStep.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Automations::AutomationSendListStep.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Automations::AutomationUpdateProfileStep.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  raise("Passed value matched no type within the union, validation failed.")
end