Class: MailSlurpClient::SentEmailDto

Inherits:
Object
  • Object
show all
Defined in:
lib/mailslurp_client/models/sent_email_dto.rb

Overview

Sent email details

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SentEmailDto

Initializes the object

Parameters:

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

    Model attributes in the form of hash



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 172

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::SentEmailDto` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::SentEmailDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'user_id')
    self.user_id = attributes[:'user_id']
  end

  if attributes.key?(:'inbox_id')
    self.inbox_id = attributes[:'inbox_id']
  end

  if attributes.key?(:'domain_id')
    self.domain_id = attributes[:'domain_id']
  end

  if attributes.key?(:'to')
    if (value = attributes[:'to']).is_a?(Array)
      self.to = value
    end
  end

  if attributes.key?(:'from')
    self.from = attributes[:'from']
  end

  if attributes.key?(:'reply_to')
    self.reply_to = attributes[:'reply_to']
  end

  if attributes.key?(:'cc')
    if (value = attributes[:'cc']).is_a?(Array)
      self.cc = value
    end
  end

  if attributes.key?(:'bcc')
    if (value = attributes[:'bcc']).is_a?(Array)
      self.bcc = value
    end
  end

  if attributes.key?(:'attachments')
    if (value = attributes[:'attachments']).is_a?(Array)
      self.attachments = value
    end
  end

  if attributes.key?(:'subject')
    self.subject = attributes[:'subject']
  end

  if attributes.key?(:'body_md5_hash')
    self.body_md5_hash = attributes[:'body_md5_hash']
  end

  if attributes.key?(:'body')
    self.body = attributes[:'body']
  end

  if attributes.key?(:'to_contacts')
    if (value = attributes[:'to_contacts']).is_a?(Array)
      self.to_contacts = value
    end
  end

  if attributes.key?(:'to_group')
    self.to_group = attributes[:'to_group']
  end

  if attributes.key?(:'charset')
    self.charset = attributes[:'charset']
  end

  if attributes.key?(:'is_html')
    self.is_html = attributes[:'is_html']
  end

  if attributes.key?(:'sent_at')
    self.sent_at = attributes[:'sent_at']
  end

  if attributes.key?(:'pixel_ids')
    if (value = attributes[:'pixel_ids']).is_a?(Array)
      self.pixel_ids = value
    end
  end

  if attributes.key?(:'message_id')
    self.message_id = attributes[:'message_id']
  end

  if attributes.key?(:'message_ids')
    if (value = attributes[:'message_ids']).is_a?(Array)
      self.message_ids = value
    end
  end

  if attributes.key?(:'virtual_send')
    self.virtual_send = attributes[:'virtual_send']
  end

  if attributes.key?(:'template_id')
    self.template_id = attributes[:'template_id']
  end

  if attributes.key?(:'template_variables')
    if (value = attributes[:'template_variables']).is_a?(Hash)
      self.template_variables = value
    end
  end

  if attributes.key?(:'headers')
    if (value = attributes[:'headers']).is_a?(Hash)
      self.headers = value
    end
  end

  if attributes.key?(:'html')
    self.html = attributes[:'html']
  end
end

Instance Attribute Details

#attachmentsObject

Array of IDs of attachments that were sent with this email



43
44
45
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 43

def attachments
  @attachments
end

#bccObject

Returns the value of attribute bcc.



40
41
42
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 40

def bcc
  @bcc
end

#bodyObject

Sent email body



51
52
53
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 51

def body
  @body
end

#body_md5_hashObject

MD5 Hash



48
49
50
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 48

def body_md5_hash
  @body_md5_hash
end

#ccObject

Returns the value of attribute cc.



38
39
40
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 38

def cc
  @cc
end

#charsetObject

Returns the value of attribute charset.



57
58
59
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 57

def charset
  @charset
end

#domain_idObject

Domain ID



28
29
30
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 28

def domain_id
  @domain_id
end

#fromObject

Sent from address



34
35
36
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 34

def from
  @from
end

#headersObject

Returns the value of attribute headers.



75
76
77
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 75

def headers
  @headers
end

#htmlObject

Returns the value of attribute html.



77
78
79
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 77

def html
  @html
end

#idObject

ID of sent email



19
20
21
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 19

def id
  @id
end

#inbox_idObject

Inbox ID email was sent from



25
26
27
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 25

def inbox_id
  @inbox_id
end

#is_htmlObject

Returns the value of attribute is_html.



59
60
61
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 59

def is_html
  @is_html
end

#message_idObject

Returns the value of attribute message_id.



65
66
67
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 65

def message_id
  @message_id
end

#message_idsObject

Returns the value of attribute message_ids.



67
68
69
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 67

def message_ids
  @message_ids
end

#pixel_idsObject

Returns the value of attribute pixel_ids.



63
64
65
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 63

def pixel_ids
  @pixel_ids
end

#reply_toObject

Returns the value of attribute reply_to.



36
37
38
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 36

def reply_to
  @reply_to
end

#sent_atObject

Returns the value of attribute sent_at.



61
62
63
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 61

def sent_at
  @sent_at
end

#subjectObject

Returns the value of attribute subject.



45
46
47
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 45

def subject
  @subject
end

#template_idObject

Returns the value of attribute template_id.



71
72
73
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 71

def template_id
  @template_id
end

#template_variablesObject

Returns the value of attribute template_variables.



73
74
75
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 73

def template_variables
  @template_variables
end

#toObject

Recipients email was sent to



31
32
33
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 31

def to
  @to
end

#to_contactsObject

Returns the value of attribute to_contacts.



53
54
55
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 53

def to_contacts
  @to_contacts
end

#to_groupObject

Returns the value of attribute to_group.



55
56
57
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 55

def to_group
  @to_group
end

#user_idObject

User ID



22
23
24
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 22

def user_id
  @user_id
end

#virtual_sendObject

Returns the value of attribute virtual_send.



69
70
71
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 69

def virtual_send
  @virtual_send
end

Class Method Details

.attribute_mapObject

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



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 80

def self.attribute_map
  {
    :'id' => :'id',
    :'user_id' => :'userId',
    :'inbox_id' => :'inboxId',
    :'domain_id' => :'domainId',
    :'to' => :'to',
    :'from' => :'from',
    :'reply_to' => :'replyTo',
    :'cc' => :'cc',
    :'bcc' => :'bcc',
    :'attachments' => :'attachments',
    :'subject' => :'subject',
    :'body_md5_hash' => :'bodyMD5Hash',
    :'body' => :'body',
    :'to_contacts' => :'toContacts',
    :'to_group' => :'toGroup',
    :'charset' => :'charset',
    :'is_html' => :'isHTML',
    :'sent_at' => :'sentAt',
    :'pixel_ids' => :'pixelIds',
    :'message_id' => :'messageId',
    :'message_ids' => :'messageIds',
    :'virtual_send' => :'virtualSend',
    :'template_id' => :'templateId',
    :'template_variables' => :'templateVariables',
    :'headers' => :'headers',
    :'html' => :'html'
  }
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



389
390
391
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 389

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 144

def self.openapi_nullable
  Set.new([
    :'domain_id',
    :'to',
    :'from',
    :'reply_to',
    :'cc',
    :'bcc',
    :'attachments',
    :'subject',
    :'body_md5_hash',
    :'body',
    :'to_contacts',
    :'to_group',
    :'charset',
    :'is_html',
    :'pixel_ids',
    :'message_id',
    :'message_ids',
    :'virtual_send',
    :'template_id',
    :'template_variables',
    :'headers',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
139
140
141
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 112

def self.openapi_types
  {
    :'id' => :'String',
    :'user_id' => :'String',
    :'inbox_id' => :'String',
    :'domain_id' => :'String',
    :'to' => :'Array<String>',
    :'from' => :'String',
    :'reply_to' => :'String',
    :'cc' => :'Array<String>',
    :'bcc' => :'Array<String>',
    :'attachments' => :'Array<String>',
    :'subject' => :'String',
    :'body_md5_hash' => :'String',
    :'body' => :'String',
    :'to_contacts' => :'Array<String>',
    :'to_group' => :'String',
    :'charset' => :'String',
    :'is_html' => :'Boolean',
    :'sent_at' => :'DateTime',
    :'pixel_ids' => :'Array<String>',
    :'message_id' => :'String',
    :'message_ids' => :'Array<String>',
    :'virtual_send' => :'Boolean',
    :'template_id' => :'String',
    :'template_variables' => :'Hash<String, Object>',
    :'headers' => :'Hash<String, String>',
    :'html' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 343

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      user_id == o.user_id &&
      inbox_id == o.inbox_id &&
      domain_id == o.domain_id &&
      to == o.to &&
      from == o.from &&
      reply_to == o.reply_to &&
      cc == o.cc &&
      bcc == o.bcc &&
      attachments == o.attachments &&
      subject == o.subject &&
      body_md5_hash == o.body_md5_hash &&
      body == o.body &&
      to_contacts == o.to_contacts &&
      to_group == o.to_group &&
      charset == o.charset &&
      is_html == o.is_html &&
      sent_at == o.sent_at &&
      pixel_ids == o.pixel_ids &&
      message_id == o.message_id &&
      message_ids == o.message_ids &&
      virtual_send == o.virtual_send &&
      template_id == o.template_id &&
      template_variables == o.template_variables &&
      headers == o.headers &&
      html == o.html
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 417

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    MailSlurpClient.const_get(type).build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 486

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 396

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(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?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


376
377
378
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 376

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



382
383
384
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 382

def hash
  [id, user_id, inbox_id, domain_id, to, from, reply_to, cc, bcc, attachments, subject, body_md5_hash, body, to_contacts, to_group, charset, is_html, sent_at, pixel_ids, message_id, message_ids, virtual_send, template_id, template_variables, headers, html].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 310

def list_invalid_properties
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @user_id.nil?
    invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
  end

  if @inbox_id.nil?
    invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
  end

  if @sent_at.nil?
    invalid_properties.push('invalid value for "sent_at", sent_at cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



462
463
464
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 462

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 468

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end
    
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



456
457
458
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 456

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



333
334
335
336
337
338
339
# File 'lib/mailslurp_client/models/sent_email_dto.rb', line 333

def valid?
  return false if @id.nil?
  return false if @user_id.nil?
  return false if @inbox_id.nil?
  return false if @sent_at.nil?
  true
end