comet_backup_ruby_sdk 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +25 -0
  3. data/Gemfile +15 -0
  4. data/LICENSE +7 -0
  5. data/README.md +81 -0
  6. data/Rakefile +22 -0
  7. data/comet_backup_ruby_sdk.gemspec +35 -0
  8. data/lib/comet/api_response_error.rb +27 -0
  9. data/lib/comet/comet_server.rb +2926 -0
  10. data/lib/comet/definitions.rb +550 -0
  11. data/lib/comet/models/add_bucket_response_message.rb +92 -0
  12. data/lib/comet/models/admin_account_properties_response.rb +76 -0
  13. data/lib/comet/models/admin_resource_response.rb +84 -0
  14. data/lib/comet/models/admin_security_options.rb +139 -0
  15. data/lib/comet/models/admin_u2fregistration.rb +84 -0
  16. data/lib/comet/models/admin_user_permissions.rb +102 -0
  17. data/lib/comet/models/available_download.rb +84 -0
  18. data/lib/comet/models/azure_destination_location.rb +102 -0
  19. data/lib/comet/models/b2destination_location.rb +110 -0
  20. data/lib/comet/models/b2storage_extra_info.rb +77 -0
  21. data/lib/comet/models/b2transaction_totals.rb +80 -0
  22. data/lib/comet/models/backup_job_advanced_options.rb +98 -0
  23. data/lib/comet/models/backup_job_detail.rb +199 -0
  24. data/lib/comet/models/backup_job_progress.rb +92 -0
  25. data/lib/comet/models/backup_rule_config.rb +188 -0
  26. data/lib/comet/models/backup_rule_event_triggers.rb +78 -0
  27. data/lib/comet/models/branding_options.rb +283 -0
  28. data/lib/comet/models/branding_properties.rb +245 -0
  29. data/lib/comet/models/browse_disk_drives_response.rb +91 -0
  30. data/lib/comet/models/browse_edbresponse.rb +91 -0
  31. data/lib/comet/models/browse_hvresponse.rb +91 -0
  32. data/lib/comet/models/browse_vssresponse.rb +91 -0
  33. data/lib/comet/models/bucket_properties.rb +89 -0
  34. data/lib/comet/models/bucket_usage_info.rb +91 -0
  35. data/lib/comet/models/comet_apiresponse_message.rb +76 -0
  36. data/lib/comet/models/comet_destination_location.rb +86 -0
  37. data/lib/comet/models/constellation_check_report.rb +89 -0
  38. data/lib/comet/models/constellation_stats.rb +86 -0
  39. data/lib/comet/models/constellation_status_apiresponse.rb +109 -0
  40. data/lib/comet/models/content_measurement.rb +89 -0
  41. data/lib/comet/models/content_measurement_component.rb +84 -0
  42. data/lib/comet/models/create_group_policy_response.rb +84 -0
  43. data/lib/comet/models/default_email_report_policy.rb +83 -0
  44. data/lib/comet/models/destination_config.rb +465 -0
  45. data/lib/comet/models/destination_location.rb +365 -0
  46. data/lib/comet/models/destination_statistics.rb +102 -0
  47. data/lib/comet/models/device_config.rb +96 -0
  48. data/lib/comet/models/disk_drive.rb +153 -0
  49. data/lib/comet/models/dispatcher_admin_sources_response.rb +92 -0
  50. data/lib/comet/models/dispatcher_stored_objects_response.rb +91 -0
  51. data/lib/comet/models/dispatcher_vault_snapshots_response.rb +91 -0
  52. data/lib/comet/models/edbfile_info.rb +92 -0
  53. data/lib/comet/models/email_options.rb +140 -0
  54. data/lib/comet/models/email_report_config.rb +90 -0
  55. data/lib/comet/models/email_report_generated_preview.rb +100 -0
  56. data/lib/comet/models/extra_file_exclusion.rb +82 -0
  57. data/lib/comet/models/ftpdestination_location.rb +124 -0
  58. data/lib/comet/models/get_group_policy_response.rb +91 -0
  59. data/lib/comet/models/get_profile_and_hash_response_message.rb +91 -0
  60. data/lib/comet/models/get_profile_hash_response_message.rb +84 -0
  61. data/lib/comet/models/group_policy.rb +83 -0
  62. data/lib/comet/models/hyper_vmachine_info.rb +78 -0
  63. data/lib/comet/models/live_user_connection.rb +125 -0
  64. data/lib/comet/models/local_destination_location.rb +92 -0
  65. data/lib/comet/models/mac_oscode_sign_properties.rb +113 -0
  66. data/lib/comet/models/mongo_dbconnection.rb +211 -0
  67. data/lib/comet/models/new_bucket_detail.rb +78 -0
  68. data/lib/comet/models/news_entry.rb +76 -0
  69. data/lib/comet/models/osinfo.rb +92 -0
  70. data/lib/comet/models/partition.rb +148 -0
  71. data/lib/comet/models/private_branding_properties.rb +185 -0
  72. data/lib/comet/models/protected_item_engine_type_policy.rb +84 -0
  73. data/lib/comet/models/public_branding_properties.rb +122 -0
  74. data/lib/comet/models/remote_server_address.rb +135 -0
  75. data/lib/comet/models/remote_storage_option.rb +147 -0
  76. data/lib/comet/models/replicator_state_apiresponse.rb +138 -0
  77. data/lib/comet/models/request_storage_vault_response_message.rb +84 -0
  78. data/lib/comet/models/restore_job_advanced_options.rb +104 -0
  79. data/lib/comet/models/retention_policy.rb +83 -0
  80. data/lib/comet/models/retention_range.rb +110 -0
  81. data/lib/comet/models/s3destination_location.rb +114 -0
  82. data/lib/comet/models/schedule_config.rb +82 -0
  83. data/lib/comet/models/search_clause.rb +111 -0
  84. data/lib/comet/models/server_config_options_branding_fragment.rb +69 -0
  85. data/lib/comet/models/server_config_options_software_build_role_fragment.rb +69 -0
  86. data/lib/comet/models/server_meta_version_info.rb +208 -0
  87. data/lib/comet/models/session_key_regenerated_response.rb +92 -0
  88. data/lib/comet/models/sftpdestination_location.rb +122 -0
  89. data/lib/comet/models/size_measurement.rb +80 -0
  90. data/lib/comet/models/software_build_role_options.rb +74 -0
  91. data/lib/comet/models/software_update_news_response.rb +102 -0
  92. data/lib/comet/models/source_basic_info.rb +93 -0
  93. data/lib/comet/models/source_config.rb +172 -0
  94. data/lib/comet/models/source_statistics.rb +69 -0
  95. data/lib/comet/models/spanned_destination_location.rb +77 -0
  96. data/lib/comet/models/spanned_storage_extra_info.rb +77 -0
  97. data/lib/comet/models/sshconnection.rb +114 -0
  98. data/lib/comet/models/stat_result.rb +86 -0
  99. data/lib/comet/models/storage_free_space_info.rb +98 -0
  100. data/lib/comet/models/storage_vault_provider_policy.rb +82 -0
  101. data/lib/comet/models/stored_object.rb +130 -0
  102. data/lib/comet/models/streamable_event.rb +74 -0
  103. data/lib/comet/models/swift_destination_location.rb +192 -0
  104. data/lib/comet/models/test_response.rb +82 -0
  105. data/lib/comet/models/totp_regenerated_response.rb +100 -0
  106. data/lib/comet/models/u2fregister_request.rb +78 -0
  107. data/lib/comet/models/u2fregistered_key.rb +86 -0
  108. data/lib/comet/models/u2fregistration_challenge_response.rb +122 -0
  109. data/lib/comet/models/u2fsign_request.rb +101 -0
  110. data/lib/comet/models/u2fsign_response.rb +94 -0
  111. data/lib/comet/models/uninstall_config.rb +74 -0
  112. data/lib/comet/models/update_campaign_device_status.rb +68 -0
  113. data/lib/comet/models/update_campaign_options.rb +86 -0
  114. data/lib/comet/models/update_campaign_properties.rb +100 -0
  115. data/lib/comet/models/update_campaign_status.rb +115 -0
  116. data/lib/comet/models/update_campaign_status_device_entry.rb +84 -0
  117. data/lib/comet/models/user_custom_email_settings.rb +77 -0
  118. data/lib/comet/models/user_on_server.rb +76 -0
  119. data/lib/comet/models/user_policy.rb +304 -0
  120. data/lib/comet/models/user_profile_config.rb +300 -0
  121. data/lib/comet/models/user_profile_fragment.rb +70 -0
  122. data/lib/comet/models/vault_snapshot.rb +84 -0
  123. data/lib/comet/models/vsscomponent.rb +92 -0
  124. data/lib/comet/models/vsswriter_info.rb +85 -0
  125. data/lib/comet/models/web_interface_branding_properties.rb +100 -0
  126. data/lib/comet/models/webhook_option.rb +84 -0
  127. data/lib/comet/models/win_smbauth.rb +92 -0
  128. data/lib/comet/models/windows_code_sign_properties.rb +130 -0
  129. data/lib/comet_backup_ruby_sdk.rb +130 -0
  130. metadata +227 -0
