mailslurp_client 15.20.0 → 15.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/lib/mailslurp_client/api/attachment_controller_api.rb +6 -0
  3. data/lib/mailslurp_client/api/bounce_controller_api.rb +79 -0
  4. data/lib/mailslurp_client/api/inbox_controller_api.rb +56 -2
  5. data/lib/mailslurp_client/api/o_auth_connection_api.rb +170 -0
  6. data/lib/mailslurp_client/api/phone_controller_api.rb +381 -1
  7. data/lib/mailslurp_client/api/user_controller_api.rb +267 -0
  8. data/lib/mailslurp_client/models/alias_projection.rb +29 -29
  9. data/lib/mailslurp_client/models/alias_thread_projection.rb +39 -39
  10. data/lib/mailslurp_client/models/attachment_projection.rb +25 -25
  11. data/lib/mailslurp_client/models/bounce_projection.rb +22 -22
  12. data/lib/mailslurp_client/models/bounce_recipient_projection.rb +10 -10
  13. data/lib/mailslurp_client/models/connector_event_projection.rb +15 -15
  14. data/lib/mailslurp_client/models/connector_projection.rb +15 -15
  15. data/lib/mailslurp_client/models/contact_projection.rb +10 -10
  16. data/lib/mailslurp_client/models/create_emergency_address_options.rb +2 -2
  17. data/lib/mailslurp_client/models/create_o_auth_connection_result.rb +211 -0
  18. data/lib/mailslurp_client/models/create_o_auth_exchange_result.rb +229 -0
  19. data/lib/mailslurp_client/models/create_phone_number_options.rb +284 -0
  20. data/lib/mailslurp_client/models/domain_dto.rb +27 -1
  21. data/lib/mailslurp_client/models/email.rb +12 -1
  22. data/lib/mailslurp_client/models/email_preview.rb +15 -5
  23. data/lib/mailslurp_client/models/email_projection.rb +35 -25
  24. data/lib/mailslurp_client/models/email_thread_projection.rb +52 -52
  25. data/lib/mailslurp_client/models/emergency_address.rb +2 -2
  26. data/lib/mailslurp_client/models/emergency_address_dto.rb +2 -2
  27. data/lib/mailslurp_client/models/entity_automation_item_projection.rb +295 -0
  28. data/lib/mailslurp_client/models/entity_event_item_projection.rb +303 -0
  29. data/lib/mailslurp_client/models/entity_favourite_item_projection.rb +296 -0
  30. data/lib/mailslurp_client/models/expired_inbox_record_projection.rb +15 -15
  31. data/lib/mailslurp_client/models/guest_portal_user_projection.rb +39 -39
  32. data/lib/mailslurp_client/models/inbox_dto.rb +2 -2
  33. data/lib/mailslurp_client/models/inbox_forwarder_event_projection.rb +10 -10
  34. data/lib/mailslurp_client/models/inbox_preview.rb +2 -2
  35. data/lib/mailslurp_client/models/inbox_replier_event_projection.rb +10 -10
  36. data/lib/mailslurp_client/models/list_unsubscribe_recipient_projection.rb +15 -15
  37. data/lib/mailslurp_client/models/missed_email_projection.rb +14 -14
  38. data/lib/mailslurp_client/models/opt_in_identity_projection.rb +29 -29
  39. data/lib/mailslurp_client/models/organization_inbox_projection.rb +2 -2
  40. data/lib/mailslurp_client/models/page_entity_automation_items.rb +309 -0
  41. data/lib/mailslurp_client/models/page_entity_event_items.rb +309 -0
  42. data/lib/mailslurp_client/models/page_entity_favourite_items.rb +309 -0
  43. data/lib/mailslurp_client/models/page_phone_message_thread_item_projection.rb +309 -0
  44. data/lib/mailslurp_client/models/page_phone_message_thread_projection.rb +309 -0
  45. data/lib/mailslurp_client/models/page_reputation_items.rb +309 -0
  46. data/lib/mailslurp_client/models/phone_message_thread_item_projection.rb +315 -0
  47. data/lib/mailslurp_client/models/phone_message_thread_projection.rb +315 -0
  48. data/lib/mailslurp_client/models/phone_number_dto.rb +2 -2
  49. data/lib/mailslurp_client/models/phone_number_projection.rb +17 -17
  50. data/lib/mailslurp_client/models/phone_plan_availability_item.rb +2 -2
  51. data/lib/mailslurp_client/models/phone_plan_dto.rb +2 -2
  52. data/lib/mailslurp_client/models/plus_address_projection.rb +29 -29
  53. data/lib/mailslurp_client/models/reputation_item_projection.rb +317 -0
  54. data/lib/mailslurp_client/models/search_inboxes_options.rb +2 -2
  55. data/lib/mailslurp_client/models/sent_email_dto.rb +12 -1
  56. data/lib/mailslurp_client/models/sent_email_projection.rb +25 -25
  57. data/lib/mailslurp_client/models/sent_sms_projection.rb +15 -15
  58. data/lib/mailslurp_client/models/sms_preview.rb +15 -1
  59. data/lib/mailslurp_client/models/sms_projection.rb +15 -15
  60. data/lib/mailslurp_client/models/template_projection.rb +15 -15
  61. data/lib/mailslurp_client/models/tracking_pixel_projection.rb +15 -15
  62. data/lib/mailslurp_client/models/unknown_missed_email_projection.rb +10 -10
  63. data/lib/mailslurp_client/models/wait_for_sms_conditions.rb +1 -1
  64. data/lib/mailslurp_client/models/webhook_projection.rb +47 -47
  65. data/lib/mailslurp_client/version.rb +1 -1
  66. data/lib/mailslurp_client.rb +16 -0
  67. metadata +18 -2
