Class: MailSlurpClient::Email

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

Overview

Email entity (also known as EmailDto). When an SMTP email message is received by MailSlurp it is parsed. The body and attachments are written to disk and the fields such as to, from, subject etc are stored in a database. The `body` contains the email content. If you want the original SMTP message see the `getRawEmail` endpoints. The attachments can be fetched using the AttachmentController

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Email

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/mailslurp_client/models/email.rb', line 239

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::Email` 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::Email`. 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?(:'sender')
    self.sender = attributes[:'sender']
  end

  if attributes.key?(:'recipients')
    self.recipients = attributes[:'recipients']
  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?(:'headers')
    if (value = attributes[:'headers']).is_a?(Hash)
      self.headers = value
    end
  end

  if attributes.key?(:'headers_map')
    if (value = attributes[:'headers_map']).is_a?(Hash)
      self.headers_map = 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')
    self.body = attributes[:'body']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#analysisObject

Returns the value of attribute analysis.



79
80
81
# File 'lib/mailslurp_client/models/email.rb', line 79

def analysis
  @analysis
end

#attachmentsObject

List of IDs of attachments found in the email. Use these IDs with the Inbox and Email Controllers to download attachments and attachment meta data such as filesize, name, extension.



56
57
58
# File 'lib/mailslurp_client/models/email.rb', line 56

def attachments
  @attachments
end

#bccObject

List of `BCC` recipients email addresses that the email was addressed to. See recipients object for names.



47
48
49
# File 'lib/mailslurp_client/models/email.rb', line 47

def bcc
  @bcc
end

#bodyObject

The body of the email message as text parsed from the SMTP message body (does not include attachments). Fetch the raw content to access the SMTP message and use the attachments property to access attachments. The body is stored separately to the email entity so the body is not returned in paginated results only in full single email or wait requests.



62
63
64
# File 'lib/mailslurp_client/models/email.rb', line 62

def body
  @body
end

#body_excerptObject

An excerpt of the body of the email message for quick preview. Takes HTML content part if exists falls back to TEXT content part if not



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

def body_excerpt
  @body_excerpt
end

#body_md5_hashObject

A hash signature of the email message using MD5. Useful for comparing emails without fetching full body.



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

def body_md5_hash
  @body_md5_hash
end

#body_part_content_typesObject

A list of detected multipart mime message body part content types such as text/plain and text/html. Can be used with email bodyPart endpoints to fetch individual body parts.



97
98
99
# File 'lib/mailslurp_client/models/email.rb', line 97

def body_part_content_types
  @body_part_content_types
end

#ccObject

List of `CC` recipients email addresses that the email was addressed to. See recipients object for names.



44
45
46
# File 'lib/mailslurp_client/models/email.rb', line 44

def cc
  @cc
end

#charsetObject

Detected character set of the email body such as UTF-8



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

def charset
  @charset
end

#created_atObject

When was the email received by MailSlurp



82
83
84
# File 'lib/mailslurp_client/models/email.rb', line 82

def created_at
  @created_at
end

#domain_idObject

ID of the domain that received the email



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

def domain_id
  @domain_id
end

#external_idObject

UID used by external IMAP server to identify email



100
101
102
# File 'lib/mailslurp_client/models/email.rb', line 100

def external_id
  @external_id
end

#favouriteObject

Is email favourited



112
113
114
# File 'lib/mailslurp_client/models/email.rb', line 112

def favourite
  @favourite
end

#fromObject

Who the email was sent from. An email address - see fromName for the sender name.



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

def from
  @from
end

#headersObject

Collection of SMTP headers attached to email



50
51
52
# File 'lib/mailslurp_client/models/email.rb', line 50

def headers
  @headers
end

#headers_mapObject

Multi-value map of SMTP headers attached to email



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

def headers_map
  @headers_map
end

#htmlObject

Returns the value of attribute html.



117
118
119
# File 'lib/mailslurp_client/models/email.rb', line 117

def html
  @html
end

#idObject

ID of the email entity



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

def id
  @id
end

#in_reply_toObject

Parsed value of In-Reply-To header. A Message-ID in a thread.



109
110
111
# File 'lib/mailslurp_client/models/email.rb', line 109

def in_reply_to
  @in_reply_to
end

#inbox_idObject

ID of the inbox that received the email



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

def inbox_id
  @inbox_id
end

#is_htmlObject

Is the email body content type HTML?



74
75
76
# File 'lib/mailslurp_client/models/email.rb', line 74

def is_html
  @is_html
end

#is_x_amp_htmlObject

Is the email body content type x-amp-html Amp4Email?



94
95
96
# File 'lib/mailslurp_client/models/email.rb', line 94

