mailslurp_client 16.2.0 → 16.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/ai_controller_api.rb +193 -79
  3. data/lib/mailslurp_client/api/attachment_controller_api.rb +6 -3
  4. data/lib/mailslurp_client/api/email_controller_api.rb +3 -0
  5. data/lib/mailslurp_client/api/form_controller_api.rb +8 -9
  6. data/lib/mailslurp_client/api/inbox_controller_api.rb +28 -2
  7. data/lib/mailslurp_client/api/mfa_controller_api.rb +88 -13
  8. data/lib/mailslurp_client/api/sms_controller_api.rb +3 -0
  9. data/lib/mailslurp_client/api/webhook_controller_api.rb +63 -9
  10. data/lib/mailslurp_client/models/abstract_webhook_payload.rb +2 -2
  11. data/lib/mailslurp_client/models/{ai_tranform_create_options.rb → ai_transform_create_options.rb} +31 -7
  12. data/lib/mailslurp_client/models/ai_transform_dto.rb +1 -0
  13. data/lib/mailslurp_client/models/ai_transform_mapping_dto.rb +18 -9
  14. data/lib/mailslurp_client/models/ai_transform_mapping_projection.rb +15 -6
  15. data/lib/mailslurp_client/models/ai_transform_projection.rb +16 -1
  16. data/lib/mailslurp_client/models/ai_transform_result_dto.rb +5 -1
  17. data/lib/mailslurp_client/models/{ai_transform_result_projection.rb → ai_transform_result_projection_dto.rb} +56 -53
  18. data/lib/mailslurp_client/models/alias_thread_projection.rb +11 -11
  19. data/lib/mailslurp_client/models/bounce_projection.rb +11 -11
  20. data/lib/mailslurp_client/models/conditional_structured_content_result.rb +221 -0
  21. data/lib/mailslurp_client/models/create_ai_transformer_mapping_options.rb +5 -10
  22. data/lib/mailslurp_client/models/create_domain_options.rb +19 -0
  23. data/lib/mailslurp_client/models/create_inbox_forwarder_options.rb +19 -0
  24. data/lib/mailslurp_client/models/create_inbox_replier_options.rb +19 -0
  25. data/lib/mailslurp_client/models/create_inbox_ruleset_options.rb +2 -2
  26. data/lib/mailslurp_client/models/create_totp_device_base32_secret_key_options.rb +306 -0
  27. data/lib/mailslurp_client/models/create_totp_device_custom_options.rb +306 -0
  28. data/lib/mailslurp_client/models/create_totp_device_otp_auth_url_options.rb +35 -0
  29. data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
  30. data/lib/mailslurp_client/models/describe_domain_options.rb +19 -0
  31. data/lib/mailslurp_client/models/dns_lookup_options.rb +19 -0
  32. data/lib/mailslurp_client/models/email.rb +13 -13
  33. data/lib/mailslurp_client/models/email_projection.rb +18 -18
  34. data/lib/mailslurp_client/models/email_thread_projection.rb +17 -17
  35. data/lib/mailslurp_client/models/entity_automation_item_projection.rb +10 -10
  36. data/lib/mailslurp_client/models/expiration_defaults.rb +1 -0
  37. data/lib/mailslurp_client/models/fake_email_dto.rb +1 -0
  38. data/lib/mailslurp_client/models/generate_structured_content_attachment_options.rb +1 -0
  39. data/lib/mailslurp_client/models/generate_structured_content_email_options.rb +1 -0
  40. data/lib/mailslurp_client/models/generate_structured_content_sms_options.rb +1 -0
  41. data/lib/mailslurp_client/models/inbox_exists_dto.rb +26 -4
  42. data/lib/mailslurp_client/models/inbox_ruleset_dto.rb +2 -2
  43. data/lib/mailslurp_client/models/inline_object.rb +58 -12
  44. data/lib/mailslurp_client/models/inline_object1.rb +211 -0
  45. data/lib/mailslurp_client/models/invoke_transformer_options.rb +329 -0
  46. data/lib/mailslurp_client/models/match_option.rb +19 -0
  47. data/lib/mailslurp_client/models/missed_email_dto.rb +1 -0
  48. data/lib/mailslurp_client/models/missed_email_projection.rb +11 -11
  49. data/lib/mailslurp_client/models/page_ai_transform_result_projection.rb +1 -1
  50. data/lib/mailslurp_client/models/pageable_object.rb +10 -10
  51. data/lib/mailslurp_client/models/phone_message_thread_item_projection.rb +19 -19
  52. data/lib/mailslurp_client/models/phone_message_thread_projection.rb +15 -25
  53. data/lib/mailslurp_client/models/sent_email_projection.rb +38 -53
  54. data/lib/mailslurp_client/models/sms_match_option.rb +19 -0
  55. data/lib/mailslurp_client/models/sms_preview.rb +4 -0
  56. data/lib/mailslurp_client/models/structured_output_schema.rb +12 -9
  57. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +10 -10
  58. data/lib/mailslurp_client/models/update_inbox_replier_options.rb +19 -0
  59. data/lib/mailslurp_client/models/upload_attachment_options.rb +19 -0
  60. data/lib/mailslurp_client/models/webhook_bounce_payload.rb +2 -2
  61. data/lib/mailslurp_client/models/webhook_bounce_recipient_payload.rb +2 -2
  62. data/lib/mailslurp_client/models/webhook_delivery_status_payload.rb +2 -2
  63. data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
  64. data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +2 -2
  65. data/lib/mailslurp_client/models/webhook_email_read_payload.rb +2 -2
  66. data/lib/mailslurp_client/models/webhook_new_ai_transform_result_payload.rb +389 -0
  67. data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
  68. data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
  69. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
  70. data/lib/mailslurp_client/models/webhook_new_sms_payload.rb +2 -2
  71. data/lib/mailslurp_client/models/webhook_projection.rb +2 -2
  72. data/lib/mailslurp_client/models/webhook_result_dto.rb +2 -2
  73. data/lib/mailslurp_client/version.rb +1 -1
  74. data/lib/mailslurp_client.rb +8 -2
  75. metadata +10 -4
