xbim_comms 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +210 -0
  4. data/Rakefile +10 -0
  5. data/lib/xbim_comms/api/contacts_api.rb +206 -0
  6. data/lib/xbim_comms/api/conversations_api.rb +2670 -0
  7. data/lib/xbim_comms/api/files_api.rb +107 -0
  8. data/lib/xbim_comms/api/snapshots_api.rb +100 -0
  9. data/lib/xbim_comms/api_client.rb +390 -0
  10. data/lib/xbim_comms/api_error.rb +57 -0
  11. data/lib/xbim_comms/configuration.rb +278 -0
  12. data/lib/xbim_comms/models/aggregate.rb +227 -0
  13. data/lib/xbim_comms/models/aggregate_list_value.rb +220 -0
  14. data/lib/xbim_comms/models/analytical_result.rb +270 -0
  15. data/lib/xbim_comms/models/analytical_result_all_of.rb +258 -0
  16. data/lib/xbim_comms/models/animation.rb +232 -0
  17. data/lib/xbim_comms/models/animation_all_of.rb +220 -0
  18. data/lib/xbim_comms/models/bitmap.rb +303 -0
  19. data/lib/xbim_comms/models/blob.rb +245 -0
  20. data/lib/xbim_comms/models/boolean_value.rb +218 -0
  21. data/lib/xbim_comms/models/clipping_plane.rb +231 -0
  22. data/lib/xbim_comms/models/coloring.rb +229 -0
  23. data/lib/xbim_comms/models/column_request.rb +279 -0
  24. data/lib/xbim_comms/models/component.rb +236 -0
  25. data/lib/xbim_comms/models/components.rb +240 -0
  26. data/lib/xbim_comms/models/contact.rb +227 -0
  27. data/lib/xbim_comms/models/contact_list.rb +238 -0
  28. data/lib/xbim_comms/models/conversation.rb +392 -0
  29. data/lib/xbim_comms/models/conversation_create.rb +273 -0
  30. data/lib/xbim_comms/models/conversation_list.rb +238 -0
  31. data/lib/xbim_comms/models/conversation_tenant.rb +254 -0
  32. data/lib/xbim_comms/models/conversation_update.rb +302 -0
  33. data/lib/xbim_comms/models/entity_key.rb +227 -0
  34. data/lib/xbim_comms/models/exception_message.rb +245 -0
  35. data/lib/xbim_comms/models/file.rb +266 -0
  36. data/lib/xbim_comms/models/file_all_of.rb +254 -0
  37. data/lib/xbim_comms/models/int32_value.rb +218 -0
  38. data/lib/xbim_comms/models/key_frame.rb +236 -0
  39. data/lib/xbim_comms/models/line.rb +231 -0
  40. data/lib/xbim_comms/models/message.rb +416 -0
  41. data/lib/xbim_comms/models/message_content.rb +220 -0
  42. data/lib/xbim_comms/models/message_create.rb +273 -0
  43. data/lib/xbim_comms/models/message_list.rb +238 -0
  44. data/lib/xbim_comms/models/message_part.rb +246 -0
  45. data/lib/xbim_comms/models/message_update.rb +297 -0
  46. data/lib/xbim_comms/models/orthogonal_camera.rb +269 -0
  47. data/lib/xbim_comms/models/participant.rb +232 -0
  48. data/lib/xbim_comms/models/participant_with_role.rb +293 -0
  49. data/lib/xbim_comms/models/participant_with_role_create.rb +266 -0
  50. data/lib/xbim_comms/models/participant_with_role_list.rb +238 -0
  51. data/lib/xbim_comms/models/participant_with_role_update.rb +261 -0
  52. data/lib/xbim_comms/models/perspective_camera.rb +269 -0
  53. data/lib/xbim_comms/models/pie_chart.rb +257 -0
  54. data/lib/xbim_comms/models/pie_chart_all_of.rb +245 -0
  55. data/lib/xbim_comms/models/point.rb +227 -0
  56. data/lib/xbim_comms/models/preview_row.rb +220 -0
  57. data/lib/xbim_comms/models/schedule.rb +270 -0
  58. data/lib/xbim_comms/models/schedule_all_of.rb +258 -0
  59. data/lib/xbim_comms/models/schedule_column.rb +384 -0
  60. data/lib/xbim_comms/models/schedule_request.rb +252 -0
  61. data/lib/xbim_comms/models/schedule_request_all_of.rb +240 -0
  62. data/lib/xbim_comms/models/section_box.rb +274 -0
  63. data/lib/xbim_comms/models/sheet.rb +268 -0
  64. data/lib/xbim_comms/models/sheet_all_of.rb +256 -0
  65. data/lib/xbim_comms/models/sheet_part.rb +254 -0
  66. data/lib/xbim_comms/models/snapshot.rb +270 -0
  67. data/lib/xbim_comms/models/text.rb +220 -0
  68. data/lib/xbim_comms/models/view.rb +239 -0
  69. data/lib/xbim_comms/models/view_all_of.rb +227 -0
  70. data/lib/xbim_comms/models/view_setup_hints.rb +236 -0
  71. data/lib/xbim_comms/models/viewpoint.rb +296 -0
  72. data/lib/xbim_comms/models/visibility.rb +238 -0
  73. data/lib/xbim_comms/version.rb +15 -0
  74. data/lib/xbim_comms.rb +104 -0
  75. data/spec/api/contacts_api_spec.rb +74 -0
  76. data/spec/api/conversations_api_spec.rb +521 -0
  77. data/spec/api/files_api_spec.rb +50 -0
  78. data/spec/api/snapshots_api_spec.rb +49 -0
  79. data/spec/api_client_spec.rb +226 -0
  80. data/spec/configuration_spec.rb +42 -0
  81. data/spec/models/aggregate_list_value_spec.rb +34 -0
  82. data/spec/models/aggregate_spec.rb +40 -0
  83. data/spec/models/analytical_result_all_of_spec.rb +58 -0
  84. data/spec/models/analytical_result_spec.rb +58 -0
  85. data/spec/models/animation_all_of_spec.rb +34 -0
  86. data/spec/models/animation_spec.rb +34 -0
  87. data/spec/models/bitmap_spec.rb +68 -0
  88. data/spec/models/blob_spec.rb +52 -0
  89. data/spec/models/boolean_value_spec.rb +34 -0
  90. data/spec/models/clipping_plane_spec.rb +40 -0
  91. data/spec/models/coloring_spec.rb +40 -0
  92. data/spec/models/column_request_spec.rb +56 -0
  93. data/spec/models/component_spec.rb +46 -0
  94. data/spec/models/components_spec.rb +46 -0
  95. data/spec/models/contact_list_spec.rb +46 -0
  96. data/spec/models/contact_spec.rb +40 -0
  97. data/spec/models/conversation_create_spec.rb +64 -0
  98. data/spec/models/conversation_list_spec.rb +46 -0
  99. data/spec/models/conversation_spec.rb +122 -0
  100. data/spec/models/conversation_tenant_spec.rb +58 -0
  101. data/spec/models/conversation_update_spec.rb +68 -0
  102. data/spec/models/entity_key_spec.rb +40 -0
  103. data/spec/models/exception_message_spec.rb +52 -0
  104. data/spec/models/file_all_of_spec.rb +58 -0
  105. data/spec/models/file_spec.rb +58 -0
  106. data/spec/models/int32_value_spec.rb +34 -0
  107. data/spec/models/key_frame_spec.rb +46 -0
  108. data/spec/models/line_spec.rb +40 -0
  109. data/spec/models/message_content_spec.rb +34 -0
  110. data/spec/models/message_create_spec.rb +64 -0
  111. data/spec/models/message_list_spec.rb +46 -0
  112. data/spec/models/message_part_spec.rb +46 -0
  113. data/spec/models/message_spec.rb +146 -0
  114. data/spec/models/message_update_spec.rb +68 -0
  115. data/spec/models/orthogonal_camera_spec.rb +64 -0
  116. data/spec/models/participant_spec.rb +40 -0
  117. data/spec/models/participant_with_role_create_spec.rb +44 -0
  118. data/spec/models/participant_with_role_list_spec.rb +46 -0
  119. data/spec/models/participant_with_role_spec.rb +62 -0
  120. data/spec/models/participant_with_role_update_spec.rb +44 -0
  121. data/spec/models/perspective_camera_spec.rb +64 -0
  122. data/spec/models/pie_chart_all_of_spec.rb +52 -0
  123. data/spec/models/pie_chart_spec.rb +52 -0
  124. data/spec/models/point_spec.rb +40 -0
  125. data/spec/models/preview_row_spec.rb +34 -0
  126. data/spec/models/schedule_all_of_spec.rb +58 -0
  127. data/spec/models/schedule_column_spec.rb +118 -0
  128. data/spec/models/schedule_request_all_of_spec.rb +46 -0
  129. data/spec/models/schedule_request_spec.rb +46 -0
  130. data/spec/models/schedule_spec.rb +58 -0
  131. data/spec/models/section_box_spec.rb +70 -0
  132. data/spec/models/sheet_all_of_spec.rb +58 -0
  133. data/spec/models/sheet_part_spec.rb +58 -0
  134. data/spec/models/sheet_spec.rb +58 -0
  135. data/spec/models/snapshot_spec.rb +50 -0
  136. data/spec/models/text_spec.rb +28 -0
  137. data/spec/models/view_all_of_spec.rb +40 -0
  138. data/spec/models/view_setup_hints_spec.rb +46 -0
  139. data/spec/models/view_spec.rb +40 -0
  140. data/spec/models/viewpoint_spec.rb +82 -0
  141. data/spec/models/visibility_spec.rb +46 -0
  142. data/spec/spec_helper.rb +111 -0
  143. data/xbim_comms-1.0.0.gem +0 -0
  144. data/xbim_comms.gemspec +38 -0
  145. metadata +226 -0
