sendmux-mailbox 1.0.0 → 1.1.0

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/LICENSE +21 -0
  4. data/README.md +105 -0
  5. data/lib/sendmux/mailbox/version.rb +1 -1
  6. data/lib/sendmux_mailbox_generated/api/mailbox_api_api.rb +275 -14
  7. data/lib/sendmux_mailbox_generated/models/batch_delete_mailbox_messages_body.rb +1 -0
  8. data/lib/sendmux_mailbox_generated/models/batch_update_mailbox_messages_body.rb +3 -0
  9. data/lib/sendmux_mailbox_generated/models/{mailbox_message_summary_from.rb → granted_mailbox.rb} +28 -19
  10. data/lib/sendmux_mailbox_generated/models/granted_mailbox_list_response.rb +251 -0
  11. data/lib/sendmux_mailbox_generated/models/mailbox_attachment.rb +3 -1
  12. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_body.rb +228 -0
  13. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_result.rb +323 -0
  14. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_result_headers.rb +191 -0
  15. data/lib/sendmux_mailbox_generated/models/mailbox_attachment_upload_intent_result_response.rb +223 -0
  16. data/lib/sendmux_mailbox_generated/models/mailbox_batch_get_body.rb +10 -0
  17. data/lib/sendmux_mailbox_generated/models/mailbox_changes.rb +11 -1
  18. data/lib/sendmux_mailbox_generated/models/mailbox_message.rb +14 -45
  19. data/lib/sendmux_mailbox_generated/models/mailbox_message_content_participants.rb +2 -16
  20. data/lib/sendmux_mailbox_generated/models/mailbox_message_summary.rb +15 -17
  21. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_event.rb +1 -15
  22. data/lib/sendmux_mailbox_generated/models/mailbox_realtime_message.rb +14 -45
  23. data/lib/sendmux_mailbox_generated/models/mailbox_thread.rb +2 -16
  24. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary.rb +2 -16
  25. data/lib/sendmux_mailbox_generated/models/send_mailbox_message_body.rb +10 -0
  26. data/lib/sendmux_mailbox_generated.rb +6 -2
  27. metadata +9 -4
  28. data/lib/sendmux_mailbox_generated/models/mailbox_thread_summary_last_message.rb +0 -463
@@ -15,6 +15,7 @@ require 'time'
15
15
 
16
16
  module Sendmux::Mailbox::Generated
17
17
  class BatchDeleteMailboxMessagesBody < ApiModelBase
18
+ # Message IDs to delete, maximum 100.
18
19
  attr_accessor :ids
19
20
 
20
21
  # Optional message state token for stale-write protection.
@@ -15,8 +15,10 @@ require 'time'
15
15
 
16
16
  module Sendmux::Mailbox::Generated
17
17
  class BatchUpdateMailboxMessagesBody < ApiModelBase
18
+ # Set or clear the flagged marker.
18
19
  attr_accessor :flagged
19
20
 
21
+ # Message IDs to update, maximum 100.
20
22
  attr_accessor :ids
21
23
 
22
24
  # Optional message state token for stale-write protection.
@@ -25,6 +27,7 @@ module Sendmux::Mailbox::Generated
25
27
  # Map of message keyword names to booleans. `true` sets the keyword; `false` clears it. Keyword names are normalised to lowercase. Lifecycle keywords such as `$draft` are read-only.
26
28
  attr_accessor :keywords
27
29
 
30
+ # Set or clear the seen flag.
28
31
  attr_accessor :seen
29
32
 
30
33
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -14,16 +14,18 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Sendmux::Mailbox::Generated
17
- class MailboxMessageSummaryFrom < ApiModelBase
17
+ class GrantedMailbox < ApiModelBase
18
+ # Mailbox email address
18
19
  attr_accessor :email
19
20
 
20
- attr_accessor :name
21
+ # Mailbox public ID
22
+ attr_accessor :id
21
23
 
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
25
27
  :'email' => :'email',
26
- :'name' => :'name'
28
+ :'id' => :'id'
27
29
  }
28
30
  end
29
31
 
@@ -41,36 +43,28 @@ module Sendmux::Mailbox::Generated
41
43
  def self.openapi_types
42
44
  {
43
45
  :'email' => :'String',
44
- :'name' => :'String'
46
+ :'id' => :'String'
45
47
  }
46
48
  end
