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