@@ -15,10 +15,10 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # ConnectorEventProjection
17
17
  class ConnectorEventProjection
18
- attr_accessor :created_at
19
-
20
18
  attr_accessor :event_type
21
19
 
20
+ attr_accessor :created_at
21
+
22
22
  attr_accessor :connector_id
23
23
 
24
24
  attr_accessor :seen
@@ -56,8 +56,8 @@ module MailSlurpClient
56
56
  # Attribute mapping from ruby-style variable name to JSON key.
57
57
  def self.attribute_map
58
58
  {
59
- :'created_at' => :'createdAt',
60
59
  :'event_type' => :'eventType',
60
+ :'created_at' => :'createdAt',
61
61
  :'connector_id' => :'connectorId',
62
62
  :'seen' => :'seen',
63
63
  :'message' => :'message',
@@ -70,8 +70,8 @@ module MailSlurpClient
70
70
  # Attribute type mapping.
71
71
  def self.openapi_types
72
72
  {
73
- :'created_at' => :'DateTime',
74
73
  :'event_type' => :'String',
74
+ :'created_at' => :'DateTime',
75
75
  :'connector_id' => :'String',
76
76
  :'seen' => :'Boolean',
77
77
  :'message' => :'String',
@@ -102,14 +102,14 @@ module MailSlurpClient
102
102
  h[k.to_sym] = v
103
103
  }
104
104
 
105
- if attributes.key?(:'created_at')
106
- self.created_at = attributes[:'created_at']
107
- end
108
-
109
105
  if attributes.key?(:'event_type')
110
106
  self.event_type = attributes[:'event_type']
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?(:'connector_id')
114
114
  self.connector_id = attributes[:'connector_id']
115
115
  end
@@ -139,14 +139,14 @@ 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 @created_at.nil?
143
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
144
- end
145
-
146
142
  if @event_type.nil?
147
143
  invalid_properties.push('invalid value for "event_type", event_type cannot be nil.')
148
144
  end
149
145
 
146
+ if @created_at.nil?
147
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
148
+ end
149
+
150
150
  if @connector_id.nil?
151
151
  invalid_properties.push('invalid value for "connector_id", connector_id cannot be nil.')
152
152
  end
@@ -165,10 +165,10 @@ module MailSlurpClient
165
165
  # Check to see if the all the properties in the model are valid
166
166
  # @return true if the model is valid
167
167
  def valid?
168
- return false if @created_at.nil?
169
168
  return false if @event_type.nil?
170
169
  event_type_validator = EnumAttributeValidator.new('String', ["SEND", "SYNC"])
171
170
  return false unless event_type_validator.valid?(@event_type)
171
+ return false if @created_at.nil?
172
172
  return false if @connector_id.nil?
173
173
  return false if @size.nil?
174
174
  return false if @status.nil?
@@ -202,8 +202,8 @@ module MailSlurpClient
202
202
  def ==(o)
203
203
  return true if self.equal?(o)
204
204
  self.class == o.class &&
205
- created_at == o.created_at &&
206
205
  event_type == o.event_type &&
206
+ created_at == o.created_at &&
207
207
  connector_id == o.connector_id &&
208
208
  seen == o.seen &&
209
209
  message == o.message &&
@@ -221,7 +221,7 @@ module MailSlurpClient
221
221
  # Calculates hash code according to all attributes.
222
222
  # @return [Integer] Hash code
223
223
  def hash
224
- [created_at, event_type, connector_id, seen, message, id, size, status].hash
224
+ [event_type, created_at, connector_id, seen, message, id, size, status].hash
225
225
  end
226
226
 
227
227
  # Builds the object from hash
@@ -15,8 +15,6 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Connector
17
17
  class ConnectorProjection
18
- attr_accessor :created_at
19
-
20
18
  attr_accessor :enabled
21
19
 
22
20
  attr_accessor :user_id
@@ -25,6 +23,8 @@ module MailSlurpClient
25
23
 
26
24
  attr_accessor :inbox_id
27
25
 
26
+ attr_accessor :created_at
27
+
28
28
  attr_accessor :name
29
29
 
30
30
  attr_accessor :id
@@ -32,11 +32,11 @@ module MailSlurpClient
32
32
  # Attribute mapping from ruby-style variable name to JSON key.
33
33
  def self.attribute_map
34
34
  {
35
- :'created_at' => :'createdAt',
36
35
  :'enabled' => :'enabled',
37
36
  :'user_id' => :'userId',
38
37
  :'email_address' => :'emailAddress',
39
38
  :'inbox_id' => :'inboxId',
39
+ :'created_at' => :'createdAt',
40
40
  :'name' => :'name',
41
41
  :'id' => :'id'
42
42
  }
@@ -45,11 +45,11 @@ module MailSlurpClient
45
45
  # Attribute type mapping.
46
46
  def self.openapi_types
47
47
  {
48
- :'created_at' => :'DateTime',
49
48
  :'enabled' => :'Boolean',
50
49
  :'user_id' => :'String',
51
50
  :'email_address' => :'String',
52
51
  :'inbox_id' => :'String',
52
+ :'created_at' => :'DateTime',
53
53
  :'name' => :'String',
54
54
  :'id' => :'String'
55
55
  }
@@ -76,10 +76,6 @@ module MailSlurpClient
76
76
  h[k.to_sym] = v
77
77
  }
