change_healthcare-professional_claims 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +30 -0
  5. data/.travis.yml +6 -0
  6. data/.yardopts +1 -0
  7. data/CHANGELOG.md +0 -0
  8. data/Gemfile +6 -0
  9. data/Gemfile.lock +118 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +39 -0
  12. data/Rakefile +8 -0
  13. data/TODO.md +8 -0
  14. data/bin/console +15 -0
  15. data/bin/rspec +29 -0
  16. data/bin/setup +8 -0
  17. data/change_healthcare-professional_claims.gemspec +43 -0
  18. data/lib/change_healthcare/professional_claims.rb +16 -0
  19. data/lib/change_healthcare/professional_claims/swagger_client.rb +106 -0
  20. data/lib/change_healthcare/professional_claims/swagger_client/api_client.rb +390 -0
  21. data/lib/change_healthcare/professional_claims/swagger_client/api_error.rb +42 -0
  22. data/lib/change_healthcare/professional_claims/swagger_client/configuration.rb +204 -0
  23. data/lib/change_healthcare/professional_claims/swagger_client/models/address.rb +219 -0
  24. data/lib/change_healthcare/professional_claims/swagger_client/models/ambulance_certification.rb +247 -0
  25. data/lib/change_healthcare/professional_claims/swagger_client/models/ambulance_transport_information.rb +259 -0
  26. data/lib/change_healthcare/professional_claims/swagger_client/models/clai_request.rb +283 -0
  27. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_adjustment.rb +244 -0
  28. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_adjustment_details.rb +199 -0
  29. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_contract_information.rb +265 -0
  30. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_date_information.rb +298 -0
  31. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_information.rb +579 -0
  32. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_note.rb +216 -0
  33. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_pricing_repricing_information.rb +363 -0
  34. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_reference.rb +231 -0
  35. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_submission_request.rb +278 -0
  36. data/lib/change_healthcare/professional_claims/swagger_client/models/claim_supplemental_information.rb +315 -0
  37. data/lib/change_healthcare/professional_claims/swagger_client/models/composite_diagnosis_code_pointers.rb +191 -0
  38. data/lib/change_healthcare/professional_claims/swagger_client/models/condition_indicator_durable_medical_equipment.rb +281 -0
  39. data/lib/change_healthcare/professional_claims/swagger_client/models/condition_information.rb +190 -0
  40. data/lib/change_healthcare/professional_claims/swagger_client/models/contact_information.rb +209 -0
  41. data/lib/change_healthcare/professional_claims/swagger_client/models/contract_information.rb +255 -0
  42. data/lib/change_healthcare/professional_claims/swagger_client/models/dependent.rb +294 -0
  43. data/lib/change_healthcare/professional_claims/swagger_client/models/drug_identification.rb +278 -0
  44. data/lib/change_healthcare/professional_claims/swagger_client/models/durable_medical_equipment_certificate_of_medical_necessity.rb +226 -0
  45. data/lib/change_healthcare/professional_claims/swagger_client/models/durable_medical_equipment_certification.rb +233 -0
  46. data/lib/change_healthcare/professional_claims/swagger_client/models/durable_medical_equipment_service.rb +243 -0
  47. data/lib/change_healthcare/professional_claims/swagger_client/models/edit_response.rb +251 -0
  48. data/lib/change_healthcare/professional_claims/swagger_client/models/epsdt_referral.rb +236 -0
  49. data/lib/change_healthcare/professional_claims/swagger_client/models/error.rb +214 -0
  50. data/lib/change_healthcare/professional_claims/swagger_client/models/failure.rb +194 -0
  51. data/lib/change_healthcare/professional_claims/swagger_client/models/form_identification.rb +240 -0
  52. data/lib/change_healthcare/professional_claims/swagger_client/models/health_care_information.rb +233 -0
  53. data/lib/change_healthcare/professional_claims/swagger_client/models/line_adjudication_information.rb +284 -0
  54. data/lib/change_healthcare/professional_claims/swagger_client/models/measurements.rb +256 -0
  55. data/lib/change_healthcare/professional_claims/swagger_client/models/medicare_outpatient_adjudication.rb +213 -0
  56. data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_billing_provider.rb +236 -0
  57. data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_name.rb +285 -0
  58. data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_referring_provider.rb +192 -0
  59. data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_rendering_provider.rb +236 -0
  60. data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_service_facility_location.rb +192 -0
  61. data/lib/change_healthcare/professional_claims/swagger_client/models/other_payer_supervising_provider.rb +192 -0
  62. data/lib/change_healthcare/professional_claims/swagger_client/models/other_subscriber_information.rb +430 -0
  63. data/lib/change_healthcare/professional_claims/swagger_client/models/other_subscriber_name.rb +288 -0
  64. data/lib/change_healthcare/professional_claims/swagger_client/models/patient_condition_information_vision.rb +259 -0
  65. data/lib/change_healthcare/professional_claims/swagger_client/models/pay_to_plan.rb +278 -0
  66. data/lib/change_healthcare/professional_claims/swagger_client/models/payer.rb +194 -0
  67. data/lib/change_healthcare/professional_claims/swagger_client/models/prior_authorization.rb +194 -0
  68. data/lib/change_healthcare/professional_claims/swagger_client/models/professional_service.rb +290 -0
  69. data/lib/change_healthcare/professional_claims/swagger_client/models/provider.rb +281 -0
  70. data/lib/change_healthcare/professional_claims/swagger_client/models/purchased_service_information.rb +194 -0
  71. data/lib/change_healthcare/professional_claims/swagger_client/models/raw_x12_request.rb +194 -0
  72. data/lib/change_healthcare/professional_claims/swagger_client/models/receiver.rb +189 -0
  73. data/lib/change_healthcare/professional_claims/swagger_client/models/reference_identification.rb +199 -0
  74. data/lib/change_healthcare/professional_claims/swagger_client/models/report_information.rb +261 -0
  75. data/lib/change_healthcare/professional_claims/swagger_client/models/response.rb +240 -0
  76. data/lib/change_healthcare/professional_claims/swagger_client/models/service_facility_location.rb +224 -0
  77. data/lib/change_healthcare/professional_claims/swagger_client/models/service_line.rb +388 -0
  78. data/lib/change_healthcare/professional_claims/swagger_client/models/service_line_date_information.rb +236 -0
  79. data/lib/change_healthcare/professional_claims/swagger_client/models/service_line_provider.rb +293 -0
  80. data/lib/change_healthcare/professional_claims/swagger_client/models/service_line_reference_information.rb +230 -0
  81. data/lib/change_healthcare/professional_claims/swagger_client/models/spinal_manipulation_service_information.rb +238 -0
  82. data/lib/change_healthcare/professional_claims/swagger_client/models/submitter.rb +209 -0
  83. data/lib/change_healthcare/professional_claims/swagger_client/models/subscriber.rb +309 -0
  84. data/lib/change_healthcare/professional_claims/swagger_client/models/supporting_documentation.rb +249 -0
  85. data/lib/change_healthcare/professional_claims/swagger_client/professional_claims_api.rb +361 -0
  86. data/lib/change_healthcare/professional_claims/swagger_client/version.rb +19 -0
  87. data/lib/change_healthcare/professional_claims/version.rb +7 -0
  88. data/lib/change_healthcare/professional_claims/wrapper.rb +141 -0
  89. metadata +274 -0
