mailslurp_client 15.3.0 → 15.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/inbox_controller_api.rb +190 -0
  3. data/lib/mailslurp_client/models/attachment_projection.rb +14 -14
  4. data/lib/mailslurp_client/models/email_projection.rb +12 -12
  5. data/lib/mailslurp_client/models/imap_smtp_access_details.rb +309 -0
  6. data/lib/mailslurp_client/models/inbox_by_email_address_result.rb +220 -0
  7. data/lib/mailslurp_client/models/inbox_id_item.rb +225 -0
  8. data/lib/mailslurp_client/models/inbox_ids_result.rb +1 -1
  9. data/lib/mailslurp_client/models/page_alias.rb +22 -22
  10. data/lib/mailslurp_client/models/page_attachment_entity.rb +22 -22
  11. data/lib/mailslurp_client/models/page_bounced_email.rb +22 -22
  12. data/lib/mailslurp_client/models/page_bounced_recipients.rb +22 -22
  13. data/lib/mailslurp_client/models/page_contact_projection.rb +22 -22
  14. data/lib/mailslurp_client/models/page_email_preview.rb +22 -22
  15. data/lib/mailslurp_client/models/page_email_projection.rb +22 -22
  16. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +22 -22
  17. data/lib/mailslurp_client/models/page_group_projection.rb +22 -22
  18. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +22 -22
  19. data/lib/mailslurp_client/models/page_inbox_projection.rb +22 -22
  20. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +22 -22
  21. data/lib/mailslurp_client/models/page_missed_email_projection.rb +22 -22
  22. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +22 -22
  23. data/lib/mailslurp_client/models/page_sent_email_projection.rb +16 -16
  24. data/lib/mailslurp_client/models/page_template_projection.rb +22 -22
  25. data/lib/mailslurp_client/models/page_thread_projection.rb +22 -22
  26. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +22 -22
  27. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +22 -22
  28. data/lib/mailslurp_client/models/page_webhook_projection.rb +22 -22
  29. data/lib/mailslurp_client/models/page_webhook_result.rb +22 -22
  30. data/lib/mailslurp_client/models/send_smtp_envelope_options.rb +242 -0
  31. data/lib/mailslurp_client/models/sent_email_projection.rb +31 -31
  32. data/lib/mailslurp_client/models/sort.rb +13 -13
  33. data/lib/mailslurp_client/version.rb +1 -1
  34. data/lib/mailslurp_client.rb +4 -0
  35. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e8f762eab0c9bf606cc5404b0f46a25612abe978c69fe65490dd6bc2ad59fa9
4
- data.tar.gz: 42478b862c0f3df7d6a1df0fd6ff555f8295706c70dd45cdb80095a9e40e6671
3
+ metadata.gz: 2732728fb102413fbc4d84c30e6b6fc8a4da192e569d1b3cb5ed0cb7a77db750
4
+ data.tar.gz: b85e2541f0b53d20d460e2e5cd6099f55ed7dff5ad9df1e53d4dbb5fc502565b
5
5
  SHA512:
6
- metadata.gz: 5731ab58c4d5e60bbdcfefebde9cd5841887a9959c7d9b726d6d6879489a3f0c826d5ec399950bacef40741516b710bd7c572aed39cddd8890a62d5669a2c095
7
- data.tar.gz: 8bcd0af7395b58601c49a4781f53a3bea26472ea960c9769f902ccccad35d010487c36b80012def2ba12e47d75f8776e8f4b6c8be1586a015ae57efbdbb58702
6
+ metadata.gz: 16680ce38d426581fd23fcbf1cc92cd32c9395868494c7bdeec0ef9dab595a922509b5c2feaaef58d9293c0f0a93ff78eefbac8db42b32fe73174adcfcf9e076
7
+ data.tar.gz: 9e022a0c01c1644a5d429e3e0a4b06ca1b9ee7ba08151eaaa1058b41e16bb3f3f3fd618131b3201f54e27db28f560cd569498101cacc3ce2bbd469f279c90350
@@ -721,6 +721,63 @@ module MailSlurpClient
721
721
  return data, status_code, headers
722
722
  end
723
723
 