@@ -0,0 +1,266 @@
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 ParticipantWithRoleCreate
18
+ attr_accessor :email
19
+
20
+ attr_accessor :role
21
+
22
+ class EnumAttributeValidator
23
+ attr_reader :datatype
24
+ attr_reader :allowable_values
25
+
26
+ def initialize(datatype, allowable_values)
27
+ @allowable_values = allowable_values.map do |value|
28
+ case datatype.to_s
29
+ when /Integer/i
30
+ value.to_i
31
+ when /Float/i
32
+ value.to_f
33
+ else
34
+ value
35
+ end
36
+ end
37
+ end
38
+
39
+ def valid?(value)
40
+ !value || allowable_values.include?(value)
41
+ end
42
+ end
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'email' => :'email',
48
+ :'role' => :'role'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'email' => :'String',
61
+ :'role' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XbimComms::ParticipantWithRoleCreate` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XbimComms::ParticipantWithRoleCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'email')
87
+ self.email = attributes[:'email']
88
+ end
89
+
90
+ if attributes.key?(:'role')
91
+ self.role = attributes[:'role']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @email.nil?
100
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
101
+ end
102
+
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ return false if @email.nil?
110
+ role_validator = EnumAttributeValidator.new('String', ["Reader", "Contributor", "Owner"])
111
+ return false unless role_validator.valid?(@role)
112
+ true
113
+ end
114
+
115
+ # Custom attribute writer method checking allowed values (enum).
116
+ # @param [Object] role Object to be assigned
117
+ def role=(role)
118
+ validator = EnumAttributeValidator.new('String', ["Reader", "Contributor", "Owner"])
119
+ unless validator.valid?(role)
120
+ fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}."
121
+ end
122
+ @role = role
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ email == o.email &&
131
+ role == o.role
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [email, role].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
166
+ end
167
+ elsif !attributes[self.class.attribute_map[key]].nil?
168
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = XbimComms.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
@@ -0,0 +1,238 @@
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 ParticipantWithRoleList
18
+ attr_accessor :odata_context
19
+
20
+ attr_accessor :odata_count
21
+
22
+ attr_accessor :value
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'odata_context' => :'@odata.context',
28
+ :'odata_count' => :'@odata.count',
29
+ :'value' => :'value'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'odata_context' => :'String',
42
+ :'odata_count' => :'Integer',
43
+ :'value' => :'Array<ParticipantWithRole>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XbimComms::ParticipantWithRoleList` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XbimComms::ParticipantWithRoleList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'odata_context')
69
+ self.odata_context = attributes[:'odata_context']
70
+ end
71
+
72
+ if attributes.key?(:'odata_count')
73
+ self.odata_count = attributes[:'odata_count']
74
+ end
75
+
76
+ if attributes.key?(:'value')
77
+ if (value = attributes[:'value']).is_a?(Array)
78
+ self.value = value
79
+ end
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ odata_context == o.odata_context &&
102
+ odata_count == o.odata_count &&
103
+ value == o.value
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [odata_context, odata_count, value].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
132
+ self.send("#{key}=", nil)
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = XbimComms.const_get(type)
186
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end