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,374 @@
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 FactoryBody
18
+ # AWS access key.
19
+ attr_accessor :aws_access_key
20
+
21
+ # AWS secret key.
22
+ attr_accessor :aws_secret_key
23
+
24
+ # A region where the factory is located.
25
+ attr_accessor :factory_region
26
+
27
+ # A pattern that will be used to locate files in the input bucket. Valid wildcards might be used.
28
+ attr_accessor :input_bucket_file_pattern
29
+
30
+ # A name of an input bucket.
31
+ attr_accessor :input_bucket_name
32
+
33
+ attr_accessor :input_bucket_recursive
34
+
35
+ # Determines how often the input bucket is synchronised.
36
+ attr_accessor :input_bucket_sync_every_n_min
37
+
38
+ # Determines whether the Factory should be notified about new files added to the input bucket.
39
+ attr_accessor :input_bucket_watch
40
+
41
+ # Name of the Factory.
42
+ attr_accessor :name
43
+
44
+ # Specify the directory where the output files should be stored. By default it is not set. More info [here](https://cloud.telestream.net/docs#path-format---know-how).
45
+ attr_accessor :outputs_path_format
46
+
47
+ attr_accessor :provider_specific_settings
48
+
49
+ # Specify if your files are public or private (private files need authorization url to access). By default this is not set.
50
+ attr_accessor :acl
51
+
52
+ # A bucket where processed files will be stored.
53
+ attr_accessor :output_bucket_name
54
+
55
+ # Specify if you want to use multi-factor server-side 256-bit AES-256 data encryption with Amazon S3-managed encryption keys (SSE-S3). Each object is encrypted using a unique key which as an additional safeguard is encrypted itself with a master key that S3 regularly rotates. By default this is not set.
56
+ attr_accessor :server_side_encryption
57
+
58
+ attr_accessor :storage_credential_attributes
59
+
60
+ # Specifies which storage provider the factory should use. Available options: S3: 0, Google Cloud Storage: 1, FTP storage: 2, Google Cloud Interoperability Storage: 5, Flip storage: 7, FASP storage: 8, Azure Blob Storage: 9
61
+ attr_accessor :storage_provider
62
+
63
+ class EnumAttributeValidator
64
+ attr_reader :datatype
65
+ attr_reader :allowable_values
66
+
67
+ def initialize(datatype, allowable_values)
68
+ @allowable_values = allowable_values.map do |value|
69
+ case datatype.to_s
70
+ when /Integer/i
71
+ value.to_i
72
+ when /Float/i
73
+ value.to_f
74
+ else
75
+ value
76
+ end
77
+ end
78
+ end
79
+
80
+ def valid?(value)
81
+ !value || allowable_values.include?(value)
82
+ end
83
+ end
84
+
85
+ # Attribute mapping from ruby-style variable name to JSON key.
86
+ def self.attribute_map
87
+ {
88
+ :'aws_access_key' => :'aws_access_key',
89
+ :'aws_secret_key' => :'aws_secret_key',
90
+ :'factory_region' => :'factory_region',
91
+ :'input_bucket_file_pattern' => :'input_bucket_file_pattern',
92
+ :'input_bucket_name' => :'input_bucket_name',
93
+ :'input_bucket_recursive' => :'input_bucket_recursive',
94
+ :'input_bucket_sync_every_n_min' => :'input_bucket_sync_every_n_min',
95
+ :'input_bucket_watch' => :'input_bucket_watch',
96
+ :'name' => :'name',
97
+ :'outputs_path_format' => :'outputs_path_format',
98
+ :'provider_specific_settings' => :'provider_specific_settings',
99
+ :'acl' => :'acl',
100
+ :'output_bucket_name' => :'output_bucket_name',
101
+ :'server_side_encryption' => :'server_side_encryption',
102
+ :'storage_credential_attributes' => :'storage_credential_attributes',
103
+ :'storage_provider' => :'storage_provider'
104
+ }
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.swagger_types
109
+ {
110
+ :'aws_access_key' => :'String',
111
+ :'aws_secret_key' => :'String',
112
+ :'factory_region' => :'String',
113
+ :'input_bucket_file_pattern' => :'String',
114
+ :'input_bucket_name' => :'String',
115
+ :'input_bucket_recursive' => :'BOOLEAN',
116
+ :'input_bucket_sync_every_n_min' => :'Integer',
117
+ :'input_bucket_watch' => :'BOOLEAN',
118
+ :'name' => :'String',
119
+ :'outputs_path_format' => :'String',
120
+ :'provider_specific_settings' => :'Object',
121
+ :'acl' => :'String',
122
+ :'output_bucket_name' => :'String',
123
+ :'server_side_encryption' => :'BOOLEAN',
124
+ :'storage_credential_attributes' => :'FactoryBodyStorageCredentialAttributes',
125
+ :'storage_provider' => :'Integer'
126
+ }
127
+ end
128
+
129
+ # Initializes the object
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ def initialize(attributes = {})
132
+ return unless attributes.is_a?(Hash)
133
+
134
+ # convert string to symbol for hash key
135
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
136
+
137
+ if attributes.has_key?(:'aws_access_key')
138
+ self.aws_access_key = attributes[:'aws_access_key']
139
+ end
140
+
141
+ if attributes.has_key?(:'aws_secret_key')
142
+ self.aws_secret_key = attributes[:'aws_secret_key']
143
+ end
144
+
145
+ if attributes.has_key?(:'factory_region')
146
+ self.factory_region = attributes[:'factory_region']
147
+ end
148
+
149
+ if attributes.has_key?(:'input_bucket_file_pattern')
150
+ self.input_bucket_file_pattern = attributes[:'input_bucket_file_pattern']
151
+ end
152
+
153
+ if attributes.has_key?(:'input_bucket_name')
154
+ self.input_bucket_name = attributes[:'input_bucket_name']
155
+ end
156
+
157
+ if attributes.has_key?(:'input_bucket_recursive')
158
+ self.input_bucket_recursive = attributes[:'input_bucket_recursive']
159
+ end
160
+
161
+ if attributes.has_key?(:'input_bucket_sync_every_n_min')
162
+ self.input_bucket_sync_every_n_min = attributes[:'input_bucket_sync_every_n_min']
163
+ end
164
+
165
+ if attributes.has_key?(:'input_bucket_watch')
166
+ self.input_bucket_watch = attributes[:'input_bucket_watch']
167
+ end
168
+
169
+ if attributes.has_key?(:'name')
170
+ self.name = attributes[:'name']
171
+ end
172
+
173
+ if attributes.has_key?(:'outputs_path_format')
174
+ self.outputs_path_format = attributes[:'outputs_path_format']
175
+ end
176
+
177
+ if attributes.has_key?(:'provider_specific_settings')
178
+ self.provider_specific_settings = attributes[:'provider_specific_settings']
179
+ end
180
+
181
+ if attributes.has_key?(:'acl')
182
+ self.acl = attributes[:'acl']
183
+ end
184
+
185
+ if attributes.has_key?(:'output_bucket_name')
186
+ self.output_bucket_name = attributes[:'output_bucket_name']
187
+ end
188
+
189
+ if attributes.has_key?(:'server_side_encryption')
190
+ self.server_side_encryption = attributes[:'server_side_encryption']
191
+ end
192
+
193
+ if attributes.has_key?(:'storage_credential_attributes')
194
+ self.storage_credential_attributes = attributes[:'storage_credential_attributes']
195
+ end
196
+
197
+ if attributes.has_key?(:'storage_provider')
198
+ self.storage_provider = attributes[:'storage_provider']
199
+ end
200
+
201
+ end
202
+
203
+ # Show invalid properties with the reasons. Usually used together with valid?
204
+ # @return Array for valid properties with the reasons
205
+ def list_invalid_properties
206
+ invalid_properties = Array.new
207
+ if @name.nil?
208
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
209
+ end
210
+
211
+ return invalid_properties
212
+ end
213
+
214
+ # Check to see if the all the properties in the model are valid
215
+ # @return true if the model is valid
216
+ def valid?
217
+ return false if @name.nil?
218
+ acl_validator = EnumAttributeValidator.new('String', ["public", "private"])
219
+ return false unless acl_validator.valid?(@acl)
220
+ return true
221
+ end
222
+
223
+ # Custom attribute writer method checking allowed values (enum).
224
+ # @param [Object] acl Object to be assigned
225
+ def acl=(acl)
226
+ validator = EnumAttributeValidator.new('String', ["public", "private"])
227
+ unless validator.valid?(acl)
228
+ fail ArgumentError, "invalid value for 'acl', must be one of #{validator.allowable_values}."
229
+ end
230
+ @acl = acl
231
+ end
232
+
233
+ # Checks equality by comparing each attribute.
234
+ # @param [Object] Object to be compared
235
+ def ==(o)
236
+ return true if self.equal?(o)
237
+ self.class == o.class &&
238
+ aws_access_key == o.aws_access_key &&
239
+ aws_secret_key == o.aws_secret_key &&
240
+ factory_region == o.factory_region &&
241
+ input_bucket_file_pattern == o.input_bucket_file_pattern &&
242
+ input_bucket_name == o.input_bucket_name &&
243
+ input_bucket_recursive == o.input_bucket_recursive &&
244
+ input_bucket_sync_every_n_min == o.input_bucket_sync_every_n_min &&
245
+ input_bucket_watch == o.input_bucket_watch &&
246
+ name == o.name &&
247
+ outputs_path_format == o.outputs_path_format &&
248
+ provider_specific_settings == o.provider_specific_settings &&
249
+ acl == o.acl &&
250
+ output_bucket_name == o.output_bucket_name &&
251
+ server_side_encryption == o.server_side_encryption &&
252
+ storage_credential_attributes == o.storage_credential_attributes &&
253
+ storage_provider == o.storage_provider
254
+ end
255
+
256
+ # @see the `==` method
257
+ # @param [Object] Object to be compared
258
+ def eql?(o)
259
+ self == o
260
+ end
261
+
262
+ # Calculates hash code according to all attributes.
263
+ # @return [Fixnum] Hash code
264
+ def hash
265
+ [aws_access_key, aws_secret_key, factory_region, input_bucket_file_pattern, input_bucket_name, input_bucket_recursive, input_bucket_sync_every_n_min, input_bucket_watch, name, outputs_path_format, provider_specific_settings, acl, output_bucket_name, server_side_encryption, storage_credential_attributes, storage_provider].hash
266
+ end
267
+
268
+ # Builds the object from hash
269
+ # @param [Hash] attributes Model attributes in the form of hash
270
+ # @return [Object] Returns the model itself
271
+ def build_from_hash(attributes)
272
+ return nil unless attributes.is_a?(Hash)
273
+ self.class.swagger_types.each_pair do |key, type|
274
+ if type =~ /\AArray<(.*)>/i
275
+ # check to ensure the input is an array given that the the attribute
276
+ # is documented as an array but the input is not
277
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
278
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
279
+ end
280
+ elsif !attributes[self.class.attribute_map[key]].nil?
281
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
282
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
283
+ end
284
+
285
+ self
286
+ end
287
+
288
+ # Deserializes the data based on type
289
+ # @param string type Data type
290
+ # @param string value Value to be deserialized
291
+ # @return [Object] Deserialized data
292
+ def _deserialize(type, value)
293
+ case type.to_sym
294
+ when :DateTime
295
+ DateTime.parse(value)
296
+ when :Date
297
+ Date.parse(value)
298
+ when :String
299
+ value.to_s
300
+ when :Integer
301
+ value.to_i
302
+ when :Float
303
+ value.to_f
304
+ when :BOOLEAN
305
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
306
+ true
307
+ else
308
+ false
309
+ end
310
+ when :Object
311
+ # generic object (usually a Hash), return directly
312
+ value
313
+ when /\AArray<(?<inner_type>.+)>\z/
314
+ inner_type = Regexp.last_match[:inner_type]
315
+ value.map { |v| _deserialize(inner_type, v) }
316
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
317
+ k_type = Regexp.last_match[:k_type]
318
+ v_type = Regexp.last_match[:v_type]
319
+ {}.tap do |hash|
320
+ value.each do |k, v|
321
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
322
+ end
323
+ end
324
+ else # model
325
+ temp_model = TelestreamCloud::Flip.const_get(type).new
326
+ temp_model.build_from_hash(value)
327
+ end
328
+ end
329
+
330
+ # Returns the string representation of the object
331
+ # @return [String] String presentation of the object
332
+ def to_s
333
+ to_hash.to_s
334
+ end
335
+
336
+ # to_body is an alias to to_hash (backward compatibility)
337
+ # @return [Hash] Returns the object in the form of hash
338
+ def to_body
339
+ to_hash
340
+ end
341
+
342
+ # Returns the object in the form of hash
343
+ # @return [Hash] Returns the object in the form of hash
344
+ def to_hash
345
+ hash = {}
346
+ self.class.attribute_map.each_pair do |attr, param|
347
+ value = self.send(attr)
348
+ next if value.nil?
349
+ hash[param] = _to_hash(value)
350
+ end
351
+ hash
352
+ end
353
+
354
+ # Outputs non-array value in the form of hash
355
+ # For object, use to_hash. Otherwise, just return the value
356
+ # @param [Object] value Any valid value
357
+ # @return [Hash] Returns the value in the form of hash
358
+ def _to_hash(value)
359
+ if value.is_a?(Array)
360
+ value.compact.map{ |v| _to_hash(v) }
361
+ elsif value.is_a?(Hash)
362
+ {}.tap do |hash|
363
+ value.each { |k, v| hash[k] = _to_hash(v) }
364
+ end
365
+ elsif value.respond_to? :to_hash
366
+ value.to_hash
367
+ else
368
+ value
369
+ end
370
+ end
371
+
372
+ end
373
+
374
+ end
@@ -0,0 +1,215 @@
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 FactoryBodyStorageCredentialAttributes
18
+ attr_accessor :host
19
+
20
+ attr_accessor :username
21
+
22
+ attr_accessor :password
23
+
24
+ attr_accessor :port
25
+
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'host' => :'host',
31
+ :'username' => :'username',
32
+ :'password' => :'password',
33
+ :'port' => :'port'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'host' => :'String',
41
+ :'username' => :'String',
42
+ :'password' => :'String',
43
+ :'port' => :'Integer'
44
+ }
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ return unless attributes.is_a?(Hash)
51
+
52
+ # convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
54
+
55
+ if attributes.has_key?(:'host')
56
+ self.host = attributes[:'host']
57
+ end
58
+
59
+ if attributes.has_key?(:'username')
60
+ self.username = attributes[:'username']
61
+ end
62
+
63
+ if attributes.has_key?(:'password')
64
+ self.password = attributes[:'password']
65
+ end
66
+
67
+ if attributes.has_key?(:'port')
68
+ self.port = attributes[:'port']
69
+ end
70
+
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ return invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ return true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ host == o.host &&
92
+ username == o.username &&
93
+ password == o.password &&
94
+ port == o.port
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Fixnum] Hash code
105
+ def hash
106
+ [host, username, password, port].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.swagger_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :BOOLEAN
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ temp_model = TelestreamCloud::Flip.const_get(type).new
167
+ temp_model.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ next if value.nil?
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map{ |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+
213
+ end
214
+
215
+ end