mailslurp_client 11.0.1 → 11.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -439,199 +439,6 @@ module MailSlurpClient
439
439
  return data, status_code, headers
440
440
  end
441
441
 
442
- # Get an expired inbox record
443
- # Inboxes created with an expiration date will expire after the given date and be moved to an ExpiredInbox entity. You can still read emails in the inbox but it can no longer send or receive emails. Fetch the expired inboxes to view the old inboxes properties
444
- # @param expired_id [String] ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId)
445
- # @param [Hash] opts the optional parameters
446
- # @return [ExpiredInboxDto]
447
- def get_expired_inbox_record_by_id(expired_id, opts = {})
448
- data, _status_code, _headers = get_expired_inbox_record_by_id_with_http_info(expired_id, opts)
449
- data
450
- end
451
-
452
- # Get an expired inbox record
453
- # Inboxes created with an expiration date will expire after the given date and be moved to an ExpiredInbox entity. You can still read emails in the inbox but it can no longer send or receive emails. Fetch the expired inboxes to view the old inboxes properties
454
- # @param expired_id [String] ID of the ExpiredInboxRecord you want to retrieve. This is different from the ID of the inbox you are interested in. See other methods for getting ExpiredInboxRecord for an inbox inboxId)
455
- # @param [Hash] opts the optional parameters
456
- # @return [Array<(ExpiredInboxDto, Integer, Hash)>] ExpiredInboxDto data, response status code and response headers
457
- def get_expired_inbox_record_by_id_with_http_info(expired_id, opts = {})
458
- if @api_client.config.debugging
459
- @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_expired_inbox_record_by_id ...'
460
- end
461
- # verify the required parameter 'expired_id' is set
462
- if @api_client.config.client_side_validation && expired_id.nil?
463
- fail ArgumentError, "Missing the required parameter 'expired_id' when calling InboxControllerApi.get_expired_inbox_record_by_id"
464
- end
465
- # resource path
466
- local_var_path = '/inboxes/expired-records/{expiredId}'.sub('{' + 'expiredId' + '}', CGI.escape(expired_id.to_s))
467
-
468
- # query parameters
469
- query_params = opts[:query_params] || {}
470
-
471
- # header parameters
472
- header_params = opts[:header_params] || {}
473
- # HTTP header 'Accept' (if needed)
474
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
475
-
476
- # form parameters
477
- form_params = opts[:form_params] || {}
478
-
479
- # http body (model)
480
- post_body = opts[:body]
481
-
482
- # return_type
483
- return_type = opts[:return_type] || 'ExpiredInboxDto'
484
-
485
- # auth_names
486
- auth_names = opts[:auth_names] || ['API_KEY']
487
-
488
- new_options = opts.merge(
489
- :header_params => header_params,
490
- :query_params => query_params,
491
- :form_params => form_params,
492
- :body => post_body,
493
- :auth_names => auth_names,
494
- :return_type => return_type
495
- )
496
-
497
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
498
- if @api_client.config.debugging
499
- @api_client.config.logger.debug "API called: InboxControllerApi#get_expired_inbox_record_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
500
- end
501
- return data, status_code, headers
502
- end
503
-
504
- # Get expired inbox record for a previously existing inbox
505
- # Use the inboxId to return an ExpiredInboxRecord if an inbox has expired. Inboxes expire and are disabled if an expiration date is set or plan requires. Returns 404 if no expired inbox is found for the inboxId
506
- # @param inbox_id [String] ID of inbox you want to retrieve (not the inbox ID)
507
- # @param [Hash] opts the optional parameters
508
- # @return [ExpiredInboxDto]
509
- def get_expired_inbox_record_by_inbox_id(inbox_id, opts = {})
510
- data, _status_code, _headers = get_expired_inbox_record_by_inbox_id_with_http_info(inbox_id, opts)
511
- data
512
- end
513
-
514
- # Get expired inbox record for a previously existing inbox
515
- # Use the inboxId to return an ExpiredInboxRecord if an inbox has expired. Inboxes expire and are disabled if an expiration date is set or plan requires. Returns 404 if no expired inbox is found for the inboxId
516
- # @param inbox_id [String] ID of inbox you want to retrieve (not the inbox ID)
517
- # @param [Hash] opts the optional parameters
518
- # @return [Array<(ExpiredInboxDto, Integer, Hash)>] ExpiredInboxDto data, response status code and response headers
519
- def get_expired_inbox_record_by_inbox_id_with_http_info(inbox_id, opts = {})
520
- if @api_client.config.debugging
521
- @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_expired_inbox_record_by_inbox_id ...'
522
- end
523
- # verify the required parameter 'inbox_id' is set
524
- if @api_client.config.client_side_validation && inbox_id.nil?
525
- fail ArgumentError, "Missing the required parameter 'inbox_id' when calling InboxControllerApi.get_expired_inbox_record_by_inbox_id"
526
- end
527
- # resource path
528
- local_var_path = '/inboxes/{inboxId}/expired-record'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))
529
-
530
- # query parameters
531
- query_params = opts[:query_params] || {}
532
-
533
- # header parameters
534
- header_params = opts[:header_params] || {}
535
- # HTTP header 'Accept' (if needed)
536
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
537
-
538
- # form parameters
539
- form_params = opts[:form_params] || {}
540
-
541
- # http body (model)
542
- post_body = opts[:body]
543
-
544
- # return_type
545
- return_type = opts[:return_type] || 'ExpiredInboxDto'
546
-
547
- # auth_names
548
- auth_names = opts[:auth_names] || ['API_KEY']
549
-
550
- new_options = opts.merge(
551
- :header_params => header_params,
552
- :query_params => query_params,
553
- :form_params => form_params,
554
- :body => post_body,
555
- :auth_names => auth_names,
556
- :return_type => return_type
557
- )
558
-
559
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
560
- if @api_client.config.debugging
561
- @api_client.config.logger.debug "API called: InboxControllerApi#get_expired_inbox_record_by_inbox_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
562
- end
563
- return data, status_code, headers
564
- end
565
-
566
- # List records of expired inboxes
567
- # Inboxes created with an expiration date will expire after the given date. An ExpiredInboxRecord is created that records the inboxes old ID and email address. You can still read emails in the inbox (using the inboxes old ID) but the email address associated with the inbox can no longer send or receive emails. Fetch expired inbox records to view the old inboxes properties
568
- # @param [Hash] opts the optional parameters
569
- # @option opts [Integer] :page Optional page index in inbox sent email list pagination (default to 0)
570
- # @option opts [Integer] :size Optional page size in inbox sent email list pagination (default to 20)
571
- # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC')
572
- # @return [PageExpiredInboxRecordProjection]
573
- def get_expired_inbox_records(opts = {})
574
- data, _status_code, _headers = get_expired_inbox_records_with_http_info(opts)
575
- data
576
- end
577
-
578
- # List records of expired inboxes
579
- # Inboxes created with an expiration date will expire after the given date. An ExpiredInboxRecord is created that records the inboxes old ID and email address. You can still read emails in the inbox (using the inboxes old ID) but the email address associated with the inbox can no longer send or receive emails. Fetch expired inbox records to view the old inboxes properties
580
- # @param [Hash] opts the optional parameters
581
- # @option opts [Integer] :page Optional page index in inbox sent email list pagination
582
- # @option opts [Integer] :size Optional page size in inbox sent email list pagination
583
- # @option opts [String] :sort Optional createdAt sort direction ASC or DESC
584
- # @return [Array<(PageExpiredInboxRecordProjection, Integer, Hash)>] PageExpiredInboxRecordProjection data, response status code and response headers
585
- def get_expired_inbox_records_with_http_info(opts = {})
586
- if @api_client.config.debugging
587
- @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_expired_inbox_records ...'
588
- end
589
- allowable_values = ["ASC", "DESC"]
590
- if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
591
- fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
592
- end
593
- # resource path
594
- local_var_path = '/inboxes/expired-records'
595
-
596
- # query parameters
597
- query_params = opts[:query_params] || {}
598
- query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
599
- query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
600
- query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
601
-
602
- # header parameters
603
- header_params = opts[:header_params] || {}
604
- # HTTP header 'Accept' (if needed)
605
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
606
-
607
- # form parameters
608
- form_params = opts[:form_params] || {}
609
-
610
- # http body (model)
611
- post_body = opts[:body]
612
-
613
- # return_type
614
- return_type = opts[:return_type] || 'PageExpiredInboxRecordProjection'
615
-
616
- # auth_names
617
- auth_names = opts[:auth_names] || ['API_KEY']
618
-
619
- new_options = opts.merge(
620
- :header_params => header_params,
621
- :query_params => query_params,
622
- :form_params => form_params,
623
- :body => post_body,
624
- :auth_names => auth_names,
625
- :return_type => return_type
626
- )
627
-
628
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
629
- if @api_client.config.debugging
630
- @api_client.config.logger.debug "API called: InboxControllerApi#get_expired_inbox_records\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
631
- end
632
- return data, status_code, headers
633
- end
634
-
635
442
  # Get Inbox
