ddr_client 2.0.0.d9f2bd2b

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +168 -0
  4. data/Rakefile +8 -0
  5. data/ddr_client.gemspec +46 -0
  6. data/docs/BatchObjectsApi.md +125 -0
  7. data/docs/BatchesApi.md +305 -0
  8. data/docs/DdrAPIBatchEntity.md +24 -0
  9. data/docs/DdrAPIBatchEntityLogfile.md +11 -0
  10. data/docs/DdrAPIBatchObjectAttributeEntity.md +16 -0
  11. data/docs/DdrAPIBatchObjectDatastreamEntity.md +17 -0
  12. data/docs/DdrAPIBatchObjectEntity.md +26 -0
  13. data/docs/DdrAPIBatchObjectMessageEntity.md +13 -0
  14. data/docs/DdrAPIBatchObjectRelationshipEntity.md +15 -0
  15. data/docs/DdrAPIBatchObjectRoleEntity.md +15 -0
  16. data/docs/DdrAPIEventEntity.md +17 -0
  17. data/docs/DdrAPIFileEntity.md +11 -0
  18. data/docs/DdrAPIGroupEntity.md +10 -0
  19. data/docs/DdrAPIGroupMemberEntity.md +10 -0
  20. data/docs/DdrAPILinkEntity.md +9 -0
  21. data/docs/DdrAPIResourceEntity.md +17 -0
  22. data/docs/DdrAPIResourceEntityFiles.md +17 -0
  23. data/docs/DdrAPIResourceEntityMetadata.md +62 -0
  24. data/docs/DdrAPIResourceEntityRelated.md +11 -0
  25. data/docs/DdrAPIRoleEntity.md +10 -0
  26. data/docs/DdrAPITechnicalMetadataEntity.md +24 -0
  27. data/docs/DdrAPIUserEntity.md +19 -0
  28. data/docs/EventsApi.md +131 -0
  29. data/docs/GroupsApi.md +63 -0
  30. data/docs/IndexApi.md +161 -0
  31. data/docs/PatchResources.md +11 -0
  32. data/docs/PatchResourcesMetadata.md +62 -0
  33. data/docs/PatchResourcesRelated.md +11 -0
  34. data/docs/PatchResourcesRoles.md +10 -0
  35. data/docs/PostResources.md +12 -0
  36. data/docs/QueuesApi.md +102 -0
  37. data/docs/ReportsApi.md +177 -0
  38. data/docs/ResourcesApi.md +1003 -0
  39. data/docs/SchemaApi.md +128 -0
  40. data/docs/UsersApi.md +131 -0
  41. data/git_push.sh +55 -0
  42. data/lib/ddr_client/api/batch_objects_api.rb +138 -0
  43. data/lib/ddr_client/api/batches_api.rb +306 -0
  44. data/lib/ddr_client/api/events_api.rb +147 -0
  45. data/lib/ddr_client/api/groups_api.rb +70 -0
  46. data/lib/ddr_client/api/index_api.rb +164 -0
  47. data/lib/ddr_client/api/queues_api.rb +109 -0
  48. data/lib/ddr_client/api/reports_api.rb +179 -0
  49. data/lib/ddr_client/api/resources_api.rb +1098 -0
  50. data/lib/ddr_client/api/schema_api.rb +152 -0
  51. data/lib/ddr_client/api/users_api.rb +141 -0
  52. data/lib/ddr_client/api_client.rb +391 -0
  53. data/lib/ddr_client/api_error.rb +38 -0
  54. data/lib/ddr_client/configuration.rb +209 -0
  55. data/lib/ddr_client/models/ddr_api_batch_entity.rb +333 -0
  56. data/lib/ddr_client/models/ddr_api_batch_entity_logfile.rb +211 -0
  57. data/lib/ddr_client/models/ddr_api_batch_object_attribute_entity.rb +256 -0
  58. data/lib/ddr_client/models/ddr_api_batch_object_datastream_entity.rb +265 -0
  59. data/lib/ddr_client/models/ddr_api_batch_object_entity.rb +349 -0
  60. data/lib/ddr_client/models/ddr_api_batch_object_message_entity.rb +230 -0
  61. data/lib/ddr_client/models/ddr_api_batch_object_relationship_entity.rb +247 -0
  62. data/lib/ddr_client/models/ddr_api_batch_object_role_entity.rb +247 -0
  63. data/lib/ddr_client/models/ddr_api_event_entity.rb +325 -0
  64. data/lib/ddr_client/models/ddr_api_file_entity.rb +215 -0
  65. data/lib/ddr_client/models/ddr_api_group_entity.rb +203 -0
  66. data/lib/ddr_client/models/ddr_api_group_member_entity.rb +202 -0
  67. data/lib/ddr_client/models/ddr_api_link_entity.rb +193 -0
  68. data/lib/ddr_client/models/ddr_api_resource_entity.rb +310 -0
  69. data/lib/ddr_client/models/ddr_api_resource_entity_files.rb +276 -0
  70. data/lib/ddr_client/models/ddr_api_resource_entity_metadata.rb +874 -0
  71. data/lib/ddr_client/models/ddr_api_resource_entity_related.rb +216 -0
  72. data/lib/ddr_client/models/ddr_api_role_entity.rb +251 -0
  73. data/lib/ddr_client/models/ddr_api_technical_metadata_entity.rb +329 -0
  74. data/lib/ddr_client/models/ddr_api_user_entity.rb +296 -0
  75. data/lib/ddr_client/models/patch_resources.rb +221 -0
  76. data/lib/ddr_client/models/patch_resources_metadata.rb +726 -0
  77. data/lib/ddr_client/models/patch_resources_related.rb +216 -0
  78. data/lib/ddr_client/models/patch_resources_roles.rb +220 -0
  79. data/lib/ddr_client/models/post_resources.rb +265 -0
  80. data/lib/ddr_client/version.rb +15 -0
  81. data/lib/ddr_client.rb +74 -0
  82. data/spec/api/batch_objects_api_spec.rb +61 -0
  83. data/spec/api/batches_api_spec.rb +100 -0
  84. data/spec/api/events_api_spec.rb +64 -0
  85. data/spec/api/groups_api_spec.rb +46 -0
  86. data/spec/api/index_api_spec.rb +67 -0
  87. data/spec/api/queues_api_spec.rb +55 -0
  88. data/spec/api/reports_api_spec.rb +70 -0
  89. data/spec/api/resources_api_spec.rb +271 -0
  90. data/spec/api/schema_api_spec.rb +65 -0
  91. data/spec/api/users_api_spec.rb +64 -0
  92. data/spec/api_client_spec.rb +243 -0
  93. data/spec/configuration_spec.rb +42 -0
  94. data/spec/models/ddr_api_batch_entity_logfile_spec.rb +59 -0
  95. data/spec/models/ddr_api_batch_entity_spec.rb +137 -0
  96. data/spec/models/ddr_api_batch_object_attribute_entity_spec.rb +89 -0
  97. data/spec/models/ddr_api_batch_object_datastream_entity_spec.rb +95 -0
  98. data/spec/models/ddr_api_batch_object_entity_spec.rb +149 -0
  99. data/spec/models/ddr_api_batch_object_message_entity_spec.rb +71 -0
  100. data/spec/models/ddr_api_batch_object_relationship_entity_spec.rb +83 -0
  101. data/spec/models/ddr_api_batch_object_role_entity_spec.rb +83 -0
  102. data/spec/models/ddr_api_event_entity_spec.rb +103 -0
  103. data/spec/models/ddr_api_file_entity_spec.rb +59 -0
  104. data/spec/models/ddr_api_group_entity_spec.rb +53 -0
  105. data/spec/models/ddr_api_group_member_entity_spec.rb +53 -0
  106. data/spec/models/ddr_api_link_entity_spec.rb +47 -0
  107. data/spec/models/ddr_api_resource_entity_files_spec.rb +95 -0
  108. data/spec/models/ddr_api_resource_entity_metadata_spec.rb +389 -0
  109. data/spec/models/ddr_api_resource_entity_related_spec.rb +59 -0
  110. data/spec/models/ddr_api_resource_entity_spec.rb +99 -0
  111. data/spec/models/ddr_api_role_entity_spec.rb +61 -0
  112. data/spec/models/ddr_api_technical_metadata_entity_spec.rb +137 -0
  113. data/spec/models/ddr_api_user_entity_spec.rb +107 -0
  114. data/spec/models/patch_resources_metadata_spec.rb +365 -0
  115. data/spec/models/patch_resources_related_spec.rb +59 -0
  116. data/spec/models/patch_resources_roles_spec.rb +53 -0
  117. data/spec/models/patch_resources_spec.rb +59 -0
  118. data/spec/models/post_resources_spec.rb +69 -0
  119. data/spec/spec_helper.rb +111 -0
  120. metadata +399 -0