@@ -0,0 +1,315 @@
1
+ # frozen_string_literal: true
2
+
3
+ # #Medical Network Professional Claims v3
4
+ #
5
+ # Reference for developers
6
+ #
7
+ # OpenAPI spec version: v3
8
+ #
9
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
10
+ # Swagger Codegen version: 2.4.19
11
+ #
12
+
13
+ require 'date'
14
+
15
+ module ChangeHealthcare
16
+ module ProfessionalClaims
17
+ module SwaggerClient
18
+ class ClaimSupplementalInformation
19
+ attr_accessor(
20
+ :adjusted_repriced_claim_number, :care_plan_oversight_number, :claim_control_number, :claim_number,
21
+ :clia_number, :demo_project_identifier, :investigational_device_exemption_number, :mammography_certification_number,
22
+ :medical_record_number, :medicare_crossover_reference_id, :prior_authorization_number, :referral_number, :report_information, :repriced_claim_numbe
23
+ )
24
+
25
+ # Allowed values are
26
+ # - '1' Immediate/Urgent Care
27
+ # - '2' Services Rendered in a Retroactive Period
28
+ # - '3' Emergency Care
29
+ # - '4' Client has Temporary Medicaid
30
+ # - '5' Request from County for Second Opinion to Determine if Recipient Can Work
31
+ # - '6' Request for Override Pending
32
+ # - '7' Special Handling, Null
33
+ attr_reader :service_authorization_exception_code
34
+
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype, :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ adjusted_repriced_claim_number: :adjustedRepricedClaimNumber,
60
+ care_plan_oversight_number: :carePlanOversightNumber,
61
+ claim_control_number: :claimControlNumber,
62
+ claim_number: :claimNumber,
63
+ clia_number: :cliaNumber,
64
+ demo_project_identifier: :demoProjectIdentifier,
65
+ investigational_device_exemption_number: :investigationalDeviceExemptionNumber,
66
+ mammography_certification_number: :mammographyCertificationNumber,
67
+ medical_record_number: :medicalRecordNumber,
68
+ medicare_crossover_reference_id: :medicareCrossoverReferenceId,
69
+ prior_authorization_number: :priorAuthorizationNumber,
70
+ referral_number: :referralNumber,
71
+ report_information: :reportInformation,
72
+ repriced_claim_number: :repricedClaimNumber,
73
+ service_authorization_exception_code: :serviceAuthorizationExceptionCode
74
+ }
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.swagger_types
79
+ {
80
+ adjusted_repriced_claim_number: :String,
81
+ care_plan_oversight_number: :String,
82
+ claim_control_number: :String,
83
+ claim_number: :String,
84
+ clia_number: :String,
85
+ demo_project_identifier: :String,
86
+ investigational_device_exemption_number: :String,
87
+ mammography_certification_number: :String,
88
+ medical_record_number: :String,
89
+ medicare_crossover_reference_id: :String,
90
+ prior_authorization_number: :String,
91
+ referral_number: :String,
92
+ report_information: :ReportInformation,
93
+ repriced_claim_number: :String,
94
+ service_authorization_exception_code: :String
95
+ }
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ return unless attributes.is_a?(Hash)
102
+
103
+ # convert string to symbol for hash key
104
+ attributes = attributes.transform_keys(&:to_sym)
105
+
106
+ self.adjusted_repriced_claim_number = attributes[:adjustedRepricedClaimNumber] if attributes.key?(:adjustedRepricedClaimNumber)
107
+
108
+ self.care_plan_oversight_number = attributes[:carePlanOversightNumber] if attributes.key?(:carePlanOversightNumber)
109
+
110
+ self.claim_control_number = attributes[:claimControlNumber] if attributes.key?(:claimControlNumber)
111
+
112
+ self.claim_number = attributes[:claimNumber] if attributes.key?(:claimNumber)
113
+
114
+ self.clia_number = attributes[:cliaNumber] if attributes.key?(:cliaNumber)
115
+
116
+ self.demo_project_identifier = attributes[:demoProjectIdentifier] if attributes.key?(:demoProjectIdentifier)
117
+
118
+ self.investigational_device_exemption_number = attributes[:investigationalDeviceExemptionNumber] if attributes.key?(:investigationalDeviceExemptionNumber)
119
+
120
+ self.mammography_certification_number = attributes[:mammographyCertificationNumber] if attributes.key?(:mammographyCertificationNumber)
121
+
122
+ self.medical_record_number = attributes[:medicalRecordNumber] if attributes.key?(:medicalRecordNumber)
123
+
124
+ self.medicare_crossover_reference_id = attributes[:medicareCrossoverReferenceId] if attributes.key?(:medicareCrossoverReferenceId)
125
+
126
+ self.prior_authorization_number = attributes[:priorAuthorizationNumber] if attributes.key?(:priorAuthorizationNumber)
127
+
128
+ self.referral_number = attributes[:referralNumber] if attributes.key?(:referralNumber)
129
+
130
+ self.report_information = attributes[:reportInformation] if attributes.key?(:reportInformation)
131
+
132
+ self.repriced_claim_number = attributes[:repricedClaimNumber] if attributes.key?(:repricedClaimNumber)
133
+
134
+ self.service_authorization_exception_code = attributes[:serviceAuthorizationExceptionCode] if attributes.key?(:serviceAuthorizationExceptionCode)
135
+ end
136
+
137
+ # Show invalid properties with the reasons. Usually used together with valid?
138
+ # @return Array for valid properties with the reasons
139
+ def list_invalid_properties
140
+ []
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ service_authorization_exception_code_validator = EnumAttributeValidator.new('String',
147
+ %w[1 2 3 4 5 6 7])
148
+ return false unless service_authorization_exception_code_validator.valid?(@service_authorization_exception_code)
149
+
150
+ true
151
+ end
152
+
153
+ # Custom attribute writer method checking allowed values (enum).
154
+ # @param [Object] service_authorization_exception_code Object to be assigned
155
+ def service_authorization_exception_code=(service_authorization_exception_code)
156
+ validator = EnumAttributeValidator.new('String', %w[1 2 3 4 5 6 7])
157
+ unless validator.valid?(service_authorization_exception_code)
158
+ raise ArgumentError,
159
+ %(invalid value for "service_authorization_exception_code", must be one of #{validator.allowable_values}.)
160
+ end
161
+
162
+ @service_authorization_exception_code = service_authorization_exception_code
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(other)
168
+ return true if equal?(other)
169
+
170
+ self.class == other.class &&
171
+ adjusted_repriced_claim_number == other.adjusted_repriced_claim_number &&
172
+ care_plan_oversight_number == other.care_plan_oversight_number &&
173
+ claim_control_number == other.claim_control_number &&
174
+ claim_number == other.claim_number &&
175
+ clia_number == other.clia_number &&
176
+ demo_project_identifier == other.demo_project_identifier &&
177
+ investigational_device_exemption_number == other.investigational_device_exemption_number &&
178
+ mammography_certification_number == other.mammography_certification_number &&
179
+ medical_record_number == other.medical_record_number &&
180
+ medicare_crossover_reference_id == other.medicare_crossover_reference_id &&
181
+ prior_authorization_number == other.prior_authorization_number &&
182
+ referral_number == other.referral_number &&
183
+ report_information == other.report_information &&
184
+ repriced_claim_number == other.repriced_claim_number &&
185
+ service_authorization_exception_code == other.service_authorization_exception_code
186
+ end
187
+
188
+ # @see the `==` method
189
+ # @param [Object] Object to be compared
190
+ def eql?(other)
191
+ self == other
192
+ end
193
+
194
+ # Calculates hash code according to all attributes.
195
+ # @return [Fixnum] Hash code
196
+ def hash
197
+ [
198
+ adjusted_repriced_claim_number, care_plan_oversight_number, claim_control_number, claim_number, clia_number,
199
+ demo_project_identifier, investigational_device_exemption_number, mammography_certification_number,
200
+ medical_record_number, medicare_crossover_reference_id, prior_authorization_number, referral_number,
201
+ report_information, repriced_claim_number, service_authorization_exception_code
202
+ ].hash
203
+ end
204
+
205
+ # Builds the object from hash
206
+ # @param [Hash] attributes Model attributes in the form of hash
207
+ # @return [Object] Returns the model itself
208
+ def build_from_hash(attributes)
209
+ return nil unless attributes.is_a?(Hash)
210
+
211
+ self.class.swagger_types.each_pair do |key, type|
212
+ if type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
216
+ send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
217
+ _deserialize(Regexp.last_match(1), v)
218
+ end)
219
+ end
220
+ elsif !attributes[self.class.attribute_map[key]].nil?
221
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
222
+ end
223
+ end
224
+
225
+ self
226
+ end
227
+
228
+ # Deserializes the data based on type
229
+ # @param string type Data type
230
+ # @param string value Value to be deserialized
231
+ # @return [Object] Deserialized data
232
+ def _deserialize(type, value)
233
+ case type.to_sym
234
+ when :DateTime
235
+ DateTime.parse(value)
236
+ when :Date
237
+ Date.parse(value)
238
+ when :String
239
+ value.to_s
240
+ when :Integer
241
+ value.to_i
242
+ when :Float
243
+ value.to_f
244
+ when :BOOLEAN
245
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
246
+ true
247
+ else
248
+ false
249
+ end
250
+ when :Object
251
+ # generic object (usually a Hash), return directly
252
+ value
253
+ when /\AArray<(?<inner_type>.+)>\z/
254
+ inner_type = Regexp.last_match[:inner_type]
255
+ value.map { |v| _deserialize(inner_type, v) }
256
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
257
+ k_type = Regexp.last_match[:k_type]
258
+ v_type = Regexp.last_match[:v_type]
259
+ {}.tap do |hash|
260
+ value.each do |k, v|
261
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
262
+ end
263
+ end
264
+ else # model
265
+ temp_model = SwaggerClient.const_get(type).new
266
+ temp_model.build_from_hash(value)
267
+ end
268
+ end
269
+
270
+ # Returns the string representation of the object
271
+ # @return [String] String presentation of the object
272
+ def to_s
273
+ to_hash.to_s
274
+ end
275
+
276
+ # to_body is an alias to to_hash (backward compatibility)
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_body
279
+ to_hash
280
+ end
281
+
282
+ # Returns the object in the form of hash
283
+ # @return [Hash] Returns the object in the form of hash
284
+ def to_hash
285
+ hash = {}
286
+ self.class.attribute_map.each_pair do |attr, param|
287
+ value = send(attr)
288
+ next if value.nil?
289
+
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map { |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+ end
313
+ end
314
+ end
315
+ end
@@ -0,0 +1,191 @@
1
+ # frozen_string_literal: true
2
+
3
+ # #Medical Network Professional Claims v3
4
+ #
5
+ # Reference for developers
6
+ #
7
+ # OpenAPI spec version: v3
8
+ #
9
+ # Generated by: https://github.com/swagger-api/swagger-codegen.git
10
+ # Swagger Codegen version: 2.4.19
11
+ #
12
+
13
+ require 'date'
14
+
15
+ module ChangeHealthcare
16
+ module ProfessionalClaims
17
+ module SwaggerClient
18
+ class CompositeDiagnosisCodePointers
19
+ attr_accessor :diagnosis_code_pointers
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ diagnosis_code_pointers: :diagnosisCodePointers
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ diagnosis_code_pointers: :'Array<String>'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.transform_keys(&:to_sym)
42
+
43
+ value = attributes[:diagnosisCodePointers]
44
+
45
+ self.diagnosis_code_pointers = value if value.is_a?(Array)
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ []
52
+ end
53
+
54
+ # Check to see if the all the properties in the model are valid
55
+ # @return true if the model is valid
56
+ def valid?
57
+ true
58
+ end
59
+
60
+ # Checks equality by comparing each attribute.
61
+ # @param [Object] Object to be compared
62
+ def ==(other)
63
+ return true if equal?(other)
64
+
65
+ self.class == other.class &&
66
+ diagnosis_code_pointers == other.diagnosis_code_pointers
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(other)
72
+ self == other
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [diagnosis_code_pointers].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
93
+ _deserialize(Regexp.last_match(1), v)
94
+ end)
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
98
+ end
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ # Deserializes the data based on type
105
+ # @param string type Data type
106
+ # @param string value Value to be deserialized
107
+ # @return [Object] Deserialized data
108
+ def _deserialize(type, value)
109
+ case type.to_sym
110
+ when :DateTime
111
+ DateTime.parse(value)
112
+ when :Date
113
+ Date.parse(value)
114
+ when :String
115
+ value.to_s
116
+ when :Integer
117
+ value.to_i
118
+ when :Float
119
+ value.to_f
120
+ when :BOOLEAN
121
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
122
+ true
123
+ else
124
+ false
125
+ end
126
+ when :Object
127
+ # generic object (usually a Hash), return directly
128
+ value
129
+ when /\AArray<(?<inner_type>.+)>\z/
130
+ inner_type = Regexp.last_match[:inner_type]
131
+ value.map { |v| _deserialize(inner_type, v) }
132
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
133
+ k_type = Regexp.last_match[:k_type]
134
+ v_type = Regexp.last_match[:v_type]
135
+ {}.tap do |hash|
136
+ value.each do |k, v|
137
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
138
+ end
139
+ end
140
+ else # model
141
+ temp_model = SwaggerClient.const_get(type).new
142
+ temp_model.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = send(attr)
164
+ next if value.nil?
165
+
166
+ hash[param] = _to_hash(value)
167
+ end
168
+ hash
169
+ end
170
+
171
+ # Outputs non-array value in the form of hash
172
+ # For object, use to_hash. Otherwise, just return the value
173
+ # @param [Object] value Any valid value
174
+ # @return [Hash] Returns the value in the form of hash
175
+ def _to_hash(value)
176
+ if value.is_a?(Array)
177
+ value.compact.map { |v| _to_hash(v) }
178
+ elsif value.is_a?(Hash)
179
+ {}.tap do |hash|
180
+ value.each { |k, v| hash[k] = _to_hash(v) }
181
+ end
182
+ elsif value.respond_to? :to_hash
183
+ value.to_hash
184
+ else
185
+ value
186
+ end
187
+ end
188
+ end
189
+ end
190
+ end
191
+ end