@@ -15,13 +15,10 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # An email thread is a message thread created for a email based on Message-ID, In-Reply-To, and References headers
17
17
  class EmailThreadProjection
18
- # Thread topic subject
19
- attr_accessor :subject
18
+ attr_accessor :recipients
20
19
 
21
20
  attr_accessor :sender
22
21
 
23
- attr_accessor :recipients
24
-
25
22
  # Inbox ID
26
23
  attr_accessor :inbox_id
27
24
 
@@ -66,6 +63,9 @@ module MailSlurpClient
66
63
 
67
64
  attr_accessor :last_sender
68
65
 
66
+ # Thread topic subject
67
+ attr_accessor :subject
68
+
69
69
  # ID of email thread
70
70
  attr_accessor :id
71
71
 
@@ -75,9 +75,8 @@ module MailSlurpClient
75
75
  # Attribute mapping from ruby-style variable name to JSON key.
76
76
  def self.attribute_map
77
77
  {
78
- :'subject' => :'subject',
79
- :'sender' => :'sender',
80
78
  :'recipients' => :'recipients',
79
+ :'sender' => :'sender',
81
80
  :'inbox_id' => :'inboxId',
82
81
  :'user_id' => :'userId',
83
82
  :'updated_at' => :'updatedAt',
@@ -93,6 +92,7 @@ module MailSlurpClient
93
92
  :'last_created_at' => :'lastCreatedAt',
94
93
  :'last_from' => :'lastFrom',
95
94
  :'last_sender' => :'lastSender',
95
+ :'subject' => :'subject',
96
96
  :'id' => :'id',
97
97
  :'from' => :'from'
98
98
  }
@@ -101,9 +101,8 @@ module MailSlurpClient
101
101
  # Attribute type mapping.
102
102
  def self.openapi_types
103
103
  {
104
- :'subject' => :'String',
105
- :'sender' => :'SenderProjection',
106
104
  :'recipients' => :'EmailRecipientsProjection',
105
+ :'sender' => :'SenderProjection',
107
106
  :'inbox_id' => :'String',
108
107
  :'user_id' => :'String',
109
108
  :'updated_at' => :'DateTime',
@@ -119,6 +118,7 @@ module MailSlurpClient
119
118
  :'last_created_at' => :'DateTime',
120
119
  :'last_from' => :'String',
121
120
  :'last_sender' => :'SenderProjection',
121
+ :'subject' => :'String',
122
122
  :'id' => :'String',
123
123
  :'from' => :'String'
124
124
  }