636
443
  # Returns an inbox's properties, including its email address and ID.
637
444
  # @param inbox_id [String] inboxId
@@ -13,14 +13,22 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Options for creating a domain to use with MailSlurp. You must have ownership access to this domain in order to verify it.
16
+ # Options for creating a domain to use with MailSlurp. You must have ownership access to this domain in order to verify it. Domains will not functionally currently until the domain has been verified. See https://www.mailslurp.com/guides/custom-domains for help.
17
17
  class CreateDomainOptions
18
- # The top level domain you wish to use with MailSlurp
18
+ # Whether to create a catch all inbox for the domain. Any email sent to an address using your domain that cannot be matched to an existing inbox you created with the domain will be routed to the created catch all inbox. You can access emails using the regular methods on this inbox ID.
19
+ attr_accessor :created_catch_all_inbox
20
+
21
+ # Optional description of the domain.
22
+ attr_accessor :description
23
+
24
+ # The top level domain you wish to use with MailSlurp. Do not specify subdomain just the top level. So `test.com` covers all subdomains such as `mail.test.com`. Don't include a protocol such as `http://`. Once added you must complete the verification steps by adding the returned records to your domain.
19
25
  attr_accessor :domain
20
26
 
21
27
  # Attribute mapping from ruby-style variable name to JSON key.
