Class: Courier::Send::BrandSettingsEmail

Inherits:
Object
  • Object
show all
Defined in:
lib/trycourier/send/types/brand_settings_email.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_override: nil, head: nil, footer: nil, header: nil, additional_properties: nil) ⇒ Send::BrandSettingsEmail

Parameters:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 20

def initialize(template_override: nil, head: nil, footer: nil, header: nil, additional_properties: nil)
  # @type [Send::BrandTemplateOverride]
  @template_override = template_override
  # @type [Send::EmailHead]
  @head = head
  # @type [Send::EmailFooter]
  @footer = footer
  # @type [Send::EmailHeader]
  @header = header
  # @type [OpenStruct] Additional properties unmapped to the current class definition
  @additional_properties = additional_properties
end

Instance Attribute Details

#additional_propertiesObject (readonly)

Returns the value of attribute additional_properties.



12
13
14
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 12

def additional_properties
  @additional_properties
end

Returns the value of attribute footer.



12
13
14
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 12

def footer
  @footer
end

#headObject (readonly)

Returns the value of attribute head.



12
13
14
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 12

def head
  @head
end

#headerObject (readonly)

Returns the value of attribute header.



12
13
14
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 12

def header
  @header
end

#template_overrideObject (readonly)

Returns the value of attribute template_override.



12
13
14
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 12

def template_override
  @template_override
end

Class Method Details

.from_json(json_object:) ⇒ Send::BrandSettingsEmail

Deserialize a JSON object to an instance of BrandSettingsEmail

Parameters:

  • json_object (JSON)

Returns:



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
65
66
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 37

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["templateOverride"].nil?
    template_override = nil
  else
    template_override = parsed_json["templateOverride"].to_json
    template_override = Send::BrandTemplateOverride.from_json(json_object: template_override)
  end
  if parsed_json["head"].nil?
    head = nil
  else
    head = parsed_json["head"].to_json
    head = Send::EmailHead.from_json(json_object: head)
  end
  if parsed_json["footer"].nil?
    footer = nil
  else
    footer = parsed_json["footer"].to_json
    footer = Send::EmailFooter.from_json(json_object: footer)
  end
  if parsed_json["header"].nil?
    header = nil
  else
    header = parsed_json["header"].to_json
    header = Send::EmailHeader.from_json(json_object: header)
  end
  new(template_override: template_override, head: head, footer: footer, header: header,
      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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


79
80
81
82
83
84
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 79

def self.validate_raw(obj:)
  obj.template_override.nil? || Send::BrandTemplateOverride.validate_raw(obj: obj.template_override)
  obj.head.nil? || Send::EmailHead.validate_raw(obj: obj.head)
  obj.footer.nil? || Send::EmailFooter.validate_raw(obj: obj.footer)
  obj.header.nil? || Send::EmailHeader.validate_raw(obj: obj.header)
end

Instance Method Details

#to_json(*_args) ⇒ JSON

Serialize an instance of BrandSettingsEmail to a JSON object

Returns:

  • (JSON)


71
72
73
# File 'lib/trycourier/send/types/brand_settings_email.rb', line 71

def to_json(*_args)
  { "templateOverride": @template_override, "head": @head, "footer": @footer, "header": @header }.to_json
end