78
78
 
79
- if attributes.key?(:'created_at')
80
- self.created_at = attributes[:'created_at']
81
- end
82
-
83
79
  if attributes.key?(:'enabled')
84
80
  self.enabled = attributes[:'enabled']
85
81
  end
@@ -96,6 +92,10 @@ module MailSlurpClient
96
92
  self.inbox_id = attributes[:'inbox_id']
97
93
  end
98
94
 
95
+ if attributes.key?(:'created_at')
96
+ self.created_at = attributes[:'created_at']
97
+ end
98
+
99
99
  if attributes.key?(:'name')
100
100
  self.name = attributes[:'name']
101
101
  end
@@ -109,10 +109,6 @@ module MailSlurpClient
109
109
  # @return Array for valid properties with the reasons
110
110
  def list_invalid_properties
111
111
  invalid_properties = Array.new
112
- if @created_at.nil?
113
- invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
114
- end
115
-
116
112
  if @user_id.nil?
117
113
  invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
118
114
  end
@@ -121,6 +117,10 @@ module MailSlurpClient
121
117
  invalid_properties.push('invalid value for "inbox_id", inbox_id cannot be nil.')
122
118
  end
123
119
 
120
+ if @created_at.nil?
121
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
122
+ end
123
+
124
124
  if @id.nil?
125
125
  invalid_properties.push('invalid value for "id", id cannot be nil.')
126
126
  end
@@ -131,9 +131,9 @@ module MailSlurpClient
131
131
  # Check to see if the all the properties in the model are valid
132
132
  # @return true if the model is valid
133
133
  def valid?
134
- return false if @created_at.nil?
135
134
  return false if @user_id.nil?
136
135
  return false if @inbox_id.nil?
136
+ return false if @created_at.nil?
137
137
  return false if @id.nil?
138
138
  true
139
139
  end
@@ -143,11 +143,11 @@ module MailSlurpClient
143
143
  def ==(o)
144
144
  return true if self.equal?(o)
145
145
  self.class == o.class &&
146
- created_at == o.created_at &&
147
146
  enabled == o.enabled &&
148
147
  user_id == o.user_id &&
149
148
  email_address == o.email_address &&
150
149
  inbox_id == o.inbox_id &&
150
+ created_at == o.created_at &&
151
151
  name == o.name &&
152
152
  id == o.id
153
153
  end
@@ -161,7 +161,7 @@ module MailSlurpClient
161
161
  # Calculates hash code according to all attributes.
162
162
  # @return [Integer] Hash code
163
163
  def hash
164
- [created_at, enabled, user_id, email_address, inbox_id, name, id].hash
164
+ [enabled, user_id, email_address, inbox_id, created_at, name, id].hash
165
165
  end
166
166
 
167
167
  # Builds the object from hash
@@ -15,10 +15,10 @@ require 'date'
15
15
  module MailSlurpClient
