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,248 @@
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
+ # Insurance company (payor)
18
+ class VisitCompany
19
+ attr_accessor :identifier
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :address
24
+
25
+ attr_accessor :phone_numbers
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'identifier' => :'identifier',
31
+ :'name' => :'name',
32
+ :'address' => :'address',
33
+ :'phone_numbers' => :'phoneNumbers'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'identifier' => :'Identifier',
46
+ :'name' => :'String',
47
+ :'address' => :'Address',
48
+ :'phone_numbers' => :'Array<PhoneNumber>'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::VisitCompany` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!self.class.attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::VisitCompany`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'identifier')
74
+ self.identifier = attributes[:'identifier']
75
+ end
76
+
77
+ if attributes.key?(:'name')
78
+ self.name = attributes[:'name']
79
+ end
80
+
81
+ if attributes.key?(:'address')
82
+ self.address = attributes[:'address']
83
+ end
84
+
85
+ if attributes.key?(:'phone_numbers')
86
+ if (value = attributes[:'phone_numbers']).is_a?(Array)
87
+ self.phone_numbers = value
88
+ end
89
+ end
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properties with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ identifier == o.identifier &&
111
+ name == o.name &&
112
+ address == o.address &&
113
+ phone_numbers == o.phone_numbers
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Integer] Hash code
124
+ def hash
125
+ [identifier, name, address, phone_numbers].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ new.build_from_hash(attributes)
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ elsif type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :Time
164
+ Time.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ # models (e.g. Pet) or oneOf
195
+ klass = PrimaryConnectClient.const_get(type)
196
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.openapi_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+
248
+ end
@@ -0,0 +1,358 @@
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
+ # Person ultimately responsible for the bill of the appointment
18
+ class VisitGuarantor
19
+ # Number of the guarantor (?)
20
+ attr_accessor :number
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :ssn
25
+
26
+ # Date of Birth
27
+ attr_accessor :dob
28
+
29
+ attr_accessor :sex
30
+
31
+ attr_accessor :spouse
32
+
33
+ attr_accessor :address
34
+
35
+ attr_accessor :phone_numbers
36
+
37
+ attr_accessor :email_addresses
38
+
39
+ attr_accessor :type
40
+
41
+ attr_accessor :relation_to_patient
42
+
43
+ attr_accessor :employer
44
+
45
+ class EnumAttributeValidator
46
+ attr_reader :datatype
47
+ attr_reader :allowable_values
48
+
49
+ def initialize(datatype, allowable_values)
50
+ @allowable_values = allowable_values.map do |value|
51
+ case datatype.to_s
52
+ when /Integer/i
53
+ value.to_i
54
+ when /Float/i
55
+ value.to_f
56
+ else
57
+ value
58
+ end
59
+ end
60
+ end
61
+
62
+ def valid?(value)
63
+ !value || allowable_values.include?(value)
64
+ end
65
+ end
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ :'number' => :'number',
71
+ :'name' => :'name',
72
+ :'ssn' => :'ssn',
73
+ :'dob' => :'dob',
74
+ :'sex' => :'sex',
75
+ :'spouse' => :'spouse',
76
+ :'address' => :'address',
77
+ :'phone_numbers' => :'phoneNumbers',
78
+ :'email_addresses' => :'emailAddresses',
79
+ :'type' => :'type',
80
+ :'relation_to_patient' => :'relationToPatient',
81
+ :'employer' => :'employer'
82
+ }
83
+ end
84
+
85
+ # Returns all the JSON keys this model knows about
86
+ def self.acceptable_attributes
87
+ attribute_map.values
88
+ end
89
+
90
+ # Attribute type mapping.
91
+ def self.openapi_types
92
+ {
93
+ :'number' => :'String',
94
+ :'name' => :'Name',
95
+ :'ssn' => :'String',
96
+ :'dob' => :'String',
97
+ :'sex' => :'String',
98
+ :'spouse' => :'Name',
99
+ :'address' => :'Address',
100
+ :'phone_numbers' => :'Array<PhoneNumber>',
101
+ :'email_addresses' => :'Array<String>',
102
+ :'type' => :'String',
103
+ :'relation_to_patient' => :'String',
104
+ :'employer' => :'VisitGuarantorEmployer'
105
+ }
106
+ end
107
+
108
+ # List of attributes with nullable: true
109
+ def self.openapi_nullable
110
+ Set.new([
111
+ ])
112
+ end
113
+
114
+ # Initializes the object
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ def initialize(attributes = {})
117
+ if (!attributes.is_a?(Hash))
118
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::VisitGuarantor` initialize method"
119
+ end
120
+
121
+ # check to see if the attribute exists and convert string to symbol for hash key
122
+ attributes = attributes.each_with_object({}) { |(k, v), h|
123
+ if (!self.class.attribute_map.key?(k.to_sym))
124
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::VisitGuarantor`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
125
+ end
126
+ h[k.to_sym] = v
127
+ }
128
+
129
+ if attributes.key?(:'number')
130
+ self.number = attributes[:'number']
131
+ end
132
+
133
+ if attributes.key?(:'name')
134
+ self.name = attributes[:'name']
135
+ end
136
+
137
+ if attributes.key?(:'ssn')
138
+ self.ssn = attributes[:'ssn']
139
+ end
140
+
141
+ if attributes.key?(:'dob')
142
+ self.dob = attributes[:'dob']
143
+ end
144
+
145
+ if attributes.key?(:'sex')
146
+ self.sex = attributes[:'sex']
147
+ end
148
+
149
+ if attributes.key?(:'spouse')
150
+ self.spouse = attributes[:'spouse']
151
+ end
152
+
153
+ if attributes.key?(:'address')
154
+ self.address = attributes[:'address']
155
+ end
156
+
157
+ if attributes.key?(:'phone_numbers')
158
+ if (value = attributes[:'phone_numbers']).is_a?(Array)
159
+ self.phone_numbers = value
160
+ end
161
+ end
162
+
163
+ if attributes.key?(:'email_addresses')
164
+ if (value = attributes[:'email_addresses']).is_a?(Array)
165
+ self.email_addresses = value
166
+ end
167
+ end
168
+
169
+ if attributes.key?(:'type')
170
+ self.type = attributes[:'type']
171
+ end
172
+
173
+ if attributes.key?(:'relation_to_patient')
174
+ self.relation_to_patient = attributes[:'relation_to_patient']
175
+ end
176
+
177
+ if attributes.key?(:'employer')
178
+ self.employer = attributes[:'employer']
179
+ end
180
+ end
181
+
182
+ # Show invalid properties with the reasons. Usually used together with valid?
183
+ # @return Array for valid properties with the reasons
184
+ def list_invalid_properties
185
+ invalid_properties = Array.new
186
+ invalid_properties
187
+ end
188
+
189
+ # Check to see if the all the properties in the model are valid
190
+ # @return true if the model is valid
191
+ def valid?
192
+ sex_validator = EnumAttributeValidator.new('String', ["SEX_UNKNOWN", "SEX_FEMALE", "SEX_MALE", "SEX_OTHER", "SEX_NON_BINARY", "SEX_PREFER_NOT_TO_DISCLOSE"])
193
+ return false unless sex_validator.valid?(@sex)
194
+ true
195
+ end
196
+
197
+ # Custom attribute writer method checking allowed values (enum).
198
+ # @param [Object] sex Object to be assigned
199
+ def sex=(sex)
200
+ validator = EnumAttributeValidator.new('String', ["SEX_UNKNOWN", "SEX_FEMALE", "SEX_MALE", "SEX_OTHER", "SEX_NON_BINARY", "SEX_PREFER_NOT_TO_DISCLOSE"])
201
+ unless validator.valid?(sex)
202
+ fail ArgumentError, "invalid value for \"sex\", must be one of #{validator.allowable_values}."
203
+ end
204
+ @sex = sex
205
+ end
206
+
207
+ # Checks equality by comparing each attribute.
208
+ # @param [Object] Object to be compared
209
+ def ==(o)
210
+ return true if self.equal?(o)
211
+ self.class == o.class &&
212
+ number == o.number &&
213
+ name == o.name &&
214
+ ssn == o.ssn &&
215
+ dob == o.dob &&
216
+ sex == o.sex &&
217
+ spouse == o.spouse &&
218
+ address == o.address &&
219
+ phone_numbers == o.phone_numbers &&
220
+ email_addresses == o.email_addresses &&
221
+ type == o.type &&
222
+ relation_to_patient == o.relation_to_patient &&
223
+ employer == o.employer
224
+ end
225
+
226
+ # @see the `==` method
227
+ # @param [Object] Object to be compared
228
+ def eql?(o)
229
+ self == o
230
+ end
231
+
232
+ # Calculates hash code according to all attributes.
233
+ # @return [Integer] Hash code
234
+ def hash
235
+ [number, name, ssn, dob, sex, spouse, address, phone_numbers, email_addresses, type, relation_to_patient, employer].hash
236
+ end
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def self.build_from_hash(attributes)
242
+ new.build_from_hash(attributes)
243
+ end
244
+
245
+ # Builds the object from hash
246
+ # @param [Hash] attributes Model attributes in the form of hash
247
+ # @return [Object] Returns the model itself
248
+ def build_from_hash(attributes)
249
+ return nil unless attributes.is_a?(Hash)
250
+ self.class.openapi_types.each_pair do |key, type|
251
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
252
+ self.send("#{key}=", nil)
253
+ elsif type =~ /\AArray<(.*)>/i
254
+ # check to ensure the input is an array given that the attribute
255
+ # is documented as an array but the input is not
256
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
257
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
258
+ end
259
+ elsif !attributes[self.class.attribute_map[key]].nil?
260
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
261
+ end
262
+ end
263
+
264
+ self
265
+ end
266
+
267
+ # Deserializes the data based on type
268
+ # @param string type Data type
269
+ # @param string value Value to be deserialized
270
+ # @return [Object] Deserialized data
271
+ def _deserialize(type, value)
272
+ case type.to_sym
273
+ when :Time
274
+ Time.parse(value)
275
+ when :Date
276
+ Date.parse(value)
277
+ when :String
278
+ value.to_s
279
+ when :Integer
280
+ value.to_i
281
+ when :Float
282
+ value.to_f
283
+ when :Boolean
284
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
285
+ true
286
+ else
287
+ false
288
+ end
289
+ when :Object
290
+ # generic object (usually a Hash), return directly
291
+ value
292
+ when /\AArray<(?<inner_type>.+)>\z/
293
+ inner_type = Regexp.last_match[:inner_type]
294
+ value.map { |v| _deserialize(inner_type, v) }
295
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
296
+ k_type = Regexp.last_match[:k_type]
297
+ v_type = Regexp.last_match[:v_type]
298
+ {}.tap do |hash|
299
+ value.each do |k, v|
300
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
301
+ end
302
+ end
303
+ else # model
304
+ # models (e.g. Pet) or oneOf
305
+ klass = PrimaryConnectClient.const_get(type)
306
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
307
+ end
308
+ end
309
+
310
+ # Returns the string representation of the object
311
+ # @return [String] String presentation of the object
312
+ def to_s
313
+ to_hash.to_s
314
+ end
315
+
316
+ # to_body is an alias to to_hash (backward compatibility)
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_body
319
+ to_hash
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ if value.nil?
329
+ is_nullable = self.class.openapi_nullable.include?(attr)
330
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
331
+ end
332
+
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+
356
+ end
357
+
358
+ end