mailslurp_client 15.17.23 → 15.17.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/email_controller_api.rb +69 -0
  3. data/lib/mailslurp_client/models/alias_projection.rb +28 -28
  4. data/lib/mailslurp_client/models/attachment_projection.rb +11 -11
  5. data/lib/mailslurp_client/models/bounce_projection.rb +17 -17
  6. data/lib/mailslurp_client/models/bounce_recipient_projection.rb +22 -22
  7. data/lib/mailslurp_client/models/connector_projection.rb +24 -24
  8. data/lib/mailslurp_client/models/connector_sync_event_projection.rb +15 -15
  9. data/lib/mailslurp_client/models/contact_projection.rb +10 -10
  10. data/lib/mailslurp_client/models/email_content_part_result.rb +207 -0
  11. data/lib/mailslurp_client/models/email_projection.rb +25 -25
  12. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  13. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +17 -17
  14. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +27 -27
  15. data/lib/mailslurp_client/models/list_unsubscribe_recipient_projection.rb +10 -10
  16. data/lib/mailslurp_client/models/missed_email_projection.rb +11 -11
  17. data/lib/mailslurp_client/models/page_alias.rb +17 -16
  18. data/lib/mailslurp_client/models/page_attachment_entity.rb +17 -16
  19. data/lib/mailslurp_client/models/page_bounced_email.rb +17 -16
  20. data/lib/mailslurp_client/models/page_bounced_recipients.rb +17 -16
  21. data/lib/mailslurp_client/models/page_complaint.rb +17 -16
  22. data/lib/mailslurp_client/models/page_connector.rb +17 -16
  23. data/lib/mailslurp_client/models/page_connector_sync_events.rb +17 -16
  24. data/lib/mailslurp_client/models/page_contact_projection.rb +17 -16
  25. data/lib/mailslurp_client/models/page_delivery_status.rb +17 -16
  26. data/lib/mailslurp_client/models/page_email_preview.rb +17 -16
  27. data/lib/mailslurp_client/models/page_email_projection.rb +12 -21
  28. data/lib/mailslurp_client/models/page_email_validation_request.rb +17 -16
  29. data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +17 -16
  30. data/lib/mailslurp_client/models/page_group_projection.rb +17 -16
  31. data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +17 -16
  32. data/lib/mailslurp_client/models/page_inbox_forwarder_events.rb +17 -16
  33. data/lib/mailslurp_client/models/page_inbox_projection.rb +17 -16
  34. data/lib/mailslurp_client/models/page_inbox_replier_dto.rb +17 -16
  35. data/lib/mailslurp_client/models/page_inbox_replier_events.rb +17 -16
  36. data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +17 -16
  37. data/lib/mailslurp_client/models/page_list_unsubscribe_recipients.rb +17 -16
  38. data/lib/mailslurp_client/models/page_missed_email_projection.rb +17 -16
  39. data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +17 -16
  40. data/lib/mailslurp_client/models/page_phone_number_projection.rb +17 -16
  41. data/lib/mailslurp_client/models/page_scheduled_jobs.rb +17 -16
  42. data/lib/mailslurp_client/models/page_sent_email_projection.rb +34 -69
  43. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +34 -69
  44. data/lib/mailslurp_client/models/page_sms_projection.rb +17 -16
  45. data/lib/mailslurp_client/models/page_template_projection.rb +17 -16
  46. data/lib/mailslurp_client/models/page_thread_projection.rb +17 -16
  47. data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +17 -16
  48. data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +17 -16
  49. data/lib/mailslurp_client/models/page_webhook_projection.rb +17 -16
  50. data/lib/mailslurp_client/models/page_webhook_result.rb +17 -16
  51. data/lib/mailslurp_client/models/phone_number_projection.rb +15 -15
  52. data/lib/mailslurp_client/models/send_with_queue_result.rb +0 -1
  53. data/lib/mailslurp_client/models/sent_email_projection.rb +30 -31
  54. data/lib/mailslurp_client/models/sms_projection.rb +29 -29
  55. data/lib/mailslurp_client/models/template_projection.rb +17 -17
  56. data/lib/mailslurp_client/models/thread_projection.rb +45 -45
  57. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +24 -24
  58. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +13 -13
  59. data/lib/mailslurp_client/models/webhook_projection.rb +27 -27
  60. data/lib/mailslurp_client/version.rb +1 -1
  61. data/lib/mailslurp_client.rb +1 -0
  62. metadata +3 -2
