comet_backup_ruby_sdk 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/Gemfile.lock +43 -0
  4. data/README.md +20 -4
  5. data/RELEASING.md +10 -0
  6. data/comet_backup_ruby_sdk.gemspec +1 -1
  7. data/lib/comet/comet_server.rb +184 -136
  8. data/lib/comet/definitions.rb +4 -4
  9. data/lib/comet/models/add_bucket_response_message.rb +15 -5
  10. data/lib/comet/models/admin_account_properties_response.rb +8 -2
  11. data/lib/comet/models/admin_resource_response.rb +13 -4
  12. data/lib/comet/models/admin_security_options.rb +18 -5
  13. data/lib/comet/models/admin_u2fregistration.rb +11 -3
  14. data/lib/comet/models/admin_user_permissions.rb +6 -2
  15. data/lib/comet/models/available_download.rb +10 -4
  16. data/lib/comet/models/azure_destination_location.rb +16 -7
  17. data/lib/comet/models/b2destination_location.rb +17 -6
  18. data/lib/comet/models/b2storage_extra_info.rb +6 -2
  19. data/lib/comet/models/b2transaction_totals.rb +15 -2
  20. data/lib/comet/models/backup_job_advanced_options.rb +12 -2
  21. data/lib/comet/models/backup_job_detail.rb +53 -10
  22. data/lib/comet/models/backup_job_progress.rb +21 -2
  23. data/lib/comet/models/backup_rule_config.rb +27 -7
  24. data/lib/comet/models/backup_rule_event_triggers.rb +6 -2
  25. data/lib/comet/models/branding_options.rb +59 -25
  26. data/lib/comet/models/branding_properties.rb +51 -21
  27. data/lib/comet/models/browse_disk_drives_response.rb +11 -3
  28. data/lib/comet/models/browse_edbresponse.rb +11 -3
  29. data/lib/comet/models/browse_hvresponse.rb +11 -3
  30. data/lib/comet/models/browse_vssresponse.rb +11 -3
  31. data/lib/comet/models/bucket_properties.rb +15 -3
  32. data/lib/comet/models/bucket_usage_info.rb +8 -2
  33. data/lib/comet/models/comet_apiresponse_message.rb +11 -3
  34. data/lib/comet/models/comet_destination_location.rb +12 -5
  35. data/lib/comet/models/constellation_check_report.rb +12 -2
  36. data/lib/comet/models/constellation_stats.rb +18 -2
  37. data/lib/comet/models/constellation_status_apiresponse.rb +9 -4
  38. data/lib/comet/models/content_measurement.rb +12 -2
  39. data/lib/comet/models/content_measurement_component.rb +10 -3
  40. data/lib/comet/models/create_group_policy_response.rb +13 -4
  41. data/lib/comet/models/default_email_report_policy.rb +6 -2
  42. data/lib/comet/models/destination_config.rb +101 -32
  43. data/lib/comet/models/destination_location.rb +78 -28
  44. data/lib/comet/models/destination_statistics.rb +16 -3
  45. data/lib/comet/models/device_config.rb +9 -3
  46. data/lib/comet/models/disk_drive.rb +34 -7
  47. data/lib/comet/models/dispatcher_admin_sources_response.rb +12 -4
  48. data/lib/comet/models/dispatcher_stored_objects_response.rb +11 -3
  49. data/lib/comet/models/dispatcher_vault_snapshots_response.rb +11 -3
  50. data/lib/comet/models/edbfile_info.rb +12 -5
  51. data/lib/comet/models/email_options.rb +21 -8
  52. data/lib/comet/models/email_report_config.rb +10 -2
  53. data/lib/comet/models/email_report_generated_preview.rb +17 -6
  54. data/lib/comet/models/extra_file_exclusion.rb +11 -3
  55. data/lib/comet/models/ftpdestination_location.rb +23 -6
  56. data/lib/comet/models/get_group_policy_response.rb +14 -4
  57. data/lib/comet/models/get_profile_and_hash_response_message.rb +14 -4
  58. data/lib/comet/models/get_profile_hash_response_message.rb +13 -4
  59. data/lib/comet/models/group_policy.rb +9 -3
  60. data/lib/comet/models/hyper_vmachine_info.rb +10 -4
  61. data/lib/comet/models/job_entry.rb +93 -0
  62. data/lib/comet/models/live_user_connection.rb +20 -7
  63. data/lib/comet/models/local_destination_location.rb +15 -5
  64. data/lib/comet/models/mac_oscode_sign_properties.rb +21 -6
  65. data/lib/comet/models/mongo_dbconnection.rb +33 -14
  66. data/lib/comet/models/new_bucket_detail.rb +10 -4
  67. data/lib/comet/models/news_entry.rb +11 -3
  68. data/lib/comet/models/osinfo.rb +12 -5
  69. data/lib/comet/models/partition.rb +32 -8
  70. data/lib/comet/models/private_branding_properties.rb +39 -15
  71. data/lib/comet/models/protected_item_engine_type_policy.rb +7 -3
  72. data/lib/comet/models/public_branding_properties.rb +18 -8
  73. data/lib/comet/models/remote_server_address.rb +19 -7
  74. data/lib/comet/models/remote_storage_option.rb +22 -7
  75. data/lib/comet/models/replicator_state_apiresponse.rb +40 -4
  76. data/lib/comet/models/request_storage_vault_response_message.rb +13 -4
  77. data/lib/comet/models/restore_job_advanced_options.rb +15 -4
  78. data/lib/comet/models/retention_policy.rb +9 -2
  79. data/lib/comet/models/retention_range.rb +30 -2
  80. data/lib/comet/models/s3destination_location.rb +16 -7
  81. data/lib/comet/models/schedule_config.rb +15 -2
  82. data/lib/comet/models/search_clause.rb +14 -6
  83. data/lib/comet/models/server_config_options_branding_fragment.rb +7 -2
  84. data/lib/comet/models/server_config_options_software_build_role_fragment.rb +7 -2
  85. data/lib/comet/models/server_meta_version_info.rb +45 -7
  86. data/lib/comet/models/session_key_regenerated_response.rb +15 -5
  87. data/lib/comet/models/sftpdestination_location.rb +21 -8
  88. data/lib/comet/models/size_measurement.rb +15 -2
  89. data/lib/comet/models/software_build_role_options.rb +6 -2
  90. data/lib/comet/models/software_update_news_response.rb +13 -6
  91. data/lib/comet/models/source_basic_info.rb +11 -3
  92. data/lib/comet/models/source_config.rb +22 -8
  93. data/lib/comet/models/source_statistics.rb +7 -2
  94. data/lib/comet/models/spanned_destination_location.rb +6 -2
  95. data/lib/comet/models/spanned_storage_extra_info.rb +6 -2
  96. data/lib/comet/models/sshconnection.rb +19 -7
  97. data/lib/comet/models/stat_result.rb +18 -2
  98. data/lib/comet/models/storage_free_space_info.rb +14 -2
  99. data/lib/comet/models/storage_vault_provider_policy.rb +8 -2
  100. data/lib/comet/models/stored_object.rb +27 -5
  101. data/lib/comet/models/streamable_event.rb +9 -2
  102. data/lib/comet/models/swift_destination_location.rb +32 -15
  103. data/lib/comet/models/test_response.rb +11 -3
  104. data/lib/comet/models/totp_regenerated_response.rb +17 -6
  105. data/lib/comet/models/u2fregister_request.rb +10 -4
  106. data/lib/comet/models/u2fregistered_key.rb +12 -5
  107. data/lib/comet/models/u2fregistration_challenge_response.rb +15 -5
  108. data/lib/comet/models/u2fsign_request.rb +12 -5
  109. data/lib/comet/models/u2fsign_response.rb +14 -6
  110. data/lib/comet/models/uninstall_config.rb +6 -2
  111. data/lib/comet/models/update_campaign_device_status.rb +9 -2
  112. data/lib/comet/models/update_campaign_options.rb +6 -2
  113. data/lib/comet/models/update_campaign_properties.rb +11 -3
  114. data/lib/comet/models/update_campaign_status.rb +11 -3
  115. data/lib/comet/models/update_campaign_status_device_entry.rb +13 -4
  116. data/lib/comet/models/user_custom_email_settings.rb +6 -2
  117. data/lib/comet/models/user_on_server.rb +11 -3
  118. data/lib/comet/models/user_policy.rb +22 -2
  119. data/lib/comet/models/user_profile_config.rb +41 -12
  120. data/lib/comet/models/user_profile_fragment.rb +8 -3
  121. data/lib/comet/models/vault_snapshot.rb +13 -4
  122. data/lib/comet/models/vsscomponent.rb +12 -5
  123. data/lib/comet/models/vsswriter_info.rb +8 -3
  124. data/lib/comet/models/web_interface_branding_properties.rb +14 -6
  125. data/lib/comet/models/webhook_option.rb +10 -3
  126. data/lib/comet/models/win_smbauth.rb +15 -5
  127. data/lib/comet/models/windows_code_sign_properties.rb +26 -9
  128. data/lib/comet_backup_ruby_sdk.rb +1 -0
  129. metadata +6 -2