def is_x_amp_html
  @is_x_amp_html
end

#message_idObject

RFC 5322 Message-ID header value without angle brackets.



103
104
105
# File 'lib/mailslurp_client/models/email.rb', line 103

def message_id
  @message_id
end

#readObject

Read flag. Has the email ever been viewed in the dashboard or fetched via the API with a hydrated body? If so the email is marked as read. Paginated results do not affect read status. Read status is different to email opened event as it depends on your own account accessing the email. Email opened is determined by tracking pixels sent to other uses if enable during sending. You can listened for both email read and email opened events using webhooks.



88
89
90
# File 'lib/mailslurp_client/models/email.rb', line 88

def read
  @read
end

#recipientsObject

Returns the value of attribute recipients.



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

def recipients
  @recipients
end

#reply_toObject

The `replyTo` field on the received email message



41
42
43
# File 'lib/mailslurp_client/models/email.rb', line 41

def reply_to
  @reply_to
end

#senderObject

Returns the value of attribute sender.



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

def sender
  @sender
end

#size_bytesObject

Size of raw email message in bytes



115
116
117
# File 'lib/mailslurp_client/models/email.rb', line 115

def size_bytes
  @size_bytes
end

#subjectObject

The subject line of the email message as specified by SMTP subject header



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

def subject
  @subject
end

#team_accessObject

Can the email be accessed by organization team members



91
92
93
# File 'lib/mailslurp_client/models/email.rb', line 91

def team_access
  @team_access
end

#text_excerptObject

An excerpt of the body of the email message for quick preview. Takes TEXT content part if exists



68
69
70
# File 'lib/mailslurp_client/models/email.rb', line 68

def text_excerpt
  @text_excerpt
end

#thread_idObject

MailSlurp thread ID for email chain that enables lookup for In-Reply-To and References fields.



106
107
108
# File 'lib/mailslurp_client/models/email.rb', line 106

def thread_id
  @thread_id
end

#toObject

List of `To` recipient email addresses that the email was addressed to. See recipients object for names.



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

def to
  @to
end

#updated_atObject

When was the email last updated



85
86
87
# File 'lib/mailslurp_client/models/email.rb', line 85

def updated_at
  @updated_at
end

#user_idObject

ID of user that email belongs to



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

def user_id
  @user_id
end

#xamp_htmlObject

Returns the value of attribute xamp_html.



119
120
121
# File 'lib/mailslurp_client/models/email.rb', line 119

def xamp_html
  @xamp_html
end

Class Method Details

.attribute_mapObject

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



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/mailslurp_client/models/email.rb', line 122

def self.attribute_map
  {
    :'id' => :'id',
    :'user_id' => :'userId',
    :'inbox_id' => :'inboxId',
    :'domain_id' => :'domainId',
    :'to' => :'to',
    :'from' => :'from',
    :'sender' => :'sender',
    :'recipients' => :'recipients',
    :'reply_to' => :'replyTo',
    :'cc' => :'cc',
    :'bcc' => :'bcc',
    :'headers' => :'headers',
    :'headers_map' => :'headersMap',
    :'attachments' => :'attachments',
    :'subject' => :'subject',
    :'body' => :'body',
    :'body_excerpt' => :'bodyExcerpt',
    :'text_excerpt' => :'textExcerpt',
    :'body_md5_hash' => :'bodyMD5Hash',
    :'is_html' => :'isHTML',
    :'charset' => :'charset',
    :'analysis' => :'analysis',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt',
    :'read' => :'read',
    :'team_access' => :'teamAccess',
    :'is_x_amp_html' => :'isXAmpHtml',
    :'body_part_content_types' => :'bodyPartContentTypes',
    :'external_id' => :'externalId',
    :'message_id' => :'messageId',
    :'thread_id' => :'threadId',
    :'in_reply_to' => :'inReplyTo',
    :'favourite' => :'favourite',
    :'size_bytes' => :'sizeBytes',
    :'html' => :'html',
    :'xamp_html' => :'xampHtml'
  }
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



522
523
524
# File 'lib/mailslurp_client/models/email.rb', line 522

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

.openapi_nullableObject

List of attributes with nullable: true



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
# File 'lib/mailslurp_client/models/email.rb', line 206

def self.openapi_nullable
  Set.new([
    :'domain_id',
    :'from',
    :'sender',
    :'recipients',
    :'reply_to',
    :'cc',
    :'bcc',
    :'headers',
    :'headers_map',
    :'attachments',
    :'subject',
    :'body',
    :'body_excerpt',
    :'text_excerpt',
    :'body_md5_hash',
    :'is_html',
    :'charset',
    :'analysis',
    :'is_x_amp_html',
    :'body_part_content_types',
    :'external_id',
    :'message_id',
    :'thread_id',
    :'in_reply_to',
    :'favourite',
    :'size_bytes',
  ])