@@ -145,18 +145,14 @@ module MailSlurpClient
145
145
  h[k.to_sym] = v
146
146
  }
147
147
 
148
- if attributes.key?(:'subject')
149
- self.subject = attributes[:'subject']
148
+ if attributes.key?(:'recipients')
149
+ self.recipients = attributes[:'recipients']
150
150
  end
151
151
 
152
152
  if attributes.key?(:'sender')
153
153
  self.sender = attributes[:'sender']
154
154
  end
155
155
 
156
- if attributes.key?(:'recipients')
157
- self.recipients = attributes[:'recipients']
158
- end
159
-
160
156
  if attributes.key?(:'inbox_id')
161
157
  self.inbox_id = attributes[:'inbox_id']
162
158
  end
@@ -223,6 +219,10 @@ module MailSlurpClient
223
219
  self.last_sender = attributes[:'last_sender']
224
220
  end
225
221
 
222
+ if attributes.key?(:'subject')
223
+ self.subject = attributes[:'subject']
224
+ end
225
+
226
226
  if attributes.key?(:'id')
227
227
  self.id = attributes[:'id']
228
228
  end
@@ -290,9 +290,8 @@ module MailSlurpClient
290
290
  def ==(o)
291
291
  return true if self.equal?(o)
292
292
  self.class == o.class &&
293
- subject == o.subject &&
294
- sender == o.sender &&
295
293
  recipients == o.recipients &&
294
+ sender == o.sender &&
296
295
  inbox_id == o.inbox_id &&
297
296
  user_id == o.user_id &&
298
297
  updated_at == o.updated_at &&
@@ -308,6 +307,7 @@ module MailSlurpClient
308
307
  last_created_at == o.last_created_at &&
309
308
  last_from == o.last_from &&
310
309
  last_sender == o.last_sender &&
310
+ subject == o.subject &&
311
311
  id == o.id &&
312
312
  from == o.from
313
313
  end
@@ -321,7 +321,7 @@ module MailSlurpClient
321
321
  # Calculates hash code according to all attributes.
322
322
  # @return [Integer] Hash code
323
323
  def hash
324
- [subject, sender, recipients, inbox_id, user_id, updated_at, created_at, to, cc, bcc, has_attachments, unread, message_count, last_body_excerpt, last_text_excerpt, last_created_at, last_from, last_sender, id, from].hash
324
+ [recipients, sender, inbox_id, user_id, updated_at, created_at, to, cc, bcc, has_attachments, unread, message_count, last_body_excerpt, last_text_excerpt, last_created_at, last_from, last_sender, subject, id, from].hash
325
325
  end
326
326
 
327
327
  # Builds the object from hash
@@ -16,10 +16,10 @@ module MailSlurpClient
16
16
  class EntityAutomationItemProjection
17
17
  attr_accessor :inbox_id
18
18
 
19
- attr_accessor :phone_id
20
-
21
19
  attr_accessor :action
22
20
 
21
+ attr_accessor :phone_id
22
+
23
23
  attr_accessor :automation_type
24
24
 
25
25
  attr_accessor :name
@@ -52,8 +52,8 @@ module MailSlurpClient
52
52
  def self.attribute_map
