late-sdk 0.0.120 → 0.0.121

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 576326e52f248b3fb235714bf00639df0b5de3a418f4bcc273ffad96aa66c1e2
4
- data.tar.gz: 1a190097ec384e406a4c7f0c4b8810152b13667fec84a6c8bc018a45d122af48
3
+ metadata.gz: 2d5f6b65fa188449e6b180747342cb2e8cb5062627774489b0abeb054486db92
4
+ data.tar.gz: 70ba187d5e62432e64059f6cef1931b28aa35e1be8a6497398f6108fdf885dda
5
5
  SHA512:
6
- metadata.gz: 2e48e86098966034ceb09519f8b7a9f9deb6ae1f9c81a8029b31b395f919acb4c56ebb9f8e659636d5ece0e6a3ac328e3f1793e2e8a00c9f21fd16a95e701a90
7
- data.tar.gz: 60f2a47d82ffb11fc1efecb36dd3f80ad15b0dcaf6a96bafa00c12dfdffd12ba21b3ac4a9db5b399b15e1a58aa7620c0bc3051591adb056be97a43670f99a200
6
+ metadata.gz: 1bc025598d5b060f3d4cedc9df0198d7886c0edb5101ea6df82afb4799c8610854a8fc313fd9a1254836d866c938efc43b88d76f60db9cedaa2777c083de1ccb
7
+ data.tar.gz: e6153a84560cf6386e0059045fad3c31b570ec0b03a0554de96b954556dc4508a5c9467dd5bb12ec4ca73997738e5ef8156cf4bf3300440a150da5f2e67381e7
data/README.md CHANGED
@@ -1070,6 +1070,9 @@ Class | Method | HTTP request | Description
1070
1070
  - [Late::WebhookPayloadMessageMessageSender](docs/WebhookPayloadMessageMessageSender.md)
1071
1071
  - [Late::WebhookPayloadMessageMessageSenderInstagramProfile](docs/WebhookPayloadMessageMessageSenderInstagramProfile.md)
1072
1072
  - [Late::WebhookPayloadMessageMetadata](docs/WebhookPayloadMessageMetadata.md)
1073
+ - [Late::WebhookPayloadMessageSent](docs/WebhookPayloadMessageSent.md)
1074
+ - [Late::WebhookPayloadMessageSentMessage](docs/WebhookPayloadMessageSentMessage.md)
1075
+ - [Late::WebhookPayloadMessageSentMessageSender](docs/WebhookPayloadMessageSentMessageSender.md)
1073
1076
  - [Late::WebhookPayloadPost](docs/WebhookPayloadPost.md)
1074
1077
  - [Late::WebhookPayloadPostPost](docs/WebhookPayloadPostPost.md)
1075
1078
  - [Late::WebhookPayloadPostPostPlatformsInner](docs/WebhookPayloadPostPostPlatformsInner.md)
