xbim_comms 2.0.1 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. metadata +7 -149
  3. data/Gemfile +0 -9
  4. data/README.md +0 -210
  5. data/Rakefile +0 -10
  6. data/lib/xbim_comms/api/contacts_api.rb +0 -206
  7. data/lib/xbim_comms/api/conversations_api.rb +0 -2670
  8. data/lib/xbim_comms/api/files_api.rb +0 -107
  9. data/lib/xbim_comms/api/snapshots_api.rb +0 -100
  10. data/lib/xbim_comms/api_client.rb +0 -390
  11. data/lib/xbim_comms/api_error.rb +0 -57
  12. data/lib/xbim_comms/configuration.rb +0 -278
  13. data/lib/xbim_comms/models/aggregate.rb +0 -227
  14. data/lib/xbim_comms/models/aggregate_list_value.rb +0 -220
  15. data/lib/xbim_comms/models/analytical_result.rb +0 -270
  16. data/lib/xbim_comms/models/analytical_result_all_of.rb +0 -258
  17. data/lib/xbim_comms/models/animation.rb +0 -232
  18. data/lib/xbim_comms/models/animation_all_of.rb +0 -220
  19. data/lib/xbim_comms/models/bitmap.rb +0 -303
  20. data/lib/xbim_comms/models/blob.rb +0 -245
  21. data/lib/xbim_comms/models/boolean_value.rb +0 -218
  22. data/lib/xbim_comms/models/clipping_plane.rb +0 -231
  23. data/lib/xbim_comms/models/coloring.rb +0 -229
  24. data/lib/xbim_comms/models/column_request.rb +0 -279
  25. data/lib/xbim_comms/models/component.rb +0 -236
  26. data/lib/xbim_comms/models/components.rb +0 -240
  27. data/lib/xbim_comms/models/contact.rb +0 -227
  28. data/lib/xbim_comms/models/contact_list.rb +0 -238
  29. data/lib/xbim_comms/models/conversation.rb +0 -392
  30. data/lib/xbim_comms/models/conversation_create.rb +0 -273
  31. data/lib/xbim_comms/models/conversation_list.rb +0 -238
  32. data/lib/xbim_comms/models/conversation_tenant.rb +0 -254
  33. data/lib/xbim_comms/models/conversation_update.rb +0 -302
  34. data/lib/xbim_comms/models/entity_key.rb +0 -227
  35. data/lib/xbim_comms/models/exception_message.rb +0 -245
  36. data/lib/xbim_comms/models/file.rb +0 -266
  37. data/lib/xbim_comms/models/file_all_of.rb +0 -254
  38. data/lib/xbim_comms/models/int32_value.rb +0 -218
  39. data/lib/xbim_comms/models/key_frame.rb +0 -236
  40. data/lib/xbim_comms/models/line.rb +0 -231
  41. data/lib/xbim_comms/models/message.rb +0 -416
  42. data/lib/xbim_comms/models/message_content.rb +0 -220
  43. data/lib/xbim_comms/models/message_create.rb +0 -273
  44. data/lib/xbim_comms/models/message_list.rb +0 -238
  45. data/lib/xbim_comms/models/message_part.rb +0 -246
  46. data/lib/xbim_comms/models/message_update.rb +0 -297
  47. data/lib/xbim_comms/models/orthogonal_camera.rb +0 -269
  48. data/lib/xbim_comms/models/participant.rb +0 -232
  49. data/lib/xbim_comms/models/participant_with_role.rb +0 -293
  50. data/lib/xbim_comms/models/participant_with_role_create.rb +0 -266
  51. data/lib/xbim_comms/models/participant_with_role_list.rb +0 -238
  52. data/lib/xbim_comms/models/participant_with_role_update.rb +0 -261
  53. data/lib/xbim_comms/models/perspective_camera.rb +0 -269
  54. data/lib/xbim_comms/models/pie_chart.rb +0 -257
  55. data/lib/xbim_comms/models/pie_chart_all_of.rb +0 -245
  56. data/lib/xbim_comms/models/point.rb +0 -227
  57. data/lib/xbim_comms/models/preview_row.rb +0 -220
  58. data/lib/xbim_comms/models/schedule.rb +0 -270
  59. data/lib/xbim_comms/models/schedule_all_of.rb +0 -258
  60. data/lib/xbim_comms/models/schedule_column.rb +0 -384
  61. data/lib/xbim_comms/models/schedule_request.rb +0 -252
  62. data/lib/xbim_comms/models/schedule_request_all_of.rb +0 -240
  63. data/lib/xbim_comms/models/section_box.rb +0 -274
  64. data/lib/xbim_comms/models/sheet.rb +0 -268
  65. data/lib/xbim_comms/models/sheet_all_of.rb +0 -256
  66. data/lib/xbim_comms/models/sheet_part.rb +0 -254
  67. data/lib/xbim_comms/models/snapshot.rb +0 -270
  68. data/lib/xbim_comms/models/text.rb +0 -220
  69. data/lib/xbim_comms/models/view.rb +0 -239
  70. data/lib/xbim_comms/models/view_all_of.rb +0 -227
  71. data/lib/xbim_comms/models/view_setup_hints.rb +0 -236
  72. data/lib/xbim_comms/models/viewpoint.rb +0 -296
  73. data/lib/xbim_comms/models/visibility.rb +0 -238
  74. data/lib/xbim_comms/version.rb +0 -15
  75. data/lib/xbim_comms.rb +0 -104
  76. data/spec/api/contacts_api_spec.rb +0 -74
  77. data/spec/api/conversations_api_spec.rb +0 -521
  78. data/spec/api/files_api_spec.rb +0 -50
  79. data/spec/api/snapshots_api_spec.rb +0 -49
  80. data/spec/api_client_spec.rb +0 -226
  81. data/spec/configuration_spec.rb +0 -42
  82. data/spec/models/aggregate_list_value_spec.rb +0 -34
  83. data/spec/models/aggregate_spec.rb +0 -40
  84. data/spec/models/analytical_result_all_of_spec.rb +0 -58
  85. data/spec/models/analytical_result_spec.rb +0 -58
  86. data/spec/models/animation_all_of_spec.rb +0 -34
  87. data/spec/models/animation_spec.rb +0 -34
  88. data/spec/models/bitmap_spec.rb +0 -68
  89. data/spec/models/blob_spec.rb +0 -52
  90. data/spec/models/boolean_value_spec.rb +0 -34
  91. data/spec/models/clipping_plane_spec.rb +0 -40
  92. data/spec/models/coloring_spec.rb +0 -40
  93. data/spec/models/column_request_spec.rb +0 -56
  94. data/spec/models/component_spec.rb +0 -46
  95. data/spec/models/components_spec.rb +0 -46
  96. data/spec/models/contact_list_spec.rb +0 -46
  97. data/spec/models/contact_spec.rb +0 -40
  98. data/spec/models/conversation_create_spec.rb +0 -64
  99. data/spec/models/conversation_list_spec.rb +0 -46
  100. data/spec/models/conversation_spec.rb +0 -122
  101. data/spec/models/conversation_tenant_spec.rb +0 -58
  102. data/spec/models/conversation_update_spec.rb +0 -68
  103. data/spec/models/entity_key_spec.rb +0 -40
  104. data/spec/models/exception_message_spec.rb +0 -52
  105. data/spec/models/file_all_of_spec.rb +0 -58
  106. data/spec/models/file_spec.rb +0 -58
  107. data/spec/models/int32_value_spec.rb +0 -34
  108. data/spec/models/key_frame_spec.rb +0 -46
  109. data/spec/models/line_spec.rb +0 -40
  110. data/spec/models/message_content_spec.rb +0 -34
  111. data/spec/models/message_create_spec.rb +0 -64
  112. data/spec/models/message_list_spec.rb +0 -46
  113. data/spec/models/message_part_spec.rb +0 -46
  114. data/spec/models/message_spec.rb +0 -146
  115. data/spec/models/message_update_spec.rb +0 -68
  116. data/spec/models/orthogonal_camera_spec.rb +0 -64
  117. data/spec/models/participant_spec.rb +0 -40
  118. data/spec/models/participant_with_role_create_spec.rb +0 -44
  119. data/spec/models/participant_with_role_list_spec.rb +0 -46
  120. data/spec/models/participant_with_role_spec.rb +0 -62
  121. data/spec/models/participant_with_role_update_spec.rb +0 -44
  122. data/spec/models/perspective_camera_spec.rb +0 -64
  123. data/spec/models/pie_chart_all_of_spec.rb +0 -52
  124. data/spec/models/pie_chart_spec.rb +0 -52
  125. data/spec/models/point_spec.rb +0 -40
  126. data/spec/models/preview_row_spec.rb +0 -34
  127. data/spec/models/schedule_all_of_spec.rb +0 -58
  128. data/spec/models/schedule_column_spec.rb +0 -118
  129. data/spec/models/schedule_request_all_of_spec.rb +0 -46
  130. data/spec/models/schedule_request_spec.rb +0 -46
  131. data/spec/models/schedule_spec.rb +0 -58
  132. data/spec/models/section_box_spec.rb +0 -70
  133. data/spec/models/sheet_all_of_spec.rb +0 -58
  134. data/spec/models/sheet_part_spec.rb +0 -58
  135. data/spec/models/sheet_spec.rb +0 -58
  136. data/spec/models/snapshot_spec.rb +0 -50
  137. data/spec/models/text_spec.rb +0 -28
  138. data/spec/models/view_all_of_spec.rb +0 -40
  139. data/spec/models/view_setup_hints_spec.rb +0 -46
  140. data/spec/models/view_spec.rb +0 -40
  141. data/spec/models/viewpoint_spec.rb +0 -82
  142. data/spec/models/visibility_spec.rb +0 -46
  143. data/spec/spec_helper.rb +0 -111
  144. data/xbim_comms.gemspec +0 -38
