change_healthcare-eligibility 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +130 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +7 -0
  7. data/Gemfile +4 -0
  8. data/Gemfile.lock +59 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +64 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +11 -0
  13. data/bin/rspec +29 -0
  14. data/bin/setup +8 -0
  15. data/change_healthcare-eligibility.gemspec +44 -0
  16. data/lib/change_healthcare/eligibility.rb +13 -0
  17. data/lib/change_healthcare/eligibility/inspector.rb +82 -0
  18. data/lib/change_healthcare/eligibility/swagger_client.rb +81 -0
  19. data/lib/change_healthcare/eligibility/swagger_client/api_client.rb +388 -0
  20. data/lib/change_healthcare/eligibility/swagger_client/api_error.rb +40 -0
  21. data/lib/change_healthcare/eligibility/swagger_client/configuration.rb +202 -0
  22. data/lib/change_healthcare/eligibility/swagger_client/eligibility_api.rb +198 -0
  23. data/lib/change_healthcare/eligibility/swagger_client/models/additional_identification.rb +266 -0
  24. data/lib/change_healthcare/eligibility/swagger_client/models/additional_information.rb +185 -0
  25. data/lib/change_healthcare/eligibility/swagger_client/models/address.rb +218 -0
  26. data/lib/change_healthcare/eligibility/swagger_client/models/benefits_additional_information.rb +376 -0
  27. data/lib/change_healthcare/eligibility/swagger_client/models/benefits_date_information.rb +340 -0
  28. data/lib/change_healthcare/eligibility/swagger_client/models/benefits_information.rb +338 -0
  29. data/lib/change_healthcare/eligibility/swagger_client/models/benefits_related_entity.rb +240 -0
  30. data/lib/change_healthcare/eligibility/swagger_client/models/benefits_service_delivery.rb +220 -0
  31. data/lib/change_healthcare/eligibility/swagger_client/models/composite_medical_procedure_identifier.rb +218 -0
  32. data/lib/change_healthcare/eligibility/swagger_client/models/eligibility_additional_information.rb +200 -0
  33. data/lib/change_healthcare/eligibility/swagger_client/models/encounter.rb +359 -0
  34. data/lib/change_healthcare/eligibility/swagger_client/models/error.rb +205 -0
  35. data/lib/change_healthcare/eligibility/swagger_client/models/health_care_diagnosis_code.rb +190 -0
  36. data/lib/change_healthcare/eligibility/swagger_client/models/health_care_information.rb +229 -0
  37. data/lib/change_healthcare/eligibility/swagger_client/models/health_check.rb +190 -0
  38. data/lib/change_healthcare/eligibility/swagger_client/models/information_receiver_name.rb +303 -0
  39. data/lib/change_healthcare/eligibility/swagger_client/models/loop_2000_cd2100_cd_segment_nm1_ref_dmg_ins_mpi_prv_notes_response_member.rb +429 -0
  40. data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_a_segments_nm1_and_per_notes_information_source_name.rb +293 -0
  41. data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_a_segments_per_element_per03_8_notes_communication.rb +194 -0
  42. data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_a_segments_per_notes_information_source_contact_information.rb +198 -0
  43. data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_bcd_segment_nm1_prv_notes_provider.rb +322 -0
  44. data/lib/change_healthcare/eligibility/swagger_client/models/loop_2100_cd_segment_trn_notes_subscriber_trace_numbers.rb +218 -0
  45. data/lib/change_healthcare/eligibility/swagger_client/models/loop_2110_cd_segments_ref_notes_subscriber_dependent_additional_identification.rb +488 -0
  46. data/lib/change_healthcare/eligibility/swagger_client/models/medical_eligibility.rb +272 -0
  47. data/lib/change_healthcare/eligibility/swagger_client/models/medical_procedure.rb +254 -0
  48. data/lib/change_healthcare/eligibility/swagger_client/models/plan_date_information.rb +340 -0
  49. data/lib/change_healthcare/eligibility/swagger_client/models/plan_status.rb +204 -0
  50. data/lib/change_healthcare/eligibility/swagger_client/models/provider.rb +304 -0
  51. data/lib/change_healthcare/eligibility/swagger_client/models/provider_information.rb +190 -0
  52. data/lib/change_healthcare/eligibility/swagger_client/models/raw_x12_request.rb +190 -0
  53. data/lib/change_healthcare/eligibility/swagger_client/models/request_dependent.rb +452 -0
  54. data/lib/change_healthcare/eligibility/swagger_client/models/request_subscriber.rb +456 -0
  55. data/lib/change_healthcare/eligibility/swagger_client/models/response.rb +322 -0
  56. data/lib/change_healthcare/eligibility/swagger_client/version.rb +17 -0
  57. data/lib/change_healthcare/eligibility/version.rb +5 -0
  58. data/lib/change_healthcare/eligibility/wrapper.rb +124 -0
  59. metadata +214 -0