724
+ # Get IMAP and SMTP access usernames and passwords
725
+ # @param [Hash] opts the optional parameters
726
+ # @option opts [String] :inbox_id Inbox ID
727
+ # @return [ImapSmtpAccessDetails]
728
+ def get_imap_smtp_access(opts = {})
729
+ data, _status_code, _headers = get_imap_smtp_access_with_http_info(opts)
730
+ data
731
+ end
732
+
733
+ # Get IMAP and SMTP access usernames and passwords
734
+ # @param [Hash] opts the optional parameters
735
+ # @option opts [String] :inbox_id Inbox ID
736
+ # @return [Array<(ImapSmtpAccessDetails, Integer, Hash)>] ImapSmtpAccessDetails data, response status code and response headers
737
+ def get_imap_smtp_access_with_http_info(opts = {})
738
+ if @api_client.config.debugging
739
+ @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_imap_smtp_access ...'
740
+ end
741
+ # resource path
742
+ local_var_path = '/inboxes/imap-smtp-access'
743
+
744
+ # query parameters
745
+ query_params = opts[:query_params] || {}
746
+ query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil?
747
+
748
+ # header parameters
749
+ header_params = opts[:header_params] || {}
750
+ # HTTP header 'Accept' (if needed)
751
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
752
+
753
+ # form parameters
754
+ form_params = opts[:form_params] || {}
755
+
756
+ # http body (model)
757
+ post_body = opts[:body]
758
+
759
+ # return_type
760
+ return_type = opts[:return_type] || 'ImapSmtpAccessDetails'
761
+
762
+ # auth_names
763
+ auth_names = opts[:auth_names] || ['API_KEY']
764
+
765
+ new_options = opts.merge(
766
+ :header_params => header_params,
767
+ :query_params => query_params,
768
+ :form_params => form_params,
769
+ :body => post_body,
770
+ :auth_names => auth_names,
771
+ :return_type => return_type
772
+ )
773
+
774
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
775
+ if @api_client.config.debugging
776
+ @api_client.config.logger.debug "API called: InboxControllerApi#get_imap_smtp_access\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
777
+ end
778
+ return data, status_code, headers
779
+ end
780
+
724
781
  # Get Inbox. Returns properties of an inbox.
725
782
  # Returns an inbox's properties, including its email address and ID.
726
783
  # @param inbox_id [String]
@@ -783,6 +840,69 @@ module MailSlurpClient
783
840
  return data, status_code, headers
784
841
  end
785
842
 
843
+ # Search for an inbox with the provided email address
844
+ # Get a inbox result by email address
845
+ # @param email_address [String]
846
+ # @param [Hash] opts the optional parameters
847
+ # @return [InboxByEmailAddressResult]
848
+ def get_inbox_by_email_address(email_address, opts = {})
849
+ data, _status_code, _headers = get_inbox_by_email_address_with_http_info(email_address, opts)
850
+ data
851
+ end
852
+
853
+ # Search for an inbox with the provided email address
854
+ # Get a inbox result by email address
855
+ # @param email_address [String]
856
+ # @param [Hash] opts the optional parameters
857
+ # @return [Array<(InboxByEmailAddressResult, Integer, Hash)>] InboxByEmailAddressResult data, response status code and response headers
858
+ def get_inbox_by_email_address_with_http_info(email_address, opts = {})
859
+ if @api_client.config.debugging
860
+ @api_client.config.logger.debug 'Calling API: InboxControllerApi.get_inbox_by_email_address ...'
861
+ end
862
+ # verify the required parameter 'email_address' is set
863
+ if @api_client.config.client_side_validation && email_address.nil?
864
+ fail ArgumentError, "Missing the required parameter 'email_address' when calling InboxControllerApi.get_inbox_by_email_address"
865
+ end
866
+ # resource path
867
+ local_var_path = '/inboxes/byEmailAddress'
868
+
869
+ # query parameters
870
+ query_params = opts[:query_params] || {}
871
+ query_params[:'emailAddress'] = email_address
872
+
873
+ # header parameters
874
+ header_params = opts[:header_params] || {}
875
+ # HTTP header 'Accept' (if needed)
876
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
877
+
878
+ # form parameters
879
+ form_params = opts[:form_params] || {}
880
+
881
+ # http body (model)
882
+ post_body = opts[:body]
883
+
884
+ # return_type
885
+ return_type = opts[:return_type] || 'InboxByEmailAddressResult'
886
+
887
+ # auth_names
888
+ auth_names = opts[:auth_names] || ['API_KEY']
889
+
890
+ new_options = opts.merge(
891
+ :header_params => header_params,
892
+ :query_params => query_params,
893
+ :form_params => form_params,
894
+ :body => post_body,
895
+ :auth_names => auth_names,
896
+ :return_type => return_type
897
+ )
898
+
899
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
900
+ if @api_client.config.debugging
901
+ @api_client.config.logger.debug "API called: InboxControllerApi#get_inbox_by_email_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
902
+ end
903
+ return data, status_code, headers
904
+ end
905
+
786
906
  # Get total inbox count