@@ -15,11 +15,9 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Connector
17
17
  class ConnectorProjection
18
- attr_accessor :inbox_id
19
-
20
18
  attr_accessor :user_id
21
19
 
22
- attr_accessor :created_at
20
+ attr_accessor :inbox_id
23
21
 
24
22
  attr_accessor :sync_enabled
25
23
 
@@ -29,6 +27,8 @@ module MailSlurpClient
29
27
 
30
28
  attr_accessor :sync_interval
31
29
 
30
+ attr_accessor :created_at
31
+
32
32
  attr_accessor :id
33
33
 
34
34
  class EnumAttributeValidator
@@ -56,13 +56,13 @@ module MailSlurpClient
56
56
  # Attribute mapping from ruby-style variable name to JSON key.
57
57
  def self.attribute_map
58
58
  {
59
- :'inbox_id' => :'inboxId',
60
59
  :'user_id' => :'userId',
61
- :'created_at' => :'createdAt',
60
+ :'inbox_id' => :'inboxId',
62
61
  :'sync_enabled' => :'syncEnabled',
63
62
  :'connector_type' => :'connectorType',
64
63
  :'sync_schedule_type' => :'syncScheduleType',
65
64
  :'sync_interval' => :'syncInterval',
65
+ :'created_at' => :'createdAt',
66
66
  :'id' => :'id'
67
67
  }
68
68
  end
@@ -70,13 +70,13 @@ module MailSlurpClient
70
70
  # Attribute type mapping.
71
71
  def self.openapi_types
72
72
  {
73
- :'inbox_id' => :'String',
74
73
  :'user_id' => :'String',
75
- :'created_at' => :'DateTime',
74
+ :'inbox_id' => :'String',
76
75
  :'sync_enabled' => :'Boolean',
77
76
  :'connector_type' => :'String',
78
77
  :'sync_schedule_type' => :'String',
79
78
  :'sync_interval' => :'Integer',
79
+ :'created_at' => :'DateTime',
80
80
  :'id' => :'String'
81
81
  }
82
82
  end
@@ -102,16 +102,12 @@ module MailSlurpClient
102
102
  h[k.to_sym] = v
103
103
  }
104
104
 
105
- if attributes.key?(:'inbox_id')
106
- self.inbox_id = attributes[:'inbox_id']
107
- end
108
-
109
105
  if attributes.key?(:'user_id')
110
106
  self.user_id = attributes[:'user_id']
111
107
  end
112
108
 
113
- if attributes.key?(:'created_at')
114
- self.created_at = attributes[:'created_at']
109
+ if attributes.key?(:'inbox_id')
110
+ self.inbox_id = attributes[:'inbox_id']
115
111
  end
116
112
 
117
113
  if attributes.key?(:'sync_enabled')
@@ -130,6 +126,10 @@ module MailSlurpClient
130
126
  self.sync_interval = attributes[:'sync_interval']
131
127
  end
132
128
 
129
+ if attributes.key?(:'created_at')
130
+ self.created_at = attributes[:'created_at']
131
+ end
132
+
133
133
  if attributes.key?(:'id')
134
134
  self.id = attributes[:'id']
135
135
  end
@@ -139,16 +139,12 @@ module MailSlurpClient
139
139
  # @return Array for valid properties with the reasons
140
140
  def list_invalid_properties
141
141
  invalid_properties = Array.new
142
- if @inbox_id.nil?
143
- invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
144
- end
145
-
146
142
  if @user_id.nil?
147
143
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
148
144
  end
149
145
 
150
- if @created_at.nil?
151
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
146
+ if @inbox_id.nil?
147
+ invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
152
148
  end
153
149
 
154
150
  if @sync_enabled.nil?
@@ -163,15 +159,18 @@ module MailSlurpClient
163
159
  invalid_properties.push('invalid value for "sync_schedule_type", sync_schedule_type cannot be nil.')