@@ -0,0 +1,329 @@
1
+ =begin
2
+ #Duke Digital Repository API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.36
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DdrClient
16
+ # Ddr_API_TechnicalMetadataEntity model
17
+ class DdrAPITechnicalMetadataEntity
18
+ attr_accessor :id
19
+
20
+ attr_accessor :local_id
21
+
22
+ attr_accessor :color_space
23
+
24
+ attr_accessor :created
25
+
26
+ attr_accessor :creating_application
27
+
28
+ attr_accessor :extent
29
+
30
+ attr_accessor :format_label
31
+
32
+ attr_accessor :format_version
33
+
34
+ attr_accessor :icc_profile_name
35
+
36
+ attr_accessor :icc_profile_version
37
+
38
+ attr_accessor :image_height
39
+
40
+ attr_accessor :image_width
41
+
42
+ attr_accessor :media_type
43
+
44
+ attr_accessor :modified
45
+
46
+ attr_accessor :pronom_identifier
47
+
48
+ attr_accessor :valid
49
+
50
+ attr_accessor :well_formed
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'id' => :'id',
56
+ :'local_id' => :'local_id',
57
+ :'color_space' => :'color_space',
58
+ :'created' => :'created',
59
+ :'creating_application' => :'creating_application',
60
+ :'extent' => :'extent',
61
+ :'format_label' => :'format_label',
62
+ :'format_version' => :'format_version',
63
+ :'icc_profile_name' => :'icc_profile_name',
64
+ :'icc_profile_version' => :'icc_profile_version',
65
+ :'image_height' => :'image_height',
66
+ :'image_width' => :'image_width',
67
+ :'media_type' => :'media_type',
68
+ :'modified' => :'modified',
69
+ :'pronom_identifier' => :'pronom_identifier',
70
+ :'valid' => :'valid',
71
+ :'well_formed' => :'well_formed'
72
+ }
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.swagger_types
77
+ {
78
+ :'id' => :'String',
79
+ :'local_id' => :'String',
80
+ :'color_space' => :'String',
81
+ :'created' => :'String',
82
+ :'creating_application' => :'String',
83
+ :'extent' => :'String',
84
+ :'format_label' => :'String',
85
+ :'format_version' => :'String',
86
+ :'icc_profile_name' => :'String',
87
+ :'icc_profile_version' => :'String',
88
+ :'image_height' => :'String',
89
+ :'image_width' => :'String',
90
+ :'media_type' => :'String',
91
+ :'modified' => :'String',
92
+ :'pronom_identifier' => :'String',
93
+ :'valid' => :'String',
94
+ :'well_formed' => :'String'
95
+ }
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ return unless attributes.is_a?(Hash)
102
+
103
+ # convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
105
+
106
+ if attributes.has_key?(:'id')
107
+ self.id = attributes[:'id']
108
+ end
109
+
110
+ if attributes.has_key?(:'local_id')
111
+ self.local_id = attributes[:'local_id']
112
+ end
113
+
114
+ if attributes.has_key?(:'color_space')
115
+ self.color_space = attributes[:'color_space']
116
+ end
117
+
118
+ if attributes.has_key?(:'created')
119
+ self.created = attributes[:'created']
120
+ end
121
+
122
+ if attributes.has_key?(:'creating_application')
123
+ self.creating_application = attributes[:'creating_application']
124
+ end
125
+
126
+ if attributes.has_key?(:'extent')
127
+ self.extent = attributes[:'extent']
128
+ end
129
+
130
+ if attributes.has_key?(:'format_label')
131
+ self.format_label = attributes[:'format_label']
132
+ end
133
+
134
+ if attributes.has_key?(:'format_version')
135
+ self.format_version = attributes[:'format_version']
136
+ end
137
+
138
+ if attributes.has_key?(:'icc_profile_name')
139
+ self.icc_profile_name = attributes[:'icc_profile_name']
140
+ end
141
+
142
+ if attributes.has_key?(:'icc_profile_version')
143
+ self.icc_profile_version = attributes[:'icc_profile_version']
144
+ end
145
+
146
+ if attributes.has_key?(:'image_height')
147
+ self.image_height = attributes[:'image_height']
148
+ end
149
+
150
+ if attributes.has_key?(:'image_width')
151
+ self.image_width = attributes[:'image_width']
152
+ end
153
+
154
+ if attributes.has_key?(:'media_type')
155
+ self.media_type = attributes[:'media_type']
156
+ end
157
+
158
+ if attributes.has_key?(:'modified')
159
+ self.modified = attributes[:'modified']
160
+ end
161
+
162
+ if attributes.has_key?(:'pronom_identifier')
163
+ self.pronom_identifier = attributes[:'pronom_identifier']
164
+ end
165
+
166
+ if attributes.has_key?(:'valid')
167
+ self.valid = attributes[:'valid']
168
+ end
169
+
170
+ if attributes.has_key?(:'well_formed')
171
+ self.well_formed = attributes[:'well_formed']
172
+ end
173
+ end
174
+
175
+ # Show invalid properties with the reasons. Usually used together with valid?
176
+ # @return Array for valid properties with the reasons
177
+ def list_invalid_properties
178
+ invalid_properties = Array.new
179
+ invalid_properties
180
+ end
181
+
182
+ # Check to see if the all the properties in the model are valid
183
+ # @return true if the model is valid
184
+ def valid?
185
+ true
186
+ end
187
+
188
+ # Checks equality by comparing each attribute.
189
+ # @param [Object] Object to be compared
190
+ def ==(o)
191
+ return true if self.equal?(o)
192
+ self.class == o.class &&
193
+ id == o.id &&
194
+ local_id == o.local_id &&
195
+ color_space == o.color_space &&
196
+ created == o.created &&
197
+ creating_application == o.creating_application &&
198
+ extent == o.extent &&
199
+ format_label == o.format_label &&
200
+ format_version == o.format_version &&
201
+ icc_profile_name == o.icc_profile_name &&
202
+ icc_profile_version == o.icc_profile_version &&
203
+ image_height == o.image_height &&
204
+ image_width == o.image_width &&
205
+ media_type == o.media_type &&
206
+ modified == o.modified &&
207
+ pronom_identifier == o.pronom_identifier &&
208
+ valid == o.valid &&
209
+ well_formed == o.well_formed
210
+ end
211
+
212
+ # @see the `==` method
213
+ # @param [Object] Object to be compared
214
+ def eql?(o)
215
+ self == o
216
+ end
217
+
218
+ # Calculates hash code according to all attributes.
219
+ # @return [Fixnum] Hash code
220
+ def hash
221
+ [id, local_id, color_space, created, creating_application, extent, format_label, format_version, icc_profile_name, icc_profile_version, image_height, image_width, media_type, modified, pronom_identifier, valid, well_formed].hash
222
+ end
223
+
224
+ # Builds the object from hash
225
+ # @param [Hash] attributes Model attributes in the form of hash
226
+ # @return [Object] Returns the model itself
227
+ def build_from_hash(attributes)
228
+ return nil unless attributes.is_a?(Hash)
229
+ self.class.swagger_types.each_pair do |key, type|
230
+ if type =~ /\AArray<(.*)>/i
231
+ # check to ensure the input is an array given that the attribute
232
+ # is documented as an array but the input is not
233
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
234
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
235
+ end
236
+ elsif !attributes[self.class.attribute_map[key]].nil?
237
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
238
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
239
+ end
240
+
241
+ self
242
+ end
243
+
244
+ # Deserializes the data based on type
245
+ # @param string type Data type
246
+ # @param string value Value to be deserialized
247
+ # @return [Object] Deserialized data
248
+ def _deserialize(type, value)
249
+ case type.to_sym
250
+ when :DateTime
251
+ DateTime.parse(value)
252
+ when :Date
253
+ Date.parse(value)
254
+ when :String
255
+ value.to_s
256
+ when :Integer
257
+ value.to_i
258
+ when :Float
259
+ value.to_f
260
+ when :BOOLEAN
261
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
262
+ true
263
+ else
264
+ false
265
+ end
266
+ when :Object
267
+ # generic object (usually a Hash), return directly
268
+ value
269
+ when /\AArray<(?<inner_type>.+)>\z/
270
+ inner_type = Regexp.last_match[:inner_type]
271
+ value.map { |v| _deserialize(inner_type, v) }
272
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
273
+ k_type = Regexp.last_match[:k_type]
274
+ v_type = Regexp.last_match[:v_type]
275
+ {}.tap do |hash|
276
+ value.each do |k, v|
277
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
278
+ end
279
+ end
280
+ else # model
281
+ temp_model = DdrClient.const_get(type).new
282
+ temp_model.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_hash
301
+ hash = {}
302
+ self.class.attribute_map.each_pair do |attr, param|
303
+ value = self.send(attr)
304
+ next if value.nil?
305
+ hash[param] = _to_hash(value)
306
+ end
307
+ hash
308
+ end
309
+
310
+ # Outputs non-array value in the form of hash
311
+ # For object, use to_hash. Otherwise, just return the value
312
+ # @param [Object] value Any valid value
313
+ # @return [Hash] Returns the value in the form of hash
314
+ def _to_hash(value)
315
+ if value.is_a?(Array)
316
+ value.compact.map { |v| _to_hash(v) }
317
+ elsif value.is_a?(Hash)
318
+ {}.tap do |hash|
319
+ value.each { |k, v| hash[k] = _to_hash(v) }
320
+ end
321
+ elsif value.respond_to? :to_hash
322
+ value.to_hash
323
+ else
324
+ value
325
+ end
326
+ end
327
+
328
+ end
329
+ end
@@ -0,0 +1,296 @@
1
+ =begin
2
+ #Duke Digital Repository API
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.36
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DdrClient
16
+ # Ddr_API_UserEntity model
17
+ class DdrAPIUserEntity
18
+ # User ID
19
+ attr_accessor :id
20
+
21
+ # User Name
22
+ attr_accessor :username
23
+
24
+ # Duke NetID
25
+ attr_accessor :netid
26
+
27
+ # Duke Unique ID
28
+ attr_accessor :duid
29
+
30
+ # Email Address
31
+ attr_accessor :email
32
+
33
+ # First Name
34
+ attr_accessor :first_name
35
+
36
+ # Middle Name
37
+ attr_accessor :middle_name
38
+
39
+ # Nickname
40
+ attr_accessor :nickname
41
+
42
+ # Last Name
43
+ attr_accessor :last_name
44
+
45
+ # Display Name
46
+ attr_accessor :display_name
47
+
48
+ # Created At
49
+ attr_accessor :created_at
50
+
51
+ # Updated At
52
+ attr_accessor :updated_at
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'id' => :'id',
58
+ :'username' => :'username',
59
+ :'netid' => :'netid',
60
+ :'duid' => :'duid',
61
+ :'email' => :'email',
62
+ :'first_name' => :'first_name',
63
+ :'middle_name' => :'middle_name',
64
+ :'nickname' => :'nickname',
65
+ :'last_name' => :'last_name',
66
+ :'display_name' => :'display_name',
67
+ :'created_at' => :'created_at',
68
+ :'updated_at' => :'updated_at'
69
+ }
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.swagger_types
74
+ {
75
+ :'id' => :'Integer',
76
+ :'username' => :'String',
77
+ :'netid' => :'String',
78
+ :'duid' => :'String',
79
+ :'email' => :'String',
80
+ :'first_name' => :'String',
81
+ :'middle_name' => :'String',
82
+ :'nickname' => :'String',
83
+ :'last_name' => :'String',
84
+ :'display_name' => :'String',
85
+ :'created_at' => :'DateTime',
86
+ :'updated_at' => :'DateTime'
87
+ }
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ return unless attributes.is_a?(Hash)
94
+
95
+ # convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
+
98
+ if attributes.has_key?(:'id')
99
+ self.id = attributes[:'id']
100
+ end
101
+
102
+ if attributes.has_key?(:'username')
103
+ self.username = attributes[:'username']
104
+ end
105
+
106
+ if attributes.has_key?(:'netid')
107
+ self.netid = attributes[:'netid']
108
+ end
109
+
110
+ if attributes.has_key?(:'duid')
111
+ self.duid = attributes[:'duid']
112
+ end
113
+
114
+ if attributes.has_key?(:'email')
115
+ self.email = attributes[:'email']
116
+ end
117
+
118
+ if attributes.has_key?(:'first_name')
119
+ self.first_name = attributes[:'first_name']
120
+ end
121
+
122
+ if attributes.has_key?(:'middle_name')
123
+ self.middle_name = attributes[:'middle_name']
124
+ end
125
+
126
+ if attributes.has_key?(:'nickname')
127
+ self.nickname = attributes[:'nickname']
128
+ end
129
+
130
+ if attributes.has_key?(:'last_name')
131
+ self.last_name = attributes[:'last_name']
132
+ end
133
+
134
+ if attributes.has_key?(:'display_name')
135
+ self.display_name = attributes[:'display_name']
136
+ end
137
+
138
+ if attributes.has_key?(:'created_at')
139
+ self.created_at = attributes[:'created_at']
140
+ end
141
+
142
+ if attributes.has_key?(:'updated_at')
143
+ self.updated_at = attributes[:'updated_at']
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ invalid_properties = Array.new
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ true
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ id == o.id &&
166
+ username == o.username &&
167
+ netid == o.netid &&
168
+ duid == o.duid &&
169
+ email == o.email &&
170
+ first_name == o.first_name &&
171
+ middle_name == o.middle_name &&
172
+ nickname == o.nickname &&
173
+ last_name == o.last_name &&
174
+ display_name == o.display_name &&
175
+ created_at == o.created_at &&
176
+ updated_at == o.updated_at
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Fixnum] Hash code
187
+ def hash
188
+ [id, username, netid, duid, email, first_name, middle_name, nickname, last_name, display_name, created_at, updated_at].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def build_from_hash(attributes)
195
+ return nil unless attributes.is_a?(Hash)
196
+ self.class.swagger_types.each_pair do |key, type|
197
+ if type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :DateTime
218
+ DateTime.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :BOOLEAN
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ temp_model = DdrClient.const_get(type).new
249
+ temp_model.build_from_hash(value)
250
+ end
251
+ end
252
+
253
+ # Returns the string representation of the object
254
+ # @return [String] String presentation of the object
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_hash (backward compatibility)
260
+ # @return [Hash] Returns the object in the form of hash
261
+ def to_body
262
+ to_hash
263
+ end
264
+
265
+ # Returns the object in the form of hash
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_hash
268
+ hash = {}
269
+ self.class.attribute_map.each_pair do |attr, param|
270
+ value = self.send(attr)
271
+ next if value.nil?
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ # Outputs non-array value in the form of hash
278
+ # For object, use to_hash. Otherwise, just return the value
279
+ # @param [Object] value Any valid value
280
+ # @return [Hash] Returns the value in the form of hash
281
+ def _to_hash(value)
282
+ if value.is_a?(Array)
283
+ value.compact.map { |v| _to_hash(v) }
284
+ elsif value.is_a?(Hash)
285
+ {}.tap do |hash|
286
+ value.each { |k, v| hash[k] = _to_hash(v) }
287
+ end
288
+ elsif value.respond_to? :to_hash
289
+ value.to_hash
290
+ else
291
+ value
292
+ end
293
+ end
294
+
295
+ end
296
+ end