787
907
  # @param [Hash] opts the optional parameters
788
908
  # @return [CountDto]
@@ -1634,6 +1754,76 @@ module MailSlurpClient
1634
1754
  return data, status_code, headers
1635
1755
  end
1636
1756
 
1757
+ # Send email using an SMTP mail envelope and message body and return sent confirmation
1758
+ # Send email using an SMTP envelope containing RCPT TO, MAIL FROM, and a SMTP BODY.
1759
+ # @param inbox_id [String] ID of the inbox you want to send the email from
1760
+ # @param send_smtp_envelope_options [SendSMTPEnvelopeOptions]
1761
+ # @param [Hash] opts the optional parameters
1762
+ # @return [SentEmailDto]
1763
+ def send_smtp_envelope(inbox_id, send_smtp_envelope_options, opts = {})
1764
+ data, _status_code, _headers = send_smtp_envelope_with_http_info(inbox_id, send_smtp_envelope_options, opts)
1765
+ data
1766
+ end
1767
+
1768
+ # Send email using an SMTP mail envelope and message body and return sent confirmation
1769
+ # Send email using an SMTP envelope containing RCPT TO, MAIL FROM, and a SMTP BODY.
1770
+ # @param inbox_id [String] ID of the inbox you want to send the email from
1771
+ # @param send_smtp_envelope_options [SendSMTPEnvelopeOptions]
1772
+ # @param [Hash] opts the optional parameters
1773
+ # @return [Array<(SentEmailDto, Integer, Hash)>] SentEmailDto data, response status code and response headers
1774
+ def send_smtp_envelope_with_http_info(inbox_id, send_smtp_envelope_options, opts = {})
1775
+ if @api_client.config.debugging
1776
+ @api_client.config.logger.debug 'Calling API: InboxControllerApi.send_smtp_envelope ...'
1777
+ end
1778
+ # verify the required parameter 'inbox_id' is set
1779
+ if @api_client.config.client_side_validation && inbox_id.nil?
1780
+ fail ArgumentError, "Missing the required parameter 'inbox_id' when calling InboxControllerApi.send_smtp_envelope"
1781
+ end
1782
+ # verify the required parameter 'send_smtp_envelope_options' is set
1783
+ if @api_client.config.client_side_validation && send_smtp_envelope_options.nil?
1784
+ fail ArgumentError, "Missing the required parameter 'send_smtp_envelope_options' when calling InboxControllerApi.send_smtp_envelope"
1785
+ end
1786
+ # resource path
1787
+ local_var_path = '/inboxes/{inboxId}/smtp-envelope'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s))
1788
+
1789
+ # query parameters
1790
+ query_params = opts[:query_params] || {}
1791
+
1792
+ # header parameters
1793
+ header_params = opts[:header_params] || {}
1794
+ # HTTP header 'Accept' (if needed)
1795
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
1796
+ # HTTP header 'Content-Type'
1797
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1798
+
1799
+ # form parameters
1800
+ form_params = opts[:form_params] || {}
1801
+
1802
+ # http body (model)
1803
+ post_body = opts[:body] || @api_client.object_to_http_body(send_smtp_envelope_options)
1804
+
1805
+ # return_type
1806
+ return_type = opts[:return_type] || 'SentEmailDto'
1807
+
1808
+ # auth_names
1809
+ auth_names = opts[:auth_names] || ['API_KEY']
1810
+
1811
+ new_options = opts.merge(
1812
+ :header_params => header_params,
1813
+ :query_params => query_params,
1814
+ :form_params => form_params,
1815
+ :body => post_body,
1816
+ :auth_names => auth_names,
1817
+ :return_type => return_type
1818
+ )
1819
+
1820
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1821
+ if @api_client.config.debugging
1822
+ @api_client.config.logger.debug "API called: InboxControllerApi#send_smtp_envelope\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1823
+ end
1824
+ return data, status_code, headers
1825
+ end
1826
+
1637
1827
  # Send a test email to inbox
