telestream_cloud_flip 2.0.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 (118) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +130 -0
  4. data/Rakefile +8 -0
  5. data/docs/CanceledResponse.md +8 -0
  6. data/docs/CloudNotificationSettings.md +11 -0
  7. data/docs/CloudNotificationSettingsEvents.md +11 -0
  8. data/docs/CopyProfileBody.md +9 -0
  9. data/docs/CountResponse.md +8 -0
  10. data/docs/CreateEncodingBody.md +10 -0
  11. data/docs/CreateVideoBody.md +12 -0
  12. data/docs/DeletedResponse.md +8 -0
  13. data/docs/Encoding.md +38 -0
  14. data/docs/EncodingSignedUrl.md +8 -0
  15. data/docs/EncodingSignedUrls.md +8 -0
  16. data/docs/Error.md +9 -0
  17. data/docs/ExtraFile.md +10 -0
  18. data/docs/Factory.md +25 -0
  19. data/docs/FactoryBody.md +23 -0
  20. data/docs/FactoryBodyStorageCredentialAttributes.md +11 -0
  21. data/docs/FactorySync.md +8 -0
  22. data/docs/FactorySyncBody.md +8 -0
  23. data/docs/FlipApi.md +2179 -0
  24. data/docs/PaginatedEncodingsCollection.md +11 -0
  25. data/docs/PaginatedFactoryCollection.md +11 -0
  26. data/docs/PaginatedProfilesCollection.md +11 -0
  27. data/docs/PaginatedVideoCollection.md +11 -0
  28. data/docs/PaginatedWorkflowsCollection.md +11 -0
  29. data/docs/Profile.md +135 -0
  30. data/docs/ProfileBody.md +137 -0
  31. data/docs/ResubmitVideoBody.md +8 -0
  32. data/docs/RetriedResponse.md +8 -0
  33. data/docs/SignedVideoUrl.md +8 -0
  34. data/docs/UpdateEncodingBody.md +9 -0
  35. data/docs/UploadSession.md +13 -0
  36. data/docs/Video.md +31 -0
  37. data/docs/VideoMetadata.md +7 -0
  38. data/docs/VideoUploadBody.md +24 -0
  39. data/git_push.sh +55 -0
  40. data/lib/telestream_cloud_flip/api/flip_api.rb +2385 -0
  41. data/lib/telestream_cloud_flip/api_client.rb +389 -0
  42. data/lib/telestream_cloud_flip/api_error.rb +38 -0
  43. data/lib/telestream_cloud_flip/configuration.rb +209 -0
  44. data/lib/telestream_cloud_flip/models/canceled_response.rb +189 -0
  45. data/lib/telestream_cloud_flip/models/cloud_notification_settings.rb +237 -0
  46. data/lib/telestream_cloud_flip/models/cloud_notification_settings_events.rb +239 -0
  47. data/lib/telestream_cloud_flip/models/copy_profile_body.rb +209 -0
  48. data/lib/telestream_cloud_flip/models/count_response.rb +189 -0
  49. data/lib/telestream_cloud_flip/models/create_encoding_body.rb +214 -0
  50. data/lib/telestream_cloud_flip/models/create_video_body.rb +231 -0
  51. data/lib/telestream_cloud_flip/models/deleted_response.rb +189 -0
  52. data/lib/telestream_cloud_flip/models/encoding.rb +486 -0
  53. data/lib/telestream_cloud_flip/models/encoding_signed_url.rb +189 -0
  54. data/lib/telestream_cloud_flip/models/encoding_signed_urls.rb +191 -0
  55. data/lib/telestream_cloud_flip/models/error.rb +199 -0
  56. data/lib/telestream_cloud_flip/models/extra_file.rb +221 -0
  57. data/lib/telestream_cloud_flip/models/factory.rb +388 -0
  58. data/lib/telestream_cloud_flip/models/factory_body.rb +374 -0
  59. data/lib/telestream_cloud_flip/models/factory_body_storage_credential_attributes.rb +215 -0
  60. data/lib/telestream_cloud_flip/models/factory_sync.rb +222 -0
  61. data/lib/telestream_cloud_flip/models/factory_sync_body.rb +227 -0
  62. data/lib/telestream_cloud_flip/models/paginated_encodings_collection.rb +240 -0
  63. data/lib/telestream_cloud_flip/models/paginated_factory_collection.rb +220 -0
  64. data/lib/telestream_cloud_flip/models/paginated_profiles_collection.rb +220 -0
  65. data/lib/telestream_cloud_flip/models/paginated_video_collection.rb +220 -0
  66. data/lib/telestream_cloud_flip/models/paginated_workflows_collection.rb +220 -0
  67. data/lib/telestream_cloud_flip/models/profile.rb +1777 -0
  68. data/lib/telestream_cloud_flip/models/profile_body.rb +1762 -0
  69. data/lib/telestream_cloud_flip/models/resubmit_video_body.rb +189 -0
  70. data/lib/telestream_cloud_flip/models/retried_response.rb +189 -0
  71. data/lib/telestream_cloud_flip/models/signed_video_url.rb +189 -0
  72. data/lib/telestream_cloud_flip/models/update_encoding_body.rb +199 -0
  73. data/lib/telestream_cloud_flip/models/upload_session.rb +249 -0
  74. data/lib/telestream_cloud_flip/models/video.rb +418 -0
  75. data/lib/telestream_cloud_flip/models/video_metadata.rb +179 -0
  76. data/lib/telestream_cloud_flip/models/video_upload_body.rb +362 -0
  77. data/lib/telestream_cloud_flip/uploader.rb +244 -0
  78. data/lib/telestream_cloud_flip/version.rb +18 -0
  79. data/lib/telestream_cloud_flip.rb +79 -0
  80. data/spec/api/flip_api_spec.rb +550 -0
  81. data/spec/api_client_spec.rb +226 -0
  82. data/spec/configuration_spec.rb +42 -0
  83. data/spec/models/canceled_response_spec.rb +42 -0
  84. data/spec/models/cloud_notification_settings_events_spec.rb +60 -0
  85. data/spec/models/cloud_notification_settings_spec.rb +60 -0
  86. data/spec/models/copy_profile_body_spec.rb +48 -0
  87. data/spec/models/count_response_spec.rb +42 -0
  88. data/spec/models/create_encoding_body_spec.rb +54 -0
  89. data/spec/models/create_video_body_spec.rb +66 -0
  90. data/spec/models/deleted_response_spec.rb +42 -0
  91. data/spec/models/encoding_signed_url_spec.rb +42 -0
  92. data/spec/models/encoding_signed_urls_spec.rb +42 -0
  93. data/spec/models/encoding_spec.rb +222 -0
  94. data/spec/models/error_spec.rb +48 -0
  95. data/spec/models/extra_file_spec.rb +54 -0
  96. data/spec/models/factory_body_spec.rb +136 -0
  97. data/spec/models/factory_body_storage_credential_attributes_spec.rb +60 -0
  98. data/spec/models/factory_spec.rb +148 -0
  99. data/spec/models/factory_sync_body_spec.rb +46 -0
  100. data/spec/models/factory_sync_spec.rb +46 -0
  101. data/spec/models/paginated_encodings_collection_spec.rb +60 -0
  102. data/spec/models/paginated_factory_collection_spec.rb +60 -0
  103. data/spec/models/paginated_profiles_collection_spec.rb +60 -0
  104. data/spec/models/paginated_video_collection_spec.rb +60 -0
  105. data/spec/models/paginated_workflows_collection_spec.rb +60 -0
  106. data/spec/models/profile_body_spec.rb +916 -0
  107. data/spec/models/profile_spec.rb +916 -0
  108. data/spec/models/resubmit_video_body_spec.rb +42 -0
  109. data/spec/models/retried_response_spec.rb +42 -0
  110. data/spec/models/signed_video_url_spec.rb +42 -0
  111. data/spec/models/update_encoding_body_spec.rb +48 -0
  112. data/spec/models/upload_session_spec.rb +72 -0
  113. data/spec/models/video_metadata_spec.rb +36 -0
  114. data/spec/models/video_spec.rb +180 -0
  115. data/spec/models/video_upload_body_spec.rb +138 -0
  116. data/spec/spec_helper.rb +111 -0
  117. data/telestream_cloud_flip.gemspec +47 -0
  118. metadata +396 -0