16
16
  # Email contact for address book
17
17
  class ContactProjection
18
- attr_accessor :created_at
19
-
20
18
  attr_accessor :email_address
21
19
 
20
+ attr_accessor :created_at
21
+
22
22
  attr_accessor :email_addresses
23
23
 
24
24
  attr_accessor :first_name
@@ -36,8 +36,8 @@ module MailSlurpClient
36
36
  # Attribute mapping from ruby-style variable name to JSON key.
37
37
  def self.attribute_map
38
38
  {
39
- :'created_at' => :'createdAt',
40
39
  :'email_address' => :'emailAddress',
40
+ :'created_at' => :'createdAt',
41
41
  :'email_addresses' => :'emailAddresses',
42
42
  :'first_name' => :'firstName',
43
43
  :'last_name' => :'lastName',
@@ -51,8 +51,8 @@ module MailSlurpClient
51
51
  # Attribute type mapping.
52
52
  def self.openapi_types
53
53
  {
54
- :'created_at' => :'DateTime',
55
54
  :'email_address' => :'String',
55
+ :'created_at' => :'DateTime',
56
56
  :'email_addresses' => :'Array<String>',
57
57
  :'first_name' => :'String',
58
58
  :'last_name' => :'String',
@@ -91,14 +91,14 @@ module MailSlurpClient
91
91
  h[k.to_sym] = v
92
92
  }
93
93
 
94
- if attributes.key?(:'created_at')
95
- self.created_at = attributes[:'created_at']
96
- end
97
-
98
94
  if attributes.key?(:'email_address')
99
95
  self.email_address = attributes[:'email_address']
100
96
  end
101
97
 
98
+ if attributes.key?(:'created_at')
99
+ self.created_at = attributes[:'created_at']
100
+ end
101
+
102
102
  if attributes.key?(:'email_addresses')
103
103
  if (value = attributes[:'email_addresses']).is_a?(Array)
104
104
  self.email_addresses = value
@@ -158,8 +158,8 @@ module MailSlurpClient
158
158
  def ==(o)
159
159
  return true if self.equal?(o)
160
160
  self.class == o.class &&
161
- created_at == o.created_at &&
162
161
  email_address == o.email_address &&
162
+ created_at == o.created_at &&
163
163
  email_addresses == o.email_addresses &&
164
164
  first_name == o.first_name &&
165
165
  last_name == o.last_name &&
@@ -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
- [created_at, email_address, email_addresses, first_name, last_name, company, opt_out, id, group_id].hash
181
+ [email_address, created_at, email_addresses, first_name, last_name, company, opt_out, id, group_id].hash
182
182
  end
183
183
 
184
184
  # Builds the object from hash
@@ -166,7 +166,7 @@ module MailSlurpClient
166
166
  return false if @region.nil?
167
167
  return false if @postal_code.nil?
168
168
  return false if @iso_country_code.nil?
169
- iso_country_code_validator = EnumAttributeValidator.new('String', ["US", "GB", "AU"])
169
+ iso_country_code_validator = EnumAttributeValidator.new('String', ["US", "GB", "AU", "CA", "EE", "HK", "PL", "CH", "PT", "NL", "IL", "SE"])
170
170
  return false unless iso_country_code_validator.valid?(@iso_country_code)
171
171
  true
172
172
  end
@@ -174,7 +174,7 @@ module MailSlurpClient
174
174
  # Custom attribute writer method checking allowed values (enum).
175
175
  # @param [Object] iso_country_code Object to be assigned
176
176
  def iso_country_code=(iso_country_code)
177
- validator = EnumAttributeValidator.new('String', ["US", "GB", "AU"])
177
+ validator = EnumAttributeValidator.new('String', ["US", "GB", "AU", "CA", "EE", "HK", "PL", "CH", "PT", "NL", "IL", "SE"])
178
178
  unless validator.valid?(iso_country_code)
179
179
  fail ArgumentError, "invalid value for \"iso_country_code\", must be one of #{validator.allowable_values}."
180
180
  end
@@ -0,0 +1,211 @@
1
+ =begin
2
+ #MailSlurp API
3
+
4
+ #MailSlurp is an API for sending and receiving emails and SMS from dynamically allocated email addresses and phone numbers. 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 CreateOAuthConnectionResult
17
+ attr_accessor :url
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'url' => :'url'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'url' => :'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::CreateOAuthConnectionResult` 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::CreateOAuthConnectionResult`. 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?(:'url')
55
+ self.url = attributes[:'url']
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 @url.nil?
64
+ invalid_properties.push('invalid value for "url", url 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 @url.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
+ url == o.url
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
+ [url].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