1638
1828
  # Send an inbox a test email to test email receiving is working
1639
1829
  # @param inbox_id [String]
@@ -19,9 +19,6 @@ module MailSlurpClient
19
19
  # Content length of attachment in bytes
20
20
  attr_accessor :content_length
21
21
 
22
- # Content type of attachment.
23
- attr_accessor :content_type
24
-
25
22
  attr_accessor :user_id
26
23
 
27
24
  # Attachment ID
@@ -31,16 +28,19 @@ module MailSlurpClient
31
28
 
32
29
  attr_accessor :updated_at
33
30
 
31
+ # Content type of attachment.
32
+ attr_accessor :content_type
33
+
34
34
  # Attribute mapping from ruby-style variable name to JSON key.
35
35
  def self.attribute_map
36
36
  {
37
37
  :'name' => :'name',
38
38
  :'content_length' => :'contentLength',
39
- :'content_type' => :'contentType',
40
39
  :'user_id' => :'userId',
41
40
  :'attachment_id' => :'attachmentId',
42
41
  :'created_at' => :'createdAt',
43
- :'updated_at' => :'updatedAt'
42
+ :'updated_at' => :'updatedAt',
43
+ :'content_type' => :'contentType'
44
44
  }
45
45
  end
46
46
 
@@ -49,11 +49,11 @@ module MailSlurpClient
49
49
  {
50
50
  :'name' => :'String',
51
51
  :'content_length' => :'Integer',
52
- :'content_type' => :'String',
53
52
  :'user_id' => :'String',
54
53
  :'attachment_id' => :'String',
55
54
  :'created_at' => :'DateTime',
56
- :'updated_at' => :'DateTime'
55
+ :'updated_at' => :'DateTime',
56
+ :'content_type' => :'String'
57
57
  }
58
58
  end
59
59
 
@@ -86,10 +86,6 @@ module MailSlurpClient
86
86
  self.content_length = attributes[:'content_length']
87
87
  end
88
88
 
89
- if attributes.key?(:'content_type')
90
- self.content_type = attributes[:'content_type']
91
- end
92
-
93
89
  if attributes.key?(:'user_id')
94
90
  self.user_id = attributes[:'user_id']
95
91
  end
@@ -105,6 +101,10 @@ module MailSlurpClient
105
101
  if attributes.key?(:'updated_at')
106
102
  self.updated_at = attributes[:'updated_at']
107
103
  end
104
+
105
+ if attributes.key?(:'content_type')
106
+ self.content_type = attributes[:'content_type']
107
+ end
108
108
  end
109
109
 
110
110
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -147,11 +147,11 @@ module MailSlurpClient
147
147
  self.class == o.class &&
148
148
  name == o.name &&
149
149
  content_length == o.content_length &&
150
- content_type == o.content_type &&
151
150
  user_id == o.user_id &&
152
151
  attachment_id == o.attachment_id &&
153
152
  created_at == o.created_at &&
154
- updated_at == o.updated_at
153
+ updated_at == o.updated_at &&
154
+ content_type == o.content_type
155
155
  end
156
156
 
157
157
  # @see the `==` method
@@ -163,7 +163,7 @@ module MailSlurpClient
163
163
  # Calculates hash code according to all attributes.
164
164
  # @return [Integer] Hash code
165
165
  def hash
166
- [name, content_length, content_type, user_id, attachment_id, created_at, updated_at].hash
166
+ [name, content_length, user_id, attachment_id, created_at, updated_at, content_type].hash
167
167
  end
168
168
 
169
169
  # Builds the object from hash
@@ -23,10 +23,10 @@ module MailSlurpClient
23
23
 
24
24
  attr_accessor :inbox_id
25
25
 
26
- attr_accessor :to
27
-
28
26
  attr_accessor :attachments
29
27
 
28
+ attr_accessor :to
29
+
30
30
  attr_accessor :bcc
31
31
 
32
32
  attr_accessor :cc
@@ -48,8 +48,8 @@ module MailSlurpClient
48
48
  :'from' => :'from',
49
49
  :'subject' => :'subject',
50
50
  :'inbox_id' => :'inboxId',
51
- :'to' => :'to',
52
51
  :'attachments' => :'attachments',
