comet_backup_ruby_sdk 0.2.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 (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,208 @@
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
+ # ServerMetaVersionInfo is a typed class wrapper around the underlying Comet Server API data structure.
15
+ class ServerMetaVersionInfo
16
+
17
+ # @type [String] version
18
+ attr_accessor :version
19
+
20
+ # @type [String] version_codename
21
+ attr_accessor :version_codename
22
+
23
+ # @type [Boolean] storage_role
24
+ attr_accessor :storage_role
25
+
26
+ # @type [Boolean] authentication_role
27
+ attr_accessor :authentication_role
28
+
29
+ # @type [Boolean] software_build_role
30
+ attr_accessor :software_build_role
31
+
32
+ # @type [Boolean] constellation_role__legacy
33
+ attr_accessor :constellation_role__legacy
34
+
35
+ # @type [Boolean] constellation_role
36
+ attr_accessor :constellation_role
37
+
38
+ # @type [Array<String>] experimental_options
39
+ attr_accessor :experimental_options
40
+
41
+ # @type [Number] server_start_time
42
+ attr_accessor :server_start_time
43
+
44
+ # @type [String] server_start_hash
45
+ attr_accessor :server_start_hash
46
+
47
+ # @type [Number] current_time
48
+ attr_accessor :current_time
49
+
50
+ # @type [String] server_license_hash
51
+ attr_accessor :server_license_hash
52
+
53
+ # @type [Number] license_valid_until
54
+ attr_accessor :license_valid_until
55
+
56
+ # @type [Number] emails_sent_successfully
57
+ attr_accessor :emails_sent_successfully
58
+
59
+ # @type [Number] emails_sent_errors
60
+ attr_accessor :emails_sent_errors
61
+
62
+ # @type [Number] emails_waiting_in_queue
63
+ attr_accessor :emails_waiting_in_queue
64
+
65
+ # @type [Number] scheduled_email_thread_current_state
66
+ attr_accessor :scheduled_email_thread_current_state
67
+
68
+ # @type [Number] scheduled_email_thread_last_calculate_duration_nanos
69
+ attr_accessor :scheduled_email_thread_last_calculate_duration_nanos
70
+
71
+ # @type [Number] scheduled_email_thread_waiting_until
72
+ attr_accessor :scheduled_email_thread_waiting_until
73
+
74
+ # @type [Number] scheduled_email_thread_last_wake_time
75
+ attr_accessor :scheduled_email_thread_last_wake_time
76
+
77
+ # @type [Boolean] scheduled_email_thread_last_wake_sent_emails
78
+ attr_accessor :scheduled_email_thread_last_wake_sent_emails
79
+
80
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
81
+ attr_accessor :unknown_json_fields
82
+
83
+ def initialize
84
+ @experimental_options = []
85
+ @unknown_json_fields = {}
86
+ end
87
+
88
+ # @param [String] json_string The complete object in JSON format
89
+ def from_json(json_string)
90
+ raise TypeError 'expected string' unless json_string.is_a? String
91
+
92
+ from_hash(JSON.parse(json_string))
93
+ end
94
+
95
+ # @param [Hash] obj The complete object as a Ruby hash
96
+ def from_hash(obj)
97
+ raise TypeError 'expected hash' unless obj.is_a? Hash
98
+
99
+ obj.each do |k, v|
100
+ case k
101
+ when 'Version'
102
+ raise TypeError 'expected string' unless v.is_a? String
103
+
104
+ @version = v
105
+ when 'VersionCodename'
106
+ raise TypeError 'expected string' unless v.is_a? String
107
+
108
+ @version_codename = v
109
+ when 'StorageRole'
110
+ @storage_role = v
111
+ when 'AuthenticationRole'
112
+ @authentication_role = v
113
+ when 'SoftwareBuildRole'
114
+ @software_build_role = v
115
+ when 'OverseerRole'
116
+ @constellation_role__legacy = v
117
+ when 'ConstellationRole'
118
+ @constellation_role = v
119
+ when 'ExperimentalOptions'
120
+ if v.nil?
121
+ @experimental_options = []
122
+ else
123
+ @experimental_options = Array.new(v.length)
124
+ v.each_with_index do |v1, i1|
125
+ raise TypeError 'expected string' unless v1.is_a? String
126
+
127
+ @experimental_options[i1] = v1
128
+ end
129
+ end
130
+ when 'ServerStartTime'
131
+ @server_start_time = v
132
+ when 'ServerStartHash'
133
+ raise TypeError 'expected string' unless v.is_a? String
134
+
135
+ @server_start_hash = v
136
+ when 'CurrentTime'
137
+ @current_time = v
138
+ when 'ServerLicenseHash'
139
+ raise TypeError 'expected string' unless v.is_a? String
140
+
141
+ @server_license_hash = v
142
+ when 'LicenseValidUntil'
143
+ @license_valid_until = v
144
+ when 'EmailsSentSuccessfully'
145
+ @emails_sent_successfully = v
146
+ when 'EmailsSentErrors'
147
+ @emails_sent_errors = v
148
+ when 'EmailsWaitingInQueue'
149
+ @emails_waiting_in_queue = v
150
+ when 'ScheduledEmailThreadCurrentState'
151
+ @scheduled_email_thread_current_state = v
152
+ when 'ScheduledEmailThreadLastCalculateDurationNanos'
153
+ @scheduled_email_thread_last_calculate_duration_nanos = v
154
+ when 'ScheduledEmailThreadWaitingUntil'
155
+ @scheduled_email_thread_waiting_until = v
156
+ when 'ScheduledEmailThreadLastWakeTime'
157
+ @scheduled_email_thread_last_wake_time = v
158
+ when 'ScheduledEmailThreadLastWakeSentEmails'
159
+ @scheduled_email_thread_last_wake_sent_emails = v
160
+ else
161
+ @unknown_json_fields[k] = v
162
+ end
163
+ end
164
+ end
165
+
166
+ # @return [Hash] The complete object as a Ruby hash
167
+ def to_hash
168
+ ret = {}
169
+ ret['Version'] = @version
170
+ ret['VersionCodename'] = @version_codename
171
+ ret['StorageRole'] = @storage_role
172
+ ret['AuthenticationRole'] = @authentication_role
173
+ ret['SoftwareBuildRole'] = @software_build_role
174
+ ret['OverseerRole'] = @constellation_role__legacy
175
+ ret['ConstellationRole'] = @constellation_role
176
+ unless @experimental_options.nil?
177
+ ret['ExperimentalOptions'] = @experimental_options
178
+ end
179
+ ret['ServerStartTime'] = @server_start_time
180
+ ret['ServerStartHash'] = @server_start_hash
181
+ ret['CurrentTime'] = @current_time
182
+ ret['ServerLicenseHash'] = @server_license_hash
183
+ ret['LicenseValidUntil'] = @license_valid_until
184
+ ret['EmailsSentSuccessfully'] = @emails_sent_successfully
185
+ ret['EmailsSentErrors'] = @emails_sent_errors
186
+ ret['EmailsWaitingInQueue'] = @emails_waiting_in_queue
187
+ ret['ScheduledEmailThreadCurrentState'] = @scheduled_email_thread_current_state
188
+ ret['ScheduledEmailThreadLastCalculateDurationNanos'] = @scheduled_email_thread_last_calculate_duration_nanos
189
+ ret['ScheduledEmailThreadWaitingUntil'] = @scheduled_email_thread_waiting_until
190
+ ret['ScheduledEmailThreadLastWakeTime'] = @scheduled_email_thread_last_wake_time
191
+ ret['ScheduledEmailThreadLastWakeSentEmails'] = @scheduled_email_thread_last_wake_sent_emails
192
+ @unknown_json_fields.each do |k, v|
193
+ ret[k] = v
194
+ end
195
+ ret
196
+ end
197
+
198
+ # @return [Hash] The complete object as a Ruby hash
199
+ def to_h
200
+ to_hash
201
+ end
202
+
203
+ # @return [String] The complete object as a JSON string
204
+ def to_json(options = {})
205
+ to_hash.to_json(options)
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,92 @@
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
+ # SessionKeyRegeneratedResponse is a typed class wrapper around the underlying Comet Server API data structure.
15
+ class SessionKeyRegeneratedResponse
16
+
17
+ # @type [Number] status
18
+ attr_accessor :status
19
+
20
+ # @type [String] message
21
+ attr_accessor :message
22
+
23
+ # @type [String] session_key
24
+ attr_accessor :session_key
25
+
26
+ # @type [String] session_type
27
+ attr_accessor :session_type
28
+
29
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
30
+ attr_accessor :unknown_json_fields
31
+
32
+ def initialize
33
+ @unknown_json_fields = {}
34
+ end
35
+
36
+ # @param [String] json_string The complete object in JSON format
37
+ def from_json(json_string)
38
+ raise TypeError 'expected string' unless json_string.is_a? String
39
+
40
+ from_hash(JSON.parse(json_string))
41
+ end
42
+
43
+ # @param [Hash] obj The complete object as a Ruby hash
44
+ def from_hash(obj)
45
+ raise TypeError 'expected hash' unless obj.is_a? Hash
46
+
47
+ obj.each do |k, v|
48
+ case k
49
+ when 'Status'
50
+ @status = v
51
+ when 'Message'
52
+ raise TypeError 'expected string' unless v.is_a? String
53
+
54
+ @message = v
55
+ when 'SessionKey'
56
+ raise TypeError 'expected string' unless v.is_a? String
57
+
58
+ @session_key = v
59
+ when 'SessionType'
60
+ raise TypeError 'expected string' unless v.is_a? String
61
+
62
+ @session_type = v
63
+ else
64
+ @unknown_json_fields[k] = v
65
+ end
66
+ end
67
+ end
68
+
69
+ # @return [Hash] The complete object as a Ruby hash
70
+ def to_hash
71
+ ret = {}
72
+ ret['Status'] = @status
73
+ ret['Message'] = @message
74
+ ret['SessionKey'] = @session_key
75
+ ret['SessionType'] = @session_type
76
+ @unknown_json_fields.each do |k, v|
77
+ ret[k] = v
78
+ end
79
+ ret
80
+ end
81
+
82
+ # @return [Hash] The complete object as a Ruby hash
83
+ def to_h
84
+ to_hash
85
+ end
86
+
87
+ # @return [String] The complete object as a JSON string
88
+ def to_json(options = {})
89
+ to_hash.to_json(options)
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,122 @@
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
+ # SFTPDestinationLocation is a typed class wrapper around the underlying Comet Server API data structure.
15
+ class SFTPDestinationLocation
16
+
17
+ # @type [String] sftpserver
18
+ attr_accessor :sftpserver
19
+
20
+ # @type [String] sftpusername
21
+ attr_accessor :sftpusername
22
+
23
+ # @type [String] sftpremote_path
24
+ attr_accessor :sftpremote_path
25
+
26
+ # @type [Number] sftpauth_mode
27
+ attr_accessor :sftpauth_mode
28
+
29
+ # @type [String] sftppassword
30
+ attr_accessor :sftppassword
31
+
32
+ # @type [String] sftpprivate_key
33
+ attr_accessor :sftpprivate_key
34
+
35
+ # @type [Boolean] sftpcustom_auth__use_known_hosts_file
36
+ attr_accessor :sftpcustom_auth__use_known_hosts_file
37
+
38
+ # @type [String] sftpcustom_auth__known_hosts_file
39
+ attr_accessor :sftpcustom_auth__known_hosts_file
40
+
41
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
42
+ attr_accessor :unknown_json_fields
43
+
44
+ def initialize
45
+ @unknown_json_fields = {}
46
+ end
47
+
48
+ # @param [String] json_string The complete object in JSON format
49
+ def from_json(json_string)
50
+ raise TypeError 'expected string' unless json_string.is_a? String
51
+
52
+ from_hash(JSON.parse(json_string))
53
+ end
54
+
55
+ # @param [Hash] obj The complete object as a Ruby hash
56
+ def from_hash(obj)
57
+ raise TypeError 'expected hash' unless obj.is_a? Hash
58
+
59
+ obj.each do |k, v|
60
+ case k
61
+ when 'SFTPServer'
62
+ raise TypeError 'expected string' unless v.is_a? String
63
+
64
+ @sftpserver = v
65
+ when 'SFTPUsername'
66
+ raise TypeError 'expected string' unless v.is_a? String
67
+
68
+ @sftpusername = v
69
+ when 'SFTPRemotePath'
70
+ raise TypeError 'expected string' unless v.is_a? String
71
+
72
+ @sftpremote_path = v
73
+ when 'SFTPAuthMode'
74
+ @sftpauth_mode = v
75
+ when 'SFTPPassword'
76
+ raise TypeError 'expected string' unless v.is_a? String
77
+
78
+ @sftppassword = v
79
+ when 'SFTPPrivateKey'
80
+ raise TypeError 'expected string' unless v.is_a? String
81
+
82
+ @sftpprivate_key = v
83
+ when 'SFTPCustomAuth_UseKnownHostsFile'
84
+ @sftpcustom_auth__use_known_hosts_file = v
85
+ when 'SFTPCustomAuth_KnownHostsFile'
86
+ raise TypeError 'expected string' unless v.is_a? String
87
+
88
+ @sftpcustom_auth__known_hosts_file = v
89
+ else
90
+ @unknown_json_fields[k] = v
91
+ end
92
+ end
93
+ end
94
+
95
+ # @return [Hash] The complete object as a Ruby hash
96
+ def to_hash
97
+ ret = {}
98
+ ret['SFTPServer'] = @sftpserver
99
+ ret['SFTPUsername'] = @sftpusername
100
+ ret['SFTPRemotePath'] = @sftpremote_path
101
+ ret['SFTPAuthMode'] = @sftpauth_mode
102
+ ret['SFTPPassword'] = @sftppassword
103
+ ret['SFTPPrivateKey'] = @sftpprivate_key
104
+ ret['SFTPCustomAuth_UseKnownHostsFile'] = @sftpcustom_auth__use_known_hosts_file
105
+ ret['SFTPCustomAuth_KnownHostsFile'] = @sftpcustom_auth__known_hosts_file
106
+ @unknown_json_fields.each do |k, v|
107
+ ret[k] = v
108
+ end
109
+ ret
110
+ end
111
+
112
+ # @return [Hash] The complete object as a Ruby hash
113
+ def to_h
114
+ to_hash
115
+ end
116
+
117
+ # @return [String] The complete object as a JSON string
118
+ def to_json(options = {})
119
+ to_hash.to_json(options)
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,80 @@
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
+ # SizeMeasurement is a typed class wrapper around the underlying Comet Server API data structure.
15
+ class SizeMeasurement
16
+
17
+ # @type [Number] size
18
+ attr_accessor :size
19
+
20
+ # @type [Number] measure_started
21
+ attr_accessor :measure_started
22
+
23
+ # @type [Number] measure_completed
24
+ attr_accessor :measure_completed
25
+
26
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
27
+ attr_accessor :unknown_json_fields
28
+
29
+ def initialize
30
+ @unknown_json_fields = {}
31
+ end
32
+
33
+ # @param [String] json_string The complete object in JSON format
34
+ def from_json(json_string)
35
+ raise TypeError 'expected string' unless json_string.is_a? String
36
+
37
+ from_hash(JSON.parse(json_string))
38
+ end
39
+
40
+ # @param [Hash] obj The complete object as a Ruby hash
41
+ def from_hash(obj)
42
+ raise TypeError 'expected hash' unless obj.is_a? Hash
43
+
44
+ obj.each do |k, v|
45
+ case k
46
+ when 'Size'
47
+ @size = v
48
+ when 'MeasureStarted'
49
+ @measure_started = v
50
+ when 'MeasureCompleted'
51
+ @measure_completed = v
52
+ else
53
+ @unknown_json_fields[k] = v
54
+ end
55
+ end
56
+ end
57
+
58
+ # @return [Hash] The complete object as a Ruby hash
59
+ def to_hash
60
+ ret = {}
61
+ ret['Size'] = @size
62
+ ret['MeasureStarted'] = @measure_started
63
+ ret['MeasureCompleted'] = @measure_completed
64
+ @unknown_json_fields.each do |k, v|
65
+ ret[k] = v
66
+ end
67
+ ret
68
+ end
69
+
70
+ # @return [Hash] The complete object as a Ruby hash
71
+ def to_h
72
+ to_hash
73
+ end
74
+
75
+ # @return [String] The complete object as a JSON string
76
+ def to_json(options = {})
77
+ to_hash.to_json(options)
78
+ end
79
+ end
80
+ end