primary_connect_client 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,466 +0,0 @@
1
- =begin
2
- #Primary Connect API V1
3
-
4
- #Client Library to interface with Primary Connect
5
-
6
- The version of the OpenAPI document: v1
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module PrimaryConnectClient
17
- class PatientDemographics
18
- attr_accessor :name
19
-
20
- attr_accessor :dob
21
-
22
- attr_accessor :ssn
23
-
24
- attr_accessor :sex
25
-
26
- attr_accessor :gender
27
-
28
- attr_accessor :sexual_orientation
29
-
30
- attr_accessor :races
31
-
32
- attr_accessor :race_details
33
-
34
- attr_accessor :ethnicity
35
-
36
- attr_accessor :ethnicity_detail
37
-
38
- attr_accessor :marital_status
39
-
40
- attr_accessor :is_deceased
41
-
42
- # ISO 8601
43
- attr_accessor :death_date_time
44
-
45
- attr_accessor :phone_numbers
46
-
47
- attr_accessor :email_addresses
48
-
49
- attr_accessor :language_code
50
-
51
- attr_accessor :citizenships
52
-
53
- attr_accessor :address
54
-
55
- class EnumAttributeValidator
56
- attr_reader :datatype
57
- attr_reader :allowable_values
58
-
59
- def initialize(datatype, allowable_values)
60
- @allowable_values = allowable_values.map do |value|
61
- case datatype.to_s
62
- when /Integer/i
63
- value.to_i
64
- when /Float/i
65
- value.to_f
66
- else
67
- value
68
- end
69
- end
70
- end
71
-
72
- def valid?(value)
73
- !value || allowable_values.include?(value)
74
- end
75
- end
76
-
77
- # Attribute mapping from ruby-style variable name to JSON key.
78
- def self.attribute_map
79
- {
80
- :'name' => :'name',
81
- :'dob' => :'dob',
82
- :'ssn' => :'ssn',
83
- :'sex' => :'sex',
84
- :'gender' => :'gender',
85
- :'sexual_orientation' => :'sexual_orientation',
86
- :'races' => :'races',
87
- :'race_details' => :'race_details',
88
- :'ethnicity' => :'ethnicity',
89
- :'ethnicity_detail' => :'ethnicity_detail',
90
- :'marital_status' => :'marital_status',
91
- :'is_deceased' => :'is_deceased',
92
- :'death_date_time' => :'death_date_time',
93
- :'phone_numbers' => :'phone_numbers',
94
- :'email_addresses' => :'email_addresses',
95
- :'language_code' => :'language_code',
96
- :'citizenships' => :'citizenships',
97
- :'address' => :'address'
98
- }
99
- end
100
-
101
- # Returns all the JSON keys this model knows about
102
- def self.acceptable_attributes
103
- attribute_map.values
104
- end
105
-
106
- # Attribute type mapping.
107
- def self.openapi_types
108
- {
109
- :'name' => :'Name',
110
- :'dob' => :'String',
111
- :'ssn' => :'String',
112
- :'sex' => :'String',
113
- :'gender' => :'String',
114
- :'sexual_orientation' => :'String',
115
- :'races' => :'Array<String>',
116
- :'race_details' => :'Array<String>',
117
- :'ethnicity' => :'String',
118
- :'ethnicity_detail' => :'Array<String>',
119
- :'marital_status' => :'String',
120
- :'is_deceased' => :'Boolean',
121
- :'death_date_time' => :'Time',
122
- :'phone_numbers' => :'Array<PhoneNumber>',
123
- :'email_addresses' => :'Array<String>',
124
- :'language_code' => :'String',
125
- :'citizenships' => :'Array<String>',
126
- :'address' => :'Address'
127
- }
128
- end
129
-
130
- # List of attributes with nullable: true
131
- def self.openapi_nullable
132
- Set.new([
133
- ])
134
- end
135
-
136
- # Initializes the object
137
- # @param [Hash] attributes Model attributes in the form of hash
138
- def initialize(attributes = {})
139
- if (!attributes.is_a?(Hash))
140
- fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::PatientDemographics` initialize method"
141
- end
142
-
143
- # check to see if the attribute exists and convert string to symbol for hash key
144
- attributes = attributes.each_with_object({}) { |(k, v), h|
145
- if (!self.class.attribute_map.key?(k.to_sym))
146
- fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::PatientDemographics`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
147
- end
148
- h[k.to_sym] = v
149
- }
150
-
151
- if attributes.key?(:'name')
152
- self.name = attributes[:'name']
153
- end
154
-
155
- if attributes.key?(:'dob')
156
- self.dob = attributes[:'dob']
157
- end
158
-
159
- if attributes.key?(:'ssn')
160
- self.ssn = attributes[:'ssn']
161
- end
162
-
163
- if attributes.key?(:'sex')
164
- self.sex = attributes[:'sex']
165
- end
166
-
167
- if attributes.key?(:'gender')
168
- self.gender = attributes[:'gender']
169
- end
170
-
171
- if attributes.key?(:'sexual_orientation')
172
- self.sexual_orientation = attributes[:'sexual_orientation']
173
- end
174
-
175
- if attributes.key?(:'races')
176
- if (value = attributes[:'races']).is_a?(Array)
177
- self.races = value
178
- end
179
- end
180
-
181
- if attributes.key?(:'race_details')
182
- if (value = attributes[:'race_details']).is_a?(Array)
183
- self.race_details = value
184
- end
185
- end
186
-
187
- if attributes.key?(:'ethnicity')
188
- self.ethnicity = attributes[:'ethnicity']
189
- end
190
-
191
- if attributes.key?(:'ethnicity_detail')
192
- if (value = attributes[:'ethnicity_detail']).is_a?(Array)
193
- self.ethnicity_detail = value
194
- end
195
- end
196
-
197
- if attributes.key?(:'marital_status')
198
- self.marital_status = attributes[:'marital_status']
199
- end
200
-
201
- if attributes.key?(:'is_deceased')
202
- self.is_deceased = attributes[:'is_deceased']
203
- end
204
-
205
- if attributes.key?(:'death_date_time')
206
- self.death_date_time = attributes[:'death_date_time']
207
- end
208
-
209
- if attributes.key?(:'phone_numbers')
210
- if (value = attributes[:'phone_numbers']).is_a?(Array)
211
- self.phone_numbers = value
212
- end
213
- end
214
-
215
- if attributes.key?(:'email_addresses')
216
- if (value = attributes[:'email_addresses']).is_a?(Array)
217
- self.email_addresses = value
218
- end
219
- end
220
-
221
- if attributes.key?(:'language_code')
222
- self.language_code = attributes[:'language_code']
223
- end
224
-
225
- if attributes.key?(:'citizenships')
226
- if (value = attributes[:'citizenships']).is_a?(Array)
227
- self.citizenships = value
228
- end
229
- end
230
-
231
- if attributes.key?(:'address')
232
- self.address = attributes[:'address']
233
- end
234
- end
235
-
236
- # Show invalid properties with the reasons. Usually used together with valid?
237
- # @return Array for valid properties with the reasons
238
- def list_invalid_properties
239
- invalid_properties = Array.new
240
- invalid_properties
241
- end
242
-
243
- # Check to see if the all the properties in the model are valid
244
- # @return true if the model is valid
245
- def valid?
246
- sex_validator = EnumAttributeValidator.new('String', ["SEX_UNKNOWN", "SEX_FEMALE", "SEX_MALE", "SEX_OTHER", "SEX_NON_BINARY", "SEX_PREFER_NOT_TO_DISCLOSE"])
247
- return false unless sex_validator.valid?(@sex)
248
- gender_validator = EnumAttributeValidator.new('String', ["GENDER_UNKNOWN", "GENDER_FEMALE", "GENDER_MALE", "GENDER_OTHER", "GENDER_NON_BINARY", "GENDER_TRANSGENDER_MALE", "GENDER_TRANSGENDER_FEMALE", "GENDER_PREFER_NOT_TO_DISCLOSE"])
249
- return false unless gender_validator.valid?(@gender)
250
- sexual_orientation_validator = EnumAttributeValidator.new('String', ["ORIENTATION_UNKNOWN", "ORIENTATION_HOMOSEXUAL", "ORIENTATION_HETEROSEXUAL", "ORIENTATION_BISEXUAL", "ORIENTATION_QUESTIONING", "ORIENTATION_OTHER", "ORIENTATION_PREFER_NOT_TO_DISCLOSE"])
251
- return false unless sexual_orientation_validator.valid?(@sexual_orientation)
252
- ethnicity_validator = EnumAttributeValidator.new('String', ["ETHNICITY_UNKNOWN", "ETHNICITY_HISPANIC", "ETHNICITY_NON_HISPANIC", "ETHNICITY_PREFER_NOT_TO_DISCLOSE"])
253
- return false unless ethnicity_validator.valid?(@ethnicity)
254
- marital_status_validator = EnumAttributeValidator.new('String', ["MARITAL_STATUS_UNKNOWN", "MARITAL_STATUS_SEPARATED", "MARITAL_STATUS_UNMARRIED", "MARITAL_STATUS_COMMON_LAW", "MARITAL_STATUS_DIVORCED", "MARITAL_STATUS_LEGALLY_SEPARATED", "MARITAL_STATUS_LIVING_TOGETHER", "MARITAL_STATUS_INTERLOCUTORY", "MARITAL_STATUS_MARRIED", "MARITAL_STATUS_ANNULLED", "MARITAL_STATUS_OTHER", "MARITAL_STATUS_DOMESTIC_PARTNER", "MARITAL_STATUS_REGISTERED_DOMESTIC_PARTNER", "MARITAL_STATUS_SINGLE", "MARITAL_STATUS_UNREPORTED", "MARITAL_STATUS_WIDOWED"])
255
- return false unless marital_status_validator.valid?(@marital_status)
256
- true
257
- end
258
-
259
- # Custom attribute writer method checking allowed values (enum).
260
- # @param [Object] sex Object to be assigned
261
- def sex=(sex)
262
- validator = EnumAttributeValidator.new('String', ["SEX_UNKNOWN", "SEX_FEMALE", "SEX_MALE", "SEX_OTHER", "SEX_NON_BINARY", "SEX_PREFER_NOT_TO_DISCLOSE"])
263
- unless validator.valid?(sex)
264
- fail ArgumentError, "invalid value for \"sex\", must be one of #{validator.allowable_values}."
265
- end
266
- @sex = sex
267
- end
268
-
269
- # Custom attribute writer method checking allowed values (enum).
270
- # @param [Object] gender Object to be assigned
271
- def gender=(gender)
272
- validator = EnumAttributeValidator.new('String', ["GENDER_UNKNOWN", "GENDER_FEMALE", "GENDER_MALE", "GENDER_OTHER", "GENDER_NON_BINARY", "GENDER_TRANSGENDER_MALE", "GENDER_TRANSGENDER_FEMALE", "GENDER_PREFER_NOT_TO_DISCLOSE"])
273
- unless validator.valid?(gender)
274
- fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}."
275
- end
276
- @gender = gender
277
- end
278
-
279
- # Custom attribute writer method checking allowed values (enum).
280
- # @param [Object] sexual_orientation Object to be assigned
281
- def sexual_orientation=(sexual_orientation)
282
- validator = EnumAttributeValidator.new('String', ["ORIENTATION_UNKNOWN", "ORIENTATION_HOMOSEXUAL", "ORIENTATION_HETEROSEXUAL", "ORIENTATION_BISEXUAL", "ORIENTATION_QUESTIONING", "ORIENTATION_OTHER", "ORIENTATION_PREFER_NOT_TO_DISCLOSE"])
283
- unless validator.valid?(sexual_orientation)
284
- fail ArgumentError, "invalid value for \"sexual_orientation\", must be one of #{validator.allowable_values}."
285
- end
286
- @sexual_orientation = sexual_orientation
287
- end
288
-
289
- # Custom attribute writer method checking allowed values (enum).
290
- # @param [Object] ethnicity Object to be assigned
291
- def ethnicity=(ethnicity)
292
- validator = EnumAttributeValidator.new('String', ["ETHNICITY_UNKNOWN", "ETHNICITY_HISPANIC", "ETHNICITY_NON_HISPANIC", "ETHNICITY_PREFER_NOT_TO_DISCLOSE"])
293
- unless validator.valid?(ethnicity)
294
- fail ArgumentError, "invalid value for \"ethnicity\", must be one of #{validator.allowable_values}."
295
- end
296
- @ethnicity = ethnicity
297
- end
298
-
299
- # Custom attribute writer method checking allowed values (enum).
300
- # @param [Object] marital_status Object to be assigned
301
- def marital_status=(marital_status)
302
- validator = EnumAttributeValidator.new('String', ["MARITAL_STATUS_UNKNOWN", "MARITAL_STATUS_SEPARATED", "MARITAL_STATUS_UNMARRIED", "MARITAL_STATUS_COMMON_LAW", "MARITAL_STATUS_DIVORCED", "MARITAL_STATUS_LEGALLY_SEPARATED", "MARITAL_STATUS_LIVING_TOGETHER", "MARITAL_STATUS_INTERLOCUTORY", "MARITAL_STATUS_MARRIED", "MARITAL_STATUS_ANNULLED", "MARITAL_STATUS_OTHER", "MARITAL_STATUS_DOMESTIC_PARTNER", "MARITAL_STATUS_REGISTERED_DOMESTIC_PARTNER", "MARITAL_STATUS_SINGLE", "MARITAL_STATUS_UNREPORTED", "MARITAL_STATUS_WIDOWED"])
303
- unless validator.valid?(marital_status)
304
- fail ArgumentError, "invalid value for \"marital_status\", must be one of #{validator.allowable_values}."
305
- end
306
- @marital_status = marital_status
307
- end
308
-
309
- # Checks equality by comparing each attribute.
310
- # @param [Object] Object to be compared
311
- def ==(o)
312
- return true if self.equal?(o)
313
- self.class == o.class &&
314
- name == o.name &&
315
- dob == o.dob &&
316
- ssn == o.ssn &&
317
- sex == o.sex &&
318
- gender == o.gender &&
319
- sexual_orientation == o.sexual_orientation &&
320
- races == o.races &&
321
- race_details == o.race_details &&
322
- ethnicity == o.ethnicity &&
323
- ethnicity_detail == o.ethnicity_detail &&
324
- marital_status == o.marital_status &&
325
- is_deceased == o.is_deceased &&
326
- death_date_time == o.death_date_time &&
327
- phone_numbers == o.phone_numbers &&
328
- email_addresses == o.email_addresses &&
329
- language_code == o.language_code &&
330
- citizenships == o.citizenships &&
331
- address == o.address
332
- end
333
-
334
- # @see the `==` method
335
- # @param [Object] Object to be compared
336
- def eql?(o)
337
- self == o
338
- end
339
-
340
- # Calculates hash code according to all attributes.
341
- # @return [Integer] Hash code
342
- def hash
343
- [name, dob, ssn, sex, gender, sexual_orientation, races, race_details, ethnicity, ethnicity_detail, marital_status, is_deceased, death_date_time, phone_numbers, email_addresses, language_code, citizenships, address].hash
344
- end
345
-
346
- # Builds the object from hash
347
- # @param [Hash] attributes Model attributes in the form of hash
348
- # @return [Object] Returns the model itself
349
- def self.build_from_hash(attributes)
350
- new.build_from_hash(attributes)
351
- end
352
-
353
- # Builds the object from hash
354
- # @param [Hash] attributes Model attributes in the form of hash
355
- # @return [Object] Returns the model itself
356
- def build_from_hash(attributes)
357
- return nil unless attributes.is_a?(Hash)
358
- self.class.openapi_types.each_pair do |key, type|
359
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
360
- self.send("#{key}=", nil)
361
- elsif type =~ /\AArray<(.*)>/i
362
- # check to ensure the input is an array given that the attribute
363
- # is documented as an array but the input is not
364
- if attributes[self.class.attribute_map[key]].is_a?(Array)
365
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
366
- end
367
- elsif !attributes[self.class.attribute_map[key]].nil?
368
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
369
- end
370
- end
371
-
372
- self
373
- end
374
-
375
- # Deserializes the data based on type
376
- # @param string type Data type
377
- # @param string value Value to be deserialized
378
- # @return [Object] Deserialized data
379
- def _deserialize(type, value)
380
- case type.to_sym
381
- when :Time
382
- Time.parse(value)
383
- when :Date
384
- Date.parse(value)
385
- when :String
386
- value.to_s
387
- when :Integer
388
- value.to_i
389
- when :Float
390
- value.to_f
391
- when :Boolean
392
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
393
- true
394
- else
395
- false
396
- end
397
- when :Object
398
- # generic object (usually a Hash), return directly
399
- value
400
- when /\AArray<(?<inner_type>.+)>\z/
401
- inner_type = Regexp.last_match[:inner_type]
402
- value.map { |v| _deserialize(inner_type, v) }
403
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
404
- k_type = Regexp.last_match[:k_type]
405
- v_type = Regexp.last_match[:v_type]
406
- {}.tap do |hash|
407
- value.each do |k, v|
408
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
409
- end
410
- end
411
- else # model
412
- # models (e.g. Pet) or oneOf
413
- klass = PrimaryConnectClient.const_get(type)
414
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
415
- end
416
- end
417
-
418
- # Returns the string representation of the object
419
- # @return [String] String presentation of the object
420
- def to_s
421
- to_hash.to_s
422
- end
423
-
424
- # to_body is an alias to to_hash (backward compatibility)
425
- # @return [Hash] Returns the object in the form of hash
426
- def to_body
427
- to_hash
428
- end
429
-
430
- # Returns the object in the form of hash
431
- # @return [Hash] Returns the object in the form of hash
432
- def to_hash
433
- hash = {}
434
- self.class.attribute_map.each_pair do |attr, param|
435
- value = self.send(attr)
436
- if value.nil?
437
- is_nullable = self.class.openapi_nullable.include?(attr)
438
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
439
- end
440
-
441
- hash[param] = _to_hash(value)
442
- end
443
- hash
444
- end
445
-
446
- # Outputs non-array value in the form of hash
447
- # For object, use to_hash. Otherwise, just return the value
448
- # @param [Object] value Any valid value
449
- # @return [Hash] Returns the value in the form of hash
450
- def _to_hash(value)
451
- if value.is_a?(Array)
452
- value.compact.map { |v| _to_hash(v) }
453
- elsif value.is_a?(Hash)
454
- {}.tap do |hash|
455
- value.each { |k, v| hash[k] = _to_hash(v) }
456
- end
457
- elsif value.respond_to? :to_hash
458
- value.to_hash
459
- else
460
- value
461
- end
462
- end
463
-
464
- end
465
-
466
- end
@@ -1,218 +0,0 @@
1
- =begin
2
- #Primary Connect API V1
3
-
4
- #Client Library to interface with Primary Connect
5
-
6
- The version of the OpenAPI document: v1
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 5.3.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module PrimaryConnectClient
17
- class SubjectOneOf
18
- attr_accessor :patient
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'patient' => :'patient'
24
- }
25
- end
26
-
27
- # Returns all the JSON keys this model knows about
28
- def self.acceptable_attributes
29
- attribute_map.values
30
- end
31
-
32
- # Attribute type mapping.
33
- def self.openapi_types
34
- {
35
- :'patient' => :'Patient'
36
- }
37
- end
38
-
39
- # List of attributes with nullable: true
40
- def self.openapi_nullable
41
- Set.new([
42
- ])
43
- end
44
-
45
- # Initializes the object
46
- # @param [Hash] attributes Model attributes in the form of hash
47
- def initialize(attributes = {})
48
- if (!attributes.is_a?(Hash))
49
- fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::SubjectOneOf` initialize method"
50
- end
51
-
52
- # check to see if the attribute exists and convert string to symbol for hash key
53
- attributes = attributes.each_with_object({}) { |(k, v), h|
54
- if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::SubjectOneOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
- end
57
- h[k.to_sym] = v
58
- }
59
-
60
- if attributes.key?(:'patient')
61
- self.patient = attributes[:'patient']
62
- end
63
- end
64
-
65
- # Show invalid properties with the reasons. Usually used together with valid?
66
- # @return Array for valid properties with the reasons
67
- def list_invalid_properties
68
- invalid_properties = Array.new
69
- invalid_properties
70
- end
71
-
72
- # Check to see if the all the properties in the model are valid
73
- # @return true if the model is valid
74
- def valid?
75
- true
76
- end
77
-
78
- # Checks equality by comparing each attribute.
79
- # @param [Object] Object to be compared
80
- def ==(o)
81
- return true if self.equal?(o)
82
- self.class == o.class &&
83
- patient == o.patient
84
- end
85
-
86
- # @see the `==` method
87
- # @param [Object] Object to be compared
88
- def eql?(o)
89
- self == o
90
- end
91
-
92
- # Calculates hash code according to all attributes.
93
- # @return [Integer] Hash code
94
- def hash
95
- [patient].hash
96
- end
97
-
98
- # Builds the object from hash
99
- # @param [Hash] attributes Model attributes in the form of hash
100
- # @return [Object] Returns the model itself
101
- def self.build_from_hash(attributes)
102
- new.build_from_hash(attributes)
103
- end
104
-
105
- # Builds the object from hash
106
- # @param [Hash] attributes Model attributes in the form of hash
107
- # @return [Object] Returns the model itself
108
- def build_from_hash(attributes)
109
- return nil unless attributes.is_a?(Hash)
110
- self.class.openapi_types.each_pair do |key, type|
111
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
112
- self.send("#{key}=", nil)
113
- elsif type =~ /\AArray<(.*)>/i
114
- # check to ensure the input is an array given that the attribute
115
- # is documented as an array but the input is not
116
- if attributes[self.class.attribute_map[key]].is_a?(Array)
117
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
- end
119
- elsif !attributes[self.class.attribute_map[key]].nil?
120
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
- end
122
- end
123
-
124
- self
125
- end
126
-
127
- # Deserializes the data based on type
128
- # @param string type Data type
129
- # @param string value Value to be deserialized
130
- # @return [Object] Deserialized data
131
- def _deserialize(type, value)
132
- case type.to_sym
133
- when :Time
134
- Time.parse(value)
135
- when :Date
136
- Date.parse(value)
137
- when :String
138
- value.to_s
139
- when :Integer
140
- value.to_i
141
- when :Float
142
- value.to_f
143
- when :Boolean
144
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
- true
146
- else
147
- false
148
- end
149
- when :Object
150
- # generic object (usually a Hash), return directly
151
- value
152
- when /\AArray<(?<inner_type>.+)>\z/
153
- inner_type = Regexp.last_match[:inner_type]
154
- value.map { |v| _deserialize(inner_type, v) }
155
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
- k_type = Regexp.last_match[:k_type]
157
- v_type = Regexp.last_match[:v_type]
158
- {}.tap do |hash|
159
- value.each do |k, v|
160
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
- end
162
- end
163
- else # model
164
- # models (e.g. Pet) or oneOf
165
- klass = PrimaryConnectClient.const_get(type)
166
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
167
- end
168
- end
169
-
170
- # Returns the string representation of the object
171
- # @return [String] String presentation of the object
172
- def to_s
173
- to_hash.to_s
174
- end
175
-
176
- # to_body is an alias to to_hash (backward compatibility)
177
- # @return [Hash] Returns the object in the form of hash
178
- def to_body
179
- to_hash
180
- end
181
-
182
- # Returns the object in the form of hash
183
- # @return [Hash] Returns the object in the form of hash
184
- def to_hash
185
- hash = {}
186
- self.class.attribute_map.each_pair do |attr, param|
187
- value = self.send(attr)
188
- if value.nil?
189
- is_nullable = self.class.openapi_nullable.include?(attr)
190
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
191
- end
192
-
193
- hash[param] = _to_hash(value)
194
- end
195
- hash
196
- end
197
-
198
- # Outputs non-array value in the form of hash
199
- # For object, use to_hash. Otherwise, just return the value
200
- # @param [Object] value Any valid value
201
- # @return [Hash] Returns the value in the form of hash
202
- def _to_hash(value)
203
- if value.is_a?(Array)
204
- value.compact.map { |v| _to_hash(v) }
205
- elsif value.is_a?(Hash)
206
- {}.tap do |hash|
207
- value.each { |k, v| hash[k] = _to_hash(v) }
208
- end
209
- elsif value.respond_to? :to_hash
210
- value.to_hash
211
- else
212
- value
213
- end
214
- end
215
-
216
- end
217
-
218
- end