Class: Courier::Automations::AutomationAdHocInvokeParams
- Inherits:
-
Object
- Object
- Courier::Automations::AutomationAdHocInvokeParams
- Defined in:
- lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#automation ⇒ Object
readonly
Returns the value of attribute automation.
-
#brand ⇒ Object
readonly
Returns the value of attribute brand.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Automations::AutomationAdHocInvokeParams
Deserialize a JSON object to an instance of AutomationAdHocInvokeParams.
-
.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(automation:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, additional_properties: nil) ⇒ Automations::AutomationAdHocInvokeParams constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of AutomationAdHocInvokeParams to a JSON object.
Constructor Details
#initialize(automation:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, additional_properties: nil) ⇒ Automations::AutomationAdHocInvokeParams
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 20 def initialize(automation:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, additional_properties: nil) # @type [Automations::Automation] @automation = automation # @type [String] @brand = brand # @type [Hash{String => String}] @data = data # @type [Automations::PROFILE] @profile = profile # @type [String] @recipient = recipient # @type [String] @template = template # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
10 11 12 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 10 def additional_properties @additional_properties end |
#automation ⇒ Object (readonly)
Returns the value of attribute automation.
10 11 12 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 10 def automation @automation end |
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
10 11 12 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 10 def brand @brand end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 10 def data @data end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
10 11 12 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 10 def profile @profile end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
10 11 12 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 10 def recipient @recipient end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
10 11 12 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 10 def template @template end |
Class Method Details
.from_json(json_object:) ⇒ Automations::AutomationAdHocInvokeParams
Deserialize a JSON object to an instance of AutomationAdHocInvokeParams
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 42 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["automation"].nil? automation = nil else automation = parsed_json["automation"].to_json automation = Automations::Automation.from_json(json_object: automation) end brand = struct.brand data = struct.data profile = struct.profile recipient = struct.recipient template = struct.template new(automation: automation, brand: brand, data: data, profile: profile, recipient: recipient, template: template, 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.
78 79 80 81 82 83 84 85 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 78 def self.validate_raw(obj:) Automations::Automation.validate_raw(obj: obj.automation) obj.brand&.is_a?(String) != false || raise("Passed value for field obj.brand is not the expected type, validation failed.") obj.data&.is_a?(Hash) != false || raise("Passed value for field obj.data is not the expected type, validation failed.") obj.profile&.is_a?(Object) != false || raise("Passed value for field obj.profile is not the expected type, validation failed.") obj.recipient&.is_a?(String) != false || raise("Passed value for field obj.recipient is not the expected type, validation failed.") obj.template&.is_a?(String) != false || raise("Passed value for field obj.template is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of AutomationAdHocInvokeParams to a JSON object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/trycourier/automations/types/automation_ad_hoc_invoke_params.rb', line 63 def to_json(*_args) { "automation": @automation, "brand": @brand, "data": @data, "profile": @profile, "recipient": @recipient, "template": @template }.to_json end |