nodeum_sdk 1.86.0 → 1.87.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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -4
  3. data/docs/ByDateFacet.md +4 -4
  4. data/docs/ByMetadataBucket.md +17 -0
  5. data/docs/ByMetadataBucketAllOf.md +17 -0
  6. data/docs/ByMetadataFacet.md +17 -0
  7. data/docs/ByMetadataFacetAllOf.md +17 -0
  8. data/docs/ByMetadataKeyBucket.md +17 -0
  9. data/docs/ByMetadataKeyBucketAllOf.md +17 -0
  10. data/docs/ByMetadataKeyBuckets.md +17 -0
  11. data/docs/ByMetadataValueBuckets.md +17 -0
  12. data/docs/ByPrimaryStorageFacet.md +4 -4
  13. data/docs/ByPrimaryTypeFacet.md +4 -4
  14. data/docs/BySecondaryStorageFacet.md +4 -4
  15. data/docs/BySizeFacet.md +4 -4
  16. data/docs/ByTaskMetadataFacet.md +17 -0
  17. data/docs/ByTaskMetadataFacetAllOf.md +17 -0
  18. data/docs/ByTypeFacetBucket.md +1 -1
  19. data/docs/CloudBucket.md +3 -1
  20. data/docs/CloudBucketsApi.md +61 -0
  21. data/docs/CloudConnector.md +3 -1
  22. data/docs/DefaultFacet.md +1 -1
  23. data/docs/FileFacet.md +3 -3
  24. data/docs/FileFacetAllOf.md +3 -3
  25. data/docs/FileMetadataDefinition.md +16 -0
  26. data/docs/FileMetadataDefinitionCollection.md +19 -0
  27. data/docs/MetadataApi.md +252 -0
  28. data/docs/MetadataDefinition.md +27 -0
  29. data/docs/StatisticsApi.md +136 -0
  30. data/docs/StorageCloudBucketFacets.md +1 -1
  31. data/docs/StorageFacet.md +1 -1
  32. data/docs/StorageNasShareFacets.md +1 -1
  33. data/docs/StoragePoolFacets.md +1 -1
  34. data/docs/StorageTapeFacets.md +1 -1
  35. data/docs/SystemGroup.md +3 -3
  36. data/docs/SystemUser.md +4 -4
  37. data/docs/TaskFacet.md +11 -7
  38. data/docs/TaskFacetAllOf.md +11 -7
  39. data/docs/TaskFacetBucket.md +12 -8
  40. data/docs/TaskFacetMetadataBucket.md +35 -0
  41. data/docs/TaskFacetMetadataKeyBucket.md +17 -0
  42. data/docs/TaskFacetMetadataKeyBucketAllOf.md +17 -0
  43. data/docs/TaskFacetMetadataKeyBuckets.md +17 -0
  44. data/docs/TaskFacetMetadataValueBuckets.md +17 -0
  45. data/docs/TaskMetadataDefinition.md +25 -0
  46. data/docs/TaskMetadataDefinitionAllOf.md +25 -0
  47. data/docs/TaskMetadataDefinitionCollection.md +19 -0
  48. data/lib/nodeum_sdk.rb +22 -0
  49. data/lib/nodeum_sdk/api/cloud_buckets_api.rb +71 -0
  50. data/lib/nodeum_sdk/api/metadata_api.rb +270 -0
  51. data/lib/nodeum_sdk/api/statistics_api.rb +151 -0
  52. data/lib/nodeum_sdk/models/by_metadata_bucket.rb +218 -0
  53. data/lib/nodeum_sdk/models/by_metadata_bucket_all_of.rb +206 -0
  54. data/lib/nodeum_sdk/models/by_metadata_facet.rb +218 -0
  55. data/lib/nodeum_sdk/models/by_metadata_facet_all_of.rb +206 -0
  56. data/lib/nodeum_sdk/models/by_metadata_key_bucket.rb +218 -0
  57. data/lib/nodeum_sdk/models/by_metadata_key_bucket_all_of.rb +206 -0
  58. data/lib/nodeum_sdk/models/by_metadata_key_buckets.rb +208 -0
  59. data/lib/nodeum_sdk/models/by_metadata_value_buckets.rb +208 -0
  60. data/lib/nodeum_sdk/models/by_task_metadata_facet.rb +218 -0
  61. data/lib/nodeum_sdk/models/by_task_metadata_facet_all_of.rb +206 -0
  62. data/lib/nodeum_sdk/models/cloud_bucket.rb +14 -4
  63. data/lib/nodeum_sdk/models/cloud_connector.rb +16 -6
  64. data/lib/nodeum_sdk/models/file_metadata_definition.rb +230 -0
  65. data/lib/nodeum_sdk/models/file_metadata_definition_collection.rb +217 -0
  66. data/lib/nodeum_sdk/models/metadata_definition.rb +285 -0
  67. data/lib/nodeum_sdk/models/task_facet.rb +22 -4
  68. data/lib/nodeum_sdk/models/task_facet_all_of.rb +22 -4
  69. data/lib/nodeum_sdk/models/task_facet_bucket.rb +22 -4
  70. data/lib/nodeum_sdk/models/task_facet_metadata_bucket.rb +295 -0
  71. data/lib/nodeum_sdk/models/task_facet_metadata_key_bucket.rb +218 -0
  72. data/lib/nodeum_sdk/models/task_facet_metadata_key_bucket_all_of.rb +206 -0
  73. data/lib/nodeum_sdk/models/task_facet_metadata_key_buckets.rb +208 -0
  74. data/lib/nodeum_sdk/models/task_facet_metadata_value_buckets.rb +208 -0
  75. data/lib/nodeum_sdk/models/task_metadata_definition.rb +288 -0
  76. data/lib/nodeum_sdk/models/task_metadata_definition_all_of.rb +276 -0
  77. data/lib/nodeum_sdk/models/task_metadata_definition_collection.rb +217 -0
  78. data/lib/nodeum_sdk/version.rb +1 -1
  79. data/spec/api/metadata_api_spec.rb +85 -0
  80. data/spec/models/by_metadata_bucket_all_of_spec.rb +41 -0
  81. data/spec/models/by_metadata_bucket_spec.rb +41 -0
  82. data/spec/models/by_metadata_facet_all_of_spec.rb +41 -0
  83. data/spec/models/by_metadata_facet_spec.rb +41 -0
  84. data/spec/models/by_metadata_key_bucket_all_of_spec.rb +41 -0
  85. data/spec/models/by_metadata_key_bucket_spec.rb +41 -0
  86. data/spec/models/by_metadata_key_buckets_spec.rb +41 -0
  87. data/spec/models/by_metadata_value_buckets_spec.rb +41 -0
  88. data/spec/models/by_task_metadata_facet_all_of_spec.rb +41 -0
  89. data/spec/models/by_task_metadata_facet_spec.rb +41 -0
  90. data/spec/models/file_metadata_definition_collection_spec.rb +47 -0
  91. data/spec/models/file_metadata_definition_spec.rb +35 -0
  92. data/spec/models/metadata_definition_spec.rb +75 -0
  93. data/spec/models/task_facet_metadata_bucket_spec.rb +95 -0
  94. data/spec/models/task_facet_metadata_key_bucket_all_of_spec.rb +41 -0
  95. data/spec/models/task_facet_metadata_key_bucket_spec.rb +41 -0
  96. data/spec/models/task_facet_metadata_key_buckets_spec.rb +41 -0
  97. data/spec/models/task_facet_metadata_value_buckets_spec.rb +41 -0
  98. data/spec/models/task_metadata_definition_all_of_spec.rb +69 -0
  99. data/spec/models/task_metadata_definition_collection_spec.rb +47 -0
  100. data/spec/models/task_metadata_definition_spec.rb +69 -0
  101. metadata +245 -157