@@ -48,40 +48,53 @@ module Comet
48
48
  attr_accessor :unknown_json_fields
49
49
 
50
50
  def initialize
51
+ clear
52
+ end
53
+
54
+ def clear
55
+ @type = ''
56
+ @description = ''
57
+ @remote_address = ''
58
+ @username = ''
59
+ @password = ''
60
+ @ldap = Comet::ExternalLDAPAuthenticationSourceSettings.new
61
+ @b2 = Comet::B2VirtualStorageRoleSettings.new
62
+ @wasabi = Comet::WasabiVirtualStorageRoleSettings.new
63
+ @storage_limit_bytes = 0
51
64
  @unknown_json_fields = {}
52
65
  end
53
66
 
54
67
  # @param [String] json_string The complete object in JSON format
55
68
  def from_json(json_string)
56
- raise TypeError 'expected string' unless json_string.is_a? String
69
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
57
70
 
58
71
  from_hash(JSON.parse(json_string))
59
72
  end
60
73
 
61
74
  # @param [Hash] obj The complete object as a Ruby hash
62
75
  def from_hash(obj)
63
- raise TypeError 'expected hash' unless obj.is_a? Hash
76
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
64
77
 
65
78
  obj.each do |k, v|
66
79
  case k
67
80
  when 'Type'
