mailslurp_client 5.0.0 → 7.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/README.md +127 -40
  4. data/docs/AttachmentControllerApi.md +124 -0
  5. data/docs/AttachmentMetaData.md +23 -0
  6. data/docs/BasicAuthOptions.md +10 -0
  7. data/docs/BulkActionsControllerApi.md +165 -0
  8. data/docs/BulkSendEmailOptions.md +11 -1
  9. data/docs/CommonActionsControllerApi.md +167 -0
  10. data/docs/ContactControllerApi.md +274 -0
  11. data/docs/ContactDto.md +31 -0
  12. data/docs/ContactProjection.md +27 -0
  13. data/docs/CreateContactOptions.md +31 -0
  14. data/docs/CreateDomainOptions.md +17 -0
  15. data/docs/CreateGroupOptions.md +19 -0
  16. data/docs/CreateTemplateOptions.md +19 -0
  17. data/docs/CreateWebhookOptions.md +13 -2
  18. data/docs/DomainControllerApi.md +223 -0
  19. data/docs/DomainDto.md +29 -0
  20. data/docs/DomainPreview.md +21 -0
  21. data/docs/Email.md +40 -15
  22. data/docs/EmailAnalysis.md +18 -5
  23. data/docs/EmailControllerApi.md +740 -0
  24. data/docs/EmailPreview.md +24 -6
  25. data/docs/EmailProjection.md +33 -0
  26. data/docs/ForwardEmailOptions.md +12 -0
  27. data/docs/GroupContactsDto.md +19 -0
  28. data/docs/GroupControllerApi.md +437 -0
  29. data/docs/GroupDto.md +23 -0
  30. data/docs/GroupProjection.md +23 -0
  31. data/docs/HTMLValidationResult.md +21 -0
  32. data/docs/Inbox.md +26 -4
  33. data/docs/InboxControllerApi.md +652 -0
  34. data/docs/InboxProjection.md +29 -0
  35. data/docs/JsonNode.md +59 -0
  36. data/docs/MatchOption.md +13 -2
  37. data/docs/MatchOptions.md +9 -0
  38. data/docs/PageContactProjection.md +37 -0
  39. data/docs/PageEmailPreview.md +37 -0
  40. data/docs/PageEmailProjection.md +37 -0
  41. data/docs/PageGroupProjection.md +37 -0
  42. data/docs/PageInboxProjection.md +37 -0
  43. data/docs/PageTemplateProjection.md +37 -0
  44. data/docs/PageWebhookProjection.md +37 -0
  45. data/docs/Pageable.md +27 -0
  46. data/docs/RawEmailJson.md +17 -0
  47. data/docs/SendEmailOptions.md +33 -6
  48. data/docs/SetInboxFavouritedOptions.md +17 -0
  49. data/docs/Sort.md +21 -0
  50. data/docs/TemplateControllerApi.md +274 -0
  51. data/docs/TemplateDto.md +25 -0
  52. data/docs/TemplateProjection.md +25 -0
  53. data/docs/TemplateVariable.md +19 -0
  54. data/docs/UnreadCount.md +17 -0
  55. data/docs/UpdateGroupContacts.md +17 -0
  56. data/docs/UpdateInboxOptions.md +25 -0
  57. data/docs/UploadAttachmentOptions.md +12 -1
  58. data/docs/ValidationDto.md +19 -0
  59. data/docs/ValidationMessage.md +19 -0
  60. data/docs/WaitForConditions.md +29 -0
  61. data/docs/WaitForControllerApi.md +317 -0
  62. data/docs/WebhookControllerApi.md +339 -0
  63. data/docs/WebhookDto.md +33 -0
  64. data/docs/WebhookProjection.md +27 -0
  65. data/docs/WebhookTestRequest.md +23 -0
  66. data/docs/WebhookTestResponse.md +19 -0
  67. data/docs/WebhookTestResult.md +21 -0
  68. data/git_push.sh +10 -7
  69. data/lib/mailslurp_client.rb +56 -7
  70. data/lib/mailslurp_client/api/attachment_controller_api.rb +157 -0
  71. data/lib/mailslurp_client/api/bulk_actions_controller_api.rb +203 -0
  72. data/lib/mailslurp_client/api/common_actions_controller_api.rb +201 -0
  73. data/lib/mailslurp_client/api/contact_controller_api.rb +323 -0
  74. data/lib/mailslurp_client/api/domain_controller_api.rb +264 -0
  75. data/lib/mailslurp_client/api/email_controller_api.rb +852 -0
  76. data/lib/mailslurp_client/api/group_controller_api.rb +519 -0
  77. data/lib/mailslurp_client/api/inbox_controller_api.rb +763 -0
  78. data/lib/mailslurp_client/api/template_controller_api.rb +323 -0
  79. data/lib/mailslurp_client/api/wait_for_controller_api.rb +359 -0
  80. data/lib/mailslurp_client/api/webhook_controller_api.rb +405 -0
  81. data/lib/mailslurp_client/api_client.rb +36 -39
  82. data/lib/mailslurp_client/api_error.rb +23 -4
  83. data/lib/mailslurp_client/configuration.rb +8 -11
  84. data/lib/mailslurp_client/models/attachment_meta_data.rb +253 -0
  85. data/lib/mailslurp_client/models/basic_auth_options.rb +39 -15
  86. data/lib/mailslurp_client/models/bulk_send_email_options.rb +42 -19
  87. data/lib/mailslurp_client/models/contact_dto.rb +288 -0
  88. data/lib/mailslurp_client/models/contact_projection.rb +261 -0
  89. data/lib/mailslurp_client/models/create_contact_options.rb +277 -0
  90. data/lib/mailslurp_client/models/create_domain_options.rb +208 -0
  91. data/lib/mailslurp_client/models/create_group_options.rb +220 -0
  92. data/lib/mailslurp_client/models/create_template_options.rb +225 -0
  93. data/lib/mailslurp_client/models/create_webhook_options.rb +54 -29
  94. data/lib/mailslurp_client/models/domain_dto.rb +296 -0
  95. data/lib/mailslurp_client/models/domain_preview.rb +240 -0
  96. data/lib/mailslurp_client/models/email.rb +86 -78
  97. data/lib/mailslurp_client/models/email_analysis.rb +46 -48
  98. data/lib/mailslurp_client/models/email_preview.rb +77 -41
  99. data/lib/mailslurp_client/models/email_projection.rb +306 -0
  100. data/lib/mailslurp_client/models/forward_email_options.rb +40 -17
  101. data/lib/mailslurp_client/models/group_contacts_dto.rb +227 -0
  102. data/lib/mailslurp_client/models/{webhook.rb → group_dto.rb} +60 -54
  103. data/lib/mailslurp_client/models/group_projection.rb +248 -0
  104. data/lib/mailslurp_client/models/html_validation_result.rb +243 -0
  105. data/lib/mailslurp_client/models/inbox.rb +104 -26
  106. data/lib/mailslurp_client/models/inbox_projection.rb +272 -0
  107. data/lib/mailslurp_client/models/json_node.rb +429 -0
  108. data/lib/mailslurp_client/models/match_option.rb +48 -24
  109. data/lib/mailslurp_client/models/match_options.rb +37 -14
  110. data/lib/mailslurp_client/models/page_contact_projection.rb +298 -0
  111. data/lib/mailslurp_client/models/page_email_preview.rb +298 -0
  112. data/lib/mailslurp_client/models/page_email_projection.rb +298 -0
  113. data/lib/mailslurp_client/models/page_group_projection.rb +298 -0
  114. data/lib/mailslurp_client/models/page_inbox_projection.rb +298 -0
  115. data/lib/mailslurp_client/models/page_template_projection.rb +298 -0
  116. data/lib/mailslurp_client/models/page_webhook_projection.rb +298 -0
  117. data/lib/mailslurp_client/models/pageable.rb +251 -0
  118. data/lib/mailslurp_client/models/raw_email_json.rb +211 -0
  119. data/lib/mailslurp_client/models/send_email_options.rb +141 -46
  120. data/lib/mailslurp_client/models/set_inbox_favourited_options.rb +208 -0
  121. data/lib/mailslurp_client/models/sort.rb +224 -0
  122. data/lib/mailslurp_client/models/template_dto.rb +269 -0
  123. data/lib/mailslurp_client/models/template_projection.rb +269 -0
  124. data/lib/mailslurp_client/models/template_variable.rb +259 -0
  125. data/lib/mailslurp_client/models/unread_count.rb +211 -0
  126. data/lib/mailslurp_client/models/update_group_contacts.rb +213 -0
  127. data/lib/mailslurp_client/models/update_inbox_options.rb +250 -0
  128. data/lib/mailslurp_client/models/upload_attachment_options.rb +43 -20
  129. data/lib/mailslurp_client/models/validation_dto.rb +225 -0
  130. data/lib/mailslurp_client/models/validation_message.rb +220 -0
  131. data/lib/mailslurp_client/models/wait_for_conditions.rb +315 -0
  132. data/lib/mailslurp_client/models/webhook_dto.rb +326 -0
  133. data/lib/mailslurp_client/models/webhook_projection.rb +277 -0
  134. data/lib/mailslurp_client/models/webhook_test_request.rb +284 -0
  135. data/lib/mailslurp_client/models/webhook_test_response.rb +215 -0
  136. data/lib/mailslurp_client/models/webhook_test_result.rb +235 -0
  137. data/lib/mailslurp_client/version.rb +5 -5
  138. data/mailslurp_client.gemspec +4 -10
  139. data/spec/api/attachment_controller_api_spec.rb +61 -0
  140. data/spec/api/bulk_actions_controller_api_spec.rb +68 -0
  141. data/spec/api/common_actions_controller_api_spec.rb +129 -0
  142. data/spec/api/contact_controller_api_spec.rb +91 -0
  143. data/spec/api/domain_controller_api_spec.rb +82 -0
  144. data/spec/api/email_controller_api_spec.rb +162 -0
  145. data/spec/api/group_controller_api_spec.rb +126 -0
  146. data/spec/api/inbox_controller_api_spec.rb +172 -0
  147. data/spec/api/template_controller_api_spec.rb +91 -0
  148. data/spec/api/wait_for_controller_api_spec.rb +107 -0
  149. data/spec/api/webhook_controller_api_spec.rb +107 -0
  150. data/spec/api_client_spec.rb +5 -5
  151. data/spec/configuration_spec.rb +4 -4
  152. data/spec/models/attachment_meta_data_spec.rb +59 -0
  153. data/spec/models/basic_auth_options_spec.rb +4 -4
  154. data/spec/models/bulk_send_email_options_spec.rb +4 -4
  155. data/spec/models/contact_dto_spec.rb +83 -0
  156. data/spec/models/contact_projection_spec.rb +71 -0
  157. data/spec/models/create_contact_options_spec.rb +83 -0
  158. data/spec/models/create_domain_options_spec.rb +41 -0
  159. data/spec/models/create_group_options_spec.rb +47 -0
  160. data/spec/models/create_template_options_spec.rb +47 -0
  161. data/spec/models/create_webhook_options_spec.rb +6 -6
  162. data/spec/models/domain_dto_spec.rb +77 -0
  163. data/spec/models/domain_preview_spec.rb +53 -0
  164. data/spec/models/email_analysis_spec.rb +4 -4
  165. data/spec/models/email_preview_spec.rb +41 -5
  166. data/spec/models/email_projection_spec.rb +89 -0
  167. data/spec/models/email_spec.rb +17 -5
  168. data/spec/models/forward_email_options_spec.rb +4 -4
  169. data/spec/models/group_contacts_dto_spec.rb +47 -0
  170. data/spec/models/group_dto_spec.rb +59 -0
  171. data/spec/models/group_projection_spec.rb +59 -0
  172. data/spec/models/html_validation_result_spec.rb +53 -0
  173. data/spec/models/inbox_projection_spec.rb +77 -0
  174. data/spec/models/inbox_spec.rb +35 -5
  175. data/spec/models/json_node_spec.rb +171 -0
  176. data/spec/models/match_option_spec.rb +4 -4
  177. data/spec/models/match_options_spec.rb +4 -4
  178. data/spec/models/page_contact_projection_spec.rb +101 -0
  179. data/spec/models/page_email_preview_spec.rb +101 -0
  180. data/spec/models/page_email_projection_spec.rb +101 -0
  181. data/spec/models/page_group_projection_spec.rb +101 -0
  182. data/spec/models/page_inbox_projection_spec.rb +101 -0
  183. data/spec/models/page_template_projection_spec.rb +101 -0
  184. data/spec/models/page_webhook_projection_spec.rb +101 -0
  185. data/spec/models/pageable_spec.rb +71 -0
  186. data/spec/models/raw_email_json_spec.rb +41 -0
  187. data/spec/models/send_email_options_spec.rb +45 -5
  188. data/spec/models/set_inbox_favourited_options_spec.rb +41 -0
  189. data/spec/models/sort_spec.rb +53 -0
  190. data/spec/models/template_dto_spec.rb +65 -0
  191. data/spec/models/template_projection_spec.rb +65 -0
  192. data/spec/models/template_variable_spec.rb +51 -0
  193. data/spec/models/unread_count_spec.rb +41 -0
  194. data/spec/models/update_group_contacts_spec.rb +41 -0
  195. data/spec/models/{webhook_spec.rb → update_inbox_options_spec.rb} +14 -20
  196. data/spec/models/upload_attachment_options_spec.rb +4 -4
  197. data/spec/models/validation_dto_spec.rb +47 -0
  198. data/spec/models/validation_message_spec.rb +47 -0
  199. data/spec/models/wait_for_conditions_spec.rb +85 -0
  200. data/spec/models/webhook_dto_spec.rb +93 -0
  201. data/spec/models/webhook_projection_spec.rb +71 -0
  202. data/spec/models/webhook_test_request_spec.rb +63 -0
  203. data/spec/models/webhook_test_response_spec.rb +47 -0
  204. data/spec/models/webhook_test_result_spec.rb +53 -0
  205. data/spec/spec_helper.rb +4 -4
  206. metadata +223 -149
  207. data/Gemfile.lock +0 -79
  208. data/docs/CommonOperationsApi.md +0 -499
  209. data/docs/ExtraOperationsApi.md +0 -1021
  210. data/docs/Webhook.md +0 -13
  211. data/lib/mailslurp_client/api/common_operations_api.rb +0 -502
  212. data/lib/mailslurp_client/api/extra_operations_api.rb +0 -1054
  213. data/spec/api/common_operations_api_spec.rb +0 -95
  214. data/spec/api/extra_operations_api_spec.rb +0 -231