53
53
  {
54
54
  :'inbox_id' => :'inboxId',
55
- :'phone_id' => :'phoneId',
56
55
  :'action' => :'action',
56
+ :'phone_id' => :'phoneId',
57
57
  :'automation_type' => :'automationType',
58
58
  :'name' => :'name',
59
59
  :'id' => :'id'
@@ -64,8 +64,8 @@ module MailSlurpClient
64
64
  def self.openapi_types
65
65
  {
66
66
  :'inbox_id' => :'String',
67
- :'phone_id' => :'String',
68
67
  :'action' => :'String',
68
+ :'phone_id' => :'String',
69
69
  :'automation_type' => :'String',
70
70
  :'name' => :'String',
71
71
  :'id' => :'String'
@@ -97,14 +97,14 @@ module MailSlurpClient
97
97
  self.inbox_id = attributes[:'inbox_id']
98
98
  end
99
99
 
100
- if attributes.key?(:'phone_id')
101
- self.phone_id = attributes[:'phone_id']
102
- end
103
-
104
100
  if attributes.key?(:'action')
105
101
  self.action = attributes[:'action']
106
102
  end
107
103
 
104
+ if attributes.key?(:'phone_id')
105
+ self.phone_id = attributes[:'phone_id']
106
+ end
107
+
108
108
  if attributes.key?(:'automation_type')
109
109
  self.automation_type = attributes[:'automation_type']
110
110
  end
@@ -159,8 +159,8 @@ module MailSlurpClient
159
159
  return true if self.equal?(o)
160
160
  self.class == o.class &&
161
161
  inbox_id == o.inbox_id &&
162
- phone_id == o.phone_id &&
163
162
  action == o.action &&
163
+ phone_id == o.phone_id &&
164
164
  automation_type == o.automation_type &&
165
165
  name == o.name &&
166
166
  id == o.id
@@ -175,7 +175,7 @@ module MailSlurpClient
175
175
  # Calculates hash code according to all attributes.
176
176
  # @return [Integer] Hash code
177
177
  def hash
178
- [inbox_id, phone_id, action, automation_type, name, id].hash
178
+ [inbox_id, action, phone_id, automation_type, name, id].hash
179
179
  end
180
180
 
181
181
  # Builds the object from hash
@@ -21,6 +21,7 @@ module MailSlurpClient
21
21
 
22
22
  attr_accessor :default_expires_at
23
23
 
24
+ # Use nextInboxAllowsPermanent instead
24
25
  attr_accessor :can_permanent_inbox
25
26
 
26
27
  attr_accessor :next_inbox_allows_permanent
@@ -28,6 +28,7 @@ module MailSlurpClient
28
28
 
29
29
  attr_accessor :preview
30
30
 
31
+ # use read content endpoints instead
31
32
  attr_accessor :body
32
33
 
33
34
  attr_accessor :seen
@@ -55,6 +55,7 @@ module MailSlurpClient
55
55
  def self.openapi_nullable
56
56
  Set.new([
57
57
  :'instructions',
58
+ :'output_schema',
58
59
  :'transform_id',
59
60
  :'email_id'
60
61
  ])
@@ -78,6 +78,7 @@ module MailSlurpClient
78
78
  Set.new([
79
79
  :'content_selector',
80
80
  :'instructions',
81
+ :'output_schema',
81
82
  :'transform_id'
82
83
  ])
83
84
  end
@@ -50,6 +50,7 @@ module MailSlurpClient
50
50
  def self.openapi_nullable
51
51
  Set.new([
52
52
  :'instructions',
53
+ :'output_schema',
53
54
  :'transform_id'
54
55
  ])
55
56
  end
@@ -17,23 +17,35 @@ module MailSlurpClient
17
17
  class InboxExistsDto
18
18
  attr_accessor :exists
19
19
 
20
+ # Inbox is full or simulating a soft bounce via inbox replier or rulesets
21
+ attr_accessor :soft_bounce
22
+
23
+ # Inbox is blocking receiving emails or simulating a hard bounce via inbox replier or rulesets
24
+ attr_accessor :hard_bounce
25
+
20
26
  # Attribute mapping from ruby-style variable name to JSON key.
21
27
  def self.attribute_map
22
28
  {
23
- :'exists' => :'exists'
29
+ :'exists' => :'exists',
30
+ :'soft_bounce' => :'softBounce',
31
+ :'hard_bounce' => :'hardBounce'
24
32
  }
25
33
  end
26
34
 
27
35
  # Attribute type mapping.
28
36
  def self.openapi_types
29
37
  {
30
- :'exists' => :'Boolean'
38
+ :'exists' => :'Boolean',
39
+ :'soft_bounce' => :'Boolean',
40
+ :'hard_bounce' => :'Boolean'
31
41
  }
32
42
  end
33
43
 
34
44
  # List of attributes with nullable: true
35
45
  def self.openapi_nullable
36
46
  Set.new([
47
+ :'soft_bounce',
48
+ :'hard_bounce'
37
49
  ])
38
50
  end
39
51
 
@@ -55,6 +67,14 @@ module MailSlurpClient
55
67
  if attributes.key?(:'exists')
56
68
  self.exists = attributes[:'exists']
57
69
  end
70
+
71
+ if attributes.key?(:'soft_bounce')
72
+ self.soft_bounce = attributes[:'soft_bounce']
73
+ end
74
+
75
+ if attributes.key?(:'hard_bounce')
76
+ self.hard_bounce = attributes[:'hard_bounce']
77
+ end
58
78
  end
59
79
 
60
80
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -80,7 +100,9 @@ module MailSlurpClient
80
100
  def ==(o)
81
101
  return true if self.equal?(o)
82
102
  self.class == o.class &&
83
- exists == o.exists
103
+ exists == o.exists &&
104
+ soft_bounce == o.soft_bounce &&
105
+ hard_bounce == o.hard_bounce
84
106
  end
85
107
 
86
108
  # @see the `==` method
@@ -92,7 +114,7 @@ module MailSlurpClient
92
114
  # Calculates hash code according to all attributes.
93
115
  # @return [Integer] Hash code
94
116
  def hash
95
- [exists].hash
117
+ [exists, soft_bounce, hard_bounce].hash
96
118
  end
97
119
 
98
120
  # Builds the object from hash
@@ -167,7 +167,7 @@ module MailSlurpClient
167
167
  scope_validator = EnumAttributeValidator.new('String', ["RECEIVING_EMAILS", "SENDING_EMAILS"])
168
168
  return false unless scope_validator.valid?(@scope)
169
169
  return false if @action.nil?
170
- action_validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE"])
170
+ action_validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE", "BOUNCE_SOFT", "BOUNCE_HARD"])
171
171
  return false unless action_validator.valid?(@action)
172
172
  return false if @target.nil?
173
173
  return false if @handler.nil?
@@ -190,7 +190,7 @@ module MailSlurpClient
190
190
  # Custom attribute writer method checking allowed values (enum).
191
191
  # @param [Object] action Object to be assigned
192
192
  def action=(action)
193
- validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE"])
193
+ validator = EnumAttributeValidator.new('String', ["BLOCK", "ALLOW", "FILTER_REMOVE", "BOUNCE_SOFT", "BOUNCE_HARD"])
194
194
  unless validator.valid?(action)
195
195
  fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
196
196
  end
@@ -14,19 +14,45 @@ require 'date'
14
14
 
15
15
  module MailSlurpClient
16
16
  class InlineObject
17
- attr_accessor :file
17
+ # The email address that submitted form should be sent to.
18
+ attr_accessor :_to
19
+
20
+ # Optional subject of the email that will be sent.
21
+ attr_accessor :_subject
22
+
23
+ # Email address of the submitting user. Include this if you wish to record the submitters email address and reply to it later.
24
+ attr_accessor :_email_address
25
+
26
+ # Optional success message to display if no _redirectTo present.
27
+ attr_accessor :_success_message
28
+
29
+ # Optional but recommended field that catches spammers out. Include as a hidden form field but LEAVE EMPTY. Spam-bots will usually fill every field. If the _spamCheck field is filled the form submission will be ignored.
30
+ attr_accessor :_spam_check
31
+
32
+ # All other parameters or fields will be accepted and attached to the sent email. This includes files and any HTML form field with a name. These fields will become the body of the email that is sent.
33
+ attr_accessor :other_parameters
18
34
 
19
35
  # Attribute mapping from ruby-style variable name to JSON key.
20
36
  def self.attribute_map
21
37
  {
22
- :'file' => :'file'
38
+ :'_to' => :'_to',
39
+ :'_subject' => :'_subject',
40
+ :'_email_address' => :'_emailAddress',
41
+ :'_success_message' => :'_successMessage',
42
+ :'_spam_check' => :'_spamCheck',
43
+ :'other_parameters' => :'otherParameters'
23
44
  }
24
45
  end
25
46
 
26
47
  # Attribute type mapping.
27
48
  def self.openapi_types
28
49
  {
29
- :'file' => :'File'
50
+ :'_to' => :'String',
51
+ :'_subject' => :'String',
52
+ :'_email_address' => :'String',
53
+ :'_success_message' => :'String',
54
+ :'_spam_check' => :'String',
55
+ :'other_parameters' => :'String'
30
56
  }
31
57
  end
32
58
 
@@ -51,8 +77,28 @@ module MailSlurpClient
51
77
  h[k.to_sym] = v
52
78
  }
53
79
 
54
- if attributes.key?(:'file')
55
- self.file = attributes[:'file']
80
+ if attributes.key?(:'_to')
81
+ self._to = attributes[:'_to']
82
+ end
83
+
84
+ if attributes.key?(:'_subject')
85
+ self._subject = attributes[:'_subject']
86
+ end
87
+
88
+ if attributes.key?(:'_email_address')
89
+ self._email_address = attributes[:'_email_address']
90
+ end
91
+
92
+ if attributes.key?(:'_success_message')
93
+ self._success_message = attributes[:'_success_message']
94
+ end
95
+
96
+ if attributes.key?(:'_spam_check')
97
+ self._spam_check = attributes[:'_spam_check']
98
+ end
99
+
100
+ if attributes.key?(:'other_parameters')
101
+ self.other_parameters = attributes[:'other_parameters']
56
102
  end
57
103
  end
58
104
 
@@ -60,17 +106,12 @@ module MailSlurpClient
60
106
  # @return Array for valid properties with the reasons
61
107
  def list_invalid_properties
62
108
  invalid_properties = Array.new
63
- if @file.nil?
64
- invalid_properties.push('invalid value for "file", file cannot be nil.')
65
- end
66
-
67
109
  invalid_properties
68
110
  end
69
111
 
70
112
  # Check to see if the all the properties in the model are valid
71
113
  # @return true if the model is valid
72
114
  def valid?
73
- return false if @file.nil?
74
115
  true
75
116
  end
76
117
 
@@ -79,7 +120,12 @@ module MailSlurpClient
79
120
  def ==(o)
80
121
  return true if self.equal?(o)
81
122
  self.class == o.class &&
82
- file == o.file
123
+ _to == o._to &&
124
+ _subject == o._subject &&
125
+ _email_address == o._email_address &&
126
+ _success_message == o._success_message &&
127
+ _spam_check == o._spam_check &&
128
+ other_parameters == o.other_parameters
83
129
  end
84
130
 
85
131
  # @see the `==` method
@@ -91,7 +137,7 @@ module MailSlurpClient
91
137
  # Calculates hash code according to all attributes.
92
138
  # @return [Integer] Hash code
93
139
  def hash
94
- [file].hash
140
+ [_to, _subject, _email_address, _success_message, _spam_check, other_parameters].hash
95
141
  end
96
142
 
97
143
  # Builds the object from hash
@@ -0,0 +1,211 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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://docs.mailslurp.com/) - [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 InlineObject1
17
+ attr_accessor :file
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'file' => :'file'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'file' => :'File'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::InlineObject1` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::InlineObject1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'file')
55
+ self.file = attributes[:'file']
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @file.nil?
64
+ invalid_properties.push('invalid value for "file", file cannot be nil.')
65
+ end
66
+
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @file.nil?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ file == o.file
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [file].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.openapi_types.each_pair do |key, type|
110
+ if type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
118
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+
124
+ # Deserializes the data based on type
125
+ # @param string type Data type
126
+ # @param string value Value to be deserialized
127
+ # @return [Object] Deserialized data
128
+ def _deserialize(type, value)
129
+ case type.to_sym
130
+ when :DateTime
131
+ DateTime.parse(value)
132
+ when :Date
133
+ Date.parse(value)
134
+ when :String
135
+ value.to_s
136
+ when :Integer
137
+ value.to_i
138
+ when :Float
139
+ value.to_f
140
+ when :Boolean
141
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
142
+ true
143
+ else
144
+ false
145
+ end
146
+ when :Object
147
+ # generic object (usually a Hash), return directly
148
+ value
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ MailSlurpClient.const_get(type).build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ if value.nil?
184
+ is_nullable = self.class.openapi_nullable.include?(attr)
185
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
186
+ end
187
+
188
+ hash[param] = _to_hash(value)
189
+ end
190
+ hash
191
+ end
192
+
193
+ # Outputs non-array value in the form of hash
194
+ # For object, use to_hash. Otherwise, just return the value
195
+ # @param [Object] value Any valid value
196
+ # @return [Hash] Returns the value in the form of hash
197
+ def _to_hash(value)
198
+ if value.is_a?(Array)
199
+ value.compact.map { |v| _to_hash(v) }
200
+ elsif value.is_a?(Hash)
201
+ {}.tap do |hash|
202
+ value.each { |k, v| hash[k] = _to_hash(v) }
203
+ end
204
+ elsif value.respond_to? :to_hash
205
+ value.to_hash
206
+ else
207
+ value
208
+ end
209
+ end
210
+ end
211
+ end