Class: Courier::Automations::AutomationV2SendStep
- Inherits:
-
Object
- Object
- Courier::Automations::AutomationV2SendStep
- Defined in:
- lib/trycourier/automations/types/automation_v_2_send_step.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#if_ ⇒ Object
readonly
Returns the value of attribute if_.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Automations::AutomationV2SendStep
Deserialize a JSON object to an instance of AutomationV2SendStep.
-
.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.
Instance Method Summary collapse
- #initialize(action:, message:, if_: nil, ref: nil, additional_properties: nil) ⇒ Automations::AutomationV2SendStep constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of AutomationV2SendStep to a JSON object.
Constructor Details
#initialize(action:, message:, if_: nil, ref: nil, additional_properties: nil) ⇒ Automations::AutomationV2SendStep
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 17 def initialize(action:, message:, if_: nil, ref: nil, additional_properties: nil) # @type [String] @action = action # @type [Send::Message] @message = # @type [String] @if_ = if_ # @type [String] @ref = ref # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 9 def action @action end |
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 9 def additional_properties @additional_properties end |
#if_ ⇒ Object (readonly)
Returns the value of attribute if_.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 9 def if_ @if_ end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 9 def @message end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 9 def ref @ref end |
Class Method Details
.from_json(json_object:) ⇒ Automations::AutomationV2SendStep
Deserialize a JSON object to an instance of AutomationV2SendStep
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 34 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) action = struct.action if parsed_json["message"].nil? = nil else = parsed_json["message"].to_json = Send::Message.from_json(json_object: ) end if_ = struct.if ref = struct.ref new(action: action, message: , if_: if_, ref: ref, additional_properties: 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.
60 61 62 63 64 65 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 60 def self.validate_raw(obj:) obj.action.is_a?(String) != false || raise("Passed value for field obj.action is not the expected type, validation failed.") Send::Message.validate_raw(obj: obj.) obj.if_&.is_a?(String) != false || raise("Passed value for field obj.if_ is not the expected type, validation failed.") obj.ref&.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of AutomationV2SendStep to a JSON object
52 53 54 |
# File 'lib/trycourier/automations/types/automation_v_2_send_step.rb', line 52 def to_json(*_args) { "action": @action, "message": @message, "if": @if_, "ref": @ref }.to_json end |