164
160
  end
165
161
 
162
+ if @created_at.nil?
163
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
164
+ end
165
+
166
166
  invalid_properties
167
167
  end
168
168
 
169
169
  # Check to see if the all the properties in the model are valid
170
170
  # @return true if the model is valid
171
171
  def valid?
172
- return false if @inbox_id.nil?
173
172
  return false if @user_id.nil?
174
- return false if @created_at.nil?
173
+ return false if @inbox_id.nil?
175
174
  return false if @sync_enabled.nil?
176
175
  return false if @connector_type.nil?
177
176
  connector_type_validator = EnumAttributeValidator.new('String', ["IMAP"])
@@ -179,6 +178,7 @@ module MailSlurpClient
179
178
  return false if @sync_schedule_type.nil?
180
179
  sync_schedule_type_validator = EnumAttributeValidator.new('String', ["INTERVAL"])
181
180
  return false unless sync_schedule_type_validator.valid?(@sync_schedule_type)
181
+ return false if @created_at.nil?
182
182
  true
183
183
  end
184
184
 
@@ -207,13 +207,13 @@ module MailSlurpClient
207
207
  def ==(o)
208
208
  return true if self.equal?(o)
209
209
  self.class == o.class &&
210
- inbox_id == o.inbox_id &&
211
210
  user_id == o.user_id &&
212
- created_at == o.created_at &&
211
+ inbox_id == o.inbox_id &&
213
212
  sync_enabled == o.sync_enabled &&
214
213
  connector_type == o.connector_type &&
215
214
  sync_schedule_type == o.sync_schedule_type &&
216
215
  sync_interval == o.sync_interval &&
216
+ created_at == o.created_at &&
217
217
  id == o.id
218
218
  end
219
219
 
@@ -226,7 +226,7 @@ module MailSlurpClient
226
226
  # Calculates hash code according to all attributes.
227
227
  # @return [Integer] Hash code
228
228
  def hash
229
- [inbox_id, user_id, created_at, sync_enabled, connector_type, sync_schedule_type, sync_interval, id].hash
229
+ [user_id, inbox_id, sync_enabled, connector_type, sync_schedule_type, sync_interval, created_at, id].hash
230
230
  end
231
231
 
232
232
  # Builds the object from hash
@@ -15,14 +15,14 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # ConnectorSyncEventProjection
17
17
  class ConnectorSyncEventProjection
18
- attr_accessor :created_at
19
-
20
18
  attr_accessor :connector_id
21
19
 
22
20
  attr_accessor :sync_count
23
21
 
24
22
  attr_accessor :sync_status
25
23
 
24
+ attr_accessor :created_at
25
+
26
26
  attr_accessor :message
27
27
 
28
28
  attr_accessor :id
@@ -52,10 +52,10 @@ module MailSlurpClient
52
52
  # Attribute mapping from ruby-style variable name to JSON key.
53
53
  def self.attribute_map
54
54
  {
55
- :'created_at' => :'createdAt',
56
55
  :'connector_id' => :'connectorId',
57
56
  :'sync_count' => :'syncCount',
58
57
  :'sync_status' => :'syncStatus',
58
+ :'created_at' => :'createdAt',
59
59
  :'message' => :'message',
60
60
  :'id' => :'id'
61
61
  }
@@ -64,10 +64,10 @@ module MailSlurpClient
64
64
  # Attribute type mapping.
65
65
  def self.openapi_types
66
66
  {
67
- :'created_at' => :'DateTime',
68
67
  :'connector_id' => :'String',
69
68
  :'sync_count' => :'Integer',
70
69
  :'sync_status' => :'String',
70
+ :'created_at' => :'DateTime',
71
71
  :'message' => :'String',
72
72
  :'id' => :'String'
73
73
  }
@@ -94,10 +94,6 @@ module MailSlurpClient
94
94
  h[k.to_sym] = v
95
95
  }
96
96
 
97
- if attributes.key?(:'created_at')
98
- self.created_at = attributes[:'created_at']
99
- end
100
-
101
97
  if attributes.key?(:'connector_id')
102
98
  self.connector_id = attributes[:'connector_id']
