mailslurp_client 15.12.16 → 15.13.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/inbox_controller_api.rb +89 -0
  3. data/lib/mailslurp_client/api/phone_controller_api.rb +64 -0
  4. data/lib/mailslurp_client/api/sent_emails_controller_api.rb +83 -3
  5. data/lib/mailslurp_client/api/sms_controller_api.rb +3 -3
  6. data/lib/mailslurp_client/api/wait_for_controller_api.rb +64 -0
  7. data/lib/mailslurp_client/api/webhook_controller_api.rb +70 -0
  8. data/lib/mailslurp_client/models/alias_projection.rb +19 -19
  9. data/lib/mailslurp_client/models/attachment_meta_data.rb +1 -1
  10. data/lib/mailslurp_client/models/bounce_projection.rb +22 -22
  11. data/lib/mailslurp_client/models/contact_projection.rb +13 -13
  12. data/lib/mailslurp_client/models/{delivery_status.rb → delivery_status_dto.rb} +18 -4
  13. data/lib/mailslurp_client/models/email.rb +11 -1
  14. data/lib/mailslurp_client/models/email_preview.rb +11 -1
  15. data/lib/mailslurp_client/models/email_projection.rb +42 -33
  16. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  17. data/lib/mailslurp_client/models/inbox_preview.rb +11 -1
  18. data/lib/mailslurp_client/models/missed_email_projection.rb +10 -10
  19. data/lib/mailslurp_client/models/organization_inbox_projection.rb +11 -1
  20. data/lib/mailslurp_client/models/page_delivery_status.rb +1 -1
  21. data/lib/mailslurp_client/models/page_sent_email_projection.rb +16 -16
  22. data/lib/mailslurp_client/models/page_sent_email_with_queue_projection.rb +16 -16
  23. data/lib/mailslurp_client/models/sent_email_dto.rb +11 -1
  24. data/lib/mailslurp_client/models/sent_email_projection.rb +56 -56
  25. data/lib/mailslurp_client/models/{sms_message.rb → sms_dto.rb} +9 -18
  26. data/lib/mailslurp_client/models/sms_preview.rb +15 -1
  27. data/lib/mailslurp_client/models/sms_projection.rb +32 -18
  28. data/lib/mailslurp_client/models/sort.rb +13 -13
  29. data/lib/mailslurp_client/models/test_phone_number_options.rb +211 -0
  30. data/lib/mailslurp_client/models/thread_projection.rb +20 -20
  31. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +10 -10
  32. data/lib/mailslurp_client/models/wait_for_single_sms_options.rb +304 -0
  33. data/lib/mailslurp_client/models/webhook_new_email_payload.rb +11 -1
  34. data/lib/mailslurp_client/version.rb +1 -1
  35. data/lib/mailslurp_client.rb +4 -2
  36. metadata +6 -4
@@ -13,7 +13,7 @@ OpenAPI Generator version: 4.3.1
13
13
  require 'date'
14
14
 
15
15
  module MailSlurpClient
16
- class SmsMessage
16
+ class SmsDto
17
17
  attr_accessor :id
18
18
 
19
19
  attr_accessor :user_id
@@ -26,8 +26,6 @@ module MailSlurpClient
26
26
 
27
27
  attr_accessor :read
28
28
 
29
- attr_accessor :sid
30
-
31
29
  attr_accessor :created_at
32
30
 
33
31
  attr_accessor :updated_at
@@ -41,7 +39,6 @@ module MailSlurpClient
41
39
  :'from_number' => :'fromNumber',
42
40
  :'body' => :'body',
43
41
  :'read' => :'read',
44
- :'sid' => :'sid',
45
42
  :'created_at' => :'createdAt',
46
43
  :'updated_at' => :'updatedAt'
47
44
  }
@@ -56,7 +53,6 @@ module MailSlurpClient
56
53
  :'from_number' => :'String',
57
54
  :'body' => :'String',
58
55
  :'read' => :'Boolean',
59
- :'sid' => :'String',
60
56
  :'created_at' => :'DateTime',
61
57
  :'updated_at' => :'DateTime'
62
58
  }
@@ -72,13 +68,13 @@ module MailSlurpClient
72
68
  # @param [Hash] attributes Model attributes in the form of hash
73
69
  def initialize(attributes = {})
74
70
  if (!attributes.is_a?(Hash))
75
- fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::SmsMessage` initialize method"
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::SmsDto` initialize method"
76
72
  end