end

.openapi_typesObject

Attribute type mapping.



164
165
166
167
168
169
170
171
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
# File 'lib/mailslurp_client/models/email.rb', line 164

def self.openapi_types
  {
    :'id' => :'String',
    :'user_id' => :'String',
    :'inbox_id' => :'String',
    :'domain_id' => :'String',
    :'to' => :'Array<String>',
    :'from' => :'String',
    :'sender' => :'Sender',
    :'recipients' => :'EmailRecipients',
    :'reply_to' => :'String',
    :'cc' => :'Array<String>',
    :'bcc' => :'Array<String>',
    :'headers' => :'Hash<String, String>',
    :'headers_map' => :'Hash<String, Array<String>>',
    :'attachments' => :'Array<String>',
    :'subject' => :'String',
    :'body' => :'String',
    :'body_excerpt' => :'String',
    :'text_excerpt' => :'String',
    :'body_md5_hash' => :'String',
    :'is_html' => :'Boolean',
    :'charset' => :'String',
    :'analysis' => :'EmailAnalysis',
    :'created_at' => :'DateTime',
    :'updated_at' => :'DateTime',
    :'read' => :'Boolean',
    :'team_access' => :'Boolean',
    :'is_x_amp_html' => :'Boolean',
    :'body_part_content_types' => :'Array<String>',
    :'external_id' => :'String',
    :'message_id' => :'String',
    :'thread_id' => :'String',
    :'in_reply_to' => :'String',
    :'favourite' => :'Boolean',
    :'size_bytes' => :'Integer',
    :'html' => :'Boolean',
    :'xamp_html' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/mailslurp_client/models/email.rb', line 466

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 &&
      sender == o.sender &&
      recipients == o.recipients &&
      reply_to == o.reply_to &&
      cc == o.cc &&
      bcc == o.bcc &&
      headers == o.headers &&
      headers_map == o.headers_map &&
      attachments == o.attachments &&
      subject == o.subject &&
      body == o.body &&
      body_excerpt == o.body_excerpt &&
      text_excerpt == o.text_excerpt &&
      body_md5_hash == o.body_md5_hash &&
      is_html == o.is_html &&
      charset == o.charset &&
      analysis == o.analysis &&
      created_at == o.created_at &&
      updated_at == o.updated_at &&
      read == o.read &&
      team_access == o.team_access &&
      is_x_amp_html == o.is_x_amp_html &&
      body_part_content_types == o.body_part_content_types &&
      external_id == o.external_id &&
      message_id == o.message_id &&
      thread_id == o.thread_id &&
      in_reply_to == o.in_reply_to &&
      favourite == o.favourite &&
      size_bytes == o.size_bytes &&
      html == o.html &&
      xamp_html == o.xamp_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



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/mailslurp_client/models/email.rb', line 550

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



619
620
621
622
623
624
625
626
627
628
629
630
631
# File 'lib/mailslurp_client/models/email.rb', line 619

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



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/mailslurp_client/models/email.rb', line 529

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


509
510
511
# File 'lib/mailslurp_client/models/email.rb', line 509

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



515
516
517
# File 'lib/mailslurp_client/models/email.rb', line 515

def hash
  [id, user_id, inbox_id, domain_id, to, from, sender, recipients, reply_to, cc, bcc, headers, headers_map, attachments, subject, body, body_excerpt, text_excerpt, body_md5_hash, is_html, charset, analysis, created_at, updated_at, read, team_access, is_x_amp_html, body_part_content_types, external_id, message_id, thread_id, in_reply_to, favourite, size_bytes, html, xamp_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



413
414
415
416
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
# File 'lib/mailslurp_client/models/email.rb', line 413

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 @to.nil?
    invalid_properties.push('invalid value for "to", to cannot be nil.')
  end

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

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

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

  if @team_access.nil?
    invalid_properties.push('invalid value for "team_access", team_access 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



595
596
597
# File 'lib/mailslurp_client/models/email.rb', line 595

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



601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/mailslurp_client/models/email.rb', line 601

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



589
590
591
# File 'lib/mailslurp_client/models/email.rb', line 589

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



452
453
454
455
456
457
458
459
460
461
462
# File 'lib/mailslurp_client/models/email.rb', line 452

def valid?
  return false if @id.nil?
  return false if @user_id.nil?
  return false if @inbox_id.nil?
  return false if @to.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  return false if @read.nil?
  return false if @team_access.nil?
  true
end