Class: Courier::Automations::AutomationInvokeTemplateParams
- Inherits:
-
Object
- Object
- Courier::Automations::AutomationInvokeTemplateParams
- Defined in:
- lib/trycourier/automations/types/automation_invoke_template_params.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#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.
-
#template_id ⇒ Object
readonly
Returns the value of attribute template_id.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Automations::AutomationInvokeTemplateParams
Deserialize a JSON object to an instance of AutomationInvokeTemplateParams.
-
.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(template_id:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, additional_properties: nil) ⇒ Automations::AutomationInvokeTemplateParams constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of AutomationInvokeTemplateParams to a JSON object.
Constructor Details
#initialize(template_id:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, additional_properties: nil) ⇒ Automations::AutomationInvokeTemplateParams
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 19 def initialize(template_id:, brand: nil, data: nil, profile: nil, recipient: nil, template: nil, additional_properties: nil) # @type [String] @template_id = template_id # @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.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 9 def additional_properties @additional_properties end |
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 9 def brand @brand end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 9 def data @data end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 9 def profile @profile end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 9 def recipient @recipient end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 9 def template @template end |
#template_id ⇒ Object (readonly)
Returns the value of attribute template_id.
9 10 11 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 9 def template_id @template_id end |
Class Method Details
.from_json(json_object:) ⇒ Automations::AutomationInvokeTemplateParams
Deserialize a JSON object to an instance of AutomationInvokeTemplateParams
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) template_id = struct.templateId brand = struct.brand data = struct.data profile = struct.profile recipient = struct.recipient template = struct.template new(template_id: template_id, 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.
72 73 74 75 76 77 78 79 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 72 def self.validate_raw(obj:) obj.template_id.is_a?(String) != false || raise("Passed value for field obj.template_id is not the expected type, validation failed.") 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 AutomationInvokeTemplateParams to a JSON object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/trycourier/automations/types/automation_invoke_template_params.rb', line 57 def to_json(*_args) { "templateId": @template_id, "brand": @brand, "data": @data, "profile": @profile, "recipient": @recipient, "template": @template }.to_json end |