22
28
  def self.attribute_map
23
29
  {
30
+ :'created_catch_all_inbox' => :'createdCatchAllInbox',
31
+ :'description' => :'description',
24
32
  :'domain' => :'domain'
25
33
  }
26
34
  end
@@ -28,6 +36,8 @@ module MailSlurpClient
28
36
  # Attribute type mapping.
29
37
  def self.openapi_types
30
38
  {
39
+ :'created_catch_all_inbox' => :'Boolean',
40
+ :'description' => :'String',
31
41
  :'domain' => :'String'
32
42
  }
33
43
  end
@@ -53,6 +63,14 @@ module MailSlurpClient
53
63
  h[k.to_sym] = v
54
64
  }
55
65
 
66
+ if attributes.key?(:'created_catch_all_inbox')
67
+ self.created_catch_all_inbox = attributes[:'created_catch_all_inbox']
68
+ end
69
+
70
+ if attributes.key?(:'description')
71
+ self.description = attributes[:'description']
72
+ end
73
+
56
74
  if attributes.key?(:'domain')
57
75
  self.domain = attributes[:'domain']
58
76
  end
@@ -76,6 +94,8 @@ module MailSlurpClient
76
94
  def ==(o)
77
95
  return true if self.equal?(o)
78
96
  self.class == o.class &&
97
+ created_catch_all_inbox == o.created_catch_all_inbox &&
98
+ description == o.description &&
79
99
  domain == o.domain
80
100
  end
81
101
 
@@ -88,7 +108,7 @@ module MailSlurpClient
88
108
  # Calculates hash code according to all attributes.
89
109
  # @return [Integer] Hash code
90
110
  def hash
91
- [domain].hash
111
+ [created_catch_all_inbox, description, domain].hash
92
112
  end
93
113
 
94
114
  # Builds the object from hash
@@ -15,6 +15,9 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Domain plus verification records and status
17
17
  class DomainDto
18
+ # The optional catch all inbox that will receive emails sent to the domain that cannot be matched.
19
+ attr_accessor :catch_all_inbox_id
20
+
18
21
  attr_accessor :created_at
19
22
 
20
23
  # Unique token DKIM tokens
@@ -41,6 +44,7 @@ module MailSlurpClient
41
44
  # Attribute mapping from ruby-style variable name to JSON key.
42
45
  def self.attribute_map
