mailslurp_client 15.11.0 → 15.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mailslurp_client/api/api_user_controller_api.rb +74 -0
- data/lib/mailslurp_client/api/attachment_controller_api.rb +4 -4
- data/lib/mailslurp_client/api/email_controller_api.rb +68 -3
- data/lib/mailslurp_client/api/inbox_controller_api.rb +63 -0
- data/lib/mailslurp_client/api/missed_email_controller_api.rb +56 -0
- data/lib/mailslurp_client/api/phone_controller_api.rb +487 -0
- data/lib/mailslurp_client/api/sent_emails_controller_api.rb +73 -0
- data/lib/mailslurp_client/api/sms_controller_api.rb +286 -0
- data/lib/mailslurp_client/api/template_controller_api.rb +124 -0
- data/lib/mailslurp_client/api/wait_for_controller_api.rb +64 -0
- data/lib/mailslurp_client/api/webhook_controller_api.rb +2 -2
- data/lib/mailslurp_client/models/abstract_webhook_payload.rb +2 -2
- data/lib/mailslurp_client/models/alias_projection.rb +27 -27
- data/lib/mailslurp_client/models/attachment_projection.rb +14 -14
- data/lib/mailslurp_client/models/bounce_projection.rb +31 -4
- data/lib/mailslurp_client/models/{bounce_recipient.rb → bounce_recipient_projection.rb} +35 -36
- data/lib/mailslurp_client/models/bounced_email_dto.rb +19 -1
- data/lib/mailslurp_client/models/bounced_recipient_dto.rb +37 -1
- data/lib/mailslurp_client/models/contact_projection.rb +18 -18
- data/lib/mailslurp_client/models/create_emergency_address_options.rb +324 -0
- data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
- data/lib/mailslurp_client/models/email_html_dto.rb +215 -0
- data/lib/mailslurp_client/models/email_projection.rb +19 -19
- data/lib/mailslurp_client/models/emergency_address.rb +408 -0
- data/lib/mailslurp_client/models/emergency_address_dto.rb +273 -0
- data/lib/mailslurp_client/models/empty_response_dto.rb +206 -0
- data/lib/mailslurp_client/models/inbox_by_name_result.rb +221 -0
- data/lib/mailslurp_client/models/inbox_dto.rb +11 -1
- data/lib/mailslurp_client/models/page_alias.rb +22 -22
- data/lib/mailslurp_client/models/page_attachment_entity.rb +22 -22
- data/lib/mailslurp_client/models/page_bounced_email.rb +22 -22
- data/lib/mailslurp_client/models/page_bounced_recipients.rb +23 -23
- data/lib/mailslurp_client/models/page_contact_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_email_preview.rb +22 -22
- data/lib/mailslurp_client/models/page_email_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_email_validation_request.rb +22 -22
- data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_group_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_inbox_forwarder_dto.rb +22 -22
- data/lib/mailslurp_client/models/page_inbox_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_inbox_ruleset_dto.rb +22 -22
- data/lib/mailslurp_client/models/page_missed_email_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_organization_inbox_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_phone_number_projection.rb +308 -0
- data/lib/mailslurp_client/models/page_sent_email_projection.rb +16 -16
- data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +344 -0
- data/lib/mailslurp_client/models/page_sms_projection.rb +308 -0
- data/lib/mailslurp_client/models/page_template_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_thread_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_tracking_pixel_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_unknown_missed_email_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_webhook_projection.rb +22 -22
- data/lib/mailslurp_client/models/page_webhook_result.rb +22 -22
- data/lib/mailslurp_client/models/phone_number_dto.rb +347 -0
- data/lib/mailslurp_client/models/phone_number_projection.rb +302 -0
- data/lib/mailslurp_client/models/phone_plan_dto.rb +287 -0
- data/lib/mailslurp_client/models/send_with_queue_result.rb +318 -0
- data/lib/mailslurp_client/models/sent_email_projection.rb +24 -24
- data/lib/mailslurp_client/models/sms_match_option.rb +289 -0
- data/lib/mailslurp_client/models/sms_message.rb +318 -0
- data/lib/mailslurp_client/models/sms_preview.rb +267 -0
- data/lib/mailslurp_client/models/sms_projection.rb +282 -0
- data/lib/mailslurp_client/models/template_preview.rb +211 -0
- data/lib/mailslurp_client/models/template_projection.rb +18 -18
- data/lib/mailslurp_client/models/thread_projection.rb +36 -36
- data/lib/mailslurp_client/models/tracking_pixel_projection.rb +19 -19
- data/lib/mailslurp_client/models/user_info_dto.rb +334 -0
- data/lib/mailslurp_client/models/wait_for_sms_conditions.rb +371 -0
- data/lib/mailslurp_client/models/webhook_bounce_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_bounce_recipient_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_dto.rb +2 -2
- data/lib/mailslurp_client/models/webhook_email_opened_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_email_read_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_new_attachment_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_new_contact_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_new_email_payload.rb +2 -2
- data/lib/mailslurp_client/models/webhook_projection.rb +2 -2
- data/lib/mailslurp_client/models/webhook_result_dto.rb +2 -2
- data/lib/mailslurp_client/version.rb +1 -1
- data/lib/mailslurp_client.rb +24 -1
- metadata +26 -3
@@ -21,11 +21,11 @@ module MailSlurpClient
|
|
21
21
|
|
22
22
|
attr_accessor :total
|
23
23
|
|
24
|
-
attr_accessor :
|
24
|
+
attr_accessor :last
|
25
25
|
|
26
26
|
attr_accessor :total_pages
|
27
27
|
|
28
|
-
attr_accessor :
|
28
|
+
attr_accessor :total_elements
|
29
29
|
|
30
30
|
attr_accessor :size
|
31
31
|
|
@@ -33,10 +33,10 @@ module MailSlurpClient
|
|
33
33
|
|
34
34
|
attr_accessor :sort
|
35
35
|
|
36
|
-
attr_accessor :number_of_elements
|
37
|
-
|
38
36
|
attr_accessor :first
|
39
37
|
|
38
|
+
attr_accessor :number_of_elements
|
39
|
+
|
40
40
|
attr_accessor :empty
|
41
41
|
|
42
42
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -45,14 +45,14 @@ module MailSlurpClient
|
|
45
45
|
:'content' => :'content',
|
46
46
|
:'pageable' => :'pageable',
|
47
47
|
:'total' => :'total',
|
48
|
-
:'total_elements' => :'totalElements',
|
49
|
-
:'total_pages' => :'totalPages',
|
50
48
|
:'last' => :'last',
|
49
|
+
:'total_pages' => :'totalPages',
|
50
|
+
:'total_elements' => :'totalElements',
|
51
51
|
:'size' => :'size',
|
52
52
|
:'number' => :'number',
|
53
53
|
:'sort' => :'sort',
|
54
|
-
:'number_of_elements' => :'numberOfElements',
|
55
54
|
:'first' => :'first',
|
55
|
+
:'number_of_elements' => :'numberOfElements',
|
56
56
|
:'empty' => :'empty'
|
57
57
|
}
|
58
58
|
end
|
@@ -63,14 +63,14 @@ module MailSlurpClient
|
|
63
63
|
:'content' => :'Array<WebhookResultDto>',
|
64
64
|
:'pageable' => :'PageableObject',
|
65
65
|
:'total' => :'Integer',
|
66
|
-
:'total_elements' => :'Integer',
|
67
|
-
:'total_pages' => :'Integer',
|
68
66
|
:'last' => :'Boolean',
|
67
|
+
:'total_pages' => :'Integer',
|
68
|
+
:'total_elements' => :'Integer',
|
69
69
|
:'size' => :'Integer',
|
70
70
|
:'number' => :'Integer',
|
71
71
|
:'sort' => :'Sort',
|
72
|
-
:'number_of_elements' => :'Integer',
|
73
72
|
:'first' => :'Boolean',
|
73
|
+
:'number_of_elements' => :'Integer',
|
74
74
|
:'empty' => :'Boolean'
|
75
75
|
}
|
76
76
|
end
|
@@ -110,16 +110,16 @@ module MailSlurpClient
|
|
110
110
|
self.total = attributes[:'total']
|
111
111
|
end
|
112
112
|
|
113
|
-
if attributes.key?(:'
|
114
|
-
self.
|
113
|
+
if attributes.key?(:'last')
|
114
|
+
self.last = attributes[:'last']
|
115
115
|
end
|
116
116
|
|
117
117
|
if attributes.key?(:'total_pages')
|
118
118
|
self.total_pages = attributes[:'total_pages']
|
119
119
|
end
|
120
120
|
|
121
|
-
if attributes.key?(:'
|
122
|
-
self.
|
121
|
+
if attributes.key?(:'total_elements')
|
122
|
+
self.total_elements = attributes[:'total_elements']
|
123
123
|
end
|
124
124
|
|
125
125
|
if attributes.key?(:'size')
|
@@ -134,14 +134,14 @@ module MailSlurpClient
|
|
134
134
|
self.sort = attributes[:'sort']
|
135
135
|
end
|
136
136
|
|
137
|
-
if attributes.key?(:'number_of_elements')
|
138
|
-
self.number_of_elements = attributes[:'number_of_elements']
|
139
|
-
end
|
140
|
-
|
141
137
|
if attributes.key?(:'first')
|
142
138
|
self.first = attributes[:'first']
|
143
139
|
end
|
144
140
|
|
141
|
+
if attributes.key?(:'number_of_elements')
|
142
|
+
self.number_of_elements = attributes[:'number_of_elements']
|
143
|
+
end
|
144
|
+
|
145
145
|
if attributes.key?(:'empty')
|
146
146
|
self.empty = attributes[:'empty']
|
147
147
|
end
|
@@ -168,14 +168,14 @@ module MailSlurpClient
|
|
168
168
|
content == o.content &&
|
169
169
|
pageable == o.pageable &&
|
170
170
|
total == o.total &&
|
171
|
-
total_elements == o.total_elements &&
|
172
|
-
total_pages == o.total_pages &&
|
173
171
|
last == o.last &&
|
172
|
+
total_pages == o.total_pages &&
|
173
|
+
total_elements == o.total_elements &&
|
174
174
|
size == o.size &&
|
175
175
|
number == o.number &&
|
176
176
|
sort == o.sort &&
|
177
|
-
number_of_elements == o.number_of_elements &&
|
178
177
|
first == o.first &&
|
178
|
+
number_of_elements == o.number_of_elements &&
|
179
179
|
empty == o.empty
|
180
180
|
end
|
181
181
|
|
@@ -188,7 +188,7 @@ module MailSlurpClient
|
|
188
188
|
# Calculates hash code according to all attributes.
|
189
189
|
# @return [Integer] Hash code
|
190
190
|
def hash
|
191
|
-
[content, pageable, total,
|
191
|
+
[content, pageable, total, last, total_pages, total_elements, size, number, sort, first, number_of_elements, empty].hash
|
192
192
|
end
|
193
193
|
|
194
194
|
# Builds the object from hash
|
@@ -0,0 +1,347 @@
|
|
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 PhoneNumberDto
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
attr_accessor :user_id
|
20
|
+
|
21
|
+
attr_accessor :compliance_address
|
22
|
+
|
23
|
+
attr_accessor :emergency_address
|
24
|
+
|
25
|
+
attr_accessor :phone_number
|
26
|
+
|
27
|
+
attr_accessor :phone_country
|
28
|
+
|
29
|
+
attr_accessor :phone_plan
|
30
|
+
|
31
|
+
attr_accessor :created_at
|
32
|
+
|
33
|
+
attr_accessor :updated_at
|
34
|
+
|
35
|
+
class EnumAttributeValidator
|
36
|
+
attr_reader :datatype
|
37
|
+
attr_reader :allowable_values
|
38
|
+
|
39
|
+
def initialize(datatype, allowable_values)
|
40
|
+
@allowable_values = allowable_values.map do |value|
|
41
|
+
case datatype.to_s
|
42
|
+
when /Integer/i
|
43
|
+
value.to_i
|
44
|
+
when /Float/i
|
45
|
+
value.to_f
|
46
|
+
else
|
47
|
+
value
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def valid?(value)
|
53
|
+
!value || allowable_values.include?(value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
58
|
+
def self.attribute_map
|
59
|
+
{
|
60
|
+
:'id' => :'id',
|
61
|
+
:'user_id' => :'userId',
|
62
|
+
:'compliance_address' => :'complianceAddress',
|
63
|
+
:'emergency_address' => :'emergencyAddress',
|
64
|
+
:'phone_number' => :'phoneNumber',
|
65
|
+
:'phone_country' => :'phoneCountry',
|
66
|
+
:'phone_plan' => :'phonePlan',
|
67
|
+
:'created_at' => :'createdAt',
|
68
|
+
:'updated_at' => :'updatedAt'
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# Attribute type mapping.
|
73
|
+
def self.openapi_types
|
74
|
+
{
|
75
|
+
:'id' => :'String',
|
76
|
+
:'user_id' => :'String',
|
77
|
+
:'compliance_address' => :'String',
|
78
|
+
:'emergency_address' => :'String',
|
79
|
+
:'phone_number' => :'String',
|
80
|
+
:'phone_country' => :'String',
|
81
|
+
:'phone_plan' => :'String',
|
82
|
+
:'created_at' => :'DateTime',
|
83
|
+
:'updated_at' => :'DateTime'
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
# List of attributes with nullable: true
|
88
|
+
def self.openapi_nullable
|
89
|
+
Set.new([
|
90
|
+
])
|
91
|
+
end
|
92
|
+
|
93
|
+
# Initializes the object
|
94
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
95
|
+
def initialize(attributes = {})
|
96
|
+
if (!attributes.is_a?(Hash))
|
97
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::PhoneNumberDto` initialize method"
|
98
|
+
end
|
99
|
+
|
100
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
101
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
102
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
103
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::PhoneNumberDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
104
|
+
end
|
105
|
+
h[k.to_sym] = v
|
106
|
+
}
|
107
|
+
|
108
|
+
if attributes.key?(:'id')
|
109
|
+
self.id = attributes[:'id']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'user_id')
|
113
|
+
self.user_id = attributes[:'user_id']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'compliance_address')
|
117
|
+
self.compliance_address = attributes[:'compliance_address']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'emergency_address')
|
121
|
+
self.emergency_address = attributes[:'emergency_address']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'phone_number')
|
125
|
+
self.phone_number = attributes[:'phone_number']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'phone_country')
|
129
|
+
self.phone_country = attributes[:'phone_country']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'phone_plan')
|
133
|
+
self.phone_plan = attributes[:'phone_plan']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'created_at')
|
137
|
+
self.created_at = attributes[:'created_at']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'updated_at')
|
141
|
+
self.updated_at = attributes[:'updated_at']
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
146
|
+
# @return Array for valid properties with the reasons
|
147
|
+
def list_invalid_properties
|
148
|
+
invalid_properties = Array.new
|
149
|
+
if @id.nil?
|
150
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
151
|
+
end
|
152
|
+
|
153
|
+
if @user_id.nil?
|
154
|
+
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
155
|
+
end
|
156
|
+
|
157
|
+
if @phone_number.nil?
|
158
|
+
invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
|
159
|
+
end
|
160
|
+
|
161
|
+
if @phone_country.nil?
|
162
|
+
invalid_properties.push('invalid value for "phone_country", phone_country cannot be nil.')
|
163
|
+
end
|
164
|
+
|
165
|
+
if @phone_plan.nil?
|
166
|
+
invalid_properties.push('invalid value for "phone_plan", phone_plan cannot be nil.')
|
167
|
+
end
|
168
|
+
|
169
|
+
if @created_at.nil?
|
170
|
+
invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
|
171
|
+
end
|
172
|
+
|
173
|
+
if @updated_at.nil?
|
174
|
+
invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
|
175
|
+
end
|
176
|
+
|
177
|
+
invalid_properties
|
178
|
+
end
|
179
|
+
|
180
|
+
# Check to see if the all the properties in the model are valid
|
181
|
+
# @return true if the model is valid
|
182
|
+
def valid?
|
183
|
+
return false if @id.nil?
|
184
|
+
return false if @user_id.nil?
|
185
|
+
return false if @phone_number.nil?
|
186
|
+
return false if @phone_country.nil?
|
187
|
+
phone_country_validator = EnumAttributeValidator.new('String', ["US", "GB"])
|
188
|
+
return false unless phone_country_validator.valid?(@phone_country)
|
189
|
+
return false if @phone_plan.nil?
|
190
|
+
return false if @created_at.nil?
|
191
|
+
return false if @updated_at.nil?
|
192
|
+
true
|
193
|
+
end
|
194
|
+
|
195
|
+
# Custom attribute writer method checking allowed values (enum).
|
196
|
+
# @param [Object] phone_country Object to be assigned
|
197
|
+
def phone_country=(phone_country)
|
198
|
+
validator = EnumAttributeValidator.new('String', ["US", "GB"])
|
199
|
+
unless validator.valid?(phone_country)
|
200
|
+
fail ArgumentError, "invalid value for \"phone_country\", must be one of #{validator.allowable_values}."
|
201
|
+
end
|
202
|
+
@phone_country = phone_country
|
203
|
+
end
|
204
|
+
|
205
|
+
# Checks equality by comparing each attribute.
|
206
|
+
# @param [Object] Object to be compared
|
207
|
+
def ==(o)
|
208
|
+
return true if self.equal?(o)
|
209
|
+
self.class == o.class &&
|
210
|
+
id == o.id &&
|
211
|
+
user_id == o.user_id &&
|
212
|
+
compliance_address == o.compliance_address &&
|
213
|
+
emergency_address == o.emergency_address &&
|
214
|
+
phone_number == o.phone_number &&
|
215
|
+
phone_country == o.phone_country &&
|
216
|
+
phone_plan == o.phone_plan &&
|
217
|
+
created_at == o.created_at &&
|
218
|
+
updated_at == o.updated_at
|
219
|
+
end
|
220
|
+
|
221
|
+
# @see the `==` method
|
222
|
+
# @param [Object] Object to be compared
|
223
|
+
def eql?(o)
|
224
|
+
self == o
|
225
|
+
end
|
226
|
+
|
227
|
+
# Calculates hash code according to all attributes.
|
228
|
+
# @return [Integer] Hash code
|
229
|
+
def hash
|
230
|
+
[id, user_id, compliance_address, emergency_address, phone_number, phone_country, phone_plan, created_at, updated_at].hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Builds the object from hash
|
234
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
235
|
+
# @return [Object] Returns the model itself
|
236
|
+
def self.build_from_hash(attributes)
|
237
|
+
new.build_from_hash(attributes)
|
238
|
+
end
|
239
|
+
|
240
|
+
# Builds the object from hash
|
241
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
242
|
+
# @return [Object] Returns the model itself
|
243
|
+
def build_from_hash(attributes)
|
244
|
+
return nil unless attributes.is_a?(Hash)
|
245
|
+
self.class.openapi_types.each_pair do |key, type|
|
246
|
+
if type =~ /\AArray<(.*)>/i
|
247
|
+
# check to ensure the input is an array given that the attribute
|
248
|
+
# is documented as an array but the input is not
|
249
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
250
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
251
|
+
end
|
252
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
253
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
254
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
255
|
+
end
|
256
|
+
|
257
|
+
self
|
258
|
+
end
|
259
|
+
|
260
|
+
# Deserializes the data based on type
|
261
|
+
# @param string type Data type
|
262
|
+
# @param string value Value to be deserialized
|
263
|
+
# @return [Object] Deserialized data
|
264
|
+
def _deserialize(type, value)
|
265
|
+
case type.to_sym
|
266
|
+
when :DateTime
|
267
|
+
DateTime.parse(value)
|
268
|
+
when :Date
|
269
|
+
Date.parse(value)
|
270
|
+
when :String
|
271
|
+
value.to_s
|
272
|
+
when :Integer
|
273
|
+
value.to_i
|
274
|
+
when :Float
|
275
|
+
value.to_f
|
276
|
+
when :Boolean
|
277
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
278
|
+
true
|
279
|
+
else
|
280
|
+
false
|
281
|
+
end
|
282
|
+
when :Object
|
283
|
+
# generic object (usually a Hash), return directly
|
284
|
+
value
|
285
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
286
|
+
inner_type = Regexp.last_match[:inner_type]
|
287
|
+
value.map { |v| _deserialize(inner_type, v) }
|
288
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
289
|
+
k_type = Regexp.last_match[:k_type]
|
290
|
+
v_type = Regexp.last_match[:v_type]
|
291
|
+
{}.tap do |hash|
|
292
|
+
value.each do |k, v|
|
293
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
294
|
+
end
|
295
|
+
end
|
296
|
+
else # model
|
297
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
# Returns the string representation of the object
|
302
|
+
# @return [String] String presentation of the object
|
303
|
+
def to_s
|
304
|
+
to_hash.to_s
|
305
|
+
end
|
306
|
+
|
307
|
+
# to_body is an alias to to_hash (backward compatibility)
|
308
|
+
# @return [Hash] Returns the object in the form of hash
|
309
|
+
def to_body
|
310
|
+
to_hash
|
311
|
+
end
|
312
|
+
|
313
|
+
# Returns the object in the form of hash
|
314
|
+
# @return [Hash] Returns the object in the form of hash
|
315
|
+
def to_hash
|
316
|
+
hash = {}
|
317
|
+
self.class.attribute_map.each_pair do |attr, param|
|
318
|
+
value = self.send(attr)
|
319
|
+
if value.nil?
|
320
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
321
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
322
|
+
end
|
323
|
+
|
324
|
+
hash[param] = _to_hash(value)
|
325
|
+
end
|
326
|
+
hash
|
327
|
+
end
|
328
|
+
|
329
|
+
# Outputs non-array value in the form of hash
|
330
|
+
# For object, use to_hash. Otherwise, just return the value
|
331
|
+
# @param [Object] value Any valid value
|
332
|
+
# @return [Hash] Returns the value in the form of hash
|
333
|
+
def _to_hash(value)
|
334
|
+
if value.is_a?(Array)
|
335
|
+
value.compact.map { |v| _to_hash(v) }
|
336
|
+
elsif value.is_a?(Hash)
|
337
|
+
{}.tap do |hash|
|
338
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
339
|
+
end
|
340
|
+
elsif value.respond_to? :to_hash
|
341
|
+
value.to_hash
|
342
|
+
else
|
343
|
+
value
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|