primary_connect_client 0.8.0 → 1.0.1

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