primary_connect_client 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -1
  3. data/README.md +15 -4
  4. data/docs/DefaultApi.md +5 -3
  5. data/docs/Device.md +30 -0
  6. data/docs/Dosage.md +30 -0
  7. data/docs/Location.md +3 -1
  8. data/docs/Medication.md +22 -0
  9. data/docs/MedicationAdministration.md +32 -0
  10. data/docs/Order.md +2 -0
  11. data/docs/OrderOrder.md +4 -0
  12. data/docs/Subject.md +49 -0
  13. data/docs/SubjectOneOf.md +18 -0
  14. data/docs/SubjectOneOf1.md +18 -0
  15. data/docs/V2Device.md +30 -0
  16. data/docs/V2Dosage.md +30 -0
  17. data/docs/V2Medication.md +22 -0
  18. data/docs/V2MedicationAdministration.md +32 -0
  19. data/lib/primary_connect_client/api/default_api.rb +6 -3
  20. data/lib/primary_connect_client/models/device.rb +276 -0
  21. data/lib/primary_connect_client/models/dosage.rb +275 -0
  22. data/lib/primary_connect_client/models/location.rb +13 -4
  23. data/lib/primary_connect_client/models/medication.rb +238 -0
  24. data/lib/primary_connect_client/models/medication_administration.rb +286 -0
  25. data/lib/primary_connect_client/models/order.rb +11 -1
  26. data/lib/primary_connect_client/models/order_order.rb +25 -3
  27. data/lib/primary_connect_client/models/subject.rb +105 -0
  28. data/lib/primary_connect_client/models/subject_one_of.rb +218 -0
  29. data/lib/primary_connect_client/models/subject_one_of1.rb +218 -0
  30. data/lib/primary_connect_client/models/v2_device.rb +276 -0
  31. data/lib/primary_connect_client/models/v2_dosage.rb +275 -0
  32. data/lib/primary_connect_client/models/v2_medication.rb +238 -0
  33. data/lib/primary_connect_client/models/v2_medication_administration.rb +286 -0
  34. data/lib/primary_connect_client/version.rb +1 -1
  35. data/lib/primary_connect_client.rb +11 -0
  36. data/primary_connect_client.gemspec +1 -0
  37. data/spec/api/default_api_spec.rb +2 -1
  38. data/spec/models/device_spec.rb +70 -0
  39. data/spec/models/dosage_spec.rb +70 -0
  40. data/spec/models/location_spec.rb +6 -0
  41. data/spec/models/medication_administration_spec.rb +76 -0
  42. data/spec/models/medication_spec.rb +46 -0
  43. data/spec/models/order_order_spec.rb +13 -1
  44. data/spec/models/order_spec.rb +6 -0
  45. data/spec/models/subject_one_of1_spec.rb +34 -0
  46. data/spec/models/subject_one_of_spec.rb +34 -0
  47. data/spec/models/subject_spec.rb +31 -0
  48. data/spec/models/v2_device_spec.rb +70 -0
  49. data/spec/models/v2_dosage_spec.rb +70 -0
  50. data/spec/models/v2_medication_administration_spec.rb +76 -0
  51. data/spec/models/v2_medication_spec.rb +46 -0
  52. metadata +67 -3