68
- raise TypeError 'expected string' unless v.is_a? String
81
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
69
82
 
70
83
  @type = v
71
84
  when 'Description'
72
- raise TypeError 'expected string' unless v.is_a? String
85
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
73
86
 
74
87
  @description = v
75
88
  when 'RemoteAddress'
76
- raise TypeError 'expected string' unless v.is_a? String
89
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
77
90
 
78
91
  @remote_address = v
79
92
  when 'Username'
80
- raise TypeError 'expected string' unless v.is_a? String
93
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
81
94
 
82
95
  @username = v
83
96
  when 'Password'
84
- raise TypeError 'expected string' unless v.is_a? String
97
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
85
98
 
86
99
  @password = v
87
100
  when 'LDAP'
@@ -96,6 +109,8 @@ module Comet
96
109
  when 'StorageLimitEnabled'
97
110
  @storage_limit_enabled = v
98
111
  when 'StorageLimitBytes'
112
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
113
+
99
114
  @storage_limit_bytes = v
100
115
  else
101
116
  @unknown_json_fields[k] = v
@@ -54,49 +54,85 @@ module Comet
54
54
  attr_accessor :unknown_json_fields
55
55
 
56
56
  def initialize
57
+ clear
58
+ end
59
+
60
+ def clear
61
+ @description = ''
62
+ @remote_server_id = ''
63
+ @display_class = 0
64
+ @active_workers = 0
65
+ @total_workers = 0
66
+ @state = 0
67
+ @items_queued = 0
68
+ @bytes_queued = 0
69
+ @last_worker_submit_time = 0
70
+ @current_time = 0
71
+ @items_replicated = 0
72
+ @bytes_replicated = 0
57
73
  @unknown_json_fields = {}