@@ -8,6 +8,7 @@ All URIs are relative to *https://zernio.com/api*
8
8
  | [**on_account_disconnected**](WebhookEventsApi.md#on_account_disconnected) | **POST** /account.disconnected | Account disconnected event |
9
9
  | [**on_comment_received**](WebhookEventsApi.md#on_comment_received) | **POST** /comment.received | Comment received event |
10
10
  | [**on_message_received**](WebhookEventsApi.md#on_message_received) | **POST** /message.received | Message received event |
11
+ | [**on_message_sent**](WebhookEventsApi.md#on_message_sent) | **POST** /message.sent | Message sent event |
11
12
  | [**on_post_cancelled**](WebhookEventsApi.md#on_post_cancelled) | **POST** /post.cancelled | Post cancelled event |
12
13
  | [**on_post_failed**](WebhookEventsApi.md#on_post_failed) | **POST** /post.failed | Post failed event |
13
14
  | [**on_post_partial**](WebhookEventsApi.md#on_post_partial) | **POST** /post.partial | Post partial event |
@@ -289,6 +290,74 @@ nil (empty response body)
289
290
  - **Accept**: Not defined
290
291
 
291
292
 
293
+ ## on_message_sent
294
+
295
+ > on_message_sent(webhook_payload_message_sent)
296
+
297
+ Message sent event
298
+
299
+ Fired when a message is sent via the API.
300
+
301
+ ### Examples
302
+
303
+ ```ruby
304
+ require 'time'
305
+ require 'late-sdk'
306
+ # setup authorization
307
+ Late.configure do |config|
308
+ # Configure Bearer authorization (JWT): bearerAuth
309
+ config.access_token = 'YOUR_BEARER_TOKEN'
310
+ end
311
+
312
+ api_instance = Late::WebhookEventsApi.new
313
+ webhook_payload_message_sent = # WebhookPayloadMessageSent |
314
+
315
+ begin
316
+ # Message sent event
317
+ api_instance.on_message_sent(webhook_payload_message_sent)
318
+ rescue Late::ApiError => e
319
+ puts "Error when calling WebhookEventsApi->on_message_sent: #{e}"
320
+ end
321
+ ```
322
+
323
+ #### Using the on_message_sent_with_http_info variant
324
+
325
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
326
+
327
+ > <Array(nil, Integer, Hash)> on_message_sent_with_http_info(webhook_payload_message_sent)
328
+
329
+ ```ruby
330
+ begin
331
+ # Message sent event
332
+ data, status_code, headers = api_instance.on_message_sent_with_http_info(webhook_payload_message_sent)
333
+ p status_code # => 2xx
334
+ p headers # => { ... }
335
+ p data # => nil
336
+ rescue Late::ApiError => e
337
+ puts "Error when calling WebhookEventsApi->on_message_sent_with_http_info: #{e}"
338
+ end
339
+ ```
340
+
341
+ ### Parameters
342
+
343
+ | Name | Type | Description | Notes |
344
+ | ---- | ---- | ----------- | ----- |
345
+ | **webhook_payload_message_sent** | [**WebhookPayloadMessageSent**](WebhookPayloadMessageSent.md) | | |
346
+
347
+ ### Return type
348
+
349
+ nil (empty response body)
350
+
351
+ ### Authorization
352
+
353
+ [bearerAuth](../README.md#bearerAuth)
354
+
355
+ ### HTTP request headers
356
+
357
+ - **Content-Type**: application/json
358
+ - **Accept**: Not defined
359
+
360
+
292
361
  ## on_post_cancelled
293
362
 
294
363
  > on_post_cancelled(webhook_payload_post)
@@ -0,0 +1,28 @@
1
+ # Late::WebhookPayloadMessageSent
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | Stable webhook event ID | |
8
+ | **event** | **String** | | |
9
+ | **message** | [**WebhookPayloadMessageSentMessage**](WebhookPayloadMessageSentMessage.md) | | |
10
+ | **conversation** | [**WebhookPayloadMessageConversation**](WebhookPayloadMessageConversation.md) | | |
11
+ | **account** | [**WebhookPayloadMessageAccount**](WebhookPayloadMessageAccount.md) | | |
12
+ | **timestamp** | **Time** | | |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'late-sdk'
18
+
19
+ instance = Late::WebhookPayloadMessageSent.new(
20
+ id: null,
21
+ event: null,
22
+ message: null,
23
+ conversation: null,
24
+ account: null,
25
+ timestamp: null
26
+ )
27
+ ```
28
+
@@ -0,0 +1,36 @@
1
+ # Late::WebhookPayloadMessageSentMessage
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | Internal message ID | |
8
+ | **conversation_id** | **String** | Internal conversation ID | |
9
+ | **platform** | **String** | | |
10
+ | **platform_message_id** | **String** | Platform&#39;s message ID | |
11
+ | **direction** | **String** | | |
12
+ | **text** | **String** | Message text content | |
13
+ | **attachments** | [**Array&lt;WebhookPayloadMessageMessageAttachmentsInner&gt;**](WebhookPayloadMessageMessageAttachmentsInner.md) | | |
14
+ | **sender** | [**WebhookPayloadMessageSentMessageSender**](WebhookPayloadMessageSentMessageSender.md) | | |
15
+ | **sent_at** | **Time** | | |
16
+ | **is_read** | **Boolean** | | |
17
+
18
+ ## Example
19
+
20
+ ```ruby
21
+ require 'late-sdk'
22
+
23
+ instance = Late::WebhookPayloadMessageSentMessage.new(
24
+ id: null,
25
+ conversation_id: null,
26
+ platform: null,
27
+ platform_message_id: null,
28
+ direction: null,
29
+ text: null,
30
+ attachments: null,
31
+ sender: null,
32
+ sent_at: null,
33
+ is_read: null
34
+ )
35
+ ```
36
+
@@ -0,0 +1,24 @@
1
+ # Late::WebhookPayloadMessageSentMessageSender
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | |
8
+ | **name** | **String** | | [optional] |
9
+ | **username** | **String** | | [optional] |
10
+ | **picture** | **String** | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'late-sdk'
16
+
17
+ instance = Late::WebhookPayloadMessageSentMessageSender.new(
18
+ id: null,
19
+ name: null,
20
+ username: null,
21
+ picture: null
22
+ )
23
+ ```
24
+
@@ -283,6 +283,72 @@ module Late
283
283
  return data, status_code, headers
284
284
  end
285
285
 
286
+ # Message sent event
287
+ # Fired when a message is sent via the API.
288
+ # @param webhook_payload_message_sent [WebhookPayloadMessageSent]
289
+ # @param [Hash] opts the optional parameters
290
+ # @return [nil]
291
+ def on_message_sent(webhook_payload_message_sent, opts = {})
292
+ on_message_sent_with_http_info(webhook_payload_message_sent, opts)
293
+ nil
294
+ end
295
+
296
+ # Message sent event
297
+ # Fired when a message is sent via the API.
298
+ # @param webhook_payload_message_sent [WebhookPayloadMessageSent]
299
+ # @param [Hash] opts the optional parameters
300
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
301
+ def on_message_sent_with_http_info(webhook_payload_message_sent, opts = {})
302
+ if @api_client.config.debugging
303
+ @api_client.config.logger.debug 'Calling API: WebhookEventsApi.on_message_sent ...'
304
+ end
305
+ # verify the required parameter 'webhook_payload_message_sent' is set
306
+ if @api_client.config.client_side_validation && webhook_payload_message_sent.nil?
307
+ fail ArgumentError, "Missing the required parameter 'webhook_payload_message_sent' when calling WebhookEventsApi.on_message_sent"
308
+ end
309
+ # resource path
310
+ local_var_path = '/message.sent'
311
+
312
+ # query parameters
313
+ query_params = opts[:query_params] || {}
314
+
315
+ # header parameters
316
+ header_params = opts[:header_params] || {}
317
+ # HTTP header 'Content-Type'
318
+ content_type = @api_client.select_header_content_type(['application/json'])
319
+ if !content_type.nil?
320
+ header_params['Content-Type'] = content_type
321
+ end
322
+
323
+ # form parameters
324
+ form_params = opts[:form_params] || {}
325
+
326
+ # http body (model)
327
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_payload_message_sent)
328
+
329
+ # return_type
330
+ return_type = opts[:debug_return_type]
331
+
332
+ # auth_names
333
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
334
+
335
+ new_options = opts.merge(
336
+ :operation => :"WebhookEventsApi.on_message_sent",
337
+ :header_params => header_params,
338
+ :query_params => query_params,
339
+ :form_params => form_params,
340
+ :body => post_body,
341
+ :auth_names => auth_names,
342
+ :return_type => return_type
343
+ )
344
+
345
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
346
+ if @api_client.config.debugging
347
+ @api_client.config.logger.debug "API called: WebhookEventsApi#on_message_sent\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
348
+ end
349
+ return data, status_code, headers
350
+ end
351
+
286
352
  # Post cancelled event
287
353
  # Fired when a post publishing job is cancelled.
288
354
  # @param webhook_payload_post [WebhookPayloadPost]
@@ -188,7 +188,7 @@ module Late
188
188
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
189
189
  fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
190
190
  end
191
- allowable_values = ["post.scheduled", "post.published", "post.failed", "post.partial", "post.cancelled", "post.recycled", "account.connected", "account.disconnected", "message.received", "comment.received", "webhook.test"]
191
+ allowable_values = ["post.scheduled", "post.published", "post.failed", "post.partial", "post.cancelled", "post.recycled", "account.connected", "account.disconnected", "message.received", "message.sent", "comment.received", "webhook.test"]
192
192
  if @api_client.config.client_side_validation && opts[:'event'] && !allowable_values.include?(opts[:'event'])
193
193
  fail ArgumentError, "invalid value for \"event\", must be one of #{allowable_values}"
194
194
  end
@@ -207,7 +207,7 @@ module Late
207
207
  # @return true if the model is valid
208
208
  def valid?
209
209
  warn '[DEPRECATED] the `valid?` method is obsolete'
210
- event_validator = EnumAttributeValidator.new('String', ["post.scheduled", "post.published", "post.failed", "post.partial", "post.cancelled", "post.recycled", "account.connected", "account.disconnected", "message.received", "comment.received", "webhook.test"])
210
+ event_validator = EnumAttributeValidator.new('String', ["post.scheduled", "post.published", "post.failed", "post.partial", "post.cancelled", "post.recycled", "account.connected", "account.disconnected", "message.received", "message.sent", "comment.received", "webhook.test"])
211
211
  return false unless event_validator.valid?(@event)
212
212
  status_validator = EnumAttributeValidator.new('String', ["success", "failed"])
213
213
  return false unless status_validator.valid?(@status)
@@ -217,7 +217,7 @@ module Late
217
217
  # Custom attribute writer method checking allowed values (enum).
218
218
  # @param [Object] event Object to be assigned
219
219
  def event=(event)
220
- validator = EnumAttributeValidator.new('String', ["post.scheduled", "post.published", "post.failed", "post.partial", "post.cancelled", "post.recycled", "account.connected", "account.disconnected", "message.received", "comment.received", "webhook.test"])
220
+ validator = EnumAttributeValidator.new('String', ["post.scheduled", "post.published", "post.failed", "post.partial", "post.cancelled", "post.recycled", "account.connected", "account.disconnected", "message.received", "message.sent", "comment.received", "webhook.test"])
221
221
  unless validator.valid?(event)
222
222
  fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
223
223
  end
@@ -0,0 +1,320 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Late
17
+ # Webhook payload for message sent events (fired when a message is sent via the API)
18
+ class WebhookPayloadMessageSent < ApiModelBase
19
+ # Stable webhook event ID
20
+ attr_accessor :id
21
+
22
+ attr_accessor :event
23
+
24
+ attr_accessor :message
25
+
26
+ attr_accessor :conversation
27
+
28
+ attr_accessor :account
29
+
30
+ attr_accessor :timestamp
31
+
32
+ class EnumAttributeValidator
33
+ attr_reader :datatype
34
+ attr_reader :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'id' => :'id',
58
+ :'event' => :'event',
59
+ :'message' => :'message',
60
+ :'conversation' => :'conversation',
61
+ :'account' => :'account',
62
+ :'timestamp' => :'timestamp'
63
+ }
64
+ end
65
+
66
+ # Returns attribute mapping this model knows about
67
+ def self.acceptable_attribute_map
68
+ attribute_map
69
+ end
70
+
71
+ # Returns all the JSON keys this model knows about
72
+ def self.acceptable_attributes
73
+ acceptable_attribute_map.values
74
+ end
75
+
76
+ # Attribute type mapping.
77
+ def self.openapi_types
78
+ {
79
+ :'id' => :'String',
80
+ :'event' => :'String',
81
+ :'message' => :'WebhookPayloadMessageSentMessage',
82
+ :'conversation' => :'WebhookPayloadMessageConversation',
83
+ :'account' => :'WebhookPayloadMessageAccount',
84
+ :'timestamp' => :'Time'
85
+ }
86
+ end
87
+
88
+ # List of attributes with nullable: true
89
+ def self.openapi_nullable
90
+ Set.new([
91
+ ])
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Late::WebhookPayloadMessageSent` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Late::WebhookPayloadMessageSent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'id')
111
+ self.id = attributes[:'id']
112
+ else
113
+ self.id = nil
114
+ end
115
+
116
+ if attributes.key?(:'event')
117
+ self.event = attributes[:'event']
118
+ else
119
+ self.event = nil
120
+ end
121
+
122
+ if attributes.key?(:'message')
123
+ self.message = attributes[:'message']
124
+ else
125
+ self.message = nil
126
+ end
127
+
128
+ if attributes.key?(:'conversation')
129
+ self.conversation = attributes[:'conversation']
130
+ else
131
+ self.conversation = nil
132
+ end
133
+
134
+ if attributes.key?(:'account')
135
+ self.account = attributes[:'account']
136
+ else
137
+ self.account = nil
138
+ end
139
+
140
+ if attributes.key?(:'timestamp')
141
+ self.timestamp = attributes[:'timestamp']
142
+ else
143
+ self.timestamp = nil
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
151
+ invalid_properties = Array.new
152
+ if @id.nil?
153
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
154
+ end
155
+
156
+ if @event.nil?
157
+ invalid_properties.push('invalid value for "event", event cannot be nil.')
158
+ end
159
+
160
+ if @message.nil?
161
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
162
+ end
163
+
164
+ if @conversation.nil?
165
+ invalid_properties.push('invalid value for "conversation", conversation cannot be nil.')
166
+ end
167
+
168
+ if @account.nil?
169
+ invalid_properties.push('invalid value for "account", account cannot be nil.')
170
+ end
171
+
172
+ if @timestamp.nil?
173
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
174
+ end
175
+
176
+ invalid_properties
177
+ end
178
+
179
+ # Check to see if the all the properties in the model are valid
180
+ # @return true if the model is valid
181
+ def valid?
182
+ warn '[DEPRECATED] the `valid?` method is obsolete'
183
+ return false if @id.nil?
184
+ return false if @event.nil?
185
+ event_validator = EnumAttributeValidator.new('String', ["message.sent"])
186
+ return false unless event_validator.valid?(@event)
187
+ return false if @message.nil?
188
+ return false if @conversation.nil?
189
+ return false if @account.nil?
190
+ return false if @timestamp.nil?
191
+ true
192
+ end
193
+
194
+ # Custom attribute writer method with validation
195
+ # @param [Object] id Value to be assigned
196
+ def id=(id)
197
+ if id.nil?
198
+ fail ArgumentError, 'id cannot be nil'
199
+ end
200
+
201
+ @id = id
202
+ end
203
+
204
+ # Custom attribute writer method checking allowed values (enum).
205
+ # @param [Object] event Object to be assigned
206
+ def event=(event)
207
+ validator = EnumAttributeValidator.new('String', ["message.sent"])
208
+ unless validator.valid?(event)
209
+ fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
210
+ end
211
+ @event = event
212
+ end
213
+
214
+ # Custom attribute writer method with validation
215
+ # @param [Object] message Value to be assigned
216
+ def message=(message)
217
+ if message.nil?
218
+ fail ArgumentError, 'message cannot be nil'
219
+ end
220
+
221
+ @message = message
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] conversation Value to be assigned
226
+ def conversation=(conversation)
227
+ if conversation.nil?
228
+ fail ArgumentError, 'conversation cannot be nil'
229
+ end
230
+
231
+ @conversation = conversation
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] account Value to be assigned
236
+ def account=(account)
237
+ if account.nil?
238
+ fail ArgumentError, 'account cannot be nil'
239
+ end
240
+
241
+ @account = account
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] timestamp Value to be assigned
246
+ def timestamp=(timestamp)
247
+ if timestamp.nil?
248
+ fail ArgumentError, 'timestamp cannot be nil'
249
+ end
250
+
251
+ @timestamp = timestamp
252
+ end
253
+
254
+ # Checks equality by comparing each attribute.
255
+ # @param [Object] Object to be compared
256
+ def ==(o)
257
+ return true if self.equal?(o)
258
+ self.class == o.class &&
259
+ id == o.id &&
260
+ event == o.event &&
261
+ message == o.message &&
262
+ conversation == o.conversation &&
263
+ account == o.account &&
264
+ timestamp == o.timestamp
265
+ end
266
+
267
+ # @see the `==` method
268
+ # @param [Object] Object to be compared
269
+ def eql?(o)
270
+ self == o
271
+ end
272
+
273
+ # Calculates hash code according to all attributes.
274
+ # @return [Integer] Hash code
275
+ def hash
276
+ [id, event, message, conversation, account, timestamp].hash
277
+ end
278
+
279
+ # Builds the object from hash
280
+ # @param [Hash] attributes Model attributes in the form of hash
281
+ # @return [Object] Returns the model itself
282
+ def self.build_from_hash(attributes)
283
+ return nil unless attributes.is_a?(Hash)
284
+ attributes = attributes.transform_keys(&:to_sym)
285
+ transformed_hash = {}
286
+ openapi_types.each_pair do |key, type|
287
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
288
+ transformed_hash["#{key}"] = nil
289
+ elsif type =~ /\AArray<(.*)>/i
290
+ # check to ensure the input is an array given that the attribute
291
+ # is documented as an array but the input is not
292
+ if attributes[attribute_map[key]].is_a?(Array)
293
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
294
+ end
295
+ elsif !attributes[attribute_map[key]].nil?
296
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
297
+ end
298
+ end
299
+ new(transformed_hash)
300
+ end
301
+
302
+ # Returns the object in the form of hash
303
+ # @return [Hash] Returns the object in the form of hash
304
+ def to_hash
305
+ hash = {}
306
+ self.class.attribute_map.each_pair do |attr, param|
307
+ value = self.send(attr)
308
+ if value.nil?
309
+ is_nullable = self.class.openapi_nullable.include?(attr)
310
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
311
+ end
312
+
313
+ hash[param] = _to_hash(value)
314
+ end
315
+ hash
316
+ end
317
+
318
+ end
319
+
320
+ end