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,297 +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 MessageUpdate
18
- attr_accessor :id
19
-
20
- attr_accessor :state
21
-
22
- attr_accessor :true_north_angle
23
-
24
- attr_accessor :content
25
-
26
- attr_accessor :default_view
27
-
28
- attr_accessor :section_box
29
-
30
- class EnumAttributeValidator
31
- attr_reader :datatype
32
- attr_reader :allowable_values
33
-
34
- def initialize(datatype, allowable_values)
35
- @allowable_values = allowable_values.map do |value|
36
- case datatype.to_s
37
- when /Integer/i
38
- value.to_i
39
- when /Float/i
40
- value.to_f
41
- else
42
- value
43
- end
44
- end
45
- end
46
-
47
- def valid?(value)
48
- !value || allowable_values.include?(value)
49
- end
50
- end
51
-
52
- # Attribute mapping from ruby-style variable name to JSON key.
53
- def self.attribute_map
54
- {
55
- :'id' => :'id',
56
- :'state' => :'state',
57
- :'true_north_angle' => :'trueNorthAngle',
58
- :'content' => :'content',
59
- :'default_view' => :'defaultView',
60
- :'section_box' => :'sectionBox'
61
- }
62
- end
63
-
64
- # Returns all the JSON keys this model knows about
65
- def self.acceptable_attributes
66
- attribute_map.values
67
- end
68
-
69
- # Attribute type mapping.
70
- def self.openapi_types
71
- {
72
- :'id' => :'Integer',
73
- :'state' => :'String',
74
- :'true_north_angle' => :'Float',
75
- :'content' => :'MessageContent',
76
- :'default_view' => :'Viewpoint',
77
- :'section_box' => :'SectionBox'
78
- }
79
- end
80
-
81
- # List of attributes with nullable: true
82
- def self.openapi_nullable
83
- Set.new([
84
- ])
85
- end
86
-
87
- # Initializes the object
88
- # @param [Hash] attributes Model attributes in the form of hash
89
- def initialize(attributes = {})
90
- if (!attributes.is_a?(Hash))
91
- fail ArgumentError, "The input argument (attributes) must be a hash in `XbimComms::MessageUpdate` initialize method"
92
- end
93
-
94
- # check to see if the attribute exists and convert string to symbol for hash key
95
- attributes = attributes.each_with_object({}) { |(k, v), h|
96
- if (!self.class.attribute_map.key?(k.to_sym))
97
- fail ArgumentError, "`#{k}` is not a valid attribute in `XbimComms::MessageUpdate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
- end
99
- h[k.to_sym] = v
100
- }
101
-
102
- if attributes.key?(:'id')
103
- self.id = attributes[:'id']
104
- end
105
-
106
- if attributes.key?(:'state')
107
- self.state = attributes[:'state']
108
- end
109
-
110
- if attributes.key?(:'true_north_angle')
111
- self.true_north_angle = attributes[:'true_north_angle']
112
- end
113
-
114
- if attributes.key?(:'content')
115
- self.content = attributes[:'content']
116
- end
117
-
118
- if attributes.key?(:'default_view')
119
- self.default_view = attributes[:'default_view']
120
- end
121
-
122
- if attributes.key?(:'section_box')
123
- self.section_box = attributes[:'section_box']
124
- end
125
- end
126
-
127
- # Show invalid properties with the reasons. Usually used together with valid?
128
- # @return Array for valid properties with the reasons
129
- def list_invalid_properties
130
- invalid_properties = Array.new
131
- invalid_properties
132
- end
133
-
134
- # Check to see if the all the properties in the model are valid
135
- # @return true if the model is valid
136
- def valid?
137
- state_validator = EnumAttributeValidator.new('String', ["NotRead", "Read", "Dismissed"])
138
- return false unless state_validator.valid?(@state)
139
- true
140
- end
141
-
142
- # Custom attribute writer method checking allowed values (enum).
143
- # @param [Object] state Object to be assigned
144
- def state=(state)
145
- validator = EnumAttributeValidator.new('String', ["NotRead", "Read", "Dismissed"])
146
- unless validator.valid?(state)
147
- fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
148
- end
149
- @state = state
150
- end
151
-
152
- # Checks equality by comparing each attribute.
153
- # @param [Object] Object to be compared
154
- def ==(o)
155
- return true if self.equal?(o)
156
- self.class == o.class &&
157
- id == o.id &&
158
- state == o.state &&
159
- true_north_angle == o.true_north_angle &&
160
- content == o.content &&
161
- default_view == o.default_view &&
162
- section_box == o.section_box
163
- end
164
-
165
- # @see the `==` method
166
- # @param [Object] Object to be compared
167
- def eql?(o)
168
- self == o
169
- end
170
-
171
- # Calculates hash code according to all attributes.
172
- # @return [Integer] Hash code
173
- def hash
174
- [id, state, true_north_angle, content, default_view, section_box].hash
175
- end
176
-
177
- # Builds the object from hash
178
- # @param [Hash] attributes Model attributes in the form of hash
179
- # @return [Object] Returns the model itself
180
- def self.build_from_hash(attributes)
181
- new.build_from_hash(attributes)
182
- end
183
-
184
- # Builds the object from hash
185
- # @param [Hash] attributes Model attributes in the form of hash
186
- # @return [Object] Returns the model itself
187
- def build_from_hash(attributes)
188
- return nil unless attributes.is_a?(Hash)
189
- self.class.openapi_types.each_pair do |key, type|
190
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
191
- self.send("#{key}=", nil)
192
- elsif type =~ /\AArray<(.*)>/i
193
- # check to ensure the input is an array given that the attribute
194
- # is documented as an array but the input is not
195
- if attributes[self.class.attribute_map[key]].is_a?(Array)
196
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
197
- end
198
- elsif !attributes[self.class.attribute_map[key]].nil?
199
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
- end
201
- end
202
-
203
- self
204
- end
205
-
206
- # Deserializes the data based on type
207
- # @param string type Data type
208
- # @param string value Value to be deserialized
209
- # @return [Object] Deserialized data
210
- def _deserialize(type, value)
211
- case type.to_sym
212
- when :Time
213
- Time.parse(value)
214
- when :Date
215
- Date.parse(value)
216
- when :String
217
- value.to_s
218
- when :Integer
219
- value.to_i
220
- when :Float
221
- value.to_f
222
- when :Boolean
223
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
- true
225
- else
226
- false
227
- end
228
- when :Object
229
- # generic object (usually a Hash), return directly
230
- value
231
- when /\AArray<(?<inner_type>.+)>\z/
232
- inner_type = Regexp.last_match[:inner_type]
233
- value.map { |v| _deserialize(inner_type, v) }
234
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
- k_type = Regexp.last_match[:k_type]
236
- v_type = Regexp.last_match[:v_type]
237
- {}.tap do |hash|
238
- value.each do |k, v|
239
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
- end
241
- end
242
- else # model
243
- # models (e.g. Pet) or oneOf
244
- klass = XbimComms.const_get(type)
245
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
246
- end
247
- end
248
-
249
- # Returns the string representation of the object
250
- # @return [String] String presentation of the object
251
- def to_s
252
- to_hash.to_s
253
- end
254
-
255
- # to_body is an alias to to_hash (backward compatibility)
256
- # @return [Hash] Returns the object in the form of hash
257
- def to_body
258
- to_hash
259
- end
260
-
261
- # Returns the object in the form of hash
262
- # @return [Hash] Returns the object in the form of hash
263
- def to_hash
264
- hash = {}
265
- self.class.attribute_map.each_pair do |attr, param|
266
- value = self.send(attr)
267
- if value.nil?
268
- is_nullable = self.class.openapi_nullable.include?(attr)
269
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
- end
271
-
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
-
297
- end
@@ -1,269 +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 OrthogonalCamera
18
- attr_accessor :camera_view_point
19
-
20
- attr_accessor :camera_direction
21
-
22
- attr_accessor :camera_up_vector
23
-
24
- attr_accessor :view_to_world_scale
25
-
26
- attr_accessor :width
27
-
28
- attr_accessor :height
29
-
30
- # Attribute mapping from ruby-style variable name to JSON key.
31
- def self.attribute_map
32
- {
33
- :'camera_view_point' => :'camera_view_point',
34
- :'camera_direction' => :'camera_direction',
35
- :'camera_up_vector' => :'camera_up_vector',
36
- :'view_to_world_scale' => :'view_to_world_scale',
37
- :'width' => :'width',
38
- :'height' => :'height'
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
- :'camera_view_point' => :'Array<Float>',
51
- :'camera_direction' => :'Array<Float>',
52
- :'camera_up_vector' => :'Array<Float>',
53
- :'view_to_world_scale' => :'Float',
54
- :'width' => :'Float',
55
- :'height' => :'Float'
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::OrthogonalCamera` 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::OrthogonalCamera`. 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?(:'camera_view_point')
81
- if (value = attributes[:'camera_view_point']).is_a?(Array)
82
- self.camera_view_point = value
83
- end
84
- end
85
-
86
- if attributes.key?(:'camera_direction')
87
- if (value = attributes[:'camera_direction']).is_a?(Array)
88
- self.camera_direction = value
89
- end
90
- end
91
-
92
- if attributes.key?(:'camera_up_vector')
93
- if (value = attributes[:'camera_up_vector']).is_a?(Array)
94
- self.camera_up_vector = value
95
- end
96
- end
97
-
98
- if attributes.key?(:'view_to_world_scale')
99
- self.view_to_world_scale = attributes[:'view_to_world_scale']
100
- end
101
-
102
- if attributes.key?(:'width')
103
- self.width = attributes[:'width']
104
- end
105
-
106
- if attributes.key?(:'height')
107
- self.height = attributes[:'height']
108
- end
109
- end
110
-
111
- # Show invalid properties with the reasons. Usually used together with valid?
112
- # @return Array for valid properties with the reasons
113
- def list_invalid_properties
114
- invalid_properties = Array.new
115
- invalid_properties
116
- end
117
-
118
- # Check to see if the all the properties in the model are valid
119
- # @return true if the model is valid
120
- def valid?
121
- true
122
- end
123
-
124
- # Checks equality by comparing each attribute.
125
- # @param [Object] Object to be compared
126
- def ==(o)
127
- return true if self.equal?(o)
128
- self.class == o.class &&
129
- camera_view_point == o.camera_view_point &&
130
- camera_direction == o.camera_direction &&
131
- camera_up_vector == o.camera_up_vector &&
132
- view_to_world_scale == o.view_to_world_scale &&
133
- width == o.width &&
134
- height == o.height
135
- end
136
-
137
- # @see the `==` method
138
- # @param [Object] Object to be compared
139
- def eql?(o)
140
- self == o
141
- end
142
-
143
- # Calculates hash code according to all attributes.
144
- # @return [Integer] Hash code
145
- def hash
146
- [camera_view_point, camera_direction, camera_up_vector, view_to_world_scale, width, height].hash
147
- end
148
-
149
- # Builds the object from hash
150
- # @param [Hash] attributes Model attributes in the form of hash
151
- # @return [Object] Returns the model itself
152
- def self.build_from_hash(attributes)
153
- new.build_from_hash(attributes)
154
- end
155
-
156
- # Builds the object from hash
157
- # @param [Hash] attributes Model attributes in the form of hash
158
- # @return [Object] Returns the model itself
159
- def build_from_hash(attributes)
160
- return nil unless attributes.is_a?(Hash)
161
- self.class.openapi_types.each_pair do |key, type|
162
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
163
- self.send("#{key}=", nil)
164
- elsif type =~ /\AArray<(.*)>/i
165
- # check to ensure the input is an array given that the attribute
166
- # is documented as an array but the input is not
167
- if attributes[self.class.attribute_map[key]].is_a?(Array)
168
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
- end
170
- elsif !attributes[self.class.attribute_map[key]].nil?
171
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
- end
173
- end
174
-
175
- self
176
- end
177
-
178
- # Deserializes the data based on type
179
- # @param string type Data type
180
- # @param string value Value to be deserialized
181
- # @return [Object] Deserialized data
182
- def _deserialize(type, value)
183
- case type.to_sym
184
- when :Time
185
- Time.parse(value)
186
- when :Date
187
- Date.parse(value)
188
- when :String
189
- value.to_s
190
- when :Integer
191
- value.to_i
192
- when :Float
193
- value.to_f
194
- when :Boolean
195
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
- true
197
- else
198
- false
199
- end
200
- when :Object
201
- # generic object (usually a Hash), return directly
202
- value
203
- when /\AArray<(?<inner_type>.+)>\z/
204
- inner_type = Regexp.last_match[:inner_type]
205
- value.map { |v| _deserialize(inner_type, v) }
206
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
- k_type = Regexp.last_match[:k_type]
208
- v_type = Regexp.last_match[:v_type]
209
- {}.tap do |hash|
210
- value.each do |k, v|
211
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
- end
213
- end
214
- else # model
215
- # models (e.g. Pet) or oneOf
216
- klass = XbimComms.const_get(type)
217
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
218
- end
219
- end
220
-
221
- # Returns the string representation of the object
222
- # @return [String] String presentation of the object
223
- def to_s
224
- to_hash.to_s
225
- end
226
-
227
- # to_body is an alias to to_hash (backward compatibility)
228
- # @return [Hash] Returns the object in the form of hash
229
- def to_body
230
- to_hash
231
- end
232
-
233
- # Returns the object in the form of hash
234
- # @return [Hash] Returns the object in the form of hash
235
- def to_hash
236
- hash = {}
237
- self.class.attribute_map.each_pair do |attr, param|
238
- value = self.send(attr)
239
- if value.nil?
240
- is_nullable = self.class.openapi_nullable.include?(attr)
241
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
242
- end
243
-
244
- hash[param] = _to_hash(value)
245
- end
246
- hash
247
- end
248
-
249
- # Outputs non-array value in the form of hash
250
- # For object, use to_hash. Otherwise, just return the value
251
- # @param [Object] value Any valid value
252
- # @return [Hash] Returns the value in the form of hash
253
- def _to_hash(value)
254
- if value.is_a?(Array)
255
- value.compact.map { |v| _to_hash(v) }
256
- elsif value.is_a?(Hash)
257
- {}.tap do |hash|
258
- value.each { |k, v| hash[k] = _to_hash(v) }
259
- end
260
- elsif value.respond_to? :to_hash
261
- value.to_hash
262
- else
263
- value
264
- end
265
- end
266
-
267
- end
268
-
269
- end