58
74
  end
59
75
 
60
76
  # @param [String] json_string The complete object in JSON format
61
77
  def from_json(json_string)
62
- raise TypeError 'expected string' unless json_string.is_a? String
78
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
63
79
 
64
80
  from_hash(JSON.parse(json_string))
65
81
  end
66
82
 
67
83
  # @param [Hash] obj The complete object as a Ruby hash
68
84
  def from_hash(obj)
69
- raise TypeError 'expected hash' unless obj.is_a? Hash
85
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
70
86
 
71
87
  obj.each do |k, v|
72
88
  case k
73
89
  when 'Description'
74
- raise TypeError 'expected string' unless v.is_a? String
90
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
75
91
 
76
92
  @description = v
77
93
  when 'RemoteServerID'
78
- raise TypeError 'expected string' unless v.is_a? String
94
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
79
95
 
80
96
  @remote_server_id = v
81
97
  when 'DisplayClass'
98
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
99
+
82
100
  @display_class = v
83
101
  when 'ActiveWorkers'
102
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
103
+
84
104
  @active_workers = v
85
105
  when 'TotalWorkers'
106
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
107
+
86
108
  @total_workers = v
87
109
  when 'State'
110
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
111
+
88
112
  @state = v
89
113
  when 'ItemsQueued'
114
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
115
+
90
116
  @items_queued = v
91
117
  when 'BytesQueued'
118
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
119
+
92
120
  @bytes_queued = v
93
121
  when 'LastWorkerSubmitTime'
122
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
123
+
94
124
  @last_worker_submit_time = v
95
125
  when 'CurrentTime'
126
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
127
+
96
128
  @current_time = v
97
129
  when 'ItemsReplicated'
130
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
131
+
98
132
  @items_replicated = v
99
133
  when 'BytesReplicated'
134
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
135
+
100
136
  @bytes_replicated = v
101
137
  else
102
138
  @unknown_json_fields[k] = v
@@ -27,30 +27,39 @@ module Comet
27
27
  attr_accessor :unknown_json_fields
28
28
 
29
29
  def initialize
30
+ clear
31
+ end
32
+
33
+ def clear
34
+ @status = 0
35
+ @message = ''
36
+ @destination_id = ''
30
37
  @unknown_json_fields = {}
31
38
  end
32
39
 
33
40
  # @param [String] json_string The complete object in JSON format
34
41
  def from_json(json_string)
35
- raise TypeError 'expected string' unless json_string.is_a? String
42
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
36
43
 
37
44
  from_hash(JSON.parse(json_string))
38
45
  end
39
46
 
40
47
  # @param [Hash] obj The complete object as a Ruby hash
41
48
  def from_hash(obj)
42
- raise TypeError 'expected hash' unless obj.is_a? Hash
49
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
43
50
 
44
51
  obj.each do |k, v|
45
52
  case k
46
53
  when 'Status'
54
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
55
+
47
56
  @status = v
48
57
  when 'Message'
49
- raise TypeError 'expected string' unless v.is_a? String
58
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
50
59
 
51
60
  @message = v
52
61
  when 'DestinationID'
53
- raise TypeError 'expected string' unless v.is_a? String
62
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
54
63
 
55
64
  @destination_id = v
56
65
  else
@@ -33,29 +33,38 @@ module Comet
33
33
  attr_accessor :unknown_json_fields
34
34
 
35
35
  def initialize