77
73
 
78
74
  # check to see if the attribute exists and convert string to symbol for hash key
79
75
  attributes = attributes.each_with_object({}) { |(k, v), h|
80
76
  if (!self.class.attribute_map.key?(k.to_sym))
81
- fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::SmsMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MailSlurpClient::SmsDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
78
  end
83
79
  h[k.to_sym] = v
84
80
  }
@@ -107,10 +103,6 @@ module MailSlurpClient
107
103
  self.read = attributes[:'read']
108
104
  end
109
105
 
110
- if attributes.key?(:'sid')
111
- self.sid = attributes[:'sid']
112
- end
113
-
114
106
  if attributes.key?(:'created_at')
115
107
  self.created_at = attributes[:'created_at']
116
108
  end
@@ -124,6 +116,10 @@ module MailSlurpClient
124
116
  # @return Array for valid properties with the reasons
125
117
  def list_invalid_properties
126
118
  invalid_properties = Array.new
119
+ if @id.nil?
120
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
121
+ end
122
+
127
123
  if @user_id.nil?
128
124
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
129
125
  end
@@ -144,10 +140,6 @@ module MailSlurpClient
144
140
  invalid_properties.push('invalid value for "read", read cannot be nil.')
145
141
  end
146
142
 
147
- if @sid.nil?
148
- invalid_properties.push('invalid value for "sid", sid cannot be nil.')
149
- end
150
-
151
143
  if @created_at.nil?
152
144
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
153
145
  end
@@ -162,12 +154,12 @@ module MailSlurpClient
162
154
  # Check to see if the all the properties in the model are valid
163
155
  # @return true if the model is valid
164
156
  def valid?
157
+ return false if @id.nil?
165
158
  return false if @user_id.nil?
166
159
  return false if @phone_number.nil?
167
160
  return false if @from_number.nil?
168
161
  return false if @body.nil?
169
162
  return false if @read.nil?
170
- return false if @sid.nil?
171
163
  return false if @created_at.nil?
172
164
  return false if @updated_at.nil?
173
165
  true
@@ -184,7 +176,6 @@ module MailSlurpClient
184
176
  from_number == o.from_number &&
185
177
  body == o.body &&
186
178
  read == o.read &&
187
- sid == o.sid &&
188
179
  created_at == o.created_at &&
189
180
  updated_at == o.updated_at
190
181
  end
@@ -198,7 +189,7 @@ module MailSlurpClient
198
189
  # Calculates hash code according to all attributes.
199
190
  # @return [Integer] Hash code
200
191
  def hash
201
- [id, user_id, phone_number, from_number, body, read, sid, created_at, updated_at].hash
192
+ [id, user_id, phone_number, from_number, body, read, created_at, updated_at].hash
202
193
  end
203
194
 
204
195
  # Builds the object from hash
@@ -18,6 +18,8 @@ module MailSlurpClient
18
18
 
19
19
  attr_accessor :user_id
20
20
 
21
+ attr_accessor :body
22
+
21
23
  attr_accessor :phone_number
22
24
 
23
25
  attr_accessor :from_number
