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.
- checksums.yaml +7 -0
- data/.rubocop.yml +25 -0
- data/Gemfile +15 -0
- data/LICENSE +7 -0
- data/README.md +81 -0
- data/Rakefile +22 -0
- data/comet_backup_ruby_sdk.gemspec +35 -0
- data/lib/comet/api_response_error.rb +27 -0
- data/lib/comet/comet_server.rb +2926 -0
- data/lib/comet/definitions.rb +550 -0
- data/lib/comet/models/add_bucket_response_message.rb +92 -0
- data/lib/comet/models/admin_account_properties_response.rb +76 -0
- data/lib/comet/models/admin_resource_response.rb +84 -0
- data/lib/comet/models/admin_security_options.rb +139 -0
- data/lib/comet/models/admin_u2fregistration.rb +84 -0
- data/lib/comet/models/admin_user_permissions.rb +102 -0
- data/lib/comet/models/available_download.rb +84 -0
- data/lib/comet/models/azure_destination_location.rb +102 -0
- data/lib/comet/models/b2destination_location.rb +110 -0
- data/lib/comet/models/b2storage_extra_info.rb +77 -0
- data/lib/comet/models/b2transaction_totals.rb +80 -0
- data/lib/comet/models/backup_job_advanced_options.rb +98 -0
- data/lib/comet/models/backup_job_detail.rb +199 -0
- data/lib/comet/models/backup_job_progress.rb +92 -0
- data/lib/comet/models/backup_rule_config.rb +188 -0
- data/lib/comet/models/backup_rule_event_triggers.rb +78 -0
- data/lib/comet/models/branding_options.rb +283 -0
- data/lib/comet/models/branding_properties.rb +245 -0
- data/lib/comet/models/browse_disk_drives_response.rb +91 -0
- data/lib/comet/models/browse_edbresponse.rb +91 -0
- data/lib/comet/models/browse_hvresponse.rb +91 -0
- data/lib/comet/models/browse_vssresponse.rb +91 -0
- data/lib/comet/models/bucket_properties.rb +89 -0
- data/lib/comet/models/bucket_usage_info.rb +91 -0
- data/lib/comet/models/comet_apiresponse_message.rb +76 -0
- data/lib/comet/models/comet_destination_location.rb +86 -0
- data/lib/comet/models/constellation_check_report.rb +89 -0
- data/lib/comet/models/constellation_stats.rb +86 -0
- data/lib/comet/models/constellation_status_apiresponse.rb +109 -0
- data/lib/comet/models/content_measurement.rb +89 -0
- data/lib/comet/models/content_measurement_component.rb +84 -0
- data/lib/comet/models/create_group_policy_response.rb +84 -0
- data/lib/comet/models/default_email_report_policy.rb +83 -0
- data/lib/comet/models/destination_config.rb +465 -0
- data/lib/comet/models/destination_location.rb +365 -0
- data/lib/comet/models/destination_statistics.rb +102 -0
- data/lib/comet/models/device_config.rb +96 -0
- data/lib/comet/models/disk_drive.rb +153 -0
- data/lib/comet/models/dispatcher_admin_sources_response.rb +92 -0
- data/lib/comet/models/dispatcher_stored_objects_response.rb +91 -0
- data/lib/comet/models/dispatcher_vault_snapshots_response.rb +91 -0
- data/lib/comet/models/edbfile_info.rb +92 -0
- data/lib/comet/models/email_options.rb +140 -0
- data/lib/comet/models/email_report_config.rb +90 -0
- data/lib/comet/models/email_report_generated_preview.rb +100 -0
- data/lib/comet/models/extra_file_exclusion.rb +82 -0
- data/lib/comet/models/ftpdestination_location.rb +124 -0
- data/lib/comet/models/get_group_policy_response.rb +91 -0
- data/lib/comet/models/get_profile_and_hash_response_message.rb +91 -0
- data/lib/comet/models/get_profile_hash_response_message.rb +84 -0
- data/lib/comet/models/group_policy.rb +83 -0
- data/lib/comet/models/hyper_vmachine_info.rb +78 -0
- data/lib/comet/models/live_user_connection.rb +125 -0
- data/lib/comet/models/local_destination_location.rb +92 -0
- data/lib/comet/models/mac_oscode_sign_properties.rb +113 -0
- data/lib/comet/models/mongo_dbconnection.rb +211 -0
- data/lib/comet/models/new_bucket_detail.rb +78 -0
- data/lib/comet/models/news_entry.rb +76 -0
- data/lib/comet/models/osinfo.rb +92 -0
- data/lib/comet/models/partition.rb +148 -0
- data/lib/comet/models/private_branding_properties.rb +185 -0
- data/lib/comet/models/protected_item_engine_type_policy.rb +84 -0
- data/lib/comet/models/public_branding_properties.rb +122 -0
- data/lib/comet/models/remote_server_address.rb +135 -0
- data/lib/comet/models/remote_storage_option.rb +147 -0
- data/lib/comet/models/replicator_state_apiresponse.rb +138 -0
- data/lib/comet/models/request_storage_vault_response_message.rb +84 -0
- data/lib/comet/models/restore_job_advanced_options.rb +104 -0
- data/lib/comet/models/retention_policy.rb +83 -0
- data/lib/comet/models/retention_range.rb +110 -0
- data/lib/comet/models/s3destination_location.rb +114 -0
- data/lib/comet/models/schedule_config.rb +82 -0
- data/lib/comet/models/search_clause.rb +111 -0
- data/lib/comet/models/server_config_options_branding_fragment.rb +69 -0
- data/lib/comet/models/server_config_options_software_build_role_fragment.rb +69 -0
- data/lib/comet/models/server_meta_version_info.rb +208 -0
- data/lib/comet/models/session_key_regenerated_response.rb +92 -0
- data/lib/comet/models/sftpdestination_location.rb +122 -0
- data/lib/comet/models/size_measurement.rb +80 -0
- data/lib/comet/models/software_build_role_options.rb +74 -0
- data/lib/comet/models/software_update_news_response.rb +102 -0
- data/lib/comet/models/source_basic_info.rb +93 -0
- data/lib/comet/models/source_config.rb +172 -0
- data/lib/comet/models/source_statistics.rb +69 -0
- data/lib/comet/models/spanned_destination_location.rb +77 -0
- data/lib/comet/models/spanned_storage_extra_info.rb +77 -0
- data/lib/comet/models/sshconnection.rb +114 -0
- data/lib/comet/models/stat_result.rb +86 -0
- data/lib/comet/models/storage_free_space_info.rb +98 -0
- data/lib/comet/models/storage_vault_provider_policy.rb +82 -0
- data/lib/comet/models/stored_object.rb +130 -0
- data/lib/comet/models/streamable_event.rb +74 -0
- data/lib/comet/models/swift_destination_location.rb +192 -0
- data/lib/comet/models/test_response.rb +82 -0
- data/lib/comet/models/totp_regenerated_response.rb +100 -0
- data/lib/comet/models/u2fregister_request.rb +78 -0
- data/lib/comet/models/u2fregistered_key.rb +86 -0
- data/lib/comet/models/u2fregistration_challenge_response.rb +122 -0
- data/lib/comet/models/u2fsign_request.rb +101 -0
- data/lib/comet/models/u2fsign_response.rb +94 -0
- data/lib/comet/models/uninstall_config.rb +74 -0
- data/lib/comet/models/update_campaign_device_status.rb +68 -0
- data/lib/comet/models/update_campaign_options.rb +86 -0
- data/lib/comet/models/update_campaign_properties.rb +100 -0
- data/lib/comet/models/update_campaign_status.rb +115 -0
- data/lib/comet/models/update_campaign_status_device_entry.rb +84 -0
- data/lib/comet/models/user_custom_email_settings.rb +77 -0
- data/lib/comet/models/user_on_server.rb +76 -0
- data/lib/comet/models/user_policy.rb +304 -0
- data/lib/comet/models/user_profile_config.rb +300 -0
- data/lib/comet/models/user_profile_fragment.rb +70 -0
- data/lib/comet/models/vault_snapshot.rb +84 -0
- data/lib/comet/models/vsscomponent.rb +92 -0
- data/lib/comet/models/vsswriter_info.rb +85 -0
- data/lib/comet/models/web_interface_branding_properties.rb +100 -0
- data/lib/comet/models/webhook_option.rb +84 -0
- data/lib/comet/models/win_smbauth.rb +92 -0
- data/lib/comet/models/windows_code_sign_properties.rb +130 -0
- data/lib/comet_backup_ruby_sdk.rb +130 -0
- metadata +227 -0
@@ -0,0 +1,82 @@
|
|
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
|
+
# TestResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class TestResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [Boolean] exists
|
24
|
+
attr_accessor :exists
|
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 'Status'
|
47
|
+
@status = v
|
48
|
+
when 'Message'
|
49
|
+
raise TypeError 'expected string' unless v.is_a? String
|
50
|
+
|
51
|
+
@message = v
|
52
|
+
when 'Exists'
|
53
|
+
@exists = v
|
54
|
+
else
|
55
|
+
@unknown_json_fields[k] = v
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# @return [Hash] The complete object as a Ruby hash
|
61
|
+
def to_hash
|
62
|
+
ret = {}
|
63
|
+
ret['Status'] = @status
|
64
|
+
ret['Message'] = @message
|
65
|
+
ret['Exists'] = @exists
|
66
|
+
@unknown_json_fields.each do |k, v|
|
67
|
+
ret[k] = v
|
68
|
+
end
|
69
|
+
ret
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [Hash] The complete object as a Ruby hash
|
73
|
+
def to_h
|
74
|
+
to_hash
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [String] The complete object as a JSON string
|
78
|
+
def to_json(options = {})
|
79
|
+
to_hash.to_json(options)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,100 @@
|
|
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
|
+
# TotpRegeneratedResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class TotpRegeneratedResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [String] image
|
24
|
+
attr_accessor :image
|
25
|
+
|
26
|
+
# @type [String] url
|
27
|
+
attr_accessor :url
|
28
|
+
|
29
|
+
# @type [String] profile_hash
|
30
|
+
attr_accessor :profile_hash
|
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 'Status'
|
53
|
+
@status = v
|
54
|
+
when 'Message'
|
55
|
+
raise TypeError 'expected string' unless v.is_a? String
|
56
|
+
|
57
|
+
@message = v
|
58
|
+
when 'Image'
|
59
|
+
raise TypeError 'expected string' unless v.is_a? String
|
60
|
+
|
61
|
+
@image = v
|
62
|
+
when 'URL'
|
63
|
+
raise TypeError 'expected string' unless v.is_a? String
|
64
|
+
|
65
|
+
@url = v
|
66
|
+
when 'ProfileHash'
|
67
|
+
raise TypeError 'expected string' unless v.is_a? String
|
68
|
+
|
69
|
+
@profile_hash = v
|
70
|
+
else
|
71
|
+
@unknown_json_fields[k] = v
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Hash] The complete object as a Ruby hash
|
77
|
+
def to_hash
|
78
|
+
ret = {}
|
79
|
+
ret['Status'] = @status
|
80
|
+
ret['Message'] = @message
|
81
|
+
ret['Image'] = @image
|
82
|
+
ret['URL'] = @url
|
83
|
+
ret['ProfileHash'] = @profile_hash
|
84
|
+
@unknown_json_fields.each do |k, v|
|
85
|
+
ret[k] = v
|
86
|
+
end
|
87
|
+
ret
|
88
|
+
end
|
89
|
+
|
90
|
+
# @return [Hash] The complete object as a Ruby hash
|
91
|
+
def to_h
|
92
|
+
to_hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [String] The complete object as a JSON string
|
96
|
+
def to_json(options = {})
|
97
|
+
to_hash.to_json(options)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,78 @@
|
|
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
|
+
# U2FRegisterRequest is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class U2FRegisterRequest
|
16
|
+
|
17
|
+
# @type [String] challenge
|
18
|
+
attr_accessor :challenge
|
19
|
+
|
20
|
+
# @type [String] version
|
21
|
+
attr_accessor :version
|
22
|
+
|
23
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
24
|
+
attr_accessor :unknown_json_fields
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
@unknown_json_fields = {}
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param [String] json_string The complete object in JSON format
|
31
|
+
def from_json(json_string)
|
32
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
33
|
+
|
34
|
+
from_hash(JSON.parse(json_string))
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
38
|
+
def from_hash(obj)
|
39
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
40
|
+
|
41
|
+
obj.each do |k, v|
|
42
|
+
case k
|
43
|
+
when 'Challenge'
|
44
|
+
raise TypeError 'expected string' unless v.is_a? String
|
45
|
+
|
46
|
+
@challenge = v
|
47
|
+
when 'Version'
|
48
|
+
raise TypeError 'expected string' unless v.is_a? String
|
49
|
+
|
50
|
+
@version = v
|
51
|
+
else
|
52
|
+
@unknown_json_fields[k] = v
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Hash] The complete object as a Ruby hash
|
58
|
+
def to_hash
|
59
|
+
ret = {}
|
60
|
+
ret['Challenge'] = @challenge
|
61
|
+
ret['Version'] = @version
|
62
|
+
@unknown_json_fields.each do |k, v|
|
63
|
+
ret[k] = v
|
64
|
+
end
|
65
|
+
ret
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [Hash] The complete object as a Ruby hash
|
69
|
+
def to_h
|
70
|
+
to_hash
|
71
|
+
end
|
72
|
+
|
73
|
+
# @return [String] The complete object as a JSON string
|
74
|
+
def to_json(options = {})
|
75
|
+
to_hash.to_json(options)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,86 @@
|
|
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
|
+
# U2FRegisteredKey is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class U2FRegisteredKey
|
16
|
+
|
17
|
+
# @type [String] app_id
|
18
|
+
attr_accessor :app_id
|
19
|
+
|
20
|
+
# @type [String] key_handle
|
21
|
+
attr_accessor :key_handle
|
22
|
+
|
23
|
+
# @type [String] version
|
24
|
+
attr_accessor :version
|
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 'AppID'
|
47
|
+
raise TypeError 'expected string' unless v.is_a? String
|
48
|
+
|
49
|
+
@app_id = v
|
50
|
+
when 'KeyHandle'
|
51
|
+
raise TypeError 'expected string' unless v.is_a? String
|
52
|
+
|
53
|
+
@key_handle = v
|
54
|
+
when 'Version'
|
55
|
+
raise TypeError 'expected string' unless v.is_a? String
|
56
|
+
|
57
|
+
@version = v
|
58
|
+
else
|
59
|
+
@unknown_json_fields[k] = v
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [Hash] The complete object as a Ruby hash
|
65
|
+
def to_hash
|
66
|
+
ret = {}
|
67
|
+
ret['AppID'] = @app_id
|
68
|
+
ret['KeyHandle'] = @key_handle
|
69
|
+
ret['Version'] = @version
|
70
|
+
@unknown_json_fields.each do |k, v|
|
71
|
+
ret[k] = v
|
72
|
+
end
|
73
|
+
ret
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Hash] The complete object as a Ruby hash
|
77
|
+
def to_h
|
78
|
+
to_hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [String] The complete object as a JSON string
|
82
|
+
def to_json(options = {})
|
83
|
+
to_hash.to_json(options)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
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
|
+
# U2FRegistrationChallengeResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class U2FRegistrationChallengeResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [String] challenge_id
|
24
|
+
attr_accessor :challenge_id
|
25
|
+
|
26
|
+
# @type [String] app_id
|
27
|
+
attr_accessor :app_id
|
28
|
+
|
29
|
+
# @type [Array<Comet::U2FRegisteredKey>] registered_keys
|
30
|
+
attr_accessor :registered_keys
|
31
|
+
|
32
|
+
# @type [Array<Comet::U2FRegisterRequest>] register_requests
|
33
|
+
attr_accessor :register_requests
|
34
|
+
|
35
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
36
|
+
attr_accessor :unknown_json_fields
|
37
|
+
|
38
|
+
def initialize
|
39
|
+
@registered_keys = []
|
40
|
+
@register_requests = []
|
41
|
+
@unknown_json_fields = {}
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param [String] json_string The complete object in JSON format
|
45
|
+
def from_json(json_string)
|
46
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
47
|
+
|
48
|
+
from_hash(JSON.parse(json_string))
|
49
|
+
end
|
50
|
+
|
51
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
52
|
+
def from_hash(obj)
|
53
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
54
|
+
|
55
|
+
obj.each do |k, v|
|
56
|
+
case k
|
57
|
+
when 'Status'
|
58
|
+
@status = v
|
59
|
+
when 'Message'
|
60
|
+
raise TypeError 'expected string' unless v.is_a? String
|
61
|
+
|
62
|
+
@message = v
|
63
|
+
when 'ChallengeID'
|
64
|
+
raise TypeError 'expected string' unless v.is_a? String
|
65
|
+
|
66
|
+
@challenge_id = v
|
67
|
+
when 'AppID'
|
68
|
+
raise TypeError 'expected string' unless v.is_a? String
|
69
|
+
|
70
|
+
@app_id = v
|
71
|
+
when 'RegisteredKeys'
|
72
|
+
if v.nil?
|
73
|
+
@registered_keys = []
|
74
|
+
else
|
75
|
+
@registered_keys = Array.new(v.length)
|
76
|
+
v.each_with_index do |v1, i1|
|
77
|
+
@registered_keys[i1] = Comet::U2FRegisteredKey.new
|
78
|
+
@registered_keys[i1].from_hash(v1)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
when 'RegisterRequests'
|
82
|
+
if v.nil?
|
83
|
+
@register_requests = []
|
84
|
+
else
|
85
|
+
@register_requests = Array.new(v.length)
|
86
|
+
v.each_with_index do |v1, i1|
|
87
|
+
@register_requests[i1] = Comet::U2FRegisterRequest.new
|
88
|
+
@register_requests[i1].from_hash(v1)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
else
|
92
|
+
@unknown_json_fields[k] = v
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# @return [Hash] The complete object as a Ruby hash
|
98
|
+
def to_hash
|
99
|
+
ret = {}
|
100
|
+
ret['Status'] = @status
|
101
|
+
ret['Message'] = @message
|
102
|
+
ret['ChallengeID'] = @challenge_id
|
103
|
+
ret['AppID'] = @app_id
|
104
|
+
ret['RegisteredKeys'] = @registered_keys
|
105
|
+
ret['RegisterRequests'] = @register_requests
|
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
|