103
99
  end
@@ -110,6 +106,10 @@ module MailSlurpClient
110
106
  self.sync_status = attributes[:'sync_status']
111
107
  end
112
108
 
109
+ if attributes.key?(:'created_at')
110
+ self.created_at = attributes[:'created_at']
111
+ end
112
+
113
113
  if attributes.key?(:'message')
114
114
  self.message = attributes[:'message']
115
115
  end
@@ -123,10 +123,6 @@ module MailSlurpClient
123
123
  # @return Array for valid properties with the reasons
124
124
  def list_invalid_properties
125
125
  invalid_properties = Array.new
126
- if @created_at.nil?
127
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
128
- end
129
-
130
126
  if @connector_id.nil?
131
127
  invalid_properties.push('invalid value for "connector_id", connector_id cannot be nil.')
132
128
  end
@@ -139,18 +135,22 @@ module MailSlurpClient
139
135
  invalid_properties.push('invalid value for "sync_status", sync_status cannot be nil.')
140
136
  end
141
137
 
138
+ if @created_at.nil?
139
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
140
+ end
141
+
142
142
  invalid_properties
143
143
  end
144
144
 
145
145
  # Check to see if the all the properties in the model are valid
146
146
  # @return true if the model is valid
147
147
  def valid?
148
- return false if @created_at.nil?
149
148
  return false if @connector_id.nil?
150
149
  return false if @sync_count.nil?
151
150
  return false if @sync_status.nil?
152
151
  sync_status_validator = EnumAttributeValidator.new('String', ["SUCCESS", "INTERNAL_ERROR", "SUBSCRIPTION_ERROR", "CONNECTION_ERROR", "NOT_FOUND"])
153
152
  return false unless sync_status_validator.valid?(@sync_status)
153
+ return false if @created_at.nil?
154
154
  true
155
155
  end
156
156
 
@@ -169,10 +169,10 @@ module MailSlurpClient
169
169
  def ==(o)
170
170
  return true if self.equal?(o)
171
171
  self.class == o.class &&
172
- created_at == o.created_at &&
173
172
  connector_id == o.connector_id &&
174
173
  sync_count == o.sync_count &&
175
174
  sync_status == o.sync_status &&
175
+ created_at == o.created_at &&
176
176
  message == o.message &&
177
177
  id == o.id
178
178
  end
@@ -186,7 +186,7 @@ module MailSlurpClient
186
186
  # Calculates hash code according to all attributes.
187
187
  # @return [Integer] Hash code
188
188
  def hash
189
- [created_at, connector_id, sync_count, sync_status, message, id].hash
189
+ [connector_id, sync_count, sync_status, created_at, message, id].hash
190
190
  end
191
191
 
192
192
  # Builds the object from hash
@@ -17,8 +17,6 @@ module MailSlurpClient
17
17
  class ContactProjection
18
18
  attr_accessor :email_address
19
19
 
20
- attr_accessor :created_at
21
-
22
20
  attr_accessor :email_addresses
23
21
 
24
22
  attr_accessor :first_name
@@ -29,6 +27,8 @@ module MailSlurpClient
29
27
 
30
28
  attr_accessor :opt_out
31
29
 
30
+ attr_accessor :created_at
31
+
32
32
  attr_accessor :id
33
33
 
34
34
  attr_accessor :group_id
@@ -37,12 +37,12 @@ module MailSlurpClient
37
37
  def self.attribute_map
38
38
  {
39
39
  :'email_address' => :'emailAddress',
40
- :'created_at' => :'createdAt',
41
40
  :'email_addresses' => :'emailAddresses',
42
41
  :'first_name' => :'firstName',
43
42
  :'last_name' => :'lastName',
44
43
  :'company' => :'company',
45
44
  :'opt_out' => :'optOut',
45
+ :'created_at' => :'createdAt',
46
46
  :'id' => :'id',
47
47
  :'group_id' => :'groupId'
48
48
  }
@@ -52,12 +52,12 @@ module MailSlurpClient
52
52
  def self.openapi_types