@@ -29,6 +31,7 @@ module MailSlurpClient
29
31
  {
30
32
  :'id' => :'id',
31
33
  :'user_id' => :'userId',
34
+ :'body' => :'body',
32
35
  :'phone_number' => :'phoneNumber',
33
36
  :'from_number' => :'fromNumber',
34
37
  :'created_at' => :'createdAt'
@@ -40,6 +43,7 @@ module MailSlurpClient
40
43
  {
41
44
  :'id' => :'String',
42
45
  :'user_id' => :'String',
46
+ :'body' => :'String',
43
47
  :'phone_number' => :'String',
44
48
  :'from_number' => :'String',
45
49
  :'created_at' => :'DateTime'
@@ -75,6 +79,10 @@ module MailSlurpClient
75
79
  self.user_id = attributes[:'user_id']
76
80
  end
77
81
 
82
+ if attributes.key?(:'body')
83
+ self.body = attributes[:'body']
84
+ end
85
+
78
86
  if attributes.key?(:'phone_number')
79
87
  self.phone_number = attributes[:'phone_number']
80
88
  end
@@ -100,6 +108,10 @@ module MailSlurpClient
100
108
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
101
109
  end
102
110
 
111
+ if @body.nil?
112
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
113
+ end
114
+
103
115
  if @phone_number.nil?
104
116
  invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
105
117
  end
@@ -120,6 +132,7 @@ module MailSlurpClient
120
132
  def valid?
121
133
  return false if @id.nil?
122
134
  return false if @user_id.nil?
135
+ return false if @body.nil?
123
136
  return false if @phone_number.nil?
124
137
  return false if @from_number.nil?
125
138
  return false if @created_at.nil?
@@ -133,6 +146,7 @@ module MailSlurpClient
133
146
  self.class == o.class &&
134
147
  id == o.id &&
135
148
  user_id == o.user_id &&
149
+ body == o.body &&
136
150
  phone_number == o.phone_number &&
137
151
  from_number == o.from_number &&
138
152
  created_at == o.created_at
@@ -147,7 +161,7 @@ module MailSlurpClient
147
161
  # Calculates hash code according to all attributes.
148
162
  # @return [Integer] Hash code
149
163
  def hash
150
- [id, user_id, phone_number, from_number, created_at].hash
164
+ [id, user_id, body, phone_number, from_number, created_at].hash
151
165
  end
152
166
 
153
167
  # Builds the object from hash
@@ -17,25 +17,28 @@ module MailSlurpClient
17
17
  class SmsProjection
18
18
  attr_accessor :id
19
19
 
20
+ attr_accessor :body
21
+
20
22
  attr_accessor :user_id
21
23
 
22
24
  attr_accessor :phone_number
23
25
 
24
26
  attr_accessor :created_at
25
27
 
26
- attr_accessor :read
27
-
28
28
  attr_accessor :from_number
29
29
 
30
+ attr_accessor :read
31
+
30
32
  # Attribute mapping from ruby-style variable name to JSON key.
31
33
  def self.attribute_map
32
34
  {
33
35
  :'id' => :'id',
36
+ :'body' => :'body',
34
37
  :'user_id' => :'userId',
35
38
  :'phone_number' => :'phoneNumber',
36
39
  :'created_at' => :'createdAt',
37
- :'read' => :'read',
38
- :'from_number' => :'fromNumber'
40
+ :'from_number' => :'fromNumber',
41
+ :'read' => :'read'
39
42
  }
40
43
  end
41
44
 
@@ -43,11 +46,12 @@ module MailSlurpClient
43
46
  def self.openapi_types
44
47
  {
45
48
  :'id' => :'String',
49
+ :'body' => :'String',
46
50
  :'user_id' => :'String',
47
51
  :'phone_number' => :'String',
48
52
  :'created_at' => :'DateTime',
49
- :'read' => :'Boolean',
50
- :'from_number' => :'String'
53
+ :'from_number' => :'String',
54
+ :'read' => :'Boolean'
51
55
  }
52
56
  end
53
57
 
@@ -76,6 +80,10 @@ module MailSlurpClient
76
80
  self.id = attributes[:'id']
77
81
  end
78
82
 
83
+ if attributes.key?(:'body')
84
+ self.body = attributes[:'body']
85
+ end
86
+
79
87
  if attributes.key?(:'user_id')
80
88
  self.user_id = attributes[:'user_id']
81
89
  end
@@ -88,13 +96,13 @@ module MailSlurpClient
88
96
  self.created_at = attributes[:'created_at']
89
97
  end
90
98
 
91
- if attributes.key?(:'read')
92
- self.read = attributes[:'read']
93
- end
94
-
95
99
  if attributes.key?(:'from_number')
96
100
  self.from_number = attributes[:'from_number']
97
101
  end
102
+
103
+ if attributes.key?(:'read')
104
+ self.read = attributes[:'read']
105
+ end
98
106
  end
99
107
 
100
108
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -105,6 +113,10 @@ module MailSlurpClient
105
113
  invalid_properties.push('invalid value for "id", id cannot be nil.')
106
114
  end
107
115
 
116
+ if @body.nil?
117
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
118
+ end
119
+
108
120
  if @user_id.nil?
109
121
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
110
122
  end
@@ -117,14 +129,14 @@ module MailSlurpClient
117
129
  invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
118
130
  end
119
131
 
120
- if @read.nil?
121
- invalid_properties.push('invalid value for "read", read cannot be nil.')
122
- end
123
-
124
132
  if @from_number.nil?
125
133
  invalid_properties.push('invalid value for "from_number", from_number cannot be nil.')
126
134
  end
127
135
 
136
+ if @read.nil?
137
+ invalid_properties.push('invalid value for "read", read cannot be nil.')
138
+ end
139
+
128
140
  invalid_properties
129
141
  end
130
142
 
@@ -132,11 +144,12 @@ module MailSlurpClient
132
144
  # @return true if the model is valid
133
145
  def valid?
134
146
  return false if @id.nil?
147
+ return false if @body.nil?
135
148
  return false if @user_id.nil?
136
149
  return false if @phone_number.nil?
137
150
  return false if @created_at.nil?
138
- return false if @read.nil?
139
151
  return false if @from_number.nil?
152
+ return false if @read.nil?
140
153
  true
141
154
  end
142
155
 
@@ -146,11 +159,12 @@ module MailSlurpClient
146
159
  return true if self.equal?(o)
147
160
  self.class == o.class &&
148
161
  id == o.id &&
162
+ body == o.body &&
149
163
  user_id == o.user_id &&
150
164
  phone_number == o.phone_number &&
151
165
  created_at == o.created_at &&
152
- read == o.read &&
153
- from_number == o.from_number
166
+ from_number == o.from_number &&
167
+ read == o.read
154
168
  end
155
169
 
156
170
  # @see the `==` method
@@ -162,7 +176,7 @@ module MailSlurpClient
162
176
  # Calculates hash code according to all attributes.
163
177
  # @return [Integer] Hash code
164
178
  def hash
165
- [id, user_id, phone_number, created_at, read, from_number].hash
179
+ [id, body, user_id, phone_number, created_at, from_number, read].hash
166
180
  end
167
181
 
168
182
  # Builds the object from hash
@@ -16,16 +16,16 @@ module MailSlurpClient
16
16
  class Sort
17
17
  attr_accessor :empty
18
18
 
19
- attr_accessor :sorted
20
-
21
19
  attr_accessor :unsorted
22
20
 
21
+ attr_accessor :sorted
22
+
23
23
  # Attribute mapping from ruby-style variable name to JSON key.
24
24
  def self.attribute_map
25
25
  {
26
26
  :'empty' => :'empty',
27
- :'sorted' => :'sorted',
28
- :'unsorted' => :'unsorted'
27
+ :'unsorted' => :'unsorted',
28
+ :'sorted' => :'sorted'
29
29
  }
30
30
  end
31
31
 
@@ -33,8 +33,8 @@ module MailSlurpClient
33
33
  def self.openapi_types
34
34
  {
35
35
  :'empty' => :'Boolean',
36
- :'sorted' => :'Boolean',
37
- :'unsorted' => :'Boolean'
36
+ :'unsorted' => :'Boolean',
37
+ :'sorted' => :'Boolean'
38
38
  }
39
39
  end
40
40
 
@@ -63,13 +63,13 @@ module MailSlurpClient
63
63
  self.empty = attributes[:'empty']
64
64
  end
65
65
 
66
- if attributes.key?(:'sorted')
67
- self.sorted = attributes[:'sorted']
68
- end
69
-
70
66
  if attributes.key?(:'unsorted')
71
67
  self.unsorted = attributes[:'unsorted']
72
68
  end
69
+
70
+ if attributes.key?(:'sorted')
71
+ self.sorted = attributes[:'sorted']
72
+ end
73
73
  end
74
74
 
75
75
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -91,8 +91,8 @@ module MailSlurpClient
91
91
  return true if self.equal?(o)
92
92
  self.class == o.class &&
93
93
  empty == o.empty &&
94
- sorted == o.sorted &&
95
- unsorted == o.unsorted
94
+ unsorted == o.unsorted &&
95
+ sorted == o.sorted
96
96
  end
97
97
 
98
98
  # @see the `==` method
@@ -104,7 +104,7 @@ module MailSlurpClient
104
104
  # Calculates hash code according to all attributes.
105
105
  # @return [Integer] Hash code
106
106
  def hash
107
- [empty, sorted, unsorted].hash
107
+ [empty, unsorted, sorted].hash
108
108
  end
109
109
 
110
110
  # 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 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 TestPhoneNumberOptions
17
+ attr_accessor :message
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'message' => :'message'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'message' => :'String'
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::TestPhoneNumberOptions` 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::TestPhoneNumberOptions`. 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?(:'message')
55
+ self.message = attributes[:'message']
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 @message.nil?
64
+ invalid_properties.push('invalid value for "message", message 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 @message.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
+ message == o.message
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
+ [message].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