Class: OCI::EmailDataPlane::Models::SubmitEmailDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/email_data_plane/models/submit_email_details.rb

Overview

Details that are required by the sender to submit a request to send email.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SubmitEmailDetails

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 97

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.message_id = attributes[:'messageId'] if attributes[:'messageId']

  raise 'You cannot provide both :messageId and :message_id' if attributes.key?(:'messageId') && attributes.key?(:'message_id')

  self.message_id = attributes[:'message_id'] if attributes[:'message_id']

  self.sender = attributes[:'sender'] if attributes[:'sender']

  self.recipients = attributes[:'recipients'] if attributes[:'recipients']

  self.subject = attributes[:'subject'] if attributes[:'subject']

  self.body_html = attributes[:'bodyHtml'] if attributes[:'bodyHtml']

  raise 'You cannot provide both :bodyHtml and :body_html' if attributes.key?(:'bodyHtml') && attributes.key?(:'body_html')

  self.body_html = attributes[:'body_html'] if attributes[:'body_html']

  self.body_text = attributes[:'bodyText'] if attributes[:'bodyText']

  raise 'You cannot provide both :bodyText and :body_text' if attributes.key?(:'bodyText') && attributes.key?(:'body_text')

  self.body_text = attributes[:'body_text'] if attributes[:'body_text']

  self.reply_to = attributes[:'replyTo'] if attributes[:'replyTo']

  raise 'You cannot provide both :replyTo and :reply_to' if attributes.key?(:'replyTo') && attributes.key?(:'reply_to')

  self.reply_to = attributes[:'reply_to'] if attributes[:'reply_to']

  self.header_fields = attributes[:'headerFields'] if attributes[:'headerFields']

  raise 'You cannot provide both :headerFields and :header_fields' if attributes.key?(:'headerFields') && attributes.key?(:'header_fields')

  self.header_fields = attributes[:'header_fields'] if attributes[:'header_fields']
end

Instance Attribute Details

#body_htmlString

HTML body content in UTF-8. NOTE: Even though bodytext and bodyhtml are both optional, at least one of them must be provided.

Returns:

  • (String)


33
34
35
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 33

def body_html
  @body_html
end

#body_textString

Text body content. NOTE: Even though bodytext and bodyhtml are both optional, at least one of them must be provided.

Returns:

  • (String)


39
40
41
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 39

def body_text
  @body_text
end

#header_fieldsHash<String, String>

The header used by the customer for the email sent. Reserved headers are not allowed e.g "subject", "from", and "to" etc. Example: {\"bar-key\": \"value\"}

Returns:

  • (Hash<String, String>)


49
50
51
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 49

def header_fields
  @header_fields
end

#message_idString

The unique ID for the email's Message-ID header used for service log correlation. The submission will return an error if the syntax is not a valid RFC 5322 Message-ID. This will be generated if not provided. Example: sdiofu234qwermls24fd@mail.example.com

Returns:

  • (String)


15
16
17
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 15

def message_id
  @message_id
end

#recipientsOCI::EmailDataPlane::Models::Recipients

This attribute is required.



23
24
25
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 23

def recipients
  @recipients
end

#reply_toArray<OCI::EmailDataPlane::Models::EmailAddress>

The email address for the recipient to reply to. If left blank, defaults to the sender address.



43
44
45
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 43

def reply_to
  @reply_to
end

#senderOCI::EmailDataPlane::Models::Sender

This attribute is required.



19
20
21
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 19

def sender
  @sender
end

#subjectString

[Required] A short summary of the content, which will appear in the recipient's inbox. UTF-8 supported RFC 2047.

Returns:

  • (String)


27
28
29
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 27

def subject
  @subject
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 52

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'message_id': :'messageId',
    'sender': :'sender',
    'recipients': :'recipients',
    'subject': :'subject',
    'body_html': :'bodyHtml',
    'body_text': :'bodyText',
    'reply_to': :'replyTo',
    'header_fields': :'headerFields'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 68

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'message_id': :'String',
    'sender': :'OCI::EmailDataPlane::Models::Sender',
    'recipients': :'OCI::EmailDataPlane::Models::Recipients',
    'subject': :'String',
    'body_html': :'String',
    'body_text': :'String',
    'reply_to': :'Array<OCI::EmailDataPlane::Models::EmailAddress>',
    'header_fields': :'Hash<String, String>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 147

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    message_id == other.message_id &&
    sender == other.sender &&
    recipients == other.recipients &&
    subject == other.subject &&
    body_html == other.body_html &&
    body_text == other.body_text &&
    reply_to == other.reply_to &&
    header_fields == other.header_fields
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 184

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


164
165
166
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 164

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



173
174
175
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 173

def hash
  [message_id, sender, recipients, subject, body_html, body_text, reply_to, header_fields].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 217

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



211
212
213
# File 'lib/oci/email_data_plane/models/submit_email_details.rb', line 211

def to_s
  to_hash.to_s
end