@@ -1,39 +1,53 @@
1
1
  =begin
2
2
  #MailSlurp API
3
3
 
4
- #For documentation see [developer guide](https://www.mailslurp.com/developers). [Create an account](https://app.mailslurp.com) in the MailSlurp Dashboard to [view your API Key](https://app). For all bugs, feature requests, or help please [see support](https://www.mailslurp.com/support/).
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: 67c9a1eda264be4cfe0bb2c76151f0aadf0862bc
5
7
 
6
- OpenAPI spec version: 0.0.1-alpha
7
- Contact: contact@mailslurp.dev
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 3.3.4
9
+ OpenAPI Generator version: 4.2.3
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- # Preview of an email message. For full message call the message endpoint with a given message id.
16
+ # Preview of an email message. For full message call the email endpoints with the provided email id.
17
17
  class EmailPreview
18
+ # 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.
19
+ attr_accessor :attachments
20
+
21
+ # List of `BCC` recipients email was addressed to
18
22
  attr_accessor :bcc
19
23
 
24
+ # List of `CC` recipients email was addressed to
20
25
  attr_accessor :cc
21
26
 
22
- attr_accessor :created
27
+ # When was the email received by MailSlurp
28
+ attr_accessor :created_at
23
29
 
30
+ # ID of the email
24
31
  attr_accessor :id
