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,294 @@
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 Dependent
19
+ attr_accessor :address, :contact_information, :date_of_birth, :first_name, :last_name, :middle_name, :ssn,
20
+ :valid_gender_and_date_of_birth
21
+
22
+ # notes
23
+ attr_accessor :gender
24
+
25
+ # 01 = Spouse, 19 = Child, 20 = Employee, 21 = Unknown, 39 = Organ Donor, 40 = Cadaver Donor, 53 = Life Partner, G8 = Other Relationship
26
+ attr_accessor :relationship_to_subscriber_code
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype, :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ address: :address,
53
+ contact_information: :contactInformation,
54
+ date_of_birth: :dateOfBirth,
55
+ first_name: :firstName,
56
+ gender: :gender,
57
+ last_name: :lastName,
58
+ middle_name: :middleName,
59
+ relationship_to_subscriber_code: :relationshipToSubscriberCode,
60
+ ssn: :ssn,
61
+ valid_gender_and_date_of_birth: :validGenderAndDateOfBirth
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.swagger_types
67
+ {
68
+ address: :Address,
69
+ contact_information: :ContactInformation,
70
+ date_of_birth: :String,
71
+ first_name: :String,
72
+ gender: :String,
73
+ last_name: :String,
74
+ middle_name: :String,
75
+ relationship_to_subscriber_code: :String,
76
+ ssn: :String,
77
+ valid_gender_and_date_of_birth: :BOOLEAN
78
+ }
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ return unless attributes.is_a?(Hash)
85
+
86
+ # convert string to symbol for hash key
87
+ attributes = attributes.transform_keys(&:to_sym)
88
+
89
+ self.address = attributes[:address] if attributes.key?(:address)
90
+
91
+ self.contact_information = attributes[:contactInformation] if attributes.key?(:contactInformation)
92
+
93
+ self.date_of_birth = attributes[:dateOfBirth] if attributes.key?(:dateOfBirth)
94
+
95
+ self.first_name = attributes[:firstName] if attributes.key?(:firstName)
96
+
97
+ self.gender = attributes[:gender] if attributes.key?(:gender)
98
+
99
+ self.last_name = attributes[:lastName] if attributes.key?(:lastName)
100
+
101
+ self.middle_name = attributes[:middleName] if attributes.key?(:middleName)
102
+
103
+ self.relationship_to_subscriber_code = attributes[:relationshipToSubscriberCode] if attributes.key?(:relationshipToSubscriberCode)
104
+
105
+ self.ssn = attributes[:ssn] if attributes.key?(:ssn)
106
+
107
+ self.valid_gender_and_date_of_birth = attributes[:validGenderAndDateOfBirth] if attributes.key?(:validGenderAndDateOfBirth)
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ []
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ gender_validator = EnumAttributeValidator.new('String', %w[M F U])
120
+ return false unless gender_validator.valid?(@gender)
121
+
122
+ relationship_to_subscriber_code_validator = EnumAttributeValidator.new('String',
123
+ %w[01 19 20 39 40 53 G8])
124
+ return false unless relationship_to_subscriber_code_validator.valid?(@relationship_to_subscriber_code)
125
+
126
+ true
127
+ end
128
+
129
+ # Custom attribute writer method checking allowed values (enum).
130
+ # @param [Object] gender Object to be assigned
131
+ def gender=(gender)
132
+ validator = EnumAttributeValidator.new('String', %w[M F U])
133
+ unless validator.valid?(gender)
134
+ raise ArgumentError,
135
+ %(invalid value for "gender", must be one of #{validator.allowable_values}.)
136
+ end
137
+
138
+ @gender = gender
139
+ end
140
+
141
+ # Custom attribute writer method checking allowed values (enum).
142
+ # @param [Object] relationship_to_subscriber_code Object to be assigned
143
+ def relationship_to_subscriber_code=(relationship_to_subscriber_code)
144
+ validator = EnumAttributeValidator.new('String', %w[01 19 20 39 40 53 G8])
145
+ unless validator.valid?(relationship_to_subscriber_code)
146
+ raise ArgumentError,
147
+ %(invalid value for "relationship_to_subscriber_code", must be one of #{validator.allowable_values}.)
148
+ end
149
+
150
+ @relationship_to_subscriber_code = relationship_to_subscriber_code
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(other)
156
+ return true if equal?(other)
157
+
158
+ self.class == other.class &&
159
+ address == other.address &&
160
+ contact_information == other.contact_information &&
161
+ date_of_birth == other.date_of_birth &&
162
+ first_name == other.first_name &&
163
+ gender == other.gender &&
164
+ last_name == other.last_name &&
165
+ middle_name == other.middle_name &&
166
+ relationship_to_subscriber_code == other.relationship_to_subscriber_code &&
167
+ ssn == other.ssn &&
168
+ valid_gender_and_date_of_birth == other.valid_gender_and_date_of_birth
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(other)
174
+ self == other
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Fixnum] Hash code
179
+ def hash
180
+ [address, contact_information, date_of_birth, first_name, gender, last_name, middle_name,
181
+ relationship_to_subscriber_code, ssn, valid_gender_and_date_of_birth].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+
190
+ self.class.swagger_types.each_pair do |key, type|
191
+ if type =~ /\AArray<(.*)>/i
192
+ # check to ensure the input is an array given that the attribute
193
+ # is documented as an array but the input is not
194
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
195
+ send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
196
+ _deserialize(Regexp.last_match(1), v)
197
+ end)
198
+ end
199
+ elsif !attributes[self.class.attribute_map[key]].nil?
200
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
201
+ end
202
+ end
203
+
204
+ self
205
+ end
206
+
207
+ # Deserializes the data based on type
208
+ # @param string type Data type
209
+ # @param string value Value to be deserialized
210
+ # @return [Object] Deserialized data
211
+ def _deserialize(type, value)
212
+ case type.to_sym
213
+ when :DateTime
214
+ DateTime.parse(value)
215
+ when :Date
216
+ Date.parse(value)
217
+ when :String
218
+ value.to_s
219
+ when :Integer
220
+ value.to_i
221
+ when :Float
222
+ value.to_f
223
+ when :BOOLEAN
224
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
225
+ true
226
+ else
227
+ false
228
+ end
229
+ when :Object
230
+ # generic object (usually a Hash), return directly
231
+ value
232
+ when /\AArray<(?<inner_type>.+)>\z/
233
+ inner_type = Regexp.last_match[:inner_type]
234
+ value.map { |v| _deserialize(inner_type, v) }
235
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
236
+ k_type = Regexp.last_match[:k_type]
237
+ v_type = Regexp.last_match[:v_type]
238
+ {}.tap do |hash|
239
+ value.each do |k, v|
240
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
241
+ end
242
+ end
243
+ else # model
244
+ temp_model = SwaggerClient.const_get(type).new
245
+ temp_model.build_from_hash(value)
246
+ end
247
+ end
248
+
249
+ # Returns the string representation of the object
250
+ # @return [String] String presentation of the object
251
+ def to_s
252
+ to_hash.to_s
253
+ end
254
+
255
+ # to_body is an alias to to_hash (backward compatibility)
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_body
258
+ to_hash
259
+ end
260
+
261
+ # Returns the object in the form of hash
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_hash
264
+ hash = {}
265
+ self.class.attribute_map.each_pair do |attr, param|
266
+ value = send(attr)
267
+ next if value.nil?
268
+
269
+ hash[param] = _to_hash(value)
270
+ end
271
+ hash
272
+ end
273
+
274
+ # Outputs non-array value in the form of hash
275
+ # For object, use to_hash. Otherwise, just return the value
276
+ # @param [Object] value Any valid value
277
+ # @return [Hash] Returns the value in the form of hash
278
+ def _to_hash(value)
279
+ if value.is_a?(Array)
280
+ value.compact.map { |v| _to_hash(v) }
281
+ elsif value.is_a?(Hash)
282
+ {}.tap do |hash|
283
+ value.each { |k, v| hash[k] = _to_hash(v) }
284
+ end
285
+ elsif value.respond_to? :to_hash
286
+ value.to_hash
287
+ else
288
+ value
289
+ end
290
+ end
291
+ end
292
+ end
293
+ end
294
+ end
@@ -0,0 +1,278 @@
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 DrugIdentification
19
+ # Can only set one of linkSequenceNumber and pharmacyPrescriptionNumber but not both
20
+ attr_accessor :link_sequence_number
21
+
22
+ # Allowed Values are:'F2' International Unit, 'GR' Gram, 'ME' Milligram, 'ML' Milliliter, 'UN' Unit
23
+ attr_accessor :measurement_unit_code
24
+
25
+ attr_accessor :national_drug_code, :national_drug_unit_count
26
+
27
+ # Can only set one of linkSequenceNumber and pharmacyPrescriptionNumber but not both
28
+ attr_accessor :pharmacy_prescription_number
29
+
30
+ # Allowed Values are:'EN' EAN/UCC - 13, 'EO' EAN/UCC - 8, 'HI' HIBC (Health Care Industry Bar Code) Supplier Labeling Standard Primary Data Message, 'N4' National Drug Code in 5-4-2 Format, 'ON' Customer Order Number, 'UK' GTIN 14-digit Data Structure, 'UP' UCC - 12
31
+ attr_accessor :service_id_qualifier
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype, :allowable_values
35
+
36
+ def initialize(datatype, allowable_values)
37
+ @allowable_values = allowable_values.map do |value|
38
+ case datatype.to_s
39
+ when /Integer/i
40
+ value.to_i
41
+ when /Float/i
42
+ value.to_f
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+
49
+ def valid?(value)
50
+ !value || allowable_values.include?(value)
51
+ end
52
+ end
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ link_sequence_number: :linkSequenceNumber,
58
+ measurement_unit_code: :measurementUnitCode,
59
+ national_drug_code: :nationalDrugCode,
60
+ national_drug_unit_count: :nationalDrugUnitCount,
61
+ pharmacy_prescription_number: :pharmacyPrescriptionNumber,
62
+ service_id_qualifier: :serviceIdQualifier
63
+ }
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.swagger_types
68
+ {
69
+ link_sequence_number: :String,
70
+ measurement_unit_code: :String,
71
+ national_drug_code: :String,
72
+ national_drug_unit_count: :String,
73
+ pharmacy_prescription_number: :String,
74
+ service_id_qualifier: :String
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ return unless attributes.is_a?(Hash)
82
+
83
+ # convert string to symbol for hash key
84
+ attributes = attributes.transform_keys(&:to_sym)
85
+
86
+ self.link_sequence_number = attributes[:linkSequenceNumber] if attributes.key?(:linkSequenceNumber)
87
+
88
+ self.measurement_unit_code = attributes[:measurementUnitCode] if attributes.key?(:measurementUnitCode)
89
+
90
+ self.national_drug_code = attributes[:nationalDrugCode] if attributes.key?(:nationalDrugCode)
91
+
92
+ self.national_drug_unit_count = attributes[:nationalDrugUnitCount] if attributes.key?(:nationalDrugUnitCount)
93
+
94
+ self.pharmacy_prescription_number = attributes[:pharmacyPrescriptionNumber] if attributes.key?(:pharmacyPrescriptionNumber)
95
+
96
+ self.service_id_qualifier = attributes[:serviceIdQualifier] if attributes.key?(:serviceIdQualifier)
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ []
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ measurement_unit_code_validator = EnumAttributeValidator.new('String', %w[F2 GR ME ML UN])
109
+ return false unless measurement_unit_code_validator.valid?(@measurement_unit_code)
110
+
111
+ service_id_qualifier_validator = EnumAttributeValidator.new('String', %w[EN EO HI N4 ON UK UP])
112
+ return false unless service_id_qualifier_validator.valid?(@service_id_qualifier)
113
+
114
+ true
115
+ end
116
+
117
+ # Custom attribute writer method checking allowed values (enum).
118
+ # @param [Object] measurement_unit_code Object to be assigned
119
+ def measurement_unit_code=(measurement_unit_code)
120
+ validator = EnumAttributeValidator.new('String', %w[F2 GR ME ML UN])
121
+ unless validator.valid?(measurement_unit_code)
122
+ raise ArgumentError,
123
+ %(invalid value for "measurement_unit_code", must be one of #{validator.allowable_values}.)
124
+ end
125
+
126
+ @measurement_unit_code = measurement_unit_code
127
+ end
128
+
129
+ # Custom attribute writer method checking allowed values (enum).
130
+ # @param [Object] service_id_qualifier Object to be assigned
131
+ def service_id_qualifier=(service_id_qualifier)
132
+ validator = EnumAttributeValidator.new('String', %w[EN EO HI N4 ON UK UP])
133
+ unless validator.valid?(service_id_qualifier)
134
+ raise ArgumentError,
135
+ %(invalid value for "service_id_qualifier", must be one of #{validator.allowable_values}.)
136
+ end
137
+
138
+ @service_id_qualifier = service_id_qualifier
139
+ end
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(other)
144
+ return true if equal?(other)
145
+
146
+ self.class == other.class &&
147
+ link_sequence_number == other.link_sequence_number &&
148
+ measurement_unit_code == other.measurement_unit_code &&
149
+ national_drug_code == other.national_drug_code &&
150
+ national_drug_unit_count == other.national_drug_unit_count &&
151
+ pharmacy_prescription_number == other.pharmacy_prescription_number &&
152
+ service_id_qualifier == other.service_id_qualifier
153
+ end
154
+
155
+ # @see the `==` method
156
+ # @param [Object] Object to be compared
157
+ def eql?(other)
158
+ self == other
159
+ end
160
+
161
+ # Calculates hash code according to all attributes.
162
+ # @return [Fixnum] Hash code
163
+ def hash
164
+ [link_sequence_number, measurement_unit_code, national_drug_code, national_drug_unit_count,
165
+ pharmacy_prescription_number, service_id_qualifier].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+
174
+ self.class.swagger_types.each_pair do |key, type|
175
+ if type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
180
+ _deserialize(Regexp.last_match(1), v)
181
+ end)
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :DateTime
198
+ DateTime.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :BOOLEAN
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ temp_model = SwaggerClient.const_get(type).new
229
+ temp_model.build_from_hash(value)
230
+ end
231
+ end
232
+
233
+ # Returns the string representation of the object
234
+ # @return [String] String presentation of the object
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # to_body is an alias to to_hash (backward compatibility)
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_body
242
+ to_hash
243
+ end
244
+
245
+ # Returns the object in the form of hash
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_hash
248
+ hash = {}
249
+ self.class.attribute_map.each_pair do |attr, param|
250
+ value = send(attr)
251
+ next if value.nil?
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end
275
+ end
276
+ end
277
+ end
278
+ end