primary_connect_client 0.8.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +74 -20
  4. data/docs/Address.md +32 -0
  5. data/docs/CodedValue.md +22 -0
  6. data/docs/DefaultApi.md +637 -0
  7. data/docs/Demographics.md +52 -0
  8. data/docs/Device.md +30 -0
  9. data/docs/Dosage.md +30 -0
  10. data/docs/Error.md +18 -0
  11. data/docs/Event.md +26 -0
  12. data/docs/Events.md +18 -0
  13. data/docs/Identifier.md +20 -0
  14. data/docs/Location.md +28 -0
  15. data/docs/Medication.md +22 -0
  16. data/docs/MedicationAdministration.md +32 -0
  17. data/docs/Meta.md +34 -0
  18. data/docs/MetaDestinations.md +22 -0
  19. data/docs/MetaMessage.md +20 -0
  20. data/docs/MetaSource.md +20 -0
  21. data/docs/MetaTransmission.md +18 -0
  22. data/docs/Name.md +22 -0
  23. data/docs/Order.md +26 -0
  24. data/docs/OrderIds.md +18 -0
  25. data/docs/OrderOrder.md +62 -0
  26. data/docs/OrderOrderClinicalInfo.md +26 -0
  27. data/docs/OrderOrderDiagnoses.md +22 -0
  28. data/docs/OrderOrderOrderingFacility.md +22 -0
  29. data/docs/OrderOrderSpecimen.md +22 -0
  30. data/docs/OrderWithEventErrors.md +20 -0
  31. data/docs/Orders.md +18 -0
  32. data/docs/OrdersOrders.md +22 -0
  33. data/docs/Patient.md +24 -0
  34. data/docs/PatientContacts.md +28 -0
  35. data/docs/PatientDemographics.md +52 -0
  36. data/docs/PhoneNumber.md +20 -0
  37. data/docs/Provider.md +32 -0
  38. data/docs/Result.md +52 -0
  39. data/docs/ResultIds.md +18 -0
  40. data/docs/ResultReferenceRange.md +22 -0
  41. data/docs/ResultReport.md +22 -0
  42. data/docs/ResultSpecimen.md +22 -0
  43. data/docs/Results.md +20 -0
  44. data/docs/Specimen.md +22 -0
  45. data/docs/Subject.md +49 -0
  46. data/docs/SubjectOneOf.md +18 -0
  47. data/docs/SubjectOneOf1.md +18 -0
  48. data/docs/V2Device.md +30 -0
  49. data/docs/V2Dosage.md +30 -0
  50. data/docs/V2Medication.md +22 -0
  51. data/docs/V2MedicationAdministration.md +32 -0
  52. data/docs/Visit.md +36 -0
  53. data/docs/VisitCompany.md +24 -0
  54. data/docs/VisitGuarantor.md +40 -0
  55. data/docs/VisitGuarantorEmployer.md +22 -0
  56. data/docs/VisitInsurances.md +40 -0
  57. data/docs/VisitInsured.md +30 -0
  58. data/docs/VisitPlan.md +22 -0
  59. data/git_push.sh +5 -6
  60. data/lib/primary_connect_client/api/default_api.rb +207 -67
  61. data/lib/primary_connect_client/api_client.rb +5 -6
  62. data/lib/primary_connect_client/api_error.rb +1 -1
  63. data/lib/primary_connect_client/configuration.rb +3 -2
  64. data/lib/primary_connect_client/models/address.rb +281 -0
  65. data/lib/primary_connect_client/models/coded_value.rb +238 -0
  66. data/lib/primary_connect_client/models/demographics.rb +466 -0
  67. data/lib/primary_connect_client/models/device.rb +276 -0
  68. data/lib/primary_connect_client/models/dosage.rb +275 -0
  69. data/lib/primary_connect_client/models/error.rb +218 -0
  70. data/lib/primary_connect_client/models/event.rb +254 -0
  71. data/lib/primary_connect_client/models/events.rb +221 -0
  72. data/lib/primary_connect_client/models/identifier.rb +228 -0
  73. data/lib/primary_connect_client/models/location.rb +264 -0
  74. data/lib/primary_connect_client/models/medication.rb +238 -0
  75. data/lib/primary_connect_client/models/medication_administration.rb +286 -0
  76. data/lib/primary_connect_client/models/meta.rb +327 -0
  77. data/lib/primary_connect_client/models/meta_destinations.rb +242 -0
  78. data/lib/primary_connect_client/models/meta_message.rb +227 -0
  79. data/lib/primary_connect_client/models/meta_source.rb +227 -0
  80. data/lib/primary_connect_client/models/meta_transmission.rb +218 -0
  81. data/lib/primary_connect_client/models/name.rb +237 -0
  82. data/lib/primary_connect_client/models/order.rb +255 -0
  83. data/lib/primary_connect_client/models/order_ids.rb +221 -0
  84. data/lib/primary_connect_client/models/order_order.rb +518 -0
  85. data/lib/primary_connect_client/models/order_order_clinical_info.rb +260 -0
  86. data/lib/primary_connect_client/models/order_order_diagnoses.rb +272 -0
  87. data/lib/primary_connect_client/models/order_order_ordering_facility.rb +239 -0
  88. data/lib/primary_connect_client/models/order_order_specimen.rb +239 -0
  89. data/lib/primary_connect_client/models/order_with_event_errors.rb +229 -0
  90. data/lib/primary_connect_client/models/orders.rb +221 -0
  91. data/lib/primary_connect_client/models/orders_orders.rb +236 -0
  92. data/lib/primary_connect_client/models/patient.rb +253 -0
  93. data/lib/primary_connect_client/models/patient_contacts.rb +305 -0
  94. data/lib/primary_connect_client/models/patient_demographics.rb +466 -0
  95. data/lib/primary_connect_client/models/phone_number.rb +262 -0
  96. data/lib/primary_connect_client/models/provider.rb +288 -0
  97. data/lib/primary_connect_client/models/result.rb +443 -0
  98. data/lib/primary_connect_client/models/result_ids.rb +221 -0
  99. data/lib/primary_connect_client/models/result_reference_range.rb +240 -0
  100. data/lib/primary_connect_client/models/result_report.rb +240 -0
  101. data/lib/primary_connect_client/models/result_specimen.rb +239 -0
  102. data/lib/primary_connect_client/models/results.rb +230 -0
  103. data/lib/primary_connect_client/models/specimen.rb +239 -0
  104. data/lib/primary_connect_client/models/subject.rb +105 -0
  105. data/lib/primary_connect_client/models/subject_one_of.rb +218 -0
  106. data/lib/primary_connect_client/models/subject_one_of1.rb +218 -0
  107. data/lib/primary_connect_client/models/v2_device.rb +276 -0
  108. data/lib/primary_connect_client/models/v2_dosage.rb +275 -0
  109. data/lib/primary_connect_client/models/v2_medication.rb +238 -0
  110. data/lib/primary_connect_client/models/v2_medication_administration.rb +286 -0
  111. data/lib/primary_connect_client/models/visit.rb +306 -0
  112. data/lib/primary_connect_client/models/visit_company.rb +248 -0
  113. data/lib/primary_connect_client/models/visit_guarantor.rb +358 -0
  114. data/lib/primary_connect_client/models/visit_guarantor_employer.rb +238 -0
  115. data/lib/primary_connect_client/models/visit_insurances.rb +386 -0
  116. data/lib/primary_connect_client/models/visit_insured.rb +322 -0
  117. data/lib/primary_connect_client/models/visit_plan.rb +238 -0
  118. data/lib/primary_connect_client/version.rb +12 -2
  119. data/lib/primary_connect_client.rb +56 -3
  120. data/primary_connect_client.gemspec +8 -5
  121. data/spec/api/default_api_spec.rb +56 -41
  122. data/spec/api_client_spec.rb +3 -3
  123. data/spec/configuration_spec.rb +1 -1
  124. data/spec/models/address_spec.rb +76 -0
  125. data/spec/models/coded_value_spec.rb +46 -0
  126. data/spec/models/demographics_spec.rb +168 -0
  127. data/spec/models/device_spec.rb +70 -0
  128. data/spec/models/dosage_spec.rb +70 -0
  129. data/spec/models/error_spec.rb +34 -0
  130. data/spec/models/event_spec.rb +58 -0
  131. data/spec/models/events_spec.rb +34 -0
  132. data/spec/models/identifier_spec.rb +40 -0
  133. data/spec/models/location_spec.rb +64 -0
  134. data/spec/models/medication_administration_spec.rb +76 -0
  135. data/spec/models/medication_spec.rb +46 -0
  136. data/spec/models/meta_destinations_spec.rb +46 -0
  137. data/spec/models/meta_message_spec.rb +40 -0
  138. data/spec/models/meta_source_spec.rb +40 -0
  139. data/spec/models/meta_spec.rb +86 -0
  140. data/spec/models/meta_transmission_spec.rb +34 -0
  141. data/spec/models/name_spec.rb +46 -0
  142. data/spec/models/order_ids_spec.rb +34 -0
  143. data/spec/models/order_order_clinical_info_spec.rb +58 -0
  144. data/spec/models/order_order_diagnoses_spec.rb +50 -0
  145. data/spec/models/order_order_ordering_facility_spec.rb +46 -0
  146. data/spec/models/order_order_spec.rb +182 -0
  147. data/spec/models/order_order_specimen_spec.rb +46 -0
  148. data/spec/models/order_spec.rb +58 -0
  149. data/spec/models/order_with_event_errors_spec.rb +40 -0
  150. data/spec/models/orders_orders_spec.rb +46 -0
  151. data/spec/models/orders_spec.rb +34 -0
  152. data/spec/models/patient_contacts_spec.rb +68 -0
  153. data/spec/models/patient_demographics_spec.rb +168 -0
  154. data/spec/models/patient_spec.rb +52 -0
  155. data/spec/models/phone_number_spec.rb +44 -0
  156. data/spec/models/provider_spec.rb +76 -0
  157. data/spec/models/result_ids_spec.rb +34 -0
  158. data/spec/models/result_reference_range_spec.rb +46 -0
  159. data/spec/models/result_report_spec.rb +46 -0
  160. data/spec/models/result_spec.rb +148 -0
  161. data/spec/models/result_specimen_spec.rb +46 -0
  162. data/spec/models/results_spec.rb +40 -0
  163. data/spec/models/specimen_spec.rb +46 -0
  164. data/spec/models/subject_one_of1_spec.rb +34 -0
  165. data/spec/models/subject_one_of_spec.rb +34 -0
  166. data/spec/models/subject_spec.rb +31 -0
  167. data/spec/models/v2_device_spec.rb +70 -0
  168. data/spec/models/v2_dosage_spec.rb +70 -0
  169. data/spec/models/v2_medication_administration_spec.rb +76 -0
  170. data/spec/models/v2_medication_spec.rb +46 -0
  171. data/spec/models/visit_company_spec.rb +52 -0
  172. data/spec/models/visit_guarantor_employer_spec.rb +46 -0
  173. data/spec/models/visit_guarantor_spec.rb +104 -0
  174. data/spec/models/visit_insurances_spec.rb +112 -0
  175. data/spec/models/visit_insured_spec.rb +78 -0
  176. data/spec/models/visit_plan_spec.rb +46 -0
  177. data/spec/models/visit_spec.rb +88 -0
  178. data/spec/spec_helper.rb +1 -1
  179. metadata +228 -7
  180. data/Gemfile.lock +0 -74