@@ -0,0 +1,365 @@
1
+ #!/usr/bin/env ruby --enable-frozen-string-literal
2
+ #
3
+ # Copyright (c) 2020-2020 Comet Licensing Ltd.
4
+ # Please see the LICENSE file for usage information.
5
+ #
6
+ # SPDX-License-Identifier: MIT
7
+ #
8
+ # frozen_string_literal: true
9
+
10
+ require 'json'
11
+
12
+ module Comet
13
+
14
+ # DestinationLocation is a typed class wrapper around the underlying Comet Server API data structure.
15
+ class DestinationLocation
16
+
17
+ # @type [Number] destination_type
18
+ attr_accessor :destination_type
19
+
20
+ # @type [String] comet_server
21
+ attr_accessor :comet_server
22
+
23
+ # @type [String] comet_bucket
24
+ attr_accessor :comet_bucket
25
+
26
+ # @type [String] comet_bucket_key
27
+ attr_accessor :comet_bucket_key
28
+
29
+ # @type [String] s3server
30
+ attr_accessor :s3server
31
+
32
+ # @type [Boolean] s3uses_tls
33
+ attr_accessor :s3uses_tls
34
+
35
+ # @type [String] s3access_key
36
+ attr_accessor :s3access_key
37
+
38
+ # @type [String] s3secret_key
39
+ attr_accessor :s3secret_key
40
+
41
+ # @type [String] s3bucket_name
42
+ attr_accessor :s3bucket_name
43
+
44
+ # @type [String] s3subdir
45
+ attr_accessor :s3subdir
46
+
47
+ # @type [Boolean] s3uses_v2signing
48
+ attr_accessor :s3uses_v2signing
49
+
50
+ # @type [String] sftpserver
51
+ attr_accessor :sftpserver
52
+
53
+ # @type [String] sftpusername
54
+ attr_accessor :sftpusername
55
+
56
+ # @type [String] sftpremote_path
57
+ attr_accessor :sftpremote_path
58
+
59
+ # @type [Number] sftpauth_mode
60
+ attr_accessor :sftpauth_mode
61
+
62
+ # @type [String] sftppassword
63
+ attr_accessor :sftppassword
64
+
65
+ # @type [String] sftpprivate_key
66
+ attr_accessor :sftpprivate_key
67
+
68
+ # @type [Boolean] sftpcustom_auth__use_known_hosts_file
69
+ attr_accessor :sftpcustom_auth__use_known_hosts_file
70
+
71
+ # @type [String] sftpcustom_auth__known_hosts_file
72
+ attr_accessor :sftpcustom_auth__known_hosts_file
73
+
74
+ # @type [String] ftpserver
75
+ attr_accessor :ftpserver
76
+
77
+ # @type [String] ftpusername
78
+ attr_accessor :ftpusername
79
+
80
+ # @type [String] ftppassword
81
+ attr_accessor :ftppassword
82
+
83
+ # @type [Boolean] ftpbase_use_home_directory
84
+ attr_accessor :ftpbase_use_home_directory
85
+
86
+ # @type [String] ftpcustom_base_directory
87
+ attr_accessor :ftpcustom_base_directory
88
+
89
+ # @type [Number] ftpsmode
90
+ attr_accessor :ftpsmode
91
+
92
+ # @type [Number] ftpport
93
+ attr_accessor :ftpport
94
+
95
+ # @type [Number] ftpmax_connections
96
+ attr_accessor :ftpmax_connections
97
+
98
+ # @type [Boolean] ftpaccept_invalid_ssl
99
+ attr_accessor :ftpaccept_invalid_ssl
100
+
101
+ # @type [String] azbaccount_name
102
+ attr_accessor :azbaccount_name
103
+
104
+ # @type [String] azbaccount_key
105
+ attr_accessor :azbaccount_key
106
+
107
+ # @type [String] azbcontainer
108
+ attr_accessor :azbcontainer
109
+
110
+ # @type [String] azbrealm
111
+ attr_accessor :azbrealm
112
+
113
+ # @type [String] azbprefix
114
+ attr_accessor :azbprefix
115
+
116
+ # @type [String] localcopy_path
117
+ attr_accessor :localcopy_path
118
+
119
+ # @type [String] localcopy_win_smbusername
120
+ attr_accessor :localcopy_win_smbusername
121
+
122
+ # @type [String] localcopy_win_smbpassword
123
+ attr_accessor :localcopy_win_smbpassword
124
+
125
+ # @type [Number] localcopy_win_smbpassword_format
126
+ attr_accessor :localcopy_win_smbpassword_format
127
+
128
+ # @type [Comet::SwiftDestinationLocation] swift
129
+ attr_accessor :swift
130
+
131
+ # @type [Comet::B2DestinationLocation] b2
132
+ attr_accessor :b2
133
+
134
+ # @type [Array<Comet::DestinationLocation>] span_targets
135
+ attr_accessor :span_targets
136
+
137
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
138
+ attr_accessor :unknown_json_fields
139
+
140
+ def initialize
141
+ @span_targets = []
142
+ @unknown_json_fields = {}
143
+ end
144
+
145
+ # @param [String] json_string The complete object in JSON format
146
+ def from_json(json_string)
147
+ raise TypeError 'expected string' unless json_string.is_a? String
148
+
149
+ from_hash(JSON.parse(json_string))
150
+ end
151
+
152
+ # @param [Hash] obj The complete object as a Ruby hash
153
+ def from_hash(obj)
154
+ raise TypeError 'expected hash' unless obj.is_a? Hash
155
+
156
+ obj.each do |k, v|
157
+ case k
158
+ when 'DestinationType'
159
+ @destination_type = v
160
+ when 'CometServer'
161
+ raise TypeError 'expected string' unless v.is_a? String
162
+
163
+ @comet_server = v
164
+ when 'CometBucket'
165
+ raise TypeError 'expected string' unless v.is_a? String
166
+
167
+ @comet_bucket = v
168
+ when 'CometBucketKey'
169
+ raise TypeError 'expected string' unless v.is_a? String
170
+
171
+ @comet_bucket_key = v
172
+ when 'S3Server'
173
+ raise TypeError 'expected string' unless v.is_a? String
174
+
175
+ @s3server = v
176
+ when 'S3UsesTLS'
177
+ @s3uses_tls = v
178
+ when 'S3AccessKey'
179
+ raise TypeError 'expected string' unless v.is_a? String
180
+
181
+ @s3access_key = v
182
+ when 'S3SecretKey'
183
+ raise TypeError 'expected string' unless v.is_a? String
184
+
185
+ @s3secret_key = v
186
+ when 'S3BucketName'
187
+ raise TypeError 'expected string' unless v.is_a? String
188
+
189
+ @s3bucket_name = v
190
+ when 'S3Subdir'
191
+ raise TypeError 'expected string' unless v.is_a? String
192
+
193
+ @s3subdir = v
194
+ when 'S3UsesV2Signing'
195
+ @s3uses_v2signing = v
196
+ when 'SFTPServer'
197
+ raise TypeError 'expected string' unless v.is_a? String
198
+
199
+ @sftpserver = v
200
+ when 'SFTPUsername'
201
+ raise TypeError 'expected string' unless v.is_a? String
202
+
203
+ @sftpusername = v
204
+ when 'SFTPRemotePath'
205
+ raise TypeError 'expected string' unless v.is_a? String
206
+
207
+ @sftpremote_path = v
208
+ when 'SFTPAuthMode'
209
+ @sftpauth_mode = v
210
+ when 'SFTPPassword'
211
+ raise TypeError 'expected string' unless v.is_a? String
212
+
213
+ @sftppassword = v
214
+ when 'SFTPPrivateKey'
215
+ raise TypeError 'expected string' unless v.is_a? String
216
+
217
+ @sftpprivate_key = v
218
+ when 'SFTPCustomAuth_UseKnownHostsFile'
219
+ @sftpcustom_auth__use_known_hosts_file = v
220
+ when 'SFTPCustomAuth_KnownHostsFile'
221
+ raise TypeError 'expected string' unless v.is_a? String
222
+
223
+ @sftpcustom_auth__known_hosts_file = v
224
+ when 'FTPServer'
225
+ raise TypeError 'expected string' unless v.is_a? String
226
+
227
+ @ftpserver = v
228
+ when 'FTPUsername'
229
+ raise TypeError 'expected string' unless v.is_a? String
230
+
231
+ @ftpusername = v
232
+ when 'FTPPassword'
233
+ raise TypeError 'expected string' unless v.is_a? String
234
+
235
+ @ftppassword = v
236
+ when 'FTPBaseUseHomeDirectory'
237
+ @ftpbase_use_home_directory = v
238
+ when 'FTPCustomBaseDirectory'
239
+ raise TypeError 'expected string' unless v.is_a? String
240
+
241
+ @ftpcustom_base_directory = v
242
+ when 'FTPSMode'
243
+ @ftpsmode = v
244
+ when 'FTPPort'
245
+ @ftpport = v
246
+ when 'FTPMaxConnections'
247
+ @ftpmax_connections = v
248
+ when 'FTPAcceptInvalidSSL'
249
+ @ftpaccept_invalid_ssl = v
250
+ when 'AZBAccountName'
251
+ raise TypeError 'expected string' unless v.is_a? String
252
+
253
+ @azbaccount_name = v
254
+ when 'AZBAccountKey'
255
+ raise TypeError 'expected string' unless v.is_a? String
256
+
257
+ @azbaccount_key = v
258
+ when 'AZBContainer'
259
+ raise TypeError 'expected string' unless v.is_a? String
260
+
261
+ @azbcontainer = v
262
+ when 'AZBRealm'
263
+ raise TypeError 'expected string' unless v.is_a? String
264
+
265
+ @azbrealm = v
266
+ when 'AZBPrefix'
267
+ raise TypeError 'expected string' unless v.is_a? String
268
+
269
+ @azbprefix = v
270
+ when 'LocalcopyPath'
271
+ raise TypeError 'expected string' unless v.is_a? String
272
+
273
+ @localcopy_path = v
274
+ when 'LocalcopyWinSMBUsername'
275
+ raise TypeError 'expected string' unless v.is_a? String
276
+
277
+ @localcopy_win_smbusername = v
278
+ when 'LocalcopyWinSMBPassword'
279
+ raise TypeError 'expected string' unless v.is_a? String
280
+
281
+ @localcopy_win_smbpassword = v
282
+ when 'LocalcopyWinSMBPasswordFormat'
283
+ @localcopy_win_smbpassword_format = v
284
+ when 'Swift'
285
+ @swift = Comet::SwiftDestinationLocation.new
286
+ @swift.from_hash(v)
287
+ when 'B2'
288
+ @b2 = Comet::B2DestinationLocation.new
289
+ @b2.from_hash(v)
290
+ when 'SpanTargets'
291
+ if v.nil?
292
+ @span_targets = []
293
+ else
294
+ @span_targets = Array.new(v.length)
295
+ v.each_with_index do |v1, i1|
296
+ @span_targets[i1] = Comet::DestinationLocation.new
297
+ @span_targets[i1].from_hash(v1)
298
+ end
299
+ end
300
+ else
301
+ @unknown_json_fields[k] = v
302
+ end
303
+ end
304
+ end
305
+
306
+ # @return [Hash] The complete object as a Ruby hash
307
+ def to_hash
308
+ ret = {}
309
+ ret['DestinationType'] = @destination_type
310
+ ret['CometServer'] = @comet_server
311
+ ret['CometBucket'] = @comet_bucket
312
+ ret['CometBucketKey'] = @comet_bucket_key
313
+ ret['S3Server'] = @s3server
314
+ ret['S3UsesTLS'] = @s3uses_tls
315
+ ret['S3AccessKey'] = @s3access_key
316
+ ret['S3SecretKey'] = @s3secret_key
317
+ ret['S3BucketName'] = @s3bucket_name
318
+ ret['S3Subdir'] = @s3subdir
319
+ ret['S3UsesV2Signing'] = @s3uses_v2signing
320
+ ret['SFTPServer'] = @sftpserver
321
+ ret['SFTPUsername'] = @sftpusername
322
+ ret['SFTPRemotePath'] = @sftpremote_path
323
+ ret['SFTPAuthMode'] = @sftpauth_mode
324
+ ret['SFTPPassword'] = @sftppassword
325
+ ret['SFTPPrivateKey'] = @sftpprivate_key
326
+ ret['SFTPCustomAuth_UseKnownHostsFile'] = @sftpcustom_auth__use_known_hosts_file
327
+ ret['SFTPCustomAuth_KnownHostsFile'] = @sftpcustom_auth__known_hosts_file
328
+ ret['FTPServer'] = @ftpserver
329
+ ret['FTPUsername'] = @ftpusername
330
+ ret['FTPPassword'] = @ftppassword
331
+ ret['FTPBaseUseHomeDirectory'] = @ftpbase_use_home_directory
332
+ ret['FTPCustomBaseDirectory'] = @ftpcustom_base_directory
333
+ ret['FTPSMode'] = @ftpsmode
334
+ ret['FTPPort'] = @ftpport
335
+ ret['FTPMaxConnections'] = @ftpmax_connections
336
+ ret['FTPAcceptInvalidSSL'] = @ftpaccept_invalid_ssl
337
+ ret['AZBAccountName'] = @azbaccount_name
338
+ ret['AZBAccountKey'] = @azbaccount_key
339
+ ret['AZBContainer'] = @azbcontainer
340
+ ret['AZBRealm'] = @azbrealm
341
+ ret['AZBPrefix'] = @azbprefix
342
+ ret['LocalcopyPath'] = @localcopy_path
343
+ ret['LocalcopyWinSMBUsername'] = @localcopy_win_smbusername
344
+ ret['LocalcopyWinSMBPassword'] = @localcopy_win_smbpassword
345
+ ret['LocalcopyWinSMBPasswordFormat'] = @localcopy_win_smbpassword_format
346
+ ret['Swift'] = @swift
347
+ ret['B2'] = @b2
348
+ ret['SpanTargets'] = @span_targets
349
+ @unknown_json_fields.each do |k, v|
350
+ ret[k] = v
351
+ end
352
+ ret
353
+ end
354
+
355
+ # @return [Hash] The complete object as a Ruby hash
356
+ def to_h
357
+ to_hash
358
+ end
359
+
360
+ # @return [String] The complete object as a JSON string
361
+ def to_json(options = {})
362
+ to_hash.to_json(options)
363
+ end
364
+ end
365
+ end
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby --enable-frozen-string-literal
2
+ #
3
+ # Copyright (c) 2020-2020 Comet Licensing Ltd.
4
+ # Please see the LICENSE file for usage information.
5
+ #
6
+ # SPDX-License-Identifier: MIT
7
+ #
8
+ # frozen_string_literal: true
9
+
10
+ require 'json'
11
+
12
+ module Comet
13
+
14
+ # DestinationStatistics is a typed class wrapper around the underlying Comet Server API data structure.
15
+ class DestinationStatistics
16
+
17
+ # @type [Comet::SizeMeasurement] client_provided_size
18
+ attr_accessor :client_provided_size
19
+
20
+ # @type [Comet::ContentMeasurement] client_provided_content
21
+ attr_accessor :client_provided_content
22
+
23
+ # @type [String] last_successful_deep_verify__guid
24
+ attr_accessor :last_successful_deep_verify__guid
25
+
26
+ # @type [Number] last_successful_deep_verify__start_time
27
+ attr_accessor :last_successful_deep_verify__start_time
28
+
29
+ # @type [Number] last_successful_deep_verify__end_time
30
+ attr_accessor :last_successful_deep_verify__end_time
31
+
32
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
33
+ attr_accessor :unknown_json_fields
34
+
35
+ def initialize
36
+ @unknown_json_fields = {}
37
+ end
38
+
39
+ # @param [String] json_string The complete object in JSON format
40
+ def from_json(json_string)
41
+ raise TypeError 'expected string' unless json_string.is_a? String
42
+
43
+ from_hash(JSON.parse(json_string))
44
+ end
45
+
46
+ # @param [Hash] obj The complete object as a Ruby hash
47
+ def from_hash(obj)
48
+ raise TypeError 'expected hash' unless obj.is_a? Hash
49
+
50
+ obj.each do |k, v|
51
+ case k
52
+ when 'ClientProvidedSize'
53
+ @client_provided_size = Comet::SizeMeasurement.new
54
+ @client_provided_size.from_hash(v)
55
+ when 'ClientProvidedContent'
56
+ @client_provided_content = Comet::ContentMeasurement.new
57
+ @client_provided_content.from_hash(v)
58
+ when 'LastSuccessfulDeepVerify_GUID'
59
+ raise TypeError 'expected string' unless v.is_a? String
60
+
61
+ @last_successful_deep_verify__guid = v
62
+ when 'LastSuccessfulDeepVerify_StartTime'
63
+ @last_successful_deep_verify__start_time = v
64
+ when 'LastSuccessfulDeepVerify_EndTime'
65
+ @last_successful_deep_verify__end_time = v
66
+ else
67
+ @unknown_json_fields[k] = v
68
+ end
69
+ end
70
+ end
71
+
72
+ # @return [Hash] The complete object as a Ruby hash
73
+ def to_hash
74
+ ret = {}
75
+ ret['ClientProvidedSize'] = @client_provided_size
76
+ ret['ClientProvidedContent'] = @client_provided_content
77
+ unless @last_successful_deep_verify__guid.nil?
78
+ ret['LastSuccessfulDeepVerify_GUID'] = @last_successful_deep_verify__guid
79
+ end
80
+ unless @last_successful_deep_verify__start_time.nil?
81
+ ret['LastSuccessfulDeepVerify_StartTime'] = @last_successful_deep_verify__start_time
82
+ end
83
+ unless @last_successful_deep_verify__end_time.nil?
84
+ ret['LastSuccessfulDeepVerify_EndTime'] = @last_successful_deep_verify__end_time
85
+ end
86
+ @unknown_json_fields.each do |k, v|
87
+ ret[k] = v
88
+ end
89
+ ret
90
+ end
91
+
92
+ # @return [Hash] The complete object as a Ruby hash
93
+ def to_h
94
+ to_hash
95
+ end
96
+
97
+ # @return [String] The complete object as a JSON string
98
+ def to_json(options = {})
99
+ to_hash.to_json(options)
100
+ end
101
+ end
102
+ end