@@ -0,0 +1,276 @@
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 Device
18
+ # Identifier used to identify the device
19
+ attr_accessor :device_id
20
+
21
+ attr_accessor :manufacturer
22
+
23
+ attr_accessor :model_number
24
+
25
+ attr_accessor :serial_number
26
+
27
+ attr_accessor :address
28
+
29
+ attr_accessor :location
30
+
31
+ # Arbitrary key/value pairs for Device specific use
32
+ attr_accessor :config
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'device_id' => :'deviceId',
38
+ :'manufacturer' => :'manufacturer',
39
+ :'model_number' => :'modelNumber',
40
+ :'serial_number' => :'serialNumber',
41
+ :'address' => :'address',
42
+ :'location' => :'location',
43
+ :'config' => :'config'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'device_id' => :'Array<Identifier>',
56
+ :'manufacturer' => :'String',
57
+ :'model_number' => :'String',
58
+ :'serial_number' => :'String',
59
+ :'address' => :'Address',
60
+ :'location' => :'Location',
61
+ :'config' => :'Object'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::Device` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::Device`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'device_id')
87
+ if (value = attributes[:'device_id']).is_a?(Array)
88
+ self.device_id = value
89
+ end
90
+ end
91
+
92
+ if attributes.key?(:'manufacturer')
93
+ self.manufacturer = attributes[:'manufacturer']
94
+ end
95
+
96
+ if attributes.key?(:'model_number')
97
+ self.model_number = attributes[:'model_number']
98
+ end
99
+
100
+ if attributes.key?(:'serial_number')
101
+ self.serial_number = attributes[:'serial_number']
102
+ end
103
+
104
+ if attributes.key?(:'address')
105
+ self.address = attributes[:'address']
106
+ end
107
+
108
+ if attributes.key?(:'location')
109
+ self.location = attributes[:'location']
110
+ end
111
+
112
+ if attributes.key?(:'config')
113
+ self.config = attributes[:'config']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ device_id == o.device_id &&
136
+ manufacturer == o.manufacturer &&
137
+ model_number == o.model_number &&
138
+ serial_number == o.serial_number &&
139
+ address == o.address &&
140
+ location == o.location &&
141
+ config == o.config
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [device_id, manufacturer, model_number, serial_number, address, location, config].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ self.class.openapi_types.each_pair do |key, type|
169
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
170
+ self.send("#{key}=", nil)
171
+ elsif type =~ /\AArray<(.*)>/i
172
+ # check to ensure the input is an array given that the attribute
173
+ # is documented as an array but the input is not
174
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
175
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
176
+ end
177
+ elsif !attributes[self.class.attribute_map[key]].nil?
178
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
179
+ end
180
+ end
181
+
182
+ self
183
+ end
184
+
185
+ # Deserializes the data based on type
186
+ # @param string type Data type
187
+ # @param string value Value to be deserialized
188
+ # @return [Object] Deserialized data
189
+ def _deserialize(type, value)
190
+ case type.to_sym
191
+ when :Time
192
+ Time.parse(value)
193
+ when :Date
194
+ Date.parse(value)
195
+ when :String
196
+ value.to_s
197
+ when :Integer
198
+ value.to_i
199
+ when :Float
200
+ value.to_f
201
+ when :Boolean
202
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
+ true
204
+ else
205
+ false
206
+ end
207
+ when :Object
208
+ # generic object (usually a Hash), return directly
209
+ value
210
+ when /\AArray<(?<inner_type>.+)>\z/
211
+ inner_type = Regexp.last_match[:inner_type]
212
+ value.map { |v| _deserialize(inner_type, v) }
213
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
+ k_type = Regexp.last_match[:k_type]
215
+ v_type = Regexp.last_match[:v_type]
216
+ {}.tap do |hash|
217
+ value.each do |k, v|
218
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
+ end
220
+ end
221
+ else # model
222
+ # models (e.g. Pet) or oneOf
223
+ klass = PrimaryConnectClient.const_get(type)
224
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
225
+ end
226
+ end
227
+
228
+ # Returns the string representation of the object
229
+ # @return [String] String presentation of the object
230
+ def to_s
231
+ to_hash.to_s
232
+ end
233
+
234
+ # to_body is an alias to to_hash (backward compatibility)
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_body
237
+ to_hash
238
+ end
239
+
240
+ # Returns the object in the form of hash
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_hash
243
+ hash = {}
244
+ self.class.attribute_map.each_pair do |attr, param|
245
+ value = self.send(attr)
246
+ if value.nil?
247
+ is_nullable = self.class.openapi_nullable.include?(attr)
248
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
249
+ end
250
+
251
+ hash[param] = _to_hash(value)
252
+ end
253
+ hash
254
+ end
255
+
256
+ # Outputs non-array value in the form of hash
257
+ # For object, use to_hash. Otherwise, just return the value
258
+ # @param [Object] value Any valid value
259
+ # @return [Hash] Returns the value in the form of hash
260
+ def _to_hash(value)
261
+ if value.is_a?(Array)
262
+ value.compact.map { |v| _to_hash(v) }
263
+ elsif value.is_a?(Hash)
264
+ {}.tap do |hash|
265
+ value.each { |k, v| hash[k] = _to_hash(v) }
266
+ end
267
+ elsif value.respond_to? :to_hash
268
+ value.to_hash
269
+ else
270
+ value
271
+ end
272
+ end
273
+
274
+ end
275
+
276
+ end
@@ -0,0 +1,275 @@
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 Dosage
18
+ attr_accessor :site
19
+
20
+ attr_accessor :route
21
+
22
+ attr_accessor :method
23
+
24
+ # Amount of medication per dose
25
+ attr_accessor :dose
26
+
27
+ attr_accessor :units
28
+
29
+ # Dose number administered within series_recommended
30
+ attr_accessor :series_number
31
+
32
+ # Number of recommended doses in a prescribed series
33
+ attr_accessor :series_recommended
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'site' => :'site',
39
+ :'route' => :'route',
40
+ :'method' => :'method',
41
+ :'dose' => :'dose',
42
+ :'units' => :'units',
43
+ :'series_number' => :'seriesNumber',
44
+ :'series_recommended' => :'seriesRecommended'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'site' => :'CodedValue',
57
+ :'route' => :'CodedValue',
58
+ :'method' => :'CodedValue',
59
+ :'dose' => :'String',
60
+ :'units' => :'CodedValue',
61
+ :'series_number' => :'String',
62
+ :'series_recommended' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::Dosage` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::Dosage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'site')
88
+ self.site = attributes[:'site']
89
+ end
90
+
91
+ if attributes.key?(:'route')
92
+ self.route = attributes[:'route']
93
+ end
94
+
95
+ if attributes.key?(:'method')
96
+ self.method = attributes[:'method']
97
+ end
98
+
99
+ if attributes.key?(:'dose')
100
+ self.dose = attributes[:'dose']
101
+ end
102
+
103
+ if attributes.key?(:'units')
104
+ self.units = attributes[:'units']
105
+ end
106
+
107
+ if attributes.key?(:'series_number')
108
+ self.series_number = attributes[:'series_number']
109
+ end
110
+
111
+ if attributes.key?(:'series_recommended')
112
+ self.series_recommended = attributes[:'series_recommended']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ true
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ site == o.site &&
135
+ route == o.route &&
136
+ method == o.method &&
137
+ dose == o.dose &&
138
+ units == o.units &&
139
+ series_number == o.series_number &&
140
+ series_recommended == o.series_recommended
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [site, route, method, dose, units, series_number, series_recommended].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ new.build_from_hash(attributes)
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ self.class.openapi_types.each_pair do |key, type|
168
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = PrimaryConnectClient.const_get(type)
223
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -26,6 +26,8 @@ module PrimaryConnectClient
26
26
 
27
27
  attr_accessor :bed
28
28
 
29
+ attr_accessor :floor
30
+
29
31
  # Attribute mapping from ruby-style variable name to JSON key.
30
32
  def self.attribute_map
31
33
  {
@@ -33,7 +35,8 @@ module PrimaryConnectClient
33
35
  :'facility' => :'facility',
34
36
  :'department' => :'department',
35
37
  :'room' => :'room',
36
- :'bed' => :'bed'
38
+ :'bed' => :'bed',
39
+ :'floor' => :'floor'
37
40
  }
38
41
  end
39
42
 
@@ -49,7 +52,8 @@ module PrimaryConnectClient
49
52
  :'facility' => :'String',
50
53
  :'department' => :'String',
51
54
  :'room' => :'String',
52
- :'bed' => :'String'
55
+ :'bed' => :'String',
56
+ :'floor' => :'String'
53
57
  }
54
58
  end
55
59
 
@@ -93,6 +97,10 @@ module PrimaryConnectClient
93
97
  if attributes.key?(:'bed')
94
98
  self.bed = attributes[:'bed']
95
99
  end
100
+
101
+ if attributes.key?(:'floor')
102
+ self.floor = attributes[:'floor']
103
+ end
96
104
  end
97
105
 
98
106
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -117,7 +125,8 @@ module PrimaryConnectClient
117
125
  facility == o.facility &&
118
126
  department == o.department &&
119
127
  room == o.room &&
120
- bed == o.bed
128
+ bed == o.bed &&
129
+ floor == o.floor
121
130
  end
122
131
 
123
132
  # @see the `==` method
@@ -129,7 +138,7 @@ module PrimaryConnectClient
129
138
  # Calculates hash code according to all attributes.
130
139
  # @return [Integer] Hash code
131
140
  def hash
132
- [type, facility, department, room, bed].hash
141
+ [type, facility, department, room, bed, floor].hash
133
142
  end
134
143
 
135
144
  # Builds the object from hash