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