53
53
  {
54
54
  :'email_address' => :'String',
55
- :'created_at' => :'DateTime',
56
55
  :'email_addresses' => :'Array<String>',
57
56
  :'first_name' => :'String',
58
57
  :'last_name' => :'String',
59
58
  :'company' => :'String',
60
59
  :'opt_out' => :'Boolean',
60
+ :'created_at' => :'DateTime',
61
61
  :'id' => :'String',
62
62
  :'group_id' => :'String'
63
63
  }
@@ -95,10 +95,6 @@ module MailSlurpClient
95
95
  self.email_address = attributes[:'email_address']
96
96
  end
97
97
 
98
- if attributes.key?(:'created_at')
99
- self.created_at = attributes[:'created_at']
100
- end
101
-
102
98
  if attributes.key?(:'email_addresses')
103
99
  if (value = attributes[:'email_addresses']).is_a?(Array)
104
100
  self.email_addresses = value
@@ -121,6 +117,10 @@ module MailSlurpClient
121
117
  self.opt_out = attributes[:'opt_out']
122
118
  end
123
119
 
120
+ if attributes.key?(:'created_at')
121
+ self.created_at = attributes[:'created_at']
122
+ end
123
+
124
124
  if attributes.key?(:'id')
125
125
  self.id = attributes[:'id']
126
126
  end
@@ -159,12 +159,12 @@ module MailSlurpClient
159
159
  return true if self.equal?(o)
160
160
  self.class == o.class &&
161
161
  email_address == o.email_address &&
162
- created_at == o.created_at &&
163
162
  email_addresses == o.email_addresses &&
164
163
  first_name == o.first_name &&
165
164
  last_name == o.last_name &&
166
165
  company == o.company &&
167
166
  opt_out == o.opt_out &&
167
+ created_at == o.created_at &&
168
168
  id == o.id &&
169
169
  group_id == o.group_id
170
170
  end
@@ -178,7 +178,7 @@ module MailSlurpClient
178
178
  # Calculates hash code according to all attributes.
179
179
  # @return [Integer] Hash code
180
180
  def hash
181
- [email_address, created_at, email_addresses, first_name, last_name, company, opt_out, id, group_id].hash
181
+ [email_address, email_addresses, first_name, last_name, company, opt_out, created_at, id, group_id].hash
182
182
  end
183
183
 
184
184
  # Builds the object from hash
@@ -0,0 +1,207 @@
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://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 EmailContentPartResult
17
+ attr_accessor :content
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'content' => :'content'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'content' => :'String'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ :'content'
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::EmailContentPartResult` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::EmailContentPartResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'content')
56
+ self.content = attributes[:'content']
57
+ end
58
+ end
59
+
60
+ # Show invalid properties with the reasons. Usually used together with valid?
61
+ # @return Array for valid properties with the reasons
62
+ def list_invalid_properties
63
+ invalid_properties = Array.new
64
+ invalid_properties
65
+ end
66
+
67
+ # Check to see if the all the properties in the model are valid
68
+ # @return true if the model is valid
69
+ def valid?
70
+ true
71
+ end
72
+
73
+ # Checks equality by comparing each attribute.
74
+ # @param [Object] Object to be compared
75
+ def ==(o)
76
+ return true if self.equal?(o)
77
+ self.class == o.class &&
78
+ content == o.content
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Integer] Hash code
89
+ def hash
90
+ [content].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def self.build_from_hash(attributes)
97
+ new.build_from_hash(attributes)
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.openapi_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :Boolean
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ MailSlurpClient.const_get(type).build_from_hash(value)
158
+ end
159
+ end
160
+
161
+ # Returns the string representation of the object
162
+ # @return [String] String presentation of the object
163
+ def to_s
164
+ to_hash.to_s
165
+ end
166
+
167
+ # to_body is an alias to to_hash (backward compatibility)
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_body
170
+ to_hash
171
+ end
172
+
173
+ # Returns the object in the form of hash
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_hash
176
+ hash = {}
177
+ self.class.attribute_map.each_pair do |attr, param|
178
+ value = self.send(attr)
179
+ if value.nil?
180
+ is_nullable = self.class.openapi_nullable.include?(attr)
181
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
182
+ end
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map { |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+ end
207
+ end