36
+ clear
37
+ end
38
+
39
+ def clear
40
+ @type = 0
41
+ @dest_path = ''
36
42
  @exact_dest_paths = []
43
+ @archive_format = 0
37
44
  @unknown_json_fields = {}
38
45
  end
39
46
 
40
47
  # @param [String] json_string The complete object in JSON format
41
48
  def from_json(json_string)
42
- raise TypeError 'expected string' unless json_string.is_a? String
49
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
43
50
 
44
51
  from_hash(JSON.parse(json_string))
45
52
  end
46
53
 
47
54
  # @param [Hash] obj The complete object as a Ruby hash
48
55
  def from_hash(obj)
49
- raise TypeError 'expected hash' unless obj.is_a? Hash
56
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
50
57
 
51
58
  obj.each do |k, v|
52
59
  case k
53
60
  when 'Type'
61
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
62
+
54
63
  @type = v
55
64
  when 'OverwriteExistingFiles'
56
65
  @overwrite_existing_files = v
57
66
  when 'DestPath'
58
- raise TypeError 'expected string' unless v.is_a? String
67
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
59
68
 
60
69
  @dest_path = v
61
70
  when 'ExactDestPaths'
@@ -64,12 +73,14 @@ module Comet
64
73
  else
65
74
  @exact_dest_paths = Array.new(v.length)
66
75
  v.each_with_index do |v1, i1|
67
- raise TypeError 'expected string' unless v1.is_a? String
76
+ raise TypeError "'v1' expected String, got #{v1.class}" unless v1.is_a? String
68
77
 
69
78
  @exact_dest_paths[i1] = v1
70
79
  end
71
80
  end
72
81
  when 'ArchiveFormat'
82
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
83
+
73
84
  @archive_format = v
74
85
  else
75
86
  @unknown_json_fields[k] = v
@@ -24,24 +24,31 @@ module Comet
24
24
  attr_accessor :unknown_json_fields
25
25
 
26
26
  def initialize
27
+ clear
28
+ end
29
+
30
+ def clear
31
+ @mode = 0
27
32
  @ranges = []
28
33
  @unknown_json_fields = {}
29
34
  end
30
35
 
31
36
  # @param [String] json_string The complete object in JSON format
32
37
  def from_json(json_string)
33
- raise TypeError 'expected string' unless json_string.is_a? String
38
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
34
39
 
35
40
  from_hash(JSON.parse(json_string))
36
41
  end
37
42
 
38
43
  # @param [Hash] obj The complete object as a Ruby hash
39
44
  def from_hash(obj)
40
- raise TypeError 'expected hash' unless obj.is_a? Hash
45
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
41
46
 
42
47
  obj.each do |k, v|
43
48
  case k
44
49
  when 'Mode'
50
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
51
+
45
52
  @mode = v
46
53
  when 'Ranges'
47
54
  if v.nil?
@@ -42,37 +42,65 @@ module Comet
42
42
  attr_accessor :unknown_json_fields
43
43
 
44
44
  def initialize
45
+ clear
46
+ end
47
+
48
+ def clear
49
+ @type = 0
50
+ @timestamp = 0
51
+ @jobs = 0
52
+ @days = 0
53
+ @weeks = 0
54
+ @months = 0
55
+ @week_offset = 0
56
+ @month_offset = 0
45
57
  @unknown_json_fields = {}
46
58
  end
47
59
 
48
60
  # @param [String] json_string The complete object in JSON format
49
61
  def from_json(json_string)
50
- raise TypeError 'expected string' unless json_string.is_a? String
62
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
51
63
 
52
64
  from_hash(JSON.parse(json_string))
53
65
  end
54
66
 
55
67
  # @param [Hash] obj The complete object as a Ruby hash
56
68
  def from_hash(obj)
57
- raise TypeError 'expected hash' unless obj.is_a? Hash
69
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
58
70
 
59
71
  obj.each do |k, v|
60
72
  case k
61
73
  when 'Type'
74
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
75
+
62
76
  @type = v