52
+ :'to' => :'to',
53
53
  :'bcc' => :'bcc',
54
54
  :'cc' => :'cc',
55
55
  :'created_at' => :'createdAt',
@@ -67,8 +67,8 @@ module MailSlurpClient
67
67
  :'from' => :'String',
68
68
  :'subject' => :'String',
69
69
  :'inbox_id' => :'String',
70
- :'to' => :'Array<String>',
71
70
  :'attachments' => :'Array<String>',
71
+ :'to' => :'Array<String>',
72
72
  :'bcc' => :'Array<String>',
73
73
  :'cc' => :'Array<String>',
74
74
  :'created_at' => :'DateTime',
@@ -116,18 +116,18 @@ module MailSlurpClient
116
116
  self.inbox_id = attributes[:'inbox_id']
117
117
  end
118
118
 
119
- if attributes.key?(:'to')
120
- if (value = attributes[:'to']).is_a?(Array)
121
- self.to = value
122
- end
123
- end
124
-
125
119
  if attributes.key?(:'attachments')
126
120
  if (value = attributes[:'attachments']).is_a?(Array)
127
121
  self.attachments = value
128
122
  end
129
123
  end
130
124
 
125
+ if attributes.key?(:'to')
126
+ if (value = attributes[:'to']).is_a?(Array)
127
+ self.to = value
128
+ end
129
+ end
130
+
131
131
  if attributes.key?(:'bcc')
132
132
  if (value = attributes[:'bcc']).is_a?(Array)
133
133
  self.bcc = value
@@ -203,8 +203,8 @@ module MailSlurpClient
203
203
  from == o.from &&
204
204
  subject == o.subject &&
205
205
  inbox_id == o.inbox_id &&
206
- to == o.to &&
207
206
  attachments == o.attachments &&
207
+ to == o.to &&
208
208
  bcc == o.bcc &&
209
209
  cc == o.cc &&
210
210
  created_at == o.created_at &&
@@ -223,7 +223,7 @@ module MailSlurpClient
223
223
  # Calculates hash code according to all attributes.
224
224
  # @return [Integer] Hash code
225
225
  def hash
226
- [id, from, subject, inbox_id, to, attachments, bcc, cc, created_at, team_access, read, body_md5_hash, body_excerpt].hash
226
+ [id, from, subject, inbox_id, attachments, to, bcc, cc, created_at, team_access, read, body_md5_hash, body_excerpt].hash
227
227
  end
228
228
 
229
229
  # Builds the object from hash