@@ -1,392 +0,0 @@
1
- =begin
2
- #Flex Comms API 2.0
3
-
4
- #Communication centralised around construction data
5
-
6
- The version of the OpenAPI document: 2.0
7
- Contact: info@xbim.net
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.4.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module XbimComms
17
- class Conversation
18
- attr_accessor :id
19
-
20
- attr_accessor :clone_of_id
21
-
22
- attr_accessor :asset_id
23
-
24
- attr_accessor :subject
25
-
26
- attr_accessor :owner
27
-
28
- attr_accessor :tenant_id
29
-
30
- attr_accessor :date_created
31
-
32
- attr_accessor :messages
33
-
34
- attr_accessor :messages_count
35
-
36
- attr_accessor :unread_count
37
-
38
- attr_accessor :state
39
-
40
- attr_accessor :building_name
41
-
42
- attr_accessor :address
43
-
44
- attr_accessor :location
45
-
46
- attr_accessor :participants
47
-
48
- class EnumAttributeValidator
49
- attr_reader :datatype
50
- attr_reader :allowable_values
51
-
52
- def initialize(datatype, allowable_values)
53
- @allowable_values = allowable_values.map do |value|
54
- case datatype.to_s
55
- when /Integer/i
56
- value.to_i
57
- when /Float/i
58
- value.to_f
59
- else
60
- value
61
- end
62
- end
63
- end
64
-
65
- def valid?(value)
66
- !value || allowable_values.include?(value)
67
- end
68
- end
69
-
70
- # Attribute mapping from ruby-style variable name to JSON key.
71
- def self.attribute_map
72
- {
73
- :'id' => :'id',
74
- :'clone_of_id' => :'cloneOfID',
75
- :'asset_id' => :'assetId',
76
- :'subject' => :'subject',
77
- :'owner' => :'owner',
78
- :'tenant_id' => :'tenantId',
79
- :'date_created' => :'dateCreated',
80
- :'messages' => :'messages',
81
- :'messages_count' => :'messagesCount',
82
- :'unread_count' => :'unreadCount',
83
- :'state' => :'state',
84
- :'building_name' => :'buildingName',
85
- :'address' => :'address',
86
- :'location' => :'location',
87
- :'participants' => :'participants'
88
- }
89
- end
90
-
91
- # Returns all the JSON keys this model knows about
92
- def self.acceptable_attributes
93
- attribute_map.values
94
- end
95
-
96
- # Attribute type mapping.
97
- def self.openapi_types
98
- {
99
- :'id' => :'Integer',
100
- :'clone_of_id' => :'Integer',
101
- :'asset_id' => :'Integer',
102
- :'subject' => :'String',
103
- :'owner' => :'Participant',
104
- :'tenant_id' => :'String',
105
- :'date_created' => :'Time',
106
- :'messages' => :'Array<Message>',
107
- :'messages_count' => :'Integer',
108
- :'unread_count' => :'Integer',
109
- :'state' => :'String',
110
- :'building_name' => :'String',
111
- :'address' => :'String',
112
- :'location' => :'Point',
113
- :'participants' => :'Array<ParticipantWithRole>'
114
- }
115
- end
116
-
117
- # List of attributes with nullable: true
118
- def self.openapi_nullable
119
- Set.new([
120
- ])
121
- end
122
-
123
- # Initializes the object
124
- # @param [Hash] attributes Model attributes in the form of hash
125
- def initialize(attributes = {})
126
- if (!attributes.is_a?(Hash))
127
- fail ArgumentError, "The input argument (attributes) must be a hash in `XbimComms::Conversation` initialize method"
128
- end
129
-
130
- # check to see if the attribute exists and convert string to symbol for hash key
131
- attributes = attributes.each_with_object({}) { |(k, v), h|
132
- if (!self.class.attribute_map.key?(k.to_sym))
133
- fail ArgumentError, "`#{k}` is not a valid attribute in `XbimComms::Conversation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
134
- end
135
- h[k.to_sym] = v
136
- }
137
-
138
- if attributes.key?(:'id')
139
- self.id = attributes[:'id']
140
- end
141
-
142
- if attributes.key?(:'clone_of_id')
143
- self.clone_of_id = attributes[:'clone_of_id']
144
- end
145
-
146
- if attributes.key?(:'asset_id')
147
- self.asset_id = attributes[:'asset_id']
148
- end
149
-
150
- if attributes.key?(:'subject')
151
- self.subject = attributes[:'subject']
152
- end
153
-
154
- if attributes.key?(:'owner')
155
- self.owner = attributes[:'owner']
156
- end
157
-
158
- if attributes.key?(:'tenant_id')
159
- self.tenant_id = attributes[:'tenant_id']
160
- end
161
-
162
- if attributes.key?(:'date_created')
163
- self.date_created = attributes[:'date_created']
164
- end
165
-
166
- if attributes.key?(:'messages')
167
- if (value = attributes[:'messages']).is_a?(Array)
168
- self.messages = value
169
- end
170
- end
171
-
172
- if attributes.key?(:'messages_count')
173
- self.messages_count = attributes[:'messages_count']
174
- end
175
-
176
- if attributes.key?(:'unread_count')
177
- self.unread_count = attributes[:'unread_count']
178
- end
179
-
180
- if attributes.key?(:'state')
181
- self.state = attributes[:'state']
182
- end
183
-
184
- if attributes.key?(:'building_name')
185
- self.building_name = attributes[:'building_name']
186
- end
187
-
188
- if attributes.key?(:'address')
189
- self.address = attributes[:'address']
190
- end
191
-
192
- if attributes.key?(:'location')
193
- self.location = attributes[:'location']
194
- end
195
-
196
- if attributes.key?(:'participants')
197
- if (value = attributes[:'participants']).is_a?(Array)
198
- self.participants = value
199
- end
200
- end
201
- end
202
-
203
- # Show invalid properties with the reasons. Usually used together with valid?
204
- # @return Array for valid properties with the reasons
205
- def list_invalid_properties
206
- invalid_properties = Array.new
207
- if @asset_id.nil?
208
- invalid_properties.push('invalid value for "asset_id", asset_id cannot be nil.')
209
- end
210
-
211
- if @tenant_id.nil?
212
- invalid_properties.push('invalid value for "tenant_id", tenant_id cannot be nil.')
213
- end
214
-
215
- invalid_properties
216
- end
217
-
218
- # Check to see if the all the properties in the model are valid
219
- # @return true if the model is valid
220
- def valid?
221
- return false if @asset_id.nil?
222
- return false if @tenant_id.nil?
223
- state_validator = EnumAttributeValidator.new('String', ["Open", "Closed"])
224
- return false unless state_validator.valid?(@state)
225
- true
226
- end
227
-
228
- # Custom attribute writer method checking allowed values (enum).
229
- # @param [Object] state Object to be assigned
230
- def state=(state)
231
- validator = EnumAttributeValidator.new('String', ["Open", "Closed"])
232
- unless validator.valid?(state)
233
- fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
234
- end
235
- @state = state
236
- end
237
-
238
- # Checks equality by comparing each attribute.
239
- # @param [Object] Object to be compared
240
- def ==(o)
241
- return true if self.equal?(o)
242
- self.class == o.class &&
243
- id == o.id &&
244
- clone_of_id == o.clone_of_id &&
245
- asset_id == o.asset_id &&
246
- subject == o.subject &&
247
- owner == o.owner &&
248
- tenant_id == o.tenant_id &&
249
- date_created == o.date_created &&
250
- messages == o.messages &&
251
- messages_count == o.messages_count &&
252
- unread_count == o.unread_count &&
253
- state == o.state &&
254
- building_name == o.building_name &&
255
- address == o.address &&
256
- location == o.location &&
257
- participants == o.participants
258
- end
259
-
260
- # @see the `==` method
261
- # @param [Object] Object to be compared
262
- def eql?(o)
263
- self == o
264
- end
265
-
266
- # Calculates hash code according to all attributes.
267
- # @return [Integer] Hash code
268
- def hash
269
- [id, clone_of_id, asset_id, subject, owner, tenant_id, date_created, messages, messages_count, unread_count, state, building_name, address, location, participants].hash
270
- end
271
-
272
- # Builds the object from hash
273
- # @param [Hash] attributes Model attributes in the form of hash
274
- # @return [Object] Returns the model itself
275
- def self.build_from_hash(attributes)
276
- new.build_from_hash(attributes)
277
- end
278
-
279
- # Builds the object from hash
280
- # @param [Hash] attributes Model attributes in the form of hash
281
- # @return [Object] Returns the model itself
282
- def build_from_hash(attributes)
283
- return nil unless attributes.is_a?(Hash)
284
- self.class.openapi_types.each_pair do |key, type|
285
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
286
- self.send("#{key}=", nil)
287
- elsif type =~ /\AArray<(.*)>/i
288
- # check to ensure the input is an array given that the attribute
289
- # is documented as an array but the input is not
290
- if attributes[self.class.attribute_map[key]].is_a?(Array)
291
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
292
- end
293
- elsif !attributes[self.class.attribute_map[key]].nil?
294
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
295
- end
296
- end
297
-
298
- self
299
- end
300
-
301
- # Deserializes the data based on type
302
- # @param string type Data type
303
- # @param string value Value to be deserialized
304
- # @return [Object] Deserialized data
305
- def _deserialize(type, value)
306
- case type.to_sym
307
- when :Time
308
- Time.parse(value)
309
- when :Date
310
- Date.parse(value)
311
- when :String
312
- value.to_s
313
- when :Integer
314
- value.to_i
315
- when :Float
316
- value.to_f
317
- when :Boolean
318
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
319
- true
320
- else
321
- false
322
- end
323
- when :Object
324
- # generic object (usually a Hash), return directly
325
- value
326
- when /\AArray<(?<inner_type>.+)>\z/
327
- inner_type = Regexp.last_match[:inner_type]
328
- value.map { |v| _deserialize(inner_type, v) }
329
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
330
- k_type = Regexp.last_match[:k_type]
331
- v_type = Regexp.last_match[:v_type]
332
- {}.tap do |hash|
333
- value.each do |k, v|
334
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
335
- end
336
- end
337
- else # model
338
- # models (e.g. Pet) or oneOf
339
- klass = XbimComms.const_get(type)
340
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
341
- end
342
- end
343
-
344
- # Returns the string representation of the object
345
- # @return [String] String presentation of the object
346
- def to_s
347
- to_hash.to_s
348
- end
349
-
350
- # to_body is an alias to to_hash (backward compatibility)
351
- # @return [Hash] Returns the object in the form of hash
352
- def to_body
353
- to_hash
354
- end
355
-
356
- # Returns the object in the form of hash
357
- # @return [Hash] Returns the object in the form of hash
358
- def to_hash
359
- hash = {}
360
- self.class.attribute_map.each_pair do |attr, param|
361
- value = self.send(attr)
362
- if value.nil?
363
- is_nullable = self.class.openapi_nullable.include?(attr)
364
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
365
- end
366
-
367
- hash[param] = _to_hash(value)
368
- end
369
- hash
370
- end
371
-
372
- # Outputs non-array value in the form of hash
373
- # For object, use to_hash. Otherwise, just return the value
374
- # @param [Object] value Any valid value
375
- # @return [Hash] Returns the value in the form of hash
376
- def _to_hash(value)
377
- if value.is_a?(Array)
378
- value.compact.map { |v| _to_hash(v) }
379
- elsif value.is_a?(Hash)
380
- {}.tap do |hash|
381
- value.each { |k, v| hash[k] = _to_hash(v) }
382
- end
383
- elsif value.respond_to? :to_hash
384
- value.to_hash
385
- else
386
- value
387
- end
388
- end
389
-
390
- end
391
-
392
- end
@@ -1,273 +0,0 @@
1
- =begin
2
- #Flex Comms API 2.0
3
-
4
- #Communication centralised around construction data
5
-
6
- The version of the OpenAPI document: 2.0
7
- Contact: info@xbim.net
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.4.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module XbimComms
17
- class ConversationCreate
18
- attr_accessor :asset_id
19
-
20
- attr_accessor :subject
21
-
22
- attr_accessor :tenant_id
23
-
24
- attr_accessor :building_name
25
-
26
- attr_accessor :address
27
-
28
- attr_accessor :location
29
-
30
- # Attribute mapping from ruby-style variable name to JSON key.
31
- def self.attribute_map
32
- {
33
- :'asset_id' => :'assetId',
34
- :'subject' => :'subject',
35
- :'tenant_id' => :'tenantId',
36
- :'building_name' => :'buildingName',
37
- :'address' => :'address',
38
- :'location' => :'location'
39
- }
40
- end
41
-
42
- # Returns all the JSON keys this model knows about
43
- def self.acceptable_attributes
44
- attribute_map.values
45
- end
46
-
47
- # Attribute type mapping.
48
- def self.openapi_types
49
- {
50
- :'asset_id' => :'Integer',
51
- :'subject' => :'String',
52
- :'tenant_id' => :'String',
53
- :'building_name' => :'String',
54
- :'address' => :'String',
55
- :'location' => :'Point'
56
- }
57
- end
58
-
59
- # List of attributes with nullable: true
60
- def self.openapi_nullable
61
- Set.new([
62
- ])
63
- end
64
-
65
- # Initializes the object
66
- # @param [Hash] attributes Model attributes in the form of hash
67
- def initialize(attributes = {})
68
- if (!attributes.is_a?(Hash))
69
- fail ArgumentError, "The input argument (attributes) must be a hash in `XbimComms::ConversationCreate` initialize method"
70
- end
71
-
72
- # check to see if the attribute exists and convert string to symbol for hash key
73
- attributes = attributes.each_with_object({}) { |(k, v), h|
74
- if (!self.class.attribute_map.key?(k.to_sym))
75
- fail ArgumentError, "`#{k}` is not a valid attribute in `XbimComms::ConversationCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
- end
77
- h[k.to_sym] = v
78
- }
79
-
80
- if attributes.key?(:'asset_id')
81
- self.asset_id = attributes[:'asset_id']
82
- end
83
-
84
- if attributes.key?(:'subject')
85
- self.subject = attributes[:'subject']
86
- end
87
-
88
- if attributes.key?(:'tenant_id')
89
- self.tenant_id = attributes[:'tenant_id']
90
- end
91
-
92
- if attributes.key?(:'building_name')
93
- self.building_name = attributes[:'building_name']
94
- end
95
-
96
- if attributes.key?(:'address')
97
- self.address = attributes[:'address']
98
- end
99
-
100
- if attributes.key?(:'location')
101
- self.location = attributes[:'location']
102
- end
103
- end
104
-
105
- # Show invalid properties with the reasons. Usually used together with valid?
106
- # @return Array for valid properties with the reasons
107
- def list_invalid_properties
108
- invalid_properties = Array.new
109
- if @asset_id.nil?
110
- invalid_properties.push('invalid value for "asset_id", asset_id cannot be nil.')
111
- end
112
-
113
- if @tenant_id.nil?
114
- invalid_properties.push('invalid value for "tenant_id", tenant_id cannot be nil.')
115
- end
116
-
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
- return false if @asset_id.nil?
124
- return false if @tenant_id.nil?
125
- true
126
- end
127
-
128
- # Checks equality by comparing each attribute.
129
- # @param [Object] Object to be compared
130
- def ==(o)
131
- return true if self.equal?(o)
132
- self.class == o.class &&
133
- asset_id == o.asset_id &&
134
- subject == o.subject &&
135
- tenant_id == o.tenant_id &&
136
- building_name == o.building_name &&
137
- address == o.address &&
138
- location == o.location
139
- end
140
-
141
- # @see the `==` method
142
- # @param [Object] Object to be compared
143
- def eql?(o)
144
- self == o
145
- end
146
-
147
- # Calculates hash code according to all attributes.
148
- # @return [Integer] Hash code
149
- def hash
150
- [asset_id, subject, tenant_id, building_name, address, location].hash
151
- end
152
-
153
- # Builds the object from hash
154
- # @param [Hash] attributes Model attributes in the form of hash
155
- # @return [Object] Returns the model itself
156
- def self.build_from_hash(attributes)
157
- new.build_from_hash(attributes)
158
- end
159
-
160
- # Builds the object from hash
161
- # @param [Hash] attributes Model attributes in the form of hash
162
- # @return [Object] Returns the model itself
163
- def build_from_hash(attributes)
164
- return nil unless attributes.is_a?(Hash)
165
- self.class.openapi_types.each_pair do |key, type|
166
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
167
- self.send("#{key}=", nil)
168
- elsif type =~ /\AArray<(.*)>/i
169
- # check to ensure the input is an array given that the attribute
170
- # is documented as an array but the input is not
171
- if attributes[self.class.attribute_map[key]].is_a?(Array)
172
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
173
- end
174
- elsif !attributes[self.class.attribute_map[key]].nil?
175
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
176
- end
177
- end
178
-
179
- self
180
- end
181
-
182
- # Deserializes the data based on type
183
- # @param string type Data type
184
- # @param string value Value to be deserialized
185
- # @return [Object] Deserialized data
186
- def _deserialize(type, value)
187
- case type.to_sym
188
- when :Time
189
- Time.parse(value)
190
- when :Date
191
- Date.parse(value)
192
- when :String
193
- value.to_s
194
- when :Integer
195
- value.to_i
196
- when :Float
197
- value.to_f
198
- when :Boolean
199
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
200
- true
201
- else
202
- false
203
- end
204
- when :Object
205
- # generic object (usually a Hash), return directly
206
- value
207
- when /\AArray<(?<inner_type>.+)>\z/
208
- inner_type = Regexp.last_match[:inner_type]
209
- value.map { |v| _deserialize(inner_type, v) }
210
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
211
- k_type = Regexp.last_match[:k_type]
212
- v_type = Regexp.last_match[:v_type]
213
- {}.tap do |hash|
214
- value.each do |k, v|
215
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
216
- end
217
- end
218
- else # model
219
- # models (e.g. Pet) or oneOf
220
- klass = XbimComms.const_get(type)
221
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
222
- end
223
- end
224
-
225
- # Returns the string representation of the object
226
- # @return [String] String presentation of the object
227
- def to_s
228
- to_hash.to_s
229
- end
230
-
231
- # to_body is an alias to to_hash (backward compatibility)
232
- # @return [Hash] Returns the object in the form of hash
233
- def to_body
234
- to_hash
235
- end
236
-
237
- # Returns the object in the form of hash
238
- # @return [Hash] Returns the object in the form of hash
239
- def to_hash
240
- hash = {}
241
- self.class.attribute_map.each_pair do |attr, param|
242
- value = self.send(attr)
243
- if value.nil?
244
- is_nullable = self.class.openapi_nullable.include?(attr)
245
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
246
- end
247
-
248
- hash[param] = _to_hash(value)
249
- end
250
- hash
251
- end
252
-
253
- # Outputs non-array value in the form of hash
254
- # For object, use to_hash. Otherwise, just return the value
255
- # @param [Object] value Any valid value
256
- # @return [Hash] Returns the value in the form of hash
257
- def _to_hash(value)
258
- if value.is_a?(Array)
259
- value.compact.map { |v| _to_hash(v) }
260
- elsif value.is_a?(Hash)
261
- {}.tap do |hash|
262
- value.each { |k, v| hash[k] = _to_hash(v) }
263
- end
264
- elsif value.respond_to? :to_hash
265
- value.to_hash
266
- else
267
- value
268
- end
269
- end
270
-
271
- end
272
-
273
- end