@@ -0,0 +1,288 @@
1
+ =begin
2
+ #Nodeum API
3
+
4
+ #The Nodeum API makes it easy to tap into the digital data mesh that runs across your organisation. Make requests to our API endpoints and we’ll give you everything you need to interconnect your business workflows with your storage. All production API requests are made to: http://nodeumhostname/api/ The current production version of the API is v1. **REST** The Nodeum API is a RESTful API. This means that the API is designed to allow you to get, create, update, & delete objects with the HTTP verbs GET, POST, PUT, PATCH, & DELETE. **JSON** The Nodeum API speaks exclusively in JSON. This means that you should always set the Content-Type header to application/json to ensure that your requests are properly accepted and processed by the API. **Authentication** All API calls require user-password authentication. **Cross-Origin Resource Sharing** The Nodeum API supports CORS for communicating from Javascript for these endpoints. You will need to specify an Origin URI when creating your application to allow for CORS to be whitelisted for your domain. **Pagination** Some endpoints such as File Listing return a potentially lengthy array of objects. In order to keep the response sizes manageable the API will take advantage of pagination. Pagination is a mechanism for returning a subset of the results for a request and allowing for subsequent requests to “page” through the rest of the results until the end is reached. Paginated endpoints follow a standard interface that accepts two query parameters, limit and offset, and return a payload that follows a standard form. These parameters names and their behavior are borrowed from SQL LIMIT and OFFSET keywords. **Versioning** The Nodeum API is constantly being worked on to add features, make improvements, and fix bugs. This means that you should expect changes to be introduced and documented. However, there are some changes or additions that are considered backwards-compatible and your applications should be flexible enough to handle them. These include: - Adding new endpoints to the API - Adding new attributes to the response of an existing endpoint - Changing the order of attributes of responses (JSON by definition is an object of unordered key/value pairs) **Filter parameters** When browsing a list of items, multiple filter parameters may be applied. Some operators can be added to the value as a prefix: - `=` value is equal. Default operator, may be omitted - `!=` value is different - `>` greater than - `>=` greater than or equal - `<` lower than - `>=` lower than or equal - `><` included in list, items should be separated by `|` - `!><` not included in list, items should be separated by `|` - `~` pattern matching, may include `%` (any characters) and `_` (one character) - `!~` pattern not matching, may include `%` (any characters) and `_` (one character)
5
+
6
+ The version of the OpenAPI document: 2.1.0
7
+ Contact: info@nodeum.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Nodeum
16
+ class TaskMetadataDefinition < MetadataDefinition
17
+ attr_accessor :type
18
+
19
+ attr_accessor :apply_active_archive
20
+
21
+ attr_accessor :apply_offline_archive
22
+
23
+ attr_accessor :apply_data_exchange
24
+
25
+ attr_accessor :apply_maintenance
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'type' => :'type',
53
+ :'apply_active_archive' => :'apply_active_archive',
54
+ :'apply_offline_archive' => :'apply_offline_archive',
55
+ :'apply_data_exchange' => :'apply_data_exchange',
56
+ :'apply_maintenance' => :'apply_maintenance'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'type' => :'String',
64
+ :'apply_active_archive' => :'Boolean',
65
+ :'apply_offline_archive' => :'Boolean',
66
+ :'apply_data_exchange' => :'Boolean',
67
+ :'apply_maintenance' => :'Boolean'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # List of class defined in allOf (OpenAPI v3)
78
+ def self.openapi_all_of
79
+ [
80
+ :'MetadataDefinition',
81
+ :'TaskMetadataDefinitionAllOf'
82
+ ]
83
+ end
84
+
85
+ # Initializes the object
86
+ # @param [Hash] attributes Model attributes in the form of hash
87
+ def initialize(attributes = {})
88
+ if (!attributes.is_a?(Hash))
89
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Nodeum::TaskMetadataDefinition` initialize method"
90
+ end
91
+
92
+ # check to see if the attribute exists and convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!self.class.attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Nodeum::TaskMetadataDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ # call parent's initialize
101
+ super(attributes)
102
+
103
+ if attributes.key?(:'type')
104
+ self.type = attributes[:'type']
105
+ end
106
+
107
+ if attributes.key?(:'apply_active_archive')
108
+ self.apply_active_archive = attributes[:'apply_active_archive']
109
+ end
110
+
111
+ if attributes.key?(:'apply_offline_archive')
112
+ self.apply_offline_archive = attributes[:'apply_offline_archive']
113
+ end
114
+
115
+ if attributes.key?(:'apply_data_exchange')
116
+ self.apply_data_exchange = attributes[:'apply_data_exchange']
117
+ end
118
+
119
+ if attributes.key?(:'apply_maintenance')
120
+ self.apply_maintenance = attributes[:'apply_maintenance']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = super
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ type_validator = EnumAttributeValidator.new('String', ["input_text", "text_area", "checkbox", "radio"])
135
+ return false unless type_validator.valid?(@type)
136
+ true && super
137
+ end
138
+
139
+ # Custom attribute writer method checking allowed values (enum).
140
+ # @param [Object] type Object to be assigned
141
+ def type=(type)
142
+ validator = EnumAttributeValidator.new('String', ["input_text", "text_area", "checkbox", "radio"])
143
+ unless validator.valid?(type)
144
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
145
+ end
146
+ @type = type
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ type == o.type &&
155
+ apply_active_archive == o.apply_active_archive &&
156
+ apply_offline_archive == o.apply_offline_archive &&
157
+ apply_data_exchange == o.apply_data_exchange &&
158
+ apply_maintenance == o.apply_maintenance && super(o)
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [type, apply_active_archive, apply_offline_archive, apply_data_exchange, apply_maintenance].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ new.build_from_hash(attributes)
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ super(attributes)
186
+ self.class.openapi_types.each_pair do |key, type|
187
+ if type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the attribute
189
+ # is documented as an array but the input is not
190
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
191
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
192
+ end
193
+ elsif !attributes[self.class.attribute_map[key]].nil?
194
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
195
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
196
+ end
197
+
198
+ self
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def _deserialize(type, value)
206
+ case type.to_sym
207
+ when :DateTime
208
+ DateTime.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ Nodeum.const_get(type).build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = super
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+ end
288
+ end
@@ -0,0 +1,276 @@
1
+ =begin
2
+ #Nodeum API
3
+
4
+ #The Nodeum API makes it easy to tap into the digital data mesh that runs across your organisation. Make requests to our API endpoints and we’ll give you everything you need to interconnect your business workflows with your storage. All production API requests are made to: http://nodeumhostname/api/ The current production version of the API is v1. **REST** The Nodeum API is a RESTful API. This means that the API is designed to allow you to get, create, update, & delete objects with the HTTP verbs GET, POST, PUT, PATCH, & DELETE. **JSON** The Nodeum API speaks exclusively in JSON. This means that you should always set the Content-Type header to application/json to ensure that your requests are properly accepted and processed by the API. **Authentication** All API calls require user-password authentication. **Cross-Origin Resource Sharing** The Nodeum API supports CORS for communicating from Javascript for these endpoints. You will need to specify an Origin URI when creating your application to allow for CORS to be whitelisted for your domain. **Pagination** Some endpoints such as File Listing return a potentially lengthy array of objects. In order to keep the response sizes manageable the API will take advantage of pagination. Pagination is a mechanism for returning a subset of the results for a request and allowing for subsequent requests to “page” through the rest of the results until the end is reached. Paginated endpoints follow a standard interface that accepts two query parameters, limit and offset, and return a payload that follows a standard form. These parameters names and their behavior are borrowed from SQL LIMIT and OFFSET keywords. **Versioning** The Nodeum API is constantly being worked on to add features, make improvements, and fix bugs. This means that you should expect changes to be introduced and documented. However, there are some changes or additions that are considered backwards-compatible and your applications should be flexible enough to handle them. These include: - Adding new endpoints to the API - Adding new attributes to the response of an existing endpoint - Changing the order of attributes of responses (JSON by definition is an object of unordered key/value pairs) **Filter parameters** When browsing a list of items, multiple filter parameters may be applied. Some operators can be added to the value as a prefix: - `=` value is equal. Default operator, may be omitted - `!=` value is different - `>` greater than - `>=` greater than or equal - `<` lower than - `>=` lower than or equal - `><` included in list, items should be separated by `|` - `!><` not included in list, items should be separated by `|` - `~` pattern matching, may include `%` (any characters) and `_` (one character) - `!~` pattern not matching, may include `%` (any characters) and `_` (one character)
5
+
6
+ The version of the OpenAPI document: 2.1.0
7
+ Contact: info@nodeum.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Nodeum
16
+ class TaskMetadataDefinitionAllOf
17
+ attr_accessor :type
18
+
19
+ attr_accessor :apply_active_archive
20
+
21
+ attr_accessor :apply_offline_archive
22
+
23
+ attr_accessor :apply_data_exchange
24
+
25
+ attr_accessor :apply_maintenance
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'type' => :'type',
53
+ :'apply_active_archive' => :'apply_active_archive',
54
+ :'apply_offline_archive' => :'apply_offline_archive',
55
+ :'apply_data_exchange' => :'apply_data_exchange',
56
+ :'apply_maintenance' => :'apply_maintenance'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'type' => :'String',
64
+ :'apply_active_archive' => :'Boolean',
65
+ :'apply_offline_archive' => :'Boolean',
66
+ :'apply_data_exchange' => :'Boolean',
67
+ :'apply_maintenance' => :'Boolean'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Nodeum::TaskMetadataDefinitionAllOf` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Nodeum::TaskMetadataDefinitionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'type')
93
+ self.type = attributes[:'type']
94
+ end
95
+
96
+ if attributes.key?(:'apply_active_archive')
97
+ self.apply_active_archive = attributes[:'apply_active_archive']
98
+ end
99
+
100
+ if attributes.key?(:'apply_offline_archive')
101
+ self.apply_offline_archive = attributes[:'apply_offline_archive']
102
+ end
103
+
104
+ if attributes.key?(:'apply_data_exchange')
105
+ self.apply_data_exchange = attributes[:'apply_data_exchange']
106
+ end
107
+
108
+ if attributes.key?(:'apply_maintenance')
109
+ self.apply_maintenance = attributes[:'apply_maintenance']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ invalid_properties = Array.new
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ type_validator = EnumAttributeValidator.new('String', ["input_text", "text_area", "checkbox", "radio"])
124
+ return false unless type_validator.valid?(@type)
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method checking allowed values (enum).
129
+ # @param [Object] type Object to be assigned
130
+ def type=(type)
131
+ validator = EnumAttributeValidator.new('String', ["input_text", "text_area", "checkbox", "radio"])
132
+ unless validator.valid?(type)
133
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
134
+ end
135
+ @type = type
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ type == o.type &&
144
+ apply_active_archive == o.apply_active_archive &&
145
+ apply_offline_archive == o.apply_offline_archive &&
146
+ apply_data_exchange == o.apply_data_exchange &&
147
+ apply_maintenance == o.apply_maintenance
148
+ end
149
+
150
+ # @see the `==` method
151
+ # @param [Object] Object to be compared
152
+ def eql?(o)
153
+ self == o
154
+ end
155
+
156
+ # Calculates hash code according to all attributes.
157
+ # @return [Integer] Hash code
158
+ def hash
159
+ [type, apply_active_archive, apply_offline_archive, apply_data_exchange, apply_maintenance].hash
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def self.build_from_hash(attributes)
166
+ new.build_from_hash(attributes)
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ Nodeum.const_get(type).build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end