@@ -0,0 +1,309 @@
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
+ Contact: contact@mailslurp.dev
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
+ class ImapSmtpAccessDetails
17
+ attr_accessor :smtp_server_host
18
+
19
+ attr_accessor :smtp_server_port
20
+
21
+ attr_accessor :smtp_username
22
+
23
+ attr_accessor :smtp_password
24
+
25
+ attr_accessor :imap_server_host
26
+
27
+ attr_accessor :imap_server_port
28
+
29
+ attr_accessor :imap_username
30
+
31
+ attr_accessor :imap_password
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'smtp_server_host' => :'smtpServerHost',
37
+ :'smtp_server_port' => :'smtpServerPort',
38
+ :'smtp_username' => :'smtpUsername',
39
+ :'smtp_password' => :'smtpPassword',
40
+ :'imap_server_host' => :'imapServerHost',
41
+ :'imap_server_port' => :'imapServerPort',
42
+ :'imap_username' => :'imapUsername',
43
+ :'imap_password' => :'imapPassword'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'smtp_server_host' => :'String',
51
+ :'smtp_server_port' => :'Integer',
52
+ :'smtp_username' => :'String',
53
+ :'smtp_password' => :'String',
54
+ :'imap_server_host' => :'String',
55
+ :'imap_server_port' => :'Integer',
56
+ :'imap_username' => :'String',
57
+ :'imap_password' => :'String'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ImapSmtpAccessDetails` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ImapSmtpAccessDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'smtp_server_host')
83
+ self.smtp_server_host = attributes[:'smtp_server_host']
84
+ end
85
+
86
+ if attributes.key?(:'smtp_server_port')
87
+ self.smtp_server_port = attributes[:'smtp_server_port']
88
+ end
89
+
90
+ if attributes.key?(:'smtp_username')
91
+ self.smtp_username = attributes[:'smtp_username']
92
+ end
93
+
94
+ if attributes.key?(:'smtp_password')
95
+ self.smtp_password = attributes[:'smtp_password']
96
+ end
97
+
98
+ if attributes.key?(:'imap_server_host')
99
+ self.imap_server_host = attributes[:'imap_server_host']
100
+ end
101
+
102
+ if attributes.key?(:'imap_server_port')
103
+ self.imap_server_port = attributes[:'imap_server_port']
104
+ end
105
+
106
+ if attributes.key?(:'imap_username')
107
+ self.imap_username = attributes[:'imap_username']
108
+ end
109
+
110
+ if attributes.key?(:'imap_password')
111
+ self.imap_password = attributes[:'imap_password']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ if @smtp_server_host.nil?
120
+ invalid_properties.push('invalid value for "smtp_server_host", smtp_server_host cannot be nil.')
121
+ end
122
+
123
+ if @smtp_server_port.nil?
124
+ invalid_properties.push('invalid value for "smtp_server_port", smtp_server_port cannot be nil.')
125
+ end
126
+
127
+ if @smtp_username.nil?
128
+ invalid_properties.push('invalid value for "smtp_username", smtp_username cannot be nil.')
129
+ end
130
+
131
+ if @smtp_password.nil?
132
+ invalid_properties.push('invalid value for "smtp_password", smtp_password cannot be nil.')
133
+ end
134
+
135
+ if @imap_server_host.nil?
136
+ invalid_properties.push('invalid value for "imap_server_host", imap_server_host cannot be nil.')
137
+ end
138
+
139
+ if @imap_server_port.nil?
140
+ invalid_properties.push('invalid value for "imap_server_port", imap_server_port cannot be nil.')
141
+ end
142
+
143
+ if @imap_username.nil?
144
+ invalid_properties.push('invalid value for "imap_username", imap_username cannot be nil.')
145
+ end
146
+
147
+ if @imap_password.nil?
148
+ invalid_properties.push('invalid value for "imap_password", imap_password cannot be nil.')
149
+ end
150
+
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ return false if @smtp_server_host.nil?
158
+ return false if @smtp_server_port.nil?
159
+ return false if @smtp_username.nil?
160
+ return false if @smtp_password.nil?
161
+ return false if @imap_server_host.nil?
162
+ return false if @imap_server_port.nil?
163
+ return false if @imap_username.nil?
164
+ return false if @imap_password.nil?
165
+ true
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ smtp_server_host == o.smtp_server_host &&
174
+ smtp_server_port == o.smtp_server_port &&
175
+ smtp_username == o.smtp_username &&
176
+ smtp_password == o.smtp_password &&
177
+ imap_server_host == o.imap_server_host &&
178
+ imap_server_port == o.imap_server_port &&
179
+ imap_username == o.imap_username &&
180
+ imap_password == o.imap_password
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [smtp_server_host, smtp_server_port, smtp_username, smtp_password, imap_server_host, imap_server_port, imap_username, imap_password].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ new.build_from_hash(attributes)
200
+ end
201
+
202
+ # Builds the object from hash
203
+ # @param [Hash] attributes Model attributes in the form of hash
204
+ # @return [Object] Returns the model itself
205
+ def build_from_hash(attributes)
206
+ return nil unless attributes.is_a?(Hash)
207
+ self.class.openapi_types.each_pair do |key, type|
208
+ if type =~ /\AArray<(.*)>/i
209
+ # check to ensure the input is an array given that the attribute
210
+ # is documented as an array but the input is not
211
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
212
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
213
+ end
214
+ elsif !attributes[self.class.attribute_map[key]].nil?
215
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
216
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
217
+ end
218
+
219
+ self
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def _deserialize(type, value)
227
+ case type.to_sym
228
+ when :DateTime
229
+ DateTime.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :Boolean
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ MailSlurpClient.const_get(type).build_from_hash(value)
260
+ end
261
+ end
262
+
263
+ # Returns the string representation of the object
264
+ # @return [String] String presentation of the object
265
+ def to_s
266
+ to_hash.to_s
267
+ end
268
+
269
+ # to_body is an alias to to_hash (backward compatibility)
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_body
272
+ to_hash
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ if value.nil?
282
+ is_nullable = self.class.openapi_nullable.include?(attr)
283
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
+ end
285
+
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+ end
309
+ end