25
32
 
33
+ # Has the email been viewed ever
34
+ attr_accessor :read
35
+
36
+ # The subject line of the email message
26
37
  attr_accessor :subject
27
38
 
39
+ # List of `To` recipients email was addressed to
28
40
  attr_accessor :to
29
41
 
30
42
  # Attribute mapping from ruby-style variable name to JSON key.
31
43
  def self.attribute_map
32
44
  {
45
+ :'attachments' => :'attachments',
33
46
  :'bcc' => :'bcc',
34
47
  :'cc' => :'cc',
35
- :'created' => :'created',
48
+ :'created_at' => :'createdAt',
36
49
  :'id' => :'id',
50
+ :'read' => :'read',
37
51
  :'subject' => :'subject',
38
52
  :'to' => :'to'
39
53
  }
@@ -42,48 +56,73 @@ module MailSlurpClient
42
56
  # Attribute type mapping.
43
57
  def self.openapi_types
44
58
  {
59
+ :'attachments' => :'Array<String>',
45
60
  :'bcc' => :'Array<String>',
46
61
  :'cc' => :'Array<String>',
47
- :'created' => :'DateTime',
62
+ :'created_at' => :'DateTime',
48
63
  :'id' => :'String',
64
+ :'read' => :'Boolean',
49
65
  :'subject' => :'String',
50
66
  :'to' => :'Array<String>'
51
67
  }