63
77
  when 'Timestamp'
78
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
79
+
64
80
  @timestamp = v
65
81
  when 'Jobs'
82
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
83
+
66
84
  @jobs = v
67
85
  when 'Days'
86
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
87
+
68
88
  @days = v
69
89
  when 'Weeks'
90
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
91
+
70
92
  @weeks = v
71
93
  when 'Months'
94
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
95
+
72
96
  @months = v
73
97
  when 'WeekOffset'
98
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
99
+
74
100
  @week_offset = v
75
101
  when 'MonthOffset'
102
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
103
+
76
104
  @month_offset = v
77
105
  else
78
106
  @unknown_json_fields[k] = v
@@ -39,42 +39,51 @@ module Comet
39
39
  attr_accessor :unknown_json_fields
40
40
 
41
41
  def initialize
42
+ clear
43
+ end
44
+
45
+ def clear
46
+ @s3server = ''
47
+ @s3access_key = ''
48
+ @s3secret_key = ''
49
+ @s3bucket_name = ''
50
+ @s3subdir = ''
42
51
  @unknown_json_fields = {}
43
52
  end
44
53
 
45
54
  # @param [String] json_string The complete object in JSON format
46
55
  def from_json(json_string)
47
- raise TypeError 'expected string' unless json_string.is_a? String
56
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
48
57
 
49
58
  from_hash(JSON.parse(json_string))
50
59
  end
51
60
 
52
61
  # @param [Hash] obj The complete object as a Ruby hash
53
62
  def from_hash(obj)
54
- raise TypeError 'expected hash' unless obj.is_a? Hash
63
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
55
64
 
56
65
  obj.each do |k, v|
57
66
  case k
58
67
  when 'S3Server'
59
- raise TypeError 'expected string' unless v.is_a? String
68
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
60
69
 
61
70
  @s3server = v
62
71
  when 'S3UsesTLS'
63
72
  @s3uses_tls = v
64
73
  when 'S3AccessKey'
65
- raise TypeError 'expected string' unless v.is_a? String
74
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
66
75
 
67
76
  @s3access_key = v
68
77
  when 'S3SecretKey'
69
- raise TypeError 'expected string' unless v.is_a? String
78
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
70
79
 
71
80
  @s3secret_key = v
72
81
  when 'S3BucketName'
73
- raise TypeError 'expected string' unless v.is_a? String
82
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
74
83
 
75
84
  @s3bucket_name = v
76
85
  when 'S3Subdir'
77
- raise TypeError 'expected string' unless v.is_a? String
86
+ raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
78
87
 
79
88
  @s3subdir = v
80
89
  when 'S3UsesV2Signing'
@@ -27,27 +27,40 @@ module Comet
27
27
  attr_accessor :unknown_json_fields
28
28
 
29
29
  def initialize
30
+ clear
31
+ end
32
+
33
+ def clear
34
+ @frequency_type = 0
35
+ @seconds_past = 0
36
+ @offset = 0
30
37
  @unknown_json_fields = {}
31
38
  end
32
39
 
33
40
  # @param [String] json_string The complete object in JSON format
34
41
  def from_json(json_string)
35
- raise TypeError 'expected string' unless json_string.is_a? String
42
+ raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
36
43
 
37
44
  from_hash(JSON.parse(json_string))
38
45
  end
39
46
 
40
47
  # @param [Hash] obj The complete object as a Ruby hash
41
48
  def from_hash(obj)
42
- raise TypeError 'expected hash' unless obj.is_a? Hash
49
+ raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
43
50
 
44
51
  obj.each do |k, v|
45
52
  case k
46
53
  when 'FrequencyType'
54
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
55
+
47
56
  @frequency_type = v
48
57
  when 'SecondsPast'
58
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
59
+
49
60
  @seconds_past = v
50
61
  when 'Offset'
62
+ raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
63
+
51
64
  @offset = v
52
65
  else
53
66
  @unknown_json_fields[k] = v