43
46
  {
47
+ :'catch_all_inbox_id' => :'catchAllInboxId',
44
48
  :'created_at' => :'createdAt',
45
49
  :'dkim_tokens' => :'dkimTokens',
46
50
  :'domain' => :'domain',
@@ -56,6 +60,7 @@ module MailSlurpClient
56
60
  # Attribute type mapping.
57
61
  def self.openapi_types
58
62
  {
63
+ :'catch_all_inbox_id' => :'String',
59
64
  :'created_at' => :'DateTime',
60
65
  :'dkim_tokens' => :'Array<String>',
61
66
  :'domain' => :'String',
@@ -89,6 +94,10 @@ module MailSlurpClient
89
94
  h[k.to_sym] = v
90
95
  }
91
96
 
97
+ if attributes.key?(:'catch_all_inbox_id')
98
+ self.catch_all_inbox_id = attributes[:'catch_all_inbox_id']
99
+ end
100
+
92
101
  if attributes.key?(:'created_at')
93
102
  self.created_at = attributes[:'created_at']
94
103
  end
@@ -168,6 +177,7 @@ module MailSlurpClient
168
177
  def ==(o)
169
178
  return true if self.equal?(o)
170
179
  self.class == o.class &&
180
+ catch_all_inbox_id == o.catch_all_inbox_id &&
171
181
  created_at == o.created_at &&
172
182
  dkim_tokens == o.dkim_tokens &&
173
183
  domain == o.domain &&
@@ -188,7 +198,7 @@ module MailSlurpClient
188
198
  # Calculates hash code according to all attributes.
189
199
  # @return [Integer] Hash code
190
200
  def hash
191
- [created_at, dkim_tokens, domain, domain_name_records, id, is_verified, updated_at, user_id, verification_token].hash
201
+ [catch_all_inbox_id, created_at, dkim_tokens, domain, domain_name_records, id, is_verified, updated_at, user_id, verification_token].hash
192
202
  end
193
203
 
194
204
  # Builds the object from hash
@@ -15,6 +15,8 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Preview object for domain entity
17
17
  class DomainPreview
18
+ attr_accessor :catch_all_inbox_id
19
+
18
20
  attr_accessor :created_at
19
21
 
20
22
  attr_accessor :domain
@@ -24,6 +26,7 @@ module MailSlurpClient
24
26
  # Attribute mapping from ruby-style variable name to JSON key.
25
27
  def self.attribute_map
26
28
  {
29
+ :'catch_all_inbox_id' => :'catchAllInboxId',
27
30
  :'created_at' => :'createdAt',
28
31
  :'domain' => :'domain',
29
32
  :'id' => :'id'
@@ -33,6 +36,7 @@ module MailSlurpClient
33
36
  # Attribute type mapping.
34
37
  def self.openapi_types
35
38
  {
39
+ :'catch_all_inbox_id' => :'String',
36
40
  :'created_at' => :'DateTime',
37
41
  :'domain' => :'String',
38
42
  :'id' => :'String'
@@ -60,6 +64,10 @@ module MailSlurpClient
60
64
  h[k.to_sym] = v
61
65
  }
62
66
 
67
+ if attributes.key?(:'catch_all_inbox_id')
68
+ self.catch_all_inbox_id = attributes[:'catch_all_inbox_id']
69
+ end
70
+
63
71
  if attributes.key?(:'created_at')
64
72
  self.created_at = attributes[:'created_at']
65
73
  end
@@ -106,6 +114,7 @@ module MailSlurpClient
106
114
  def ==(o)
107
115
  return true if self.equal?(o)
108
116
  self.class == o.class &&
117
+ catch_all_inbox_id == o.catch_all_inbox_id &&
109
118
  created_at == o.created_at &&
110
119
  domain == o.domain &&
111
120
  id == o.id
@@ -120,7 +129,7 @@ module MailSlurpClient
120
129
  # Calculates hash code according to all attributes.
121
130
  # @return [Integer] Hash code
122
131
  def hash
123
- [created_at, domain, id].hash
132
+ [catch_all_inbox_id, created_at, domain, id].hash
124
133
  end
125
134
 
126
135
  # Builds the object from hash
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
5
+
6
+ The version of the OpenAPI document: 6.5.2
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ # Parsed text of an email
17
+ class EmailTextLinesResult
18
+ attr_accessor :body
19
+
20
+ attr_accessor :lines
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'body' => :'body',
26
+ :'lines' => :'lines'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.openapi_types
32
+ {
33
+ :'body' => :'String',
34
+ :'lines' => :'Array<String>'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::EmailTextLinesResult` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::EmailTextLinesResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'body')
60
+ self.body = attributes[:'body']
61
+ end
62
+
63
+ if attributes.key?(:'lines')
64
+ if (value = attributes[:'lines']).is_a?(Array)
65
+ self.lines = value
66
+ end
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @body.nil?
75
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
76
+ end
77
+
78
+ if @lines.nil?
79
+ invalid_properties.push('invalid value for "lines", lines cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @body.nil?
89
+ return false if @lines.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ body == o.body &&
99
+ lines == o.lines
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [body, lines].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ MailSlurpClient.const_get(type).build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end