52
68
  end
53
69
 
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
54
76
  # Initializes the object
55
77
  # @param [Hash] attributes Model attributes in the form of hash
56
78
  def initialize(attributes = {})
57
- return unless attributes.is_a?(Hash)
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::EmailPreview` initialize method"
81
+ end
58
82
 
59
- # convert string to symbol for hash key
60
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::EmailPreview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'attachments')
92
+ if (value = attributes[:'attachments']).is_a?(Array)
93
+ self.attachments = value
94
+ end
95
+ end
61
96
 
62
- if attributes.has_key?(:'bcc')
97
+ if attributes.key?(:'bcc')
63
98
  if (value = attributes[:'bcc']).is_a?(Array)
64
99
  self.bcc = value
65
100
  end
66
101
  end
67
102
 
68
- if attributes.has_key?(:'cc')
103
+ if attributes.key?(:'cc')
69
104
  if (value = attributes[:'cc']).is_a?(Array)
70
105
  self.cc = value
71
106
  end
72
107
  end
73
108
 
74
- if attributes.has_key?(:'created')
75
- self.created = attributes[:'created']
109
+ if attributes.key?(:'created_at')
110
+ self.created_at = attributes[:'created_at']
76
111
  end
77
112
 
78
- if attributes.has_key?(:'id')
113
+ if attributes.key?(:'id')
79
114
  self.id = attributes[:'id']
80
115
  end
81
116
 
82
- if attributes.has_key?(:'subject')
117
+ if attributes.key?(:'read')
118
+ self.read = attributes[:'read']
119
+ end
120
+
121
+ if attributes.key?(:'subject')
83
122
  self.subject = attributes[:'subject']
84
123
  end
85
124
 
86
- if attributes.has_key?(:'to')
125
+ if attributes.key?(:'to')
87
126
  if (value = attributes[:'to']).is_a?(Array)
88
127
  self.to = value
89
128
  end
@@ -94,27 +133,12 @@ module MailSlurpClient
94
133
  # @return Array for valid properties with the reasons
95
134
  def list_invalid_properties
96
135
  invalid_properties = Array.new
97
- if @created.nil?
98
- invalid_properties.push('invalid value for "created", created cannot be nil.')
99
- end
100
-
101
- if @id.nil?
102
- invalid_properties.push('invalid value for "id", id cannot be nil.')
103
- end
104
-
105
- if @to.nil?
106
- invalid_properties.push('invalid value for "to", to cannot be nil.')
107
- end
108
-
109
136
  invalid_properties
110
137
  end
111
138
 
112
139
  # Check to see if the all the properties in the model are valid
113
140
  # @return true if the model is valid
114
141
  def valid?
115
- return false if @created.nil?
116
- return false if @id.nil?
117
- return false if @to.nil?
118
142
  true
119
143
  end
120
144
 
@@ -123,10 +147,12 @@ module MailSlurpClient
123
147
  def ==(o)
124
148
  return true if self.equal?(o)
125
149
  self.class == o.class &&
150
+ attachments == o.attachments &&
126
151
  bcc == o.bcc &&
127
152
  cc == o.cc &&
128
- created == o.created &&
153
+ created_at == o.created_at &&
129
154
  id == o.id &&
155
+ read == o.read &&
130
156
  subject == o.subject &&
131
157
  to == o.to
132
158
  end
@@ -138,9 +164,16 @@ module MailSlurpClient
138
164
  end
139
165
 
140
166
  # Calculates hash code according to all attributes.
141
- # @return [Fixnum] Hash code
167
+ # @return [Integer] Hash code
142
168
  def hash
143
- [bcc, cc, created, id, subject, to].hash
169
+ [attachments, bcc, cc, created_at, id, read, subject, to].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def self.build_from_hash(attributes)
176
+ new.build_from_hash(attributes)
144
177
  end
145
178
 
146
179
  # Builds the object from hash
@@ -150,7 +183,7 @@ module MailSlurpClient
150
183
  return nil unless attributes.is_a?(Hash)
151
184
  self.class.openapi_types.each_pair do |key, type|
152
185
  if type =~ /\AArray<(.*)>/i
153
- # check to ensure the input is an array given that the the attribute
186
+ # check to ensure the input is an array given that the attribute
154
187
  # is documented as an array but the input is not
155
188
  if attributes[self.class.attribute_map[key]].is_a?(Array)
156
189
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -179,7 +212,7 @@ module MailSlurpClient
179
212
  value.to_i
180
213
  when :Float
181
214
  value.to_f
182
- when :BOOLEAN
215
+ when :Boolean
183
216
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
217
  true
185
218
  else
@@ -200,8 +233,7 @@ module MailSlurpClient
200
233
  end
201
234
  end
202
235
  else # model
203
- temp_model = MailSlurpClient.const_get(type).new
204
- temp_model.build_from_hash(value)
236
+ MailSlurpClient.const_get(type).build_from_hash(value)
205
237
  end
206
238
  end
207
239
 
@@ -223,7 +255,11 @@ module MailSlurpClient
223
255
  hash = {}
224
256
  self.class.attribute_map.each_pair do |attr, param|
225
257
  value = self.send(attr)
226
- next if value.nil?
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
227
263
  hash[param] = _to_hash(value)
228
264
  end
229
265
  hash
@@ -0,0 +1,306 @@
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: 67c9a1eda264be4cfe0bb2c76151f0aadf0862bc
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module MailSlurpClient
16
+ class EmailProjection
17
+ attr_accessor :attachments
18
+
19
+ attr_accessor :bcc
20
+
21
+ attr_accessor :cc
22
+
23
+ attr_accessor :created_at
24
+
25
+ attr_accessor :id
26
+
27
+ attr_accessor :inbox_id
28
+
29
+ attr_accessor :read
30
+
31
+ attr_accessor :subject
32
+
33
+ attr_accessor :to
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'attachments' => :'attachments',
39
+ :'bcc' => :'bcc',
40
+ :'cc' => :'cc',
41
+ :'created_at' => :'createdAt',
42
+ :'id' => :'id',
43
+ :'inbox_id' => :'inboxId',
44
+ :'read' => :'read',
45
+ :'subject' => :'subject',
46
+ :'to' => :'to'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'attachments' => :'Array<String>',
54
+ :'bcc' => :'Array<String>',
55
+ :'cc' => :'Array<String>',
56
+ :'created_at' => :'DateTime',
57
+ :'id' => :'String',
58
+ :'inbox_id' => :'String',
59
+ :'read' => :'Boolean',
60
+ :'subject' => :'String',
61
+ :'to' => :'Array<String>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::EmailProjection` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::EmailProjection`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'attachments')
87
+ if (value = attributes[:'attachments']).is_a?(Array)
88
+ self.attachments = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:'bcc')
93
+ if (value = attributes[:'bcc']).is_a?(Array)
94
+ self.bcc = value
95
+ end
96
+ end
97
+
98
+ if attributes.key?(:'cc')
99
+ if (value = attributes[:'cc']).is_a?(Array)
100
+ self.cc = value
101
+ end
102
+ end
103
+
104
+ if attributes.key?(:'created_at')
105
+ self.created_at = attributes[:'created_at']
106
+ end
107
+
108
+ if attributes.key?(:'id')
109
+ self.id = attributes[:'id']
110
+ end
111
+
112
+ if attributes.key?(:'inbox_id')
113
+ self.inbox_id = attributes[:'inbox_id']
114
+ end
115
+
116
+ if attributes.key?(:'read')
117
+ self.read = attributes[:'read']
118
+ end
119
+
120
+ if attributes.key?(:'subject')
121
+ self.subject = attributes[:'subject']
122
+ end
123
+
124
+ if attributes.key?(:'to')
125
+ if (value = attributes[:'to']).is_a?(Array)
126
+ self.to = value
127
+ end
128
+ end
129
+ end
130
+
131
+ # Show invalid properties with the reasons. Usually used together with valid?
132
+ # @return Array for valid properties with the reasons
133
+ def list_invalid_properties
134
+ invalid_properties = Array.new
135
+ if @created_at.nil?
136
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
137
+ end
138
+
139
+ if @id.nil?
140
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
141
+ end
142
+
143
+ if @inbox_id.nil?
144
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
145
+ end
146
+
147
+ if @to.nil?
148
+ invalid_properties.push('invalid value for "to", to 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 @created_at.nil?
158
+ return false if @id.nil?
159
+ return false if @inbox_id.nil?
160
+ return false if @to.nil?
161
+ true
162
+ end
163
+
164
+ # Checks equality by comparing each attribute.
165
+ # @param [Object] Object to be compared
166
+ def ==(o)
167
+ return true if self.equal?(o)
168
+ self.class == o.class &&
169
+ attachments == o.attachments &&
170
+ bcc == o.bcc &&
171
+ cc == o.cc &&
172
+ created_at == o.created_at &&
173
+ id == o.id &&
174
+ inbox_id == o.inbox_id &&
175
+ read == o.read &&
176
+ subject == o.subject &&
177
+ to == o.to
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Integer] Hash code
188
+ def hash
189
+ [attachments, bcc, cc, created_at, id, inbox_id, read, subject, to].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def self.build_from_hash(attributes)
196
+ new.build_from_hash(attributes)
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def build_from_hash(attributes)
203
+ return nil unless attributes.is_a?(Hash)
204
+ self.class.openapi_types.each_pair do |key, type|
205
+ if type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
209
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
210
+ end
211
+ elsif !attributes[self.class.attribute_map[key]].nil?
212
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
213
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
214
+ end
215
+
216
+ self
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :DateTime
226
+ DateTime.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :Boolean
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ MailSlurpClient.const_get(type).build_from_hash(value)
257
+ end
258
+ end
259
+
260
+ # Returns the string representation of the object
261
+ # @return [String] String presentation of the object
262
+ def to_s
263
+ to_hash.to_s
264
+ end
265
+
266
+ # to_body is an alias to to_hash (backward compatibility)
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_body
269
+ to_hash
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = self.send(attr)
278
+ if value.nil?
279
+ is_nullable = self.class.openapi_nullable.include?(attr)
280
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
281
+ end
282
+
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map { |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end
305
+ end
306
+ end