mailslurp_client 8.5.4 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/lib/mailslurp_client.rb +5 -0
- data/lib/mailslurp_client/api/alias_controller_api.rb +217 -0
- data/lib/mailslurp_client/api/common_actions_controller_api.rb +20 -6
- data/lib/mailslurp_client/api/email_controller_api.rb +2 -2
- data/lib/mailslurp_client/api/inbox_controller_api.rb +210 -14
- data/lib/mailslurp_client/models/contact_projection.rb +12 -1
- data/lib/mailslurp_client/models/create_inbox_dto.rb +19 -8
- data/lib/mailslurp_client/models/domain_dto.rb +15 -3
- data/lib/mailslurp_client/models/domain_name_record.rb +290 -0
- data/lib/mailslurp_client/models/expired_inbox_dto.rb +240 -0
- data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +253 -0
- data/lib/mailslurp_client/models/inbox.rb +7 -7
- data/lib/mailslurp_client/models/page_expired_inbox_record_projection.rb +299 -0
- data/lib/mailslurp_client/models/reply_to_alias_email_options.rb +304 -0
- data/lib/mailslurp_client/models/reply_to_email_options.rb +11 -1
- data/lib/mailslurp_client/models/set_inbox_favourited_options.rb +1 -1
- data/lib/mailslurp_client/models/simple_send_email_options.rb +1 -1
- data/lib/mailslurp_client/models/update_inbox_options.rb +4 -4
- data/lib/mailslurp_client/version.rb +1 -1
- metadata +7 -2
@@ -18,6 +18,8 @@ module MailSlurpClient
|
|
18
18
|
|
19
19
|
attr_accessor :created_at
|
20
20
|
|
21
|
+
attr_accessor :email_addresses
|
22
|
+
|
21
23
|
attr_accessor :first_name
|
22
24
|
|
23
25
|
attr_accessor :group_id
|
@@ -33,6 +35,7 @@ module MailSlurpClient
|
|
33
35
|
{
|
34
36
|
:'company' => :'company',
|
35
37
|
:'created_at' => :'createdAt',
|
38
|
+
:'email_addresses' => :'emailAddresses',
|
36
39
|
:'first_name' => :'firstName',
|
37
40
|
:'group_id' => :'groupId',
|
38
41
|
:'id' => :'id',
|
@@ -46,6 +49,7 @@ module MailSlurpClient
|
|
46
49
|
{
|
47
50
|
:'company' => :'String',
|
48
51
|
:'created_at' => :'DateTime',
|
52
|
+
:'email_addresses' => :'Array<String>',
|
49
53
|
:'first_name' => :'String',
|
50
54
|
:'group_id' => :'String',
|
51
55
|
:'id' => :'String',
|
@@ -83,6 +87,12 @@ module MailSlurpClient
|
|
83
87
|
self.created_at = attributes[:'created_at']
|
84
88
|
end
|
85
89
|
|
90
|
+
if attributes.key?(:'email_addresses')
|
91
|
+
if (value = attributes[:'email_addresses']).is_a?(Array)
|
92
|
+
self.email_addresses = value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
86
96
|
if attributes.key?(:'first_name')
|
87
97
|
self.first_name = attributes[:'first_name']
|
88
98
|
end
|
@@ -134,6 +144,7 @@ module MailSlurpClient
|
|
134
144
|
self.class == o.class &&
|
135
145
|
company == o.company &&
|
136
146
|
created_at == o.created_at &&
|
147
|
+
email_addresses == o.email_addresses &&
|
137
148
|
first_name == o.first_name &&
|
138
149
|
group_id == o.group_id &&
|
139
150
|
id == o.id &&
|
@@ -150,7 +161,7 @@ module MailSlurpClient
|
|
150
161
|
# Calculates hash code according to all attributes.
|
151
162
|
# @return [Integer] Hash code
|
152
163
|
def hash
|
153
|
-
[company, created_at, first_name, group_id, id, last_name, opt_out].hash
|
164
|
+
[company, created_at, email_addresses, first_name, group_id, id, last_name, opt_out].hash
|
154
165
|
end
|
155
166
|
|
156
167
|
# Builds the object from hash
|
@@ -13,17 +13,18 @@ OpenAPI Generator version: 4.3.1
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module MailSlurpClient
|
16
|
+
# Options for creating an inbox. An inbox has a real email address that can send and receive emails. Inboxes can be permanent or expire at a given time. They can use a custom email address (by verifying your own domain) or a randomly assigned email ending in either `mailslurp.com` or if `useDomainPool` is enabled then ending in a similar domains such as `mailslurp.xyz` (selected at random).
|
16
17
|
class CreateInboxDto
|
17
|
-
# Optional description of
|
18
|
+
# Optional description of the inbox for labelling purposes. Is shown in the dashboard and can be used with
|
18
19
|
attr_accessor :description
|
19
20
|
|
20
|
-
#
|
21
|
+
# A custom email address to use with the inbox. Defaults to null. When null MailSlurp will assign a random email address to the inbox such as `123@mailslurp.com`. If you use the `useDomainPool` option when the email address is null it will generate an email address with a more varied domain ending such as `123@mailslurp.info` or `123@mailslurp.biz`. When a custom email address is provided the address is split into a domain and the domain is queried against your user. If you have created the domain in the MailSlurp dashboard and verified it you can use any email address that ends with the domain. Send an email to this address and the inbox will receive and store it for you. To retrieve the email use the Inbox and Email Controller endpoints with the inbox ID.
|
21
22
|
attr_accessor :email_address
|
22
23
|
|
23
|
-
#
|
24
|
+
# Optional inbox expiration date. If null then this inbox is permanent and the emails in it won't be deleted. If an expiration date is provided or is required by your plan the inbox will be closed when the expiration time is reached. Expired inboxes still contain their emails but can no longer send or receive emails. An ExpiredInboxRecord is created when an inbox and the email address and inbox ID are recorded. The expiresAt property is a timestamp string in ISO DateTime Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX.
|
24
25
|
attr_accessor :expires_at
|
25
26
|
|
26
|
-
# Is the inbox favorited. Favouriting inboxes is typically done in the dashboard for quick access
|
27
|
+
# Is the inbox favorited. Favouriting inboxes is typically done in the dashboard for quick access or filtering
|
27
28
|
attr_accessor :favourite
|
28
29
|
|
29
30
|
# Optional name of the inbox. Displayed in the dashboard for easier search
|
@@ -32,6 +33,9 @@ module MailSlurpClient
|
|
32
33
|
# Tags that inbox has been tagged with. Tags can be added to inboxes to group different inboxes within an account. You can also search for inboxes by tag in the dashboard UI.
|
33
34
|
attr_accessor :tags
|
34
35
|
|
36
|
+
# Use the MailSlurp domain name pool with this inbox when creating the email address. Defaults to null. If enabled the inbox will be an email address with a domain randomly chosen from a list of the MailSlurp domains. This is useful when the default `@mailslurp.com` email addresses used with inboxes are blocked or considered spam by a provider or receiving service. When domain pool is enabled an email address will be generated ending in `@mailslurp.{world,info,xyz,...}` . This means a TLD is randomly selecting from a list of `.biz`, `.info`, `.xyz` etc to add variance to the generated email addresses. When null or false MailSlurp uses the default behavior of `@mailslurp.com` or custom email address provided by the emailAddress field.
|
37
|
+
attr_accessor :use_domain_pool
|
38
|
+
|
35
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
36
40
|
def self.attribute_map
|
37
41
|
{
|
@@ -40,7 +44,8 @@ module MailSlurpClient
|
|
40
44
|
:'expires_at' => :'expiresAt',
|
41
45
|
:'favourite' => :'favourite',
|
42
46
|
:'name' => :'name',
|
43
|
-
:'tags' => :'tags'
|
47
|
+
:'tags' => :'tags',
|
48
|
+
:'use_domain_pool' => :'useDomainPool'
|
44
49
|
}
|
45
50
|
end
|
46
51
|
|
@@ -52,7 +57,8 @@ module MailSlurpClient
|
|
52
57
|
:'expires_at' => :'DateTime',
|
53
58
|
:'favourite' => :'Boolean',
|
54
59
|
:'name' => :'String',
|
55
|
-
:'tags' => :'Array<String>'
|
60
|
+
:'tags' => :'Array<String>',
|
61
|
+
:'use_domain_pool' => :'Boolean'
|
56
62
|
}
|
57
63
|
end
|
58
64
|
|
@@ -102,6 +108,10 @@ module MailSlurpClient
|
|
102
108
|
self.tags = value
|
103
109
|
end
|
104
110
|
end
|
111
|
+
|
112
|
+
if attributes.key?(:'use_domain_pool')
|
113
|
+
self.use_domain_pool = attributes[:'use_domain_pool']
|
114
|
+
end
|
105
115
|
end
|
106
116
|
|
107
117
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -127,7 +137,8 @@ module MailSlurpClient
|
|
127
137
|
expires_at == o.expires_at &&
|
128
138
|
favourite == o.favourite &&
|
129
139
|
name == o.name &&
|
130
|
-
tags == o.tags
|
140
|
+
tags == o.tags &&
|
141
|
+
use_domain_pool == o.use_domain_pool
|
131
142
|
end
|
132
143
|
|
133
144
|
# @see the `==` method
|
@@ -139,7 +150,7 @@ module MailSlurpClient
|
|
139
150
|
# Calculates hash code according to all attributes.
|
140
151
|
# @return [Integer] Hash code
|
141
152
|
def hash
|
142
|
-
[description, email_address, expires_at, favourite, name, tags].hash
|
153
|
+
[description, email_address, expires_at, favourite, name, tags, use_domain_pool].hash
|
143
154
|
end
|
144
155
|
|
145
156
|
# Builds the object from hash
|
@@ -17,12 +17,15 @@ module MailSlurpClient
|
|
17
17
|
class DomainDto
|
18
18
|
attr_accessor :created_at
|
19
19
|
|
20
|
-
#
|
20
|
+
# Unique token DKIM tokens
|
21
21
|
attr_accessor :dkim_tokens
|
22
22
|
|
23
23
|
# Custom domain name
|
24
24
|
attr_accessor :domain
|
25
25
|
|
26
|
+
# List of DNS domain name records (C, MX, TXT) etc that you must add to the DNS server associated with your domain provider.
|
27
|
+
attr_accessor :domain_name_records
|
28
|
+
|
26
29
|
attr_accessor :id
|
27
30
|
|
28
31
|
# Whether domain has been verified or not. If the domain is not verified after 72 hours there is most likely an issue with the domains DNS records.
|
@@ -32,7 +35,7 @@ module MailSlurpClient
|
|
32
35
|
|
33
36
|
attr_accessor :user_id
|
34
37
|
|
35
|
-
#
|
38
|
+
# Verification tokens
|
36
39
|
attr_accessor :verification_token
|
37
40
|
|
38
41
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -41,6 +44,7 @@ module MailSlurpClient
|
|
41
44
|
:'created_at' => :'createdAt',
|
42
45
|
:'dkim_tokens' => :'dkimTokens',
|
43
46
|
:'domain' => :'domain',
|
47
|
+
:'domain_name_records' => :'domainNameRecords',
|
44
48
|
:'id' => :'id',
|
45
49
|
:'is_verified' => :'isVerified',
|
46
50
|
:'updated_at' => :'updatedAt',
|
@@ -55,6 +59,7 @@ module MailSlurpClient
|
|
55
59
|
:'created_at' => :'DateTime',
|
56
60
|
:'dkim_tokens' => :'Array<String>',
|
57
61
|
:'domain' => :'String',
|
62
|
+
:'domain_name_records' => :'Array<DomainNameRecord>',
|
58
63
|
:'id' => :'String',
|
59
64
|
:'is_verified' => :'Boolean',
|
60
65
|
:'updated_at' => :'DateTime',
|
@@ -98,6 +103,12 @@ module MailSlurpClient
|
|
98
103
|
self.domain = attributes[:'domain']
|
99
104
|
end
|
100
105
|
|
106
|
+
if attributes.key?(:'domain_name_records')
|
107
|
+
if (value = attributes[:'domain_name_records']).is_a?(Array)
|
108
|
+
self.domain_name_records = value
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
101
112
|
if attributes.key?(:'id')
|
102
113
|
self.id = attributes[:'id']
|
103
114
|
end
|
@@ -160,6 +171,7 @@ module MailSlurpClient
|
|
160
171
|
created_at == o.created_at &&
|
161
172
|
dkim_tokens == o.dkim_tokens &&
|
162
173
|
domain == o.domain &&
|
174
|
+
domain_name_records == o.domain_name_records &&
|
163
175
|
id == o.id &&
|
164
176
|
is_verified == o.is_verified &&
|
165
177
|
updated_at == o.updated_at &&
|
@@ -176,7 +188,7 @@ module MailSlurpClient
|
|
176
188
|
# Calculates hash code according to all attributes.
|
177
189
|
# @return [Integer] Hash code
|
178
190
|
def hash
|
179
|
-
[created_at, dkim_tokens, domain, id, is_verified, updated_at, user_id, verification_token].hash
|
191
|
+
[created_at, dkim_tokens, domain, domain_name_records, id, is_verified, updated_at, user_id, verification_token].hash
|
180
192
|
end
|
181
193
|
|
182
194
|
# Builds the object from hash
|
@@ -0,0 +1,290 @@
|
|
1
|
+
=begin
|
2
|
+
#MailSlurp API
|
3
|
+
|
4
|
+
#MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 6.5.2
|
7
|
+
|
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
|
+
# DNS Record required for verification of a domain
|
17
|
+
class DomainNameRecord
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
attr_accessor :record_entries
|
21
|
+
|
22
|
+
attr_accessor :record_type
|
23
|
+
|
24
|
+
attr_accessor :ttl
|
25
|
+
|
26
|
+
class EnumAttributeValidator
|
27
|
+
attr_reader :datatype
|
28
|
+
attr_reader :allowable_values
|
29
|
+
|
30
|
+
def initialize(datatype, allowable_values)
|
31
|
+
@allowable_values = allowable_values.map do |value|
|
32
|
+
case datatype.to_s
|
33
|
+
when /Integer/i
|
34
|
+
value.to_i
|
35
|
+
when /Float/i
|
36
|
+
value.to_f
|
37
|
+
else
|
38
|
+
value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def valid?(value)
|
44
|
+
!value || allowable_values.include?(value)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:'name' => :'name',
|
52
|
+
:'record_entries' => :'recordEntries',
|
53
|
+
:'record_type' => :'recordType',
|
54
|
+
:'ttl' => :'ttl'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.openapi_types
|
60
|
+
{
|
61
|
+
:'name' => :'String',
|
62
|
+
:'record_entries' => :'Array<String>',
|
63
|
+
:'record_type' => :'String',
|
64
|
+
:'ttl' => :'Integer'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# List of attributes with nullable: true
|
69
|
+
def self.openapi_nullable
|
70
|
+
Set.new([
|
71
|
+
])
|
72
|
+
end
|
73
|
+
|
74
|
+
# Initializes the object
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
76
|
+
def initialize(attributes = {})
|
77
|
+
if (!attributes.is_a?(Hash))
|
78
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::DomainNameRecord` initialize method"
|
79
|
+
end
|
80
|
+
|
81
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
83
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
84
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::DomainNameRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
85
|
+
end
|
86
|
+
h[k.to_sym] = v
|
87
|
+
}
|
88
|
+
|
89
|
+
if attributes.key?(:'name')
|
90
|
+
self.name = attributes[:'name']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'record_entries')
|
94
|
+
if (value = attributes[:'record_entries']).is_a?(Array)
|
95
|
+
self.record_entries = value
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'record_type')
|
100
|
+
self.record_type = attributes[:'record_type']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'ttl')
|
104
|
+
self.ttl = attributes[:'ttl']
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
109
|
+
# @return Array for valid properties with the reasons
|
110
|
+
def list_invalid_properties
|
111
|
+
invalid_properties = Array.new
|
112
|
+
if @name.nil?
|
113
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
114
|
+
end
|
115
|
+
|
116
|
+
if @record_entries.nil?
|
117
|
+
invalid_properties.push('invalid value for "record_entries", record_entries cannot be nil.')
|
118
|
+
end
|
119
|
+
|
120
|
+
if @record_type.nil?
|
121
|
+
invalid_properties.push('invalid value for "record_type", record_type cannot be nil.')
|
122
|
+
end
|
123
|
+
|
124
|
+
if @ttl.nil?
|
125
|
+
invalid_properties.push('invalid value for "ttl", ttl cannot be nil.')
|
126
|
+
end
|
127
|
+
|
128
|
+
invalid_properties
|
129
|
+
end
|
130
|
+
|
131
|
+
# Check to see if the all the properties in the model are valid
|
132
|
+
# @return true if the model is valid
|
133
|
+
def valid?
|
134
|
+
return false if @name.nil?
|
135
|
+
return false if @record_entries.nil?
|
136
|
+
return false if @record_type.nil?
|
137
|
+
record_type_validator = EnumAttributeValidator.new('String', ["A", "NS", "MD", "MF", "CNAME", "SOA", "MB", "MG", "MR", "NULL", "WKS", "PTR", "HINFO", "MINFO", "MX", "TXT", "RP", "AFSDB", "X25", "ISDN", "RT", "NSAP", "NSAP_PTR", "SIG", "KEY", "PX", "GPOS", "AAAA", "LOC", "NXT", "EID", "NIMLOC", "SRV", "ATMA", "NAPTR", "KX", "CERT", "A6", "DNAME", "SINK", "OPT", "APL", "DS", "SSHFP", "IPSECKEY", "RRSIG", "NSEC", "DNSKEY", "DHCID", "NSEC3", "NSEC3PARAM", "TLSA", "SMIMEA", "HIP", "NINFO", "RKEY", "TALINK", "CDS", "CDNSKEY", "OPENPGPKEY", "CSYNC", "ZONEMD", "SVCB", "HTTPS", "SPF", "UINFO", "UID", "GID", "UNSPEC", "NID", "L32", "L64", "LP", "EUI48", "EUI64", "TKEY", "TSIG", "IXFR", "AXFR", "MAILB", "MAILA", "ANY", "URI", "CAA", "AVC", "DOA", "AMTRELAY", "TA", "DLV"])
|
138
|
+
return false unless record_type_validator.valid?(@record_type)
|
139
|
+
return false if @ttl.nil?
|
140
|
+
true
|
141
|
+
end
|
142
|
+
|
143
|
+
# Custom attribute writer method checking allowed values (enum).
|
144
|
+
# @param [Object] record_type Object to be assigned
|
145
|
+
def record_type=(record_type)
|
146
|
+
validator = EnumAttributeValidator.new('String', ["A", "NS", "MD", "MF", "CNAME", "SOA", "MB", "MG", "MR", "NULL", "WKS", "PTR", "HINFO", "MINFO", "MX", "TXT", "RP", "AFSDB", "X25", "ISDN", "RT", "NSAP", "NSAP_PTR", "SIG", "KEY", "PX", "GPOS", "AAAA", "LOC", "NXT", "EID", "NIMLOC", "SRV", "ATMA", "NAPTR", "KX", "CERT", "A6", "DNAME", "SINK", "OPT", "APL", "DS", "SSHFP", "IPSECKEY", "RRSIG", "NSEC", "DNSKEY", "DHCID", "NSEC3", "NSEC3PARAM", "TLSA", "SMIMEA", "HIP", "NINFO", "RKEY", "TALINK", "CDS", "CDNSKEY", "OPENPGPKEY", "CSYNC", "ZONEMD", "SVCB", "HTTPS", "SPF", "UINFO", "UID", "GID", "UNSPEC", "NID", "L32", "L64", "LP", "EUI48", "EUI64", "TKEY", "TSIG", "IXFR", "AXFR", "MAILB", "MAILA", "ANY", "URI", "CAA", "AVC", "DOA", "AMTRELAY", "TA", "DLV"])
|
147
|
+
unless validator.valid?(record_type)
|
148
|
+
fail ArgumentError, "invalid value for \"record_type\", must be one of #{validator.allowable_values}."
|
149
|
+
end
|
150
|
+
@record_type = record_type
|
151
|
+
end
|
152
|
+
|
153
|
+
# Checks equality by comparing each attribute.
|
154
|
+
# @param [Object] Object to be compared
|
155
|
+
def ==(o)
|
156
|
+
return true if self.equal?(o)
|
157
|
+
self.class == o.class &&
|
158
|
+
name == o.name &&
|
159
|
+
record_entries == o.record_entries &&
|
160
|
+
record_type == o.record_type &&
|
161
|
+
ttl == o.ttl
|
162
|
+
end
|
163
|
+
|
164
|
+
# @see the `==` method
|
165
|
+
# @param [Object] Object to be compared
|
166
|
+
def eql?(o)
|
167
|
+
self == o
|
168
|
+
end
|
169
|
+
|
170
|
+
# Calculates hash code according to all attributes.
|
171
|
+
# @return [Integer] Hash code
|
172
|
+
def hash
|
173
|
+
[name, record_entries, record_type, ttl].hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Builds the object from hash
|
177
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
178
|
+
# @return [Object] Returns the model itself
|
179
|
+
def self.build_from_hash(attributes)
|
180
|
+
new.build_from_hash(attributes)
|
181
|
+
end
|
182
|
+
|
183
|
+
# Builds the object from hash
|
184
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
185
|
+
# @return [Object] Returns the model itself
|
186
|
+
def build_from_hash(attributes)
|
187
|
+
return nil unless attributes.is_a?(Hash)
|
188
|
+
self.class.openapi_types.each_pair do |key, type|
|
189
|
+
if type =~ /\AArray<(.*)>/i
|
190
|
+
# check to ensure the input is an array given that the attribute
|
191
|
+
# is documented as an array but the input is not
|
192
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
193
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
194
|
+
end
|
195
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
196
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
197
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
198
|
+
end
|
199
|
+
|
200
|
+
self
|
201
|
+
end
|
202
|
+
|
203
|
+
# Deserializes the data based on type
|
204
|
+
# @param string type Data type
|
205
|
+
# @param string value Value to be deserialized
|
206
|
+
# @return [Object] Deserialized data
|
207
|
+
def _deserialize(type, value)
|
208
|
+
case type.to_sym
|
209
|
+
when :DateTime
|
210
|
+
DateTime.parse(value)
|
211
|
+
when :Date
|
212
|
+
Date.parse(value)
|
213
|
+
when :String
|
214
|
+
value.to_s
|
215
|
+
when :Integer
|
216
|
+
value.to_i
|
217
|
+
when :Float
|
218
|
+
value.to_f
|
219
|
+
when :Boolean
|
220
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
221
|
+
true
|
222
|
+
else
|
223
|
+
false
|
224
|
+
end
|
225
|
+
when :Object
|
226
|
+
# generic object (usually a Hash), return directly
|
227
|
+
value
|
228
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
229
|
+
inner_type = Regexp.last_match[:inner_type]
|
230
|
+
value.map { |v| _deserialize(inner_type, v) }
|
231
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
232
|
+
k_type = Regexp.last_match[:k_type]
|
233
|
+
v_type = Regexp.last_match[:v_type]
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each do |k, v|
|
236
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
else # model
|
240
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
# Returns the string representation of the object
|
245
|
+
# @return [String] String presentation of the object
|
246
|
+
def to_s
|
247
|
+
to_hash.to_s
|
248
|
+
end
|
249
|
+
|
250
|
+
# to_body is an alias to to_hash (backward compatibility)
|
251
|
+
# @return [Hash] Returns the object in the form of hash
|
252
|
+
def to_body
|
253
|
+
to_hash
|
254
|
+
end
|
255
|
+
|
256
|
+
# Returns the object in the form of hash
|
257
|
+
# @return [Hash] Returns the object in the form of hash
|
258
|
+
def to_hash
|
259
|
+
hash = {}
|
260
|
+
self.class.attribute_map.each_pair do |attr, param|
|
261
|
+
value = self.send(attr)
|
262
|
+
if value.nil?
|
263
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
264
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
265
|
+
end
|
266
|
+
|
267
|
+
hash[param] = _to_hash(value)
|
268
|
+
end
|
269
|
+
hash
|
270
|
+
end
|
271
|
+
|
272
|
+
# Outputs non-array value in the form of hash
|
273
|
+
# For object, use to_hash. Otherwise, just return the value
|
274
|
+
# @param [Object] value Any valid value
|
275
|
+
# @return [Hash] Returns the value in the form of hash
|
276
|
+
def _to_hash(value)
|
277
|
+
if value.is_a?(Array)
|
278
|
+
value.compact.map { |v| _to_hash(v) }
|
279
|
+
elsif value.is_a?(Hash)
|
280
|
+
{}.tap do |hash|
|
281
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
282
|
+
end
|
283
|
+
elsif value.respond_to? :to_hash
|
284
|
+
value.to_hash
|
285
|
+
else
|
286
|
+
value
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|