@@ -0,0 +1,418 @@
1
+ =begin
2
+ #Flip API
3
+
4
+ #Description
5
+
6
+ OpenAPI spec version: 3.1.0
7
+ Contact: cloudsupport@telestream.net
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TelestreamCloud::Flip
16
+
17
+ class Video
18
+ # A unique identifier of the Video.
19
+ attr_accessor :id
20
+
21
+ # audio bitrate (in bits/s)
22
+ attr_accessor :audio_bitrate
23
+
24
+ # A number of audio channels.
25
+ attr_accessor :audio_channels
26
+
27
+ # A codec that has been used to encode audio streams.
28
+ attr_accessor :audio_codec
29
+
30
+ # A number of samples of audio carried per second.
31
+ attr_accessor :audio_sample_rate
32
+
33
+ # A date and time when the Video has been created.
34
+ attr_accessor :created_at
35
+
36
+ # A duration of the video in seconds.
37
+ attr_accessor :duration
38
+
39
+ # A number of related Encoding objects.
40
+ attr_accessor :encodings_count
41
+
42
+ # A class of an error that has occurred during the encoding process. It is present only if the encoding status is equal to `fail`.
43
+ attr_accessor :error_class
44
+
45
+ # A message that explains why the encoding process has resulted in an error. It is present only if the encoding status is equal to `fail`.
46
+ attr_accessor :error_message
47
+
48
+ # Extension of the source file.
49
+ attr_accessor :extname
50
+
51
+ # A size of the source file.
52
+ attr_accessor :file_size
53
+
54
+ # Number of frames per second.
55
+ attr_accessor :fps
56
+
57
+ # Height of the output video.
58
+ attr_accessor :height
59
+
60
+ # Width of the output video.
61
+ attr_accessor :width
62
+
63
+ # A mime type of the source file.
64
+ attr_accessor :mime_type
65
+
66
+ # A name of the source file.
67
+ attr_accessor :original_filename
68
+
69
+ attr_accessor :path
70
+
71
+ # Payload is an arbitrary text of length 256 or shorter that you can store along the Video. It is typically used to retain an association with one of your own DB record ID.
72
+ attr_accessor :payload
73
+
74
+ # An URL pointing to the source file.
75
+ attr_accessor :source_url
76
+
77
+ # Determines at what stage of importing process the Video is at the moment.
78
+ attr_accessor :status
79
+
80
+ # A date and time when a Video has been updated last time.
81
+ attr_accessor :updated_at
82
+
83
+ # video bitrate (in bits/s)
84
+ attr_accessor :video_bitrate
85
+
86
+ # A codec that has been used to encode the input file's video streams.
87
+ attr_accessor :video_codec
88
+
89
+
90
+ # Attribute mapping from ruby-style variable name to JSON key.
91
+ def self.attribute_map
92
+ {
93
+ :'id' => :'id',
94
+ :'audio_bitrate' => :'audio_bitrate',
95
+ :'audio_channels' => :'audio_channels',
96
+ :'audio_codec' => :'audio_codec',
97
+ :'audio_sample_rate' => :'audio_sample_rate',
98
+ :'created_at' => :'created_at',
99
+ :'duration' => :'duration',
100
+ :'encodings_count' => :'encodings_count',
101
+ :'error_class' => :'error_class',
102
+ :'error_message' => :'error_message',
103
+ :'extname' => :'extname',
104
+ :'file_size' => :'file_size',
105
+ :'fps' => :'fps',
106
+ :'height' => :'height',
107
+ :'width' => :'width',
108
+ :'mime_type' => :'mime_type',
109
+ :'original_filename' => :'original_filename',
110
+ :'path' => :'path',
111
+ :'payload' => :'payload',
112
+ :'source_url' => :'source_url',
113
+ :'status' => :'status',
114
+ :'updated_at' => :'updated_at',
115
+ :'video_bitrate' => :'video_bitrate',
116
+ :'video_codec' => :'video_codec'
117
+ }
118
+ end
119
+
120
+ # Attribute type mapping.
121
+ def self.swagger_types
122
+ {
123
+ :'id' => :'String',
124
+ :'audio_bitrate' => :'Integer',
125
+ :'audio_channels' => :'Integer',
126
+ :'audio_codec' => :'String',
127
+ :'audio_sample_rate' => :'Integer',
128
+ :'created_at' => :'String',
129
+ :'duration' => :'Integer',
130
+ :'encodings_count' => :'Integer',
131
+ :'error_class' => :'String',
132
+ :'error_message' => :'String',
133
+ :'extname' => :'String',
134
+ :'file_size' => :'Integer',
135
+ :'fps' => :'String',
136
+ :'height' => :'String',
137
+ :'width' => :'String',
138
+ :'mime_type' => :'String',
139
+ :'original_filename' => :'String',
140
+ :'path' => :'String',
141
+ :'payload' => :'String',
142
+ :'source_url' => :'String',
143
+ :'status' => :'String',
144
+ :'updated_at' => :'String',
145
+ :'video_bitrate' => :'String',
146
+ :'video_codec' => :'String'
147
+ }
148
+ end
149
+
150
+ # Initializes the object
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ def initialize(attributes = {})
153
+ return unless attributes.is_a?(Hash)
154
+
155
+ # convert string to symbol for hash key
156
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
157
+
158
+ if attributes.has_key?(:'id')
159
+ self.id = attributes[:'id']
160
+ end
161
+
162
+ if attributes.has_key?(:'audio_bitrate')
163
+ self.audio_bitrate = attributes[:'audio_bitrate']
164
+ end
165
+
166
+ if attributes.has_key?(:'audio_channels')
167
+ self.audio_channels = attributes[:'audio_channels']
168
+ end
169
+
170
+ if attributes.has_key?(:'audio_codec')
171
+ self.audio_codec = attributes[:'audio_codec']
172
+ end
173
+
174
+ if attributes.has_key?(:'audio_sample_rate')
175
+ self.audio_sample_rate = attributes[:'audio_sample_rate']
176
+ end
177
+
178
+ if attributes.has_key?(:'created_at')
179
+ self.created_at = attributes[:'created_at']
180
+ end
181
+
182
+ if attributes.has_key?(:'duration')
183
+ self.duration = attributes[:'duration']
184
+ end
185
+
186
+ if attributes.has_key?(:'encodings_count')
187
+ self.encodings_count = attributes[:'encodings_count']
188
+ end
189
+
190
+ if attributes.has_key?(:'error_class')
191
+ self.error_class = attributes[:'error_class']
192
+ end
193
+
194
+ if attributes.has_key?(:'error_message')
195
+ self.error_message = attributes[:'error_message']
196
+ end
197
+
198
+ if attributes.has_key?(:'extname')
199
+ self.extname = attributes[:'extname']
200
+ end
201
+
202
+ if attributes.has_key?(:'file_size')
203
+ self.file_size = attributes[:'file_size']
204
+ end
205
+
206
+ if attributes.has_key?(:'fps')
207
+ self.fps = attributes[:'fps']
208
+ end
209
+
210
+ if attributes.has_key?(:'height')
211
+ self.height = attributes[:'height']
212
+ end
213
+
214
+ if attributes.has_key?(:'width')
215
+ self.width = attributes[:'width']
216
+ end
217
+
218
+ if attributes.has_key?(:'mime_type')
219
+ self.mime_type = attributes[:'mime_type']
220
+ end
221
+
222
+ if attributes.has_key?(:'original_filename')
223
+ self.original_filename = attributes[:'original_filename']
224
+ end
225
+
226
+ if attributes.has_key?(:'path')
227
+ self.path = attributes[:'path']
228
+ end
229
+
230
+ if attributes.has_key?(:'payload')
231
+ self.payload = attributes[:'payload']
232
+ end
233
+
234
+ if attributes.has_key?(:'source_url')
235
+ self.source_url = attributes[:'source_url']
236
+ end
237
+
238
+ if attributes.has_key?(:'status')
239
+ self.status = attributes[:'status']
240
+ end
241
+
242
+ if attributes.has_key?(:'updated_at')
243
+ self.updated_at = attributes[:'updated_at']
244
+ end
245
+
246
+ if attributes.has_key?(:'video_bitrate')
247
+ self.video_bitrate = attributes[:'video_bitrate']
248
+ end
249
+
250
+ if attributes.has_key?(:'video_codec')
251
+ self.video_codec = attributes[:'video_codec']
252
+ end
253
+
254
+ end
255
+
256
+ # Show invalid properties with the reasons. Usually used together with valid?
257
+ # @return Array for valid properties with the reasons
258
+ def list_invalid_properties
259
+ invalid_properties = Array.new
260
+ return invalid_properties
261
+ end
262
+
263
+ # Check to see if the all the properties in the model are valid
264
+ # @return true if the model is valid
265
+ def valid?
266
+ return true
267
+ end
268
+
269
+ # Checks equality by comparing each attribute.
270
+ # @param [Object] Object to be compared
271
+ def ==(o)
272
+ return true if self.equal?(o)
273
+ self.class == o.class &&
274
+ id == o.id &&
275
+ audio_bitrate == o.audio_bitrate &&
276
+ audio_channels == o.audio_channels &&
277
+ audio_codec == o.audio_codec &&
278
+ audio_sample_rate == o.audio_sample_rate &&
279
+ created_at == o.created_at &&
280
+ duration == o.duration &&
281
+ encodings_count == o.encodings_count &&
282
+ error_class == o.error_class &&
283
+ error_message == o.error_message &&
284
+ extname == o.extname &&
285
+ file_size == o.file_size &&
286
+ fps == o.fps &&
287
+ height == o.height &&
288
+ width == o.width &&
289
+ mime_type == o.mime_type &&
290
+ original_filename == o.original_filename &&
291
+ path == o.path &&
292
+ payload == o.payload &&
293
+ source_url == o.source_url &&
294
+ status == o.status &&
295
+ updated_at == o.updated_at &&
296
+ video_bitrate == o.video_bitrate &&
297
+ video_codec == o.video_codec
298
+ end
299
+
300
+ # @see the `==` method
301
+ # @param [Object] Object to be compared
302
+ def eql?(o)
303
+ self == o
304
+ end
305
+
306
+ # Calculates hash code according to all attributes.
307
+ # @return [Fixnum] Hash code
308
+ def hash
309
+ [id, audio_bitrate, audio_channels, audio_codec, audio_sample_rate, created_at, duration, encodings_count, error_class, error_message, extname, file_size, fps, height, width, mime_type, original_filename, path, payload, source_url, status, updated_at, video_bitrate, video_codec].hash
310
+ end
311
+
312
+ # Builds the object from hash
313
+ # @param [Hash] attributes Model attributes in the form of hash
314
+ # @return [Object] Returns the model itself
315
+ def build_from_hash(attributes)
316
+ return nil unless attributes.is_a?(Hash)
317
+ self.class.swagger_types.each_pair do |key, type|
318
+ if type =~ /\AArray<(.*)>/i
319
+ # check to ensure the input is an array given that the the attribute
320
+ # is documented as an array but the input is not
321
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
322
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
323
+ end
324
+ elsif !attributes[self.class.attribute_map[key]].nil?
325
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
326
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
327
+ end
328
+
329
+ self
330
+ end
331
+
332
+ # Deserializes the data based on type
333
+ # @param string type Data type
334
+ # @param string value Value to be deserialized
335
+ # @return [Object] Deserialized data
336
+ def _deserialize(type, value)
337
+ case type.to_sym
338
+ when :DateTime
339
+ DateTime.parse(value)
340
+ when :Date
341
+ Date.parse(value)
342
+ when :String
343
+ value.to_s
344
+ when :Integer
345
+ value.to_i
346
+ when :Float
347
+ value.to_f
348
+ when :BOOLEAN
349
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
350
+ true
351
+ else
352
+ false
353
+ end
354
+ when :Object
355
+ # generic object (usually a Hash), return directly
356
+ value
357
+ when /\AArray<(?<inner_type>.+)>\z/
358
+ inner_type = Regexp.last_match[:inner_type]
359
+ value.map { |v| _deserialize(inner_type, v) }
360
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
361
+ k_type = Regexp.last_match[:k_type]
362
+ v_type = Regexp.last_match[:v_type]
363
+ {}.tap do |hash|
364
+ value.each do |k, v|
365
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
366
+ end
367
+ end
368
+ else # model
369
+ temp_model = TelestreamCloud::Flip.const_get(type).new
370
+ temp_model.build_from_hash(value)
371
+ end
372
+ end
373
+
374
+ # Returns the string representation of the object
375
+ # @return [String] String presentation of the object
376
+ def to_s
377
+ to_hash.to_s
378
+ end
379
+
380
+ # to_body is an alias to to_hash (backward compatibility)
381
+ # @return [Hash] Returns the object in the form of hash
382
+ def to_body
383
+ to_hash
384
+ end
385
+
386
+ # Returns the object in the form of hash
387
+ # @return [Hash] Returns the object in the form of hash
388
+ def to_hash
389
+ hash = {}
390
+ self.class.attribute_map.each_pair do |attr, param|
391
+ value = self.send(attr)
392
+ next if value.nil?
393
+ hash[param] = _to_hash(value)
394
+ end
395
+ hash
396
+ end
397
+
398
+ # Outputs non-array value in the form of hash
399
+ # For object, use to_hash. Otherwise, just return the value
400
+ # @param [Object] value Any valid value
401
+ # @return [Hash] Returns the value in the form of hash
402
+ def _to_hash(value)
403
+ if value.is_a?(Array)
404
+ value.compact.map{ |v| _to_hash(v) }
405
+ elsif value.is_a?(Hash)
406
+ {}.tap do |hash|
407
+ value.each { |k, v| hash[k] = _to_hash(v) }
408
+ end
409
+ elsif value.respond_to? :to_hash
410
+ value.to_hash
411
+ else
412
+ value
413
+ end
414
+ end
415
+
416
+ end
417
+
418
+ end
@@ -0,0 +1,179 @@
1
+ =begin
2
+ #Flip API
3
+
4
+ #Description
5
+
6
+ OpenAPI spec version: 3.1.0
7
+ Contact: cloudsupport@telestream.net
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TelestreamCloud::Flip
16
+
17
+ class VideoMetadata
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ }
29
+ end
30
+
31
+ # Initializes the object
32
+ # @param [Hash] attributes Model attributes in the form of hash
33
+ def initialize(attributes = {})
34
+ return unless attributes.is_a?(Hash)
35
+
36
+ # convert string to symbol for hash key
37
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
38
+
39
+ end
40
+
41
+ # Show invalid properties with the reasons. Usually used together with valid?
42
+ # @return Array for valid properties with the reasons
43
+ def list_invalid_properties
44
+ invalid_properties = Array.new
45
+ return invalid_properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ return true
52
+ end
53
+
54
+ # Checks equality by comparing each attribute.
55
+ # @param [Object] Object to be compared
56
+ def ==(o)
57
+ return true if self.equal?(o)
58
+ self.class == o.class
59
+ end
60
+
61
+ # @see the `==` method
62
+ # @param [Object] Object to be compared
63
+ def eql?(o)
64
+ self == o
65
+ end
66
+
67
+ # Calculates hash code according to all attributes.
68
+ # @return [Fixnum] Hash code
69
+ def hash
70
+ [].hash
71
+ end
72
+
73
+ # Builds the object from hash
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ # @return [Object] Returns the model itself
76
+ def build_from_hash(attributes)
77
+ return nil unless attributes.is_a?(Hash)
78
+ self.class.swagger_types.each_pair do |key, type|
79
+ if type =~ /\AArray<(.*)>/i
80
+ # check to ensure the input is an array given that the the attribute
81
+ # is documented as an array but the input is not
82
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
83
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
84
+ end
85
+ elsif !attributes[self.class.attribute_map[key]].nil?
86
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
87
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
88
+ end
89
+
90
+ self
91
+ end
92
+
93
+ # Deserializes the data based on type
94
+ # @param string type Data type
95
+ # @param string value Value to be deserialized
96
+ # @return [Object] Deserialized data
97
+ def _deserialize(type, value)
98
+ case type.to_sym
99
+ when :DateTime
100
+ DateTime.parse(value)
101
+ when :Date
102
+ Date.parse(value)
103
+ when :String
104
+ value.to_s
105
+ when :Integer
106
+ value.to_i
107
+ when :Float
108
+ value.to_f
109
+ when :BOOLEAN
110
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
111
+ true
112
+ else
113
+ false
114
+ end
115
+ when :Object
116
+ # generic object (usually a Hash), return directly
117
+ value
118
+ when /\AArray<(?<inner_type>.+)>\z/
119
+ inner_type = Regexp.last_match[:inner_type]
120
+ value.map { |v| _deserialize(inner_type, v) }
121
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
122
+ k_type = Regexp.last_match[:k_type]
123
+ v_type = Regexp.last_match[:v_type]
124
+ {}.tap do |hash|
125
+ value.each do |k, v|
126
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
127
+ end
128
+ end
129
+ else # model
130
+ temp_model = TelestreamCloud::Flip.const_get(type).new
131
+ temp_model.build_from_hash(value)
132
+ end
133
+ end
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # to_body is an alias to to_hash (backward compatibility)
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_body
144
+ to_hash
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ next if value.nil?
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param [Object] value Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map{ |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+
177
+ end
178
+
179
+ end