mailslurp_client 12.1.23 → 12.1.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/mailslurp_client.rb +5 -0
- data/lib/mailslurp_client/api/export_controller_api.rb +199 -0
- data/lib/mailslurp_client/api/webhook_controller_api.rb +200 -0
- data/lib/mailslurp_client/models/create_webhook_options.rb +2 -2
- data/lib/mailslurp_client/models/export_link.rb +212 -0
- data/lib/mailslurp_client/models/export_options.rb +291 -0
- data/lib/mailslurp_client/models/page_webhook_projection.rb +1 -1
- data/lib/mailslurp_client/models/page_webhook_result.rb +299 -0
- data/lib/mailslurp_client/models/webhook_dto.rb +14 -4
- data/lib/mailslurp_client/models/webhook_result_entity.rb +410 -0
- data/lib/mailslurp_client/version.rb +1 -1
- metadata +7 -2
@@ -17,13 +17,13 @@ module MailSlurpClient
|
|
17
17
|
class CreateWebhookOptions
|
18
18
|
attr_accessor :basic_auth
|
19
19
|
|
20
|
-
# Optional webhook event name. Default is `EMAIL_RECEIVED
|
20
|
+
# Optional webhook event name. Default is `EMAIL_RECEIVED` and is triggered when an email is received by the inbox associated with the webhook. Payload differ according to the webhook event name. The other events are `NEW_EMAIL`, `NEW_CONTACT`, and `NEW_ATTACHMENT`.
|
21
21
|
attr_accessor :event_name
|
22
22
|
|
23
23
|
# Optional name for the webhook
|
24
24
|
attr_accessor :name
|
25
25
|
|
26
|
-
# Public URL on your server that MailSlurp can post WebhookNotification payload to when an email is received. The payload of the submitted JSON is described by https://api.mailslurp.com/schemas/webhook-payload
|
26
|
+
# Public URL on your server that MailSlurp can post WebhookNotification payload to when an email is received or an event is trigger. The payload of the submitted JSON is dependent on the webhook event type. The default `EMAIL_RECEIVED` payload is described by `https://api.mailslurp.com/schemas/webhook-payload`. The other events, `NEW_EMAIL`, `NEW_CONTACT`, and `NEW_ATTACHMENT` are described by `https://api.mailslurp.com/schemas/webhook-new-email-payload`, `https://api.mailslurp.com/schemas/webhook-new-contact-payload`,`https://api.mailslurp.com/schemas/webhook-new-attachment-payload` respectively.
|
27
27
|
attr_accessor :url
|
28
28
|
|
29
29
|
class EnumAttributeValidator
|
@@ -0,0 +1,212 @@
|
|
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
|
+
# Export download link
|
17
|
+
class ExportLink
|
18
|
+
attr_accessor :download_link
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'download_link' => :'downloadLink'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.openapi_types
|
29
|
+
{
|
30
|
+
:'download_link' => :'String'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# List of attributes with nullable: true
|
35
|
+
def self.openapi_nullable
|
36
|
+
Set.new([
|
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::ExportLink` 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::ExportLink`. 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?(:'download_link')
|
56
|
+
self.download_link = attributes[:'download_link']
|
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
|
+
if @download_link.nil?
|
65
|
+
invalid_properties.push('invalid value for "download_link", download_link cannot be nil.')
|
66
|
+
end
|
67
|
+
|
68
|
+
invalid_properties
|
69
|
+
end
|
70
|
+
|
71
|
+
# Check to see if the all the properties in the model are valid
|
72
|
+
# @return true if the model is valid
|
73
|
+
def valid?
|
74
|
+
return false if @download_link.nil?
|
75
|
+
true
|
76
|
+
end
|
77
|
+
|
78
|
+
# Checks equality by comparing each attribute.
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
download_link == o.download_link
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def eql?(o)
|
89
|
+
self == o
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calculates hash code according to all attributes.
|
93
|
+
# @return [Integer] Hash code
|
94
|
+
def hash
|
95
|
+
[download_link].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
new.build_from_hash(attributes)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
108
|
+
def build_from_hash(attributes)
|
109
|
+
return nil unless attributes.is_a?(Hash)
|
110
|
+
self.class.openapi_types.each_pair do |key, type|
|
111
|
+
if type =~ /\AArray<(.*)>/i
|
112
|
+
# check to ensure the input is an array given that the attribute
|
113
|
+
# is documented as an array but the input is not
|
114
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
115
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
116
|
+
end
|
117
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
118
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
119
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
120
|
+
end
|
121
|
+
|
122
|
+
self
|
123
|
+
end
|
124
|
+
|
125
|
+
# Deserializes the data based on type
|
126
|
+
# @param string type Data type
|
127
|
+
# @param string value Value to be deserialized
|
128
|
+
# @return [Object] Deserialized data
|
129
|
+
def _deserialize(type, value)
|
130
|
+
case type.to_sym
|
131
|
+
when :DateTime
|
132
|
+
DateTime.parse(value)
|
133
|
+
when :Date
|
134
|
+
Date.parse(value)
|
135
|
+
when :String
|
136
|
+
value.to_s
|
137
|
+
when :Integer
|
138
|
+
value.to_i
|
139
|
+
when :Float
|
140
|
+
value.to_f
|
141
|
+
when :Boolean
|
142
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
|
+
true
|
144
|
+
else
|
145
|
+
false
|
146
|
+
end
|
147
|
+
when :Object
|
148
|
+
# generic object (usually a Hash), return directly
|
149
|
+
value
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
153
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
156
|
+
{}.tap do |hash|
|
157
|
+
value.each do |k, v|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
else # model
|
162
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
168
|
+
def to_s
|
169
|
+
to_hash.to_s
|
170
|
+
end
|
171
|
+
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
174
|
+
def to_body
|
175
|
+
to_hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_hash
|
181
|
+
hash = {}
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
183
|
+
value = self.send(attr)
|
184
|
+
if value.nil?
|
185
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
186
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
187
|
+
end
|
188
|
+
|
189
|
+
hash[param] = _to_hash(value)
|
190
|
+
end
|
191
|
+
hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Outputs non-array value in the form of hash
|
195
|
+
# For object, use to_hash. Otherwise, just return the value
|
196
|
+
# @param [Object] value Any valid value
|
197
|
+
# @return [Hash] Returns the value in the form of hash
|
198
|
+
def _to_hash(value)
|
199
|
+
if value.is_a?(Array)
|
200
|
+
value.compact.map { |v| _to_hash(v) }
|
201
|
+
elsif value.is_a?(Hash)
|
202
|
+
{}.tap do |hash|
|
203
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
204
|
+
end
|
205
|
+
elsif value.respond_to? :to_hash
|
206
|
+
value.to_hash
|
207
|
+
else
|
208
|
+
value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
@@ -0,0 +1,291 @@
|
|
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
|
+
# Options for exporting user data
|
17
|
+
class ExportOptions
|
18
|
+
attr_accessor :output_format
|
19
|
+
|
20
|
+
attr_accessor :exclude_previously_exported
|
21
|
+
|
22
|
+
attr_accessor :created_earliest_time
|
23
|
+
|
24
|
+
attr_accessor :created_oldest_time
|
25
|
+
|
26
|
+
attr_accessor :filter
|
27
|
+
|
28
|
+
attr_accessor :list_separator_token
|
29
|
+
|
30
|
+
class EnumAttributeValidator
|
31
|
+
attr_reader :datatype
|
32
|
+
attr_reader :allowable_values
|
33
|
+
|
34
|
+
def initialize(datatype, allowable_values)
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
36
|
+
case datatype.to_s
|
37
|
+
when /Integer/i
|
38
|
+
value.to_i
|
39
|
+
when /Float/i
|
40
|
+
value.to_f
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def valid?(value)
|
48
|
+
!value || allowable_values.include?(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'output_format' => :'outputFormat',
|
56
|
+
:'exclude_previously_exported' => :'excludePreviouslyExported',
|
57
|
+
:'created_earliest_time' => :'createdEarliestTime',
|
58
|
+
:'created_oldest_time' => :'createdOldestTime',
|
59
|
+
:'filter' => :'filter',
|
60
|
+
:'list_separator_token' => :'listSeparatorToken'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.openapi_types
|
66
|
+
{
|
67
|
+
:'output_format' => :'String',
|
68
|
+
:'exclude_previously_exported' => :'Boolean',
|
69
|
+
:'created_earliest_time' => :'DateTime',
|
70
|
+
:'created_oldest_time' => :'DateTime',
|
71
|
+
:'filter' => :'String',
|
72
|
+
:'list_separator_token' => :'Object'
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# List of attributes with nullable: true
|
77
|
+
def self.openapi_nullable
|
78
|
+
Set.new([
|
79
|
+
])
|
80
|
+
end
|
81
|
+
|
82
|
+
# Initializes the object
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
84
|
+
def initialize(attributes = {})
|
85
|
+
if (!attributes.is_a?(Hash))
|
86
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::ExportOptions` initialize method"
|
87
|
+
end
|
88
|
+
|
89
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
90
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
91
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
92
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::ExportOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
93
|
+
end
|
94
|
+
h[k.to_sym] = v
|
95
|
+
}
|
96
|
+
|
97
|
+
if attributes.key?(:'output_format')
|
98
|
+
self.output_format = attributes[:'output_format']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'exclude_previously_exported')
|
102
|
+
self.exclude_previously_exported = attributes[:'exclude_previously_exported']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'created_earliest_time')
|
106
|
+
self.created_earliest_time = attributes[:'created_earliest_time']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'created_oldest_time')
|
110
|
+
self.created_oldest_time = attributes[:'created_oldest_time']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'filter')
|
114
|
+
self.filter = attributes[:'filter']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'list_separator_token')
|
118
|
+
self.list_separator_token = attributes[:'list_separator_token']
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
123
|
+
# @return Array for valid properties with the reasons
|
124
|
+
def list_invalid_properties
|
125
|
+
invalid_properties = Array.new
|
126
|
+
if @output_format.nil?
|
127
|
+
invalid_properties.push('invalid value for "output_format", output_format cannot be nil.')
|
128
|
+
end
|
129
|
+
|
130
|
+
invalid_properties
|
131
|
+
end
|
132
|
+
|
133
|
+
# Check to see if the all the properties in the model are valid
|
134
|
+
# @return true if the model is valid
|
135
|
+
def valid?
|
136
|
+
return false if @output_format.nil?
|
137
|
+
output_format_validator = EnumAttributeValidator.new('String', ["CSV_DEFAULT", "CSV_EXCEL"])
|
138
|
+
return false unless output_format_validator.valid?(@output_format)
|
139
|
+
true
|
140
|
+
end
|
141
|
+
|
142
|
+
# Custom attribute writer method checking allowed values (enum).
|
143
|
+
# @param [Object] output_format Object to be assigned
|
144
|
+
def output_format=(output_format)
|
145
|
+
validator = EnumAttributeValidator.new('String', ["CSV_DEFAULT", "CSV_EXCEL"])
|
146
|
+
unless validator.valid?(output_format)
|
147
|
+
fail ArgumentError, "invalid value for \"output_format\", must be one of #{validator.allowable_values}."
|
148
|
+
end
|
149
|
+
@output_format = output_format
|
150
|
+
end
|
151
|
+
|
152
|
+
# Checks equality by comparing each attribute.
|
153
|
+
# @param [Object] Object to be compared
|
154
|
+
def ==(o)
|
155
|
+
return true if self.equal?(o)
|
156
|
+
self.class == o.class &&
|
157
|
+
output_format == o.output_format &&
|
158
|
+
exclude_previously_exported == o.exclude_previously_exported &&
|
159
|
+
created_earliest_time == o.created_earliest_time &&
|
160
|
+
created_oldest_time == o.created_oldest_time &&
|
161
|
+
filter == o.filter &&
|
162
|
+
list_separator_token == o.list_separator_token
|
163
|
+
end
|
164
|
+
|
165
|
+
# @see the `==` method
|
166
|
+
# @param [Object] Object to be compared
|
167
|
+
def eql?(o)
|
168
|
+
self == o
|
169
|
+
end
|
170
|
+
|
171
|
+
# Calculates hash code according to all attributes.
|
172
|
+
# @return [Integer] Hash code
|
173
|
+
def hash
|
174
|
+
[output_format, exclude_previously_exported, created_earliest_time, created_oldest_time, filter, list_separator_token].hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Builds the object from hash
|
178
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
179
|
+
# @return [Object] Returns the model itself
|
180
|
+
def self.build_from_hash(attributes)
|
181
|
+
new.build_from_hash(attributes)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Builds the object from hash
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
186
|
+
# @return [Object] Returns the model itself
|
187
|
+
def build_from_hash(attributes)
|
188
|
+
return nil unless attributes.is_a?(Hash)
|
189
|
+
self.class.openapi_types.each_pair do |key, type|
|
190
|
+
if type =~ /\AArray<(.*)>/i
|
191
|
+
# check to ensure the input is an array given that the attribute
|
192
|
+
# is documented as an array but the input is not
|
193
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
194
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
195
|
+
end
|
196
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
197
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
198
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
199
|
+
end
|
200
|
+
|
201
|
+
self
|
202
|
+
end
|
203
|
+
|
204
|
+
# Deserializes the data based on type
|
205
|
+
# @param string type Data type
|
206
|
+
# @param string value Value to be deserialized
|
207
|
+
# @return [Object] Deserialized data
|
208
|
+
def _deserialize(type, value)
|
209
|
+
case type.to_sym
|
210
|
+
when :DateTime
|
211
|
+
DateTime.parse(value)
|
212
|
+
when :Date
|
213
|
+
Date.parse(value)
|
214
|
+
when :String
|
215
|
+
value.to_s
|
216
|
+
when :Integer
|
217
|
+
value.to_i
|
218
|
+
when :Float
|
219
|
+
value.to_f
|
220
|
+
when :Boolean
|
221
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
222
|
+
true
|
223
|
+
else
|
224
|
+
false
|
225
|
+
end
|
226
|
+
when :Object
|
227
|
+
# generic object (usually a Hash), return directly
|
228
|
+
value
|
229
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
230
|
+
inner_type = Regexp.last_match[:inner_type]
|
231
|
+
value.map { |v| _deserialize(inner_type, v) }
|
232
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
233
|
+
k_type = Regexp.last_match[:k_type]
|
234
|
+
v_type = Regexp.last_match[:v_type]
|
235
|
+
{}.tap do |hash|
|
236
|
+
value.each do |k, v|
|
237
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
else # model
|
241
|
+
MailSlurpClient.const_get(type).build_from_hash(value)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the string representation of the object
|
246
|
+
# @return [String] String presentation of the object
|
247
|
+
def to_s
|
248
|
+
to_hash.to_s
|
249
|
+
end
|
250
|
+
|
251
|
+
# to_body is an alias to to_hash (backward compatibility)
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
253
|
+
def to_body
|
254
|
+
to_hash
|
255
|
+
end
|
256
|
+
|
257
|
+
# Returns the object in the form of hash
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
259
|
+
def to_hash
|
260
|
+
hash = {}
|
261
|
+
self.class.attribute_map.each_pair do |attr, param|
|
262
|
+
value = self.send(attr)
|
263
|
+
if value.nil?
|
264
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
265
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
266
|
+
end
|
267
|
+
|
268
|
+
hash[param] = _to_hash(value)
|
269
|
+
end
|
270
|
+
hash
|
271
|
+
end
|
272
|
+
|
273
|
+
# Outputs non-array value in the form of hash
|
274
|
+
# For object, use to_hash. Otherwise, just return the value
|
275
|
+
# @param [Object] value Any valid value
|
276
|
+
# @return [Hash] Returns the value in the form of hash
|
277
|
+
def _to_hash(value)
|
278
|
+
if value.is_a?(Array)
|
279
|
+
value.compact.map { |v| _to_hash(v) }
|
280
|
+
elsif value.is_a?(Hash)
|
281
|
+
{}.tap do |hash|
|
282
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
283
|
+
end
|
284
|
+
elsif value.respond_to? :to_hash
|
285
|
+
value.to_hash
|
286
|
+
else
|
287
|
+
value
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|