@@ -0,0 +1,238 @@
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 Medication
18
+ # Lot number product component
19
+ attr_accessor :lot_number
20
+
21
+ # Product expiration date
22
+ attr_accessor :expiration_date
23
+
24
+ attr_accessor :manufacturer
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'lot_number' => :'lotNumber',
30
+ :'expiration_date' => :'expirationDate',
31
+ :'manufacturer' => :'manufacturer'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'lot_number' => :'String',
44
+ :'expiration_date' => :'Time',
45
+ :'manufacturer' => :'CodedValue'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::Medication` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::Medication`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'lot_number')
71
+ self.lot_number = attributes[:'lot_number']
72
+ end
73
+
74
+ if attributes.key?(:'expiration_date')
75
+ self.expiration_date = attributes[:'expiration_date']
76
+ end
77
+
78
+ if attributes.key?(:'manufacturer')
79
+ self.manufacturer = attributes[:'manufacturer']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ lot_number == o.lot_number &&
102
+ expiration_date == o.expiration_date &&
103
+ manufacturer == o.manufacturer
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [lot_number, expiration_date, manufacturer].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
132
+ self.send("#{key}=", nil)
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = PrimaryConnectClient.const_get(type)
186
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -0,0 +1,286 @@
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 MedicationAdministration
18
+ attr_accessor :identifier
19
+
20
+ # Codes for the medication administration
21
+ attr_accessor :administration_codes
22
+
23
+ # Administration start date of medication
24
+ attr_accessor :administration_start_time
25
+
26
+ # Administration end date of medication
27
+ attr_accessor :administration_end_time
28
+
29
+ attr_accessor :medication
30
+
31
+ attr_accessor :dosage
32
+
33
+ attr_accessor :refusal_reason
34
+
35
+ attr_accessor :administering_provider
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'identifier' => :'identifier',
41
+ :'administration_codes' => :'administrationCodes',
42
+ :'administration_start_time' => :'administrationStartTime',
43
+ :'administration_end_time' => :'administrationEndTime',
44
+ :'medication' => :'medication',
45
+ :'dosage' => :'dosage',
46
+ :'refusal_reason' => :'refusalReason',
47
+ :'administering_provider' => :'administeringProvider'
48
+ }
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'identifier' => :'Identifier',
60
+ :'administration_codes' => :'Array<CodedValue>',
61
+ :'administration_start_time' => :'Time',
62
+ :'administration_end_time' => :'Time',
63
+ :'medication' => :'Medication',
64
+ :'dosage' => :'Dosage',
65
+ :'refusal_reason' => :'CodedValue',
66
+ :'administering_provider' => :'Provider'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::MedicationAdministration` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::MedicationAdministration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'identifier')
92
+ self.identifier = attributes[:'identifier']
93
+ end
94
+
95
+ if attributes.key?(:'administration_codes')
96
+ if (value = attributes[:'administration_codes']).is_a?(Array)
97
+ self.administration_codes = value
98
+ end
99
+ end
100
+
101
+ if attributes.key?(:'administration_start_time')
102
+ self.administration_start_time = attributes[:'administration_start_time']
103
+ end
104
+
105
+ if attributes.key?(:'administration_end_time')
106
+ self.administration_end_time = attributes[:'administration_end_time']
107
+ end
108
+
109
+ if attributes.key?(:'medication')
110
+ self.medication = attributes[:'medication']
111
+ end
112
+
113
+ if attributes.key?(:'dosage')
114
+ self.dosage = attributes[:'dosage']
115
+ end
116
+
117
+ if attributes.key?(:'refusal_reason')
118
+ self.refusal_reason = attributes[:'refusal_reason']
119
+ end
120
+
121
+ if attributes.key?(:'administering_provider')
122
+ self.administering_provider = attributes[:'administering_provider']
123
+ end
124
+ end
125
+
126
+ # Show invalid properties with the reasons. Usually used together with valid?
127
+ # @return Array for valid properties with the reasons
128
+ def list_invalid_properties
129
+ invalid_properties = Array.new
130
+ invalid_properties
131
+ end
132
+
133
+ # Check to see if the all the properties in the model are valid
134
+ # @return true if the model is valid
135
+ def valid?
136
+ true
137
+ end
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] Object to be compared
141
+ def ==(o)
142
+ return true if self.equal?(o)
143
+ self.class == o.class &&
144
+ identifier == o.identifier &&
145
+ administration_codes == o.administration_codes &&
146
+ administration_start_time == o.administration_start_time &&
147
+ administration_end_time == o.administration_end_time &&
148
+ medication == o.medication &&
149
+ dosage == o.dosage &&
150
+ refusal_reason == o.refusal_reason &&
151
+ administering_provider == o.administering_provider
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [identifier, administration_codes, administration_start_time, administration_end_time, medication, dosage, refusal_reason, administering_provider].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ new.build_from_hash(attributes)
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ self.class.openapi_types.each_pair do |key, type|
179
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
180
+ self.send("#{key}=", nil)
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
185
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
186
+ end
187
+ elsif !attributes[self.class.attribute_map[key]].nil?
188
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
189
+ end
190
+ end
191
+
192
+ self
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def _deserialize(type, value)
200
+ case type.to_sym
201
+ when :Time
202
+ Time.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :Boolean
212
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+ when :Object
218
+ # generic object (usually a Hash), return directly
219
+ value
220
+ when /\AArray<(?<inner_type>.+)>\z/
221
+ inner_type = Regexp.last_match[:inner_type]
222
+ value.map { |v| _deserialize(inner_type, v) }
223
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224
+ k_type = Regexp.last_match[:k_type]
225
+ v_type = Regexp.last_match[:v_type]
226
+ {}.tap do |hash|
227
+ value.each do |k, v|
228
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
+ end
230
+ end
231
+ else # model
232
+ # models (e.g. Pet) or oneOf
233
+ klass = PrimaryConnectClient.const_get(type)
234
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
+ end
236
+ end
237
+
238
+ # Returns the string representation of the object
239
+ # @return [String] String presentation of the object
240
+ def to_s
241
+ to_hash.to_s
242
+ end
243
+
244
+ # to_body is an alias to to_hash (backward compatibility)
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_body
247
+ to_hash
248
+ end
249
+
250
+ # Returns the object in the form of hash
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_hash
253
+ hash = {}
254
+ self.class.attribute_map.each_pair do |attr, param|
255
+ value = self.send(attr)
256
+ if value.nil?
257
+ is_nullable = self.class.openapi_nullable.include?(attr)
258
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
+ end
260
+
261
+ hash[param] = _to_hash(value)
262
+ end
263
+ hash
264
+ end
265
+
266
+ # Outputs non-array value in the form of hash
267
+ # For object, use to_hash. Otherwise, just return the value
268
+ # @param [Object] value Any valid value
269
+ # @return [Hash] Returns the value in the form of hash
270
+ def _to_hash(value)
271
+ if value.is_a?(Array)
272
+ value.compact.map { |v| _to_hash(v) }
273
+ elsif value.is_a?(Hash)
274
+ {}.tap do |hash|
275
+ value.each { |k, v| hash[k] = _to_hash(v) }
276
+ end
277
+ elsif value.respond_to? :to_hash
278
+ value.to_hash
279
+ else
280
+ value
281
+ end
282
+ end
283
+
284
+ end
285
+
286
+ end