47
49
 
48
50
  # List of attributes with nullable: true
49
51
  def self.openapi_nullable
50
52
  Set.new([
51
- :'name'
52
53
  ])
53
54
  end
54
55
 
55
- # List of class defined in allOf (OpenAPI v3)
56
- def self.openapi_all_of
57
- [
58
- :'MailboxAddress'
59
- ]
60
- end
61
-
62
56
  # Initializes the object
63
57
  # @param [Hash] attributes Model attributes in the form of hash
64
58
  def initialize(attributes = {})
65
59
  if (!attributes.is_a?(Hash))
66
- fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxMessageSummaryFrom` initialize method"
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::GrantedMailbox` initialize method"
67
61
  end
68
62
 
69
63
  # check to see if the attribute exists and convert string to symbol for hash key
70
64
  acceptable_attribute_map = self.class.acceptable_attribute_map
71
65
  attributes = attributes.each_with_object({}) { |(k, v), h|
72
66
  if (!acceptable_attribute_map.key?(k.to_sym))
73
- fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxMessageSummaryFrom`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::GrantedMailbox`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
74
68
  end
75
69
  h[k.to_sym] = v
76
70
  }
@@ -81,10 +75,10 @@ module Sendmux::Mailbox::Generated
81
75
  self.email = nil
82
76
  end
83
77
 
84
- if attributes.key?(:'name')
85
- self.name = attributes[:'name']
78
+ if attributes.key?(:'id')
79
+ self.id = attributes[:'id']
86
80
  else
87
- self.name = nil
81
+ self.id = nil
88
82
  end
89
83
  end
90
84
 
@@ -97,6 +91,10 @@ module Sendmux::Mailbox::Generated
97
91
  invalid_properties.push('invalid value for "email", email cannot be nil.')
98
92
  end
99
93
 
94
+ if @id.nil?
95
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
96
+ end
97
+
100
98
  invalid_properties
101
99
  end
102
100
 
@@ -105,6 +103,7 @@ module Sendmux::Mailbox::Generated
105
103
  def valid?
106
104
  warn '[DEPRECATED] the `valid?` method is obsolete'
107
105
  return false if @email.nil?
106
+ return false if @id.nil?
108
107
  true
109
108
  end
110
109
 
@@ -118,13 +117,23 @@ module Sendmux::Mailbox::Generated
118
117
  @email = email
119
118
  end
120
119
 
120
+ # Custom attribute writer method with validation
121
+ # @param [Object] id Value to be assigned
122
+ def id=(id)
123
+ if id.nil?
124
+ fail ArgumentError, 'id cannot be nil'
125
+ end
126
+
127
+ @id = id
128
+ end
129
+
121
130
  # Checks equality by comparing each attribute.
122
131
  # @param [Object] Object to be compared
123
132
  def ==(o)
124
133
  return true if self.equal?(o)
125
134
  self.class == o.class &&
126
135
  email == o.email &&
127
- name == o.name
136
+ id == o.id
128
137
  end
129
138
 
130
139
  # @see the `==` method
@@ -136,7 +145,7 @@ module Sendmux::Mailbox::Generated
136
145
  # Calculates hash code according to all attributes.
137
146
  # @return [Integer] Hash code
138
147
  def hash
139
- [email, name].hash
148
+ [email, id].hash
140
149
  end
141
150
 
142
151
  # Builds the object from hash