@@ -0,0 +1,340 @@
1
+ # #Eligibility
2
+ #
3
+ # Reference for developers
4
+ #
5
+ # OpenAPI spec version: v3
6
+ #
7
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
8
+ # Swagger Codegen version: 2.4.17
9
+ #
10
+
11
+ require 'date'
12
+
13
+ module ChangeHealthcare
14
+ module Eligibility
15
+ module SwaggerClient
16
+ class PlanDateInformation
17
+ attr_accessor :added, :admission, :benefit, :benefit_begin, :benefit_end, :certification, :cobra_begin, :cobra_end, :completion, :coordination_of_benefits, :date_of_death, :date_of_last_update, :discharge, :effective_date_of_change, :eligibility, :eligibility_begin, :eligibility_end, :enrollment, :issue, :latest_visit_or_consultation, :period_end, :period_start, :plan, :plan_begin, :plan_end, :policy_effective, :policy_expiration, :premium_paid_to_date_begin, :premium_paid_to_date_end, :primary_care_provider, :service, :status
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ 'added': :added,
23
+ 'admission': :admission,
24
+ 'benefit': :benefit,
25
+ 'benefit_begin': :benefitBegin,
26
+ 'benefit_end': :benefitEnd,
27
+ 'certification': :certification,
28
+ 'cobra_begin': :cobraBegin,
29
+ 'cobra_end': :cobraEnd,
30
+ 'completion': :completion,
31
+ 'coordination_of_benefits': :coordinationOfBenefits,
32
+ 'date_of_death': :dateOfDeath,
33
+ 'date_of_last_update': :dateOfLastUpdate,
34
+ 'discharge': :discharge,
35
+ 'effective_date_of_change': :effectiveDateOfChange,
36
+ 'eligibility': :eligibility,
37
+ 'eligibility_begin': :eligibilityBegin,
38
+ 'eligibility_end': :eligibilityEnd,
39
+ 'enrollment': :enrollment,
40
+ 'issue': :issue,
41
+ 'latest_visit_or_consultation': :latestVisitOrConsultation,
42
+ 'period_end': :periodEnd,
43
+ 'period_start': :periodStart,
44
+ 'plan': :plan,
45
+ 'plan_begin': :planBegin,
46
+ 'plan_end': :planEnd,
47
+ 'policy_effective': :policyEffective,
48
+ 'policy_expiration': :policyExpiration,
49
+ 'premium_paid_to_date_begin': :premiumPaidToDateBegin,
50
+ 'premium_paid_to_date_end': :premiumPaidToDateEnd,
51
+ 'primary_care_provider': :primaryCareProvider,
52
+ 'service': :service,
53
+ 'status': :status
54
+ }
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.swagger_types
59
+ {
60
+ 'added': :String,
61
+ 'admission': :String,
62
+ 'benefit': :String,
63
+ 'benefit_begin': :String,
64
+ 'benefit_end': :String,
65
+ 'certification': :String,
66
+ 'cobra_begin': :String,
67
+ 'cobra_end': :String,
68
+ 'completion': :String,
69
+ 'coordination_of_benefits': :String,
70
+ 'date_of_death': :String,
71
+ 'date_of_last_update': :String,
72
+ 'discharge': :String,
73
+ 'effective_date_of_change': :String,
74
+ 'eligibility': :String,
75
+ 'eligibility_begin': :String,
76
+ 'eligibility_end': :String,
77
+ 'enrollment': :String,
78
+ 'issue': :String,
79
+ 'latest_visit_or_consultation': :String,
80
+ 'period_end': :String,
81
+ 'period_start': :String,
82
+ 'plan': :String,
83
+ 'plan_begin': :String,
84
+ 'plan_end': :String,
85
+ 'policy_effective': :String,
86
+ 'policy_expiration': :String,
87
+ 'premium_paid_to_date_begin': :String,
88
+ 'premium_paid_to_date_end': :String,
89
+ 'primary_care_provider': :String,
90
+ 'service': :String,
91
+ 'status': :String
92
+ }
93
+ end
94
+
95
+ # Initializes the object
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ def initialize(attributes = {})
98
+ return unless attributes.is_a?(Hash)
99
+
100
+ # convert string to symbol for hash key
101
+ attributes = attributes.transform_keys(&:to_sym)
102
+
103
+ self.added = attributes[:added] if attributes.key?(:added)
104
+
105
+ self.admission = attributes[:admission] if attributes.key?(:admission)
106
+
107
+ self.benefit = attributes[:benefit] if attributes.key?(:benefit)
108
+
109
+ self.benefit_begin = attributes[:benefitBegin] if attributes.key?(:benefitBegin)
110
+
111
+ self.benefit_end = attributes[:benefitEnd] if attributes.key?(:benefitEnd)
112
+
113
+ self.certification = attributes[:certification] if attributes.key?(:certification)
114
+
115
+ self.cobra_begin = attributes[:cobraBegin] if attributes.key?(:cobraBegin)
116
+
117
+ self.cobra_end = attributes[:cobraEnd] if attributes.key?(:cobraEnd)
118
+
119
+ self.completion = attributes[:completion] if attributes.key?(:completion)
120
+
121
+ self.coordination_of_benefits = attributes[:coordinationOfBenefits] if attributes.key?(:coordinationOfBenefits)
122
+
123
+ self.date_of_death = attributes[:dateOfDeath] if attributes.key?(:dateOfDeath)
124
+
125
+ self.date_of_last_update = attributes[:dateOfLastUpdate] if attributes.key?(:dateOfLastUpdate)
126
+
127
+ self.discharge = attributes[:discharge] if attributes.key?(:discharge)
128
+
129
+ self.effective_date_of_change = attributes[:effectiveDateOfChange] if attributes.key?(:effectiveDateOfChange)
130
+
131
+ self.eligibility = attributes[:eligibility] if attributes.key?(:eligibility)
132
+
133
+ self.eligibility_begin = attributes[:eligibilityBegin] if attributes.key?(:eligibilityBegin)
134
+
135
+ self.eligibility_end = attributes[:eligibilityEnd] if attributes.key?(:eligibilityEnd)
136
+
137
+ self.enrollment = attributes[:enrollment] if attributes.key?(:enrollment)
138
+
139
+ self.issue = attributes[:issue] if attributes.key?(:issue)
140
+
141
+ self.latest_visit_or_consultation = attributes[:latestVisitOrConsultation] if attributes.key?(:latestVisitOrConsultation)
142
+
143
+ self.period_end = attributes[:periodEnd] if attributes.key?(:periodEnd)
144
+
145
+ self.period_start = attributes[:periodStart] if attributes.key?(:periodStart)
146
+
147
+ self.plan = attributes[:plan] if attributes.key?(:plan)
148
+
149
+ self.plan_begin = attributes[:planBegin] if attributes.key?(:planBegin)
150
+
151
+ self.plan_end = attributes[:planEnd] if attributes.key?(:planEnd)
152
+
153
+ self.policy_effective = attributes[:policyEffective] if attributes.key?(:policyEffective)
154
+
155
+ self.policy_expiration = attributes[:policyExpiration] if attributes.key?(:policyExpiration)
156
+
157
+ self.premium_paid_to_date_begin = attributes[:premiumPaidToDateBegin] if attributes.key?(:premiumPaidToDateBegin)
158
+
159
+ self.premium_paid_to_date_end = attributes[:premiumPaidToDateEnd] if attributes.key?(:premiumPaidToDateEnd)
160
+
161
+ self.primary_care_provider = attributes[:primaryCareProvider] if attributes.key?(:primaryCareProvider)
162
+
163
+ self.service = attributes[:service] if attributes.key?(:service)
164
+
165
+ self.status = attributes[:status] if attributes.key?(:status)
166
+ end
167
+
168
+ # Show invalid properties with the reasons. Usually used together with valid?
169
+ # @return Array for valid properties with the reasons
170
+ def list_invalid_properties
171
+ []
172
+ end
173
+
174
+ # Check to see if the all the properties in the model are valid
175
+ # @return true if the model is valid
176
+ def valid?
177
+ true
178
+ end
179
+
180
+ # Checks equality by comparing each attribute.
181
+ # @param [Object] Object to be compared
182
+ def ==(o)
183
+ return true if equal?(o)
184
+
185
+ self.class == o.class &&
186
+ added == o.added &&
187
+ admission == o.admission &&
188
+ benefit == o.benefit &&
189
+ benefit_begin == o.benefit_begin &&
190
+ benefit_end == o.benefit_end &&
191
+ certification == o.certification &&
192
+ cobra_begin == o.cobra_begin &&
193
+ cobra_end == o.cobra_end &&
194
+ completion == o.completion &&
195
+ coordination_of_benefits == o.coordination_of_benefits &&
196
+ date_of_death == o.date_of_death &&
197
+ date_of_last_update == o.date_of_last_update &&
198
+ discharge == o.discharge &&
199
+ effective_date_of_change == o.effective_date_of_change &&
200
+ eligibility == o.eligibility &&
201
+ eligibility_begin == o.eligibility_begin &&
202
+ eligibility_end == o.eligibility_end &&
203
+ enrollment == o.enrollment &&
204
+ issue == o.issue &&
205
+ latest_visit_or_consultation == o.latest_visit_or_consultation &&
206
+ period_end == o.period_end &&
207
+ period_start == o.period_start &&
208
+ plan == o.plan &&
209
+ plan_begin == o.plan_begin &&
210
+ plan_end == o.plan_end &&
211
+ policy_effective == o.policy_effective &&
212
+ policy_expiration == o.policy_expiration &&
213
+ premium_paid_to_date_begin == o.premium_paid_to_date_begin &&
214
+ premium_paid_to_date_end == o.premium_paid_to_date_end &&
215
+ primary_care_provider == o.primary_care_provider &&
216
+ service == o.service &&
217
+ status == o.status
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Fixnum] Hash code
228
+ def hash
229
+ [added, admission, benefit, benefit_begin, benefit_end, certification, cobra_begin, cobra_end, completion, coordination_of_benefits, date_of_death, date_of_last_update, discharge, effective_date_of_change, eligibility, eligibility_begin, eligibility_end, enrollment, issue, latest_visit_or_consultation, period_end, period_start, plan, plan_begin, plan_end, policy_effective, policy_expiration, premium_paid_to_date_begin, premium_paid_to_date_end, primary_care_provider, service, status].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def build_from_hash(attributes)
236
+ return nil unless attributes.is_a?(Hash)
237
+
238
+ self.class.swagger_types.each_pair do |key, type|
239
+ if type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
243
+ send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(Regexp.last_match(1), v) })
244
+ end
245
+ elsif !attributes[self.class.attribute_map[key]].nil?
246
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
247
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
248
+ end
249
+
250
+ self
251
+ end
252
+
253
+ # Deserializes the data based on type
254
+ # @param string type Data type
255
+ # @param string value Value to be deserialized
256
+ # @return [Object] Deserialized data
257
+ def _deserialize(type, value)
258
+ case type.to_sym
259
+ when :DateTime
260
+ DateTime.parse(value)
261
+ when :Date
262
+ Date.parse(value)
263
+ when :String
264
+ value.to_s
265
+ when :Integer
266
+ value.to_i
267
+ when :Float
268
+ value.to_f
269
+ when :BOOLEAN
270
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
271
+ true
272
+ else
273
+ false
274
+ end
275
+ when :Object
276
+ # generic object (usually a Hash), return directly
277
+ value
278
+ when /\AArray<(?<inner_type>.+)>\z/
279
+ inner_type = Regexp.last_match[:inner_type]
280
+ value.map { |v| _deserialize(inner_type, v) }
281
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
282
+ k_type = Regexp.last_match[:k_type]
283
+ v_type = Regexp.last_match[:v_type]
284
+ {}.tap do |hash|
285
+ value.each do |k, v|
286
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
287
+ end
288
+ end
289
+ else # model
290
+ temp_model = SwaggerClient.const_get(type).new
291
+ temp_model.build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = send(attr)
313
+ next if value.nil?
314
+
315
+ hash[param] = _to_hash(value)
316
+ end
317
+ hash
318
+ end
319
+
320
+ # Outputs non-array value in the form of hash
321
+ # For object, use to_hash. Otherwise, just return the value
322
+ # @param [Object] value Any valid value
323
+ # @return [Hash] Returns the value in the form of hash
324
+ def _to_hash(value)
325
+ if value.is_a?(Array)
326
+ value.compact.map { |v| _to_hash(v) }
327
+ elsif value.is_a?(Hash)
328
+ {}.tap do |hash|
329
+ value.each { |k, v| hash[k] = _to_hash(v) }
330
+ end
331
+ elsif value.respond_to? :to_hash
332
+ value.to_hash
333
+ else
334
+ value
335
+ end
336
+ end
337
+ end
338
+ end
339
+ end
340
+ end
@@ -0,0 +1,204 @@
1
+ # #Eligibility
2
+ #
3
+ # Reference for developers
4
+ #
5
+ # OpenAPI spec version: v3
6
+ #
7
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
8
+ # Swagger Codegen version: 2.4.17
9
+ #
10
+
11
+ require 'date'
12
+
13
+ module ChangeHealthcare
14
+ module Eligibility
15
+ module SwaggerClient
16
+ class PlanStatus
17
+ attr_accessor :plan_details, :service_type_codes, :status, :status_code
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ 'plan_details': :planDetails,
23
+ 'service_type_codes': :serviceTypeCodes,
24
+ 'status': :status,
25
+ 'status_code': :statusCode
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ 'plan_details': :String,
33
+ 'service_type_codes': :'Array<String>',
34
+ 'status': :String,
35
+ 'status_code': :String
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.transform_keys(&:to_sym)
46
+
47
+ self.plan_details = attributes[:planDetails] if attributes.key?(:planDetails)
48
+
49
+ if attributes.key?(:serviceTypeCodes)
50
+ if (value = attributes[:serviceTypeCodes]).is_a?(Array)
51
+ self.service_type_codes = value
52
+ end
53
+ end
54
+
55
+ self.status = attributes[:status] if attributes.key?(:status)
56
+
57
+ self.status_code = attributes[:statusCode] if attributes.key?(:statusCode)
58
+ end
59
+
60
+ # Show invalid properties with the reasons. Usually used together with valid?
61
+ # @return Array for valid properties with the reasons
62
+ def list_invalid_properties
63
+ []
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if equal?(o)
76
+
77
+ self.class == o.class &&
78
+ plan_details == o.plan_details &&
79
+ service_type_codes == o.service_type_codes &&
80
+ status == o.status &&
81
+ status_code == o.status_code
82
+ end
83
+
84
+ # @see the `==` method
85
+ # @param [Object] Object to be compared
86
+ def eql?(o)
87
+ self == o
88
+ end
89
+
90
+ # Calculates hash code according to all attributes.
91
+ # @return [Fixnum] Hash code
92
+ def hash
93
+ [plan_details, service_type_codes, status, status_code].hash
94
+ end
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(Regexp.last_match(1), v) })
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :DateTime
124
+ DateTime.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :BOOLEAN
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ temp_model = SwaggerClient.const_get(type).new
155
+ temp_model.build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = send(attr)
177
+ next if value.nil?
178
+
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map { |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+ end
202
+ end
203
+ end
204
+ end