@@ -0,0 +1,251 @@
1
+ =begin
2
+ #Sendmux API
3
+
4
+ #Programmatic access to your Sendmux email infrastructure.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendmux::Mailbox::Generated
17
+ class GrantedMailboxListResponse < ApiModelBase
18
+ attr_accessor :meta
19
+
20
+ attr_accessor :ok
21
+
22
+ attr_accessor :data
23
+
24
+ attr_accessor :pagination
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'meta' => :'meta',
30
+ :'ok' => :'ok',
31
+ :'data' => :'data',
32
+ :'pagination' => :'pagination'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'meta' => :'ResponseMeta',
50
+ :'ok' => :'Boolean',
51
+ :'data' => :'Array<GrantedMailbox>',
52
+ :'pagination' => :'CursorPagination'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # List of class defined in allOf (OpenAPI v3)
63
+ def self.openapi_all_of
64
+ [
65
+ :'SuccessEnvelope'
66
+ ]
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::GrantedMailboxListResponse` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ acceptable_attribute_map = self.class.acceptable_attribute_map
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!acceptable_attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::GrantedMailboxListResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'meta')
86
+ self.meta = attributes[:'meta']
87
+ else
88
+ self.meta = nil
89
+ end
90
+
91
+ if attributes.key?(:'ok')
92
+ self.ok = attributes[:'ok']
93
+ else
94
+ self.ok = nil
95
+ end
96
+
97
+ if attributes.key?(:'data')
98
+ if (value = attributes[:'data']).is_a?(Array)
99
+ self.data = value
100
+ end
101
+ else
102
+ self.data = nil
103
+ end
104
+
105
+ if attributes.key?(:'pagination')
106
+ self.pagination = attributes[:'pagination']
107
+ else
108
+ self.pagination = nil
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
116
+ invalid_properties = Array.new
117
+ if @meta.nil?
118
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
119
+ end
120
+
121
+ if @ok.nil?
122
+ invalid_properties.push('invalid value for "ok", ok cannot be nil.')
123
+ end
124
+
125
+ if @data.nil?
126
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
127
+ end
128
+
129
+ if @pagination.nil?
130
+ invalid_properties.push('invalid value for "pagination", pagination cannot be nil.')
131
+ end
132
+
133
+ invalid_properties
134
+ end
135
+
136
+ # Check to see if the all the properties in the model are valid
137
+ # @return true if the model is valid
138
+ def valid?
139
+ warn '[DEPRECATED] the `valid?` method is obsolete'
140
+ return false if @meta.nil?
141
+ return false if @ok.nil?
142
+ return false if @data.nil?
143
+ return false if @pagination.nil?
144
+ true
145
+ end
146
+
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] meta Value to be assigned
149
+ def meta=(meta)
150
+ if meta.nil?
151
+ fail ArgumentError, 'meta cannot be nil'
152
+ end
153
+
154
+ @meta = meta
155
+ end
156
+
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] ok Value to be assigned
159
+ def ok=(ok)
160
+ if ok.nil?
161
+ fail ArgumentError, 'ok cannot be nil'
162
+ end
163
+
164
+ @ok = ok
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] data Value to be assigned
169
+ def data=(data)
170
+ if data.nil?
171
+ fail ArgumentError, 'data cannot be nil'
172
+ end
173
+
174
+ @data = data
175
+ end
176
+
177
+ # Custom attribute writer method with validation
178
+ # @param [Object] pagination Value to be assigned
179
+ def pagination=(pagination)
180
+ if pagination.nil?
181
+ fail ArgumentError, 'pagination cannot be nil'
182
+ end
183
+
184
+ @pagination = pagination
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ meta == o.meta &&
193
+ ok == o.ok &&
194
+ data == o.data &&
195
+ pagination == o.pagination
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Integer] Hash code
206
+ def hash
207
+ [meta, ok, data, pagination].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def self.build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ attributes = attributes.transform_keys(&:to_sym)
216
+ transformed_hash = {}
217
+ openapi_types.each_pair do |key, type|
218
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = nil
220
+ elsif type =~ /\AArray<(.*)>/i
221
+ # check to ensure the input is an array given that the attribute
222
+ # is documented as an array but the input is not
223
+ if attributes[attribute_map[key]].is_a?(Array)
224
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
225
+ end
226
+ elsif !attributes[attribute_map[key]].nil?
227
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
228
+ end
229
+ end
230
+ new(transformed_hash)
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ if value.nil?
240
+ is_nullable = self.class.openapi_nullable.include?(attr)
241
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
242
+ end
243
+
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ end
250
+
251
+ end
@@ -15,17 +15,19 @@ require 'time'
15
15
 
16
16
  module Sendmux::Mailbox::Generated
17
17
  class MailboxAttachment < ApiModelBase
18
+ # Content ID for inline attachments, when present.
18
19
  attr_accessor :content_id
19
20
 
20
21
  attr_accessor :content_type
21
22
 
22
23
  attr_accessor :disposition
23
24
 
25
+ # Short-lived URL for this exact attachment. Fetch it promptly; if it expires, call the message or attachment metadata endpoint again to receive a fresh URL.
24
26
  attr_accessor :download_url
25
27
 
26
28
  attr_accessor :filename
27
29
 
28
- # Attachment ID
30
+ # Attachment blob ID.
29
31
  attr_accessor :id
30
32
 
31
33
  attr_accessor :size_bytes
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #Sendmux API
3
+
4
+ #Programmatic access to your Sendmux email infrastructure.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Sendmux::Mailbox::Generated
17
+ class MailboxAttachmentUploadIntentBody < ApiModelBase
18
+ # Content-Type that must be sent on the later PUT request.
19
+ attr_accessor :content_type
20
+
21
+ # Filename to use when sending the uploaded attachment.
22
+ attr_accessor :filename
23
+
24
+ # Exact byte length that must be sent on the later PUT request.
25
+ attr_accessor :size_bytes
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'content_type' => :'content_type',
31
+ :'filename' => :'filename',
32
+ :'size_bytes' => :'size_bytes'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'content_type' => :'String',
50
+ :'filename' => :'String',
51
+ :'size_bytes' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Mailbox::Generated::MailboxAttachmentUploadIntentBody` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Mailbox::Generated::MailboxAttachmentUploadIntentBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'content_type')
78
+ self.content_type = attributes[:'content_type']
79
+ else
80
+ self.content_type = nil
81
+ end
82
+
83
+ if attributes.key?(:'filename')
84
+ self.filename = attributes[:'filename']
85
+ else
86
+ self.filename = nil
87
+ end
88
+
89
+ if attributes.key?(:'size_bytes')
90
+ self.size_bytes = attributes[:'size_bytes']
91
+ else
92
+ self.size_bytes = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @content_type.nil?
102
+ invalid_properties.push('invalid value for "content_type", content_type cannot be nil.')
103
+ end
104
+
105
+ if @filename.nil?
106
+ invalid_properties.push('invalid value for "filename", filename cannot be nil.')
107
+ end
108
+
109
+ if @size_bytes.nil?
110
+ invalid_properties.push('invalid value for "size_bytes", size_bytes cannot be nil.')
111
+ end
112
+
113
+ if @size_bytes < 1
114
+ invalid_properties.push('invalid value for "size_bytes", must be greater than or equal to 1.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ warn '[DEPRECATED] the `valid?` method is obsolete'
124
+ return false if @content_type.nil?
125
+ return false if @filename.nil?
126
+ return false if @size_bytes.nil?
127
+ return false if @size_bytes < 1
128
+ true
129
+ end
130
+
131
+ # Custom attribute writer method with validation
132
+ # @param [Object] content_type Value to be assigned
133
+ def content_type=(content_type)
134
+ if content_type.nil?
135
+ fail ArgumentError, 'content_type cannot be nil'
136
+ end
137
+
138
+ @content_type = content_type
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param [Object] filename Value to be assigned
143
+ def filename=(filename)
144
+ if filename.nil?
145
+ fail ArgumentError, 'filename cannot be nil'
146
+ end
147
+
148
+ @filename = filename
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] size_bytes Value to be assigned
153
+ def size_bytes=(size_bytes)
154
+ if size_bytes.nil?
155
+ fail ArgumentError, 'size_bytes cannot be nil'
156
+ end
157
+
158
+ if size_bytes < 1
159
+ fail ArgumentError, 'invalid value for "size_bytes", must be greater than or equal to 1.'
160
+ end
161
+
162
+ @size_bytes = size_bytes
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ content_type == o.content_type &&
171
+ filename == o.filename &&
172
+ size_bytes == o.size_bytes
173
+ end
174
+
175
+ # @see the `==` method
176
+ # @param [Object] Object to be compared
177
+ def eql?(o)
178
+ self == o
179
+ end
180
+
181
+ # Calculates hash code according to all attributes.
182
+ # @return [Integer] Hash code
183
+ def hash
184
+ [content_type, filename, size_bytes].hash
185
+ end
186
+
187
+ # Builds the object from hash
188
+ # @param [Hash] attributes Model attributes in the form of hash
189
+ # @return [Object] Returns the model itself
190
+ def self.build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ attributes = attributes.transform_keys(&:to_sym)
193
+ transformed_hash = {}
194
+ openapi_types.each_pair do |key, type|
195
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
196
+ transformed_hash["#{key}"] = nil
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[attribute_map[key]].is_a?(Array)
201
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
202
+ end
203
+ elsif !attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
205
+ end
206
+ end
207
+ new(transformed_hash)
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ end
227
+
228
+ end