primary_connect_client 1.4.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,6 +49,9 @@ module PrimaryConnectClient
49
49
 
50
50
  attr_accessor :procedure
51
51
 
52
+ # Array of Procedures ordered
53
+ attr_accessor :procedures
54
+
52
55
  attr_accessor :ordering_provider
53
56
 
54
57
  # Array of providers to be copied on the results
@@ -119,6 +122,7 @@ module PrimaryConnectClient
119
122
  :'specimen' => :'specimen',
120
123
  :'medication_administrations' => :'medicationAdministrations',
121
124
  :'procedure' => :'procedure',
125
+ :'procedures' => :'procedures',
122
126
  :'ordering_provider' => :'orderingProvider',
123
127
  :'result_copy_providers' => :'resultCopyProviders',
124
128
  :'ordering_facility' => :'orderingFacility',
@@ -154,6 +158,7 @@ module PrimaryConnectClient
154
158
  :'specimen' => :'Specimen',
155
159
  :'medication_administrations' => :'Array<MedicationAdministration>',
156
160
  :'procedure' => :'CodedValue',
161
+ :'procedures' => :'Array<CodedValue>',
157
162
  :'ordering_provider' => :'Provider',
158
163
  :'result_copy_providers' => :'Array<Provider>',
159
164
  :'ordering_facility' => :'OrderOrderOrderingFacility',
@@ -240,6 +245,12 @@ module PrimaryConnectClient
240
245
  self.procedure = attributes[:'procedure']
241
246
  end
242
247
 
248
+ if attributes.key?(:'procedures')
249
+ if (value = attributes[:'procedures']).is_a?(Array)
250
+ self.procedures = value
251
+ end
252
+ end
253
+
243
254
  if attributes.key?(:'ordering_provider')
244
255
  self.ordering_provider = attributes[:'ordering_provider']
245
256
  end
@@ -379,6 +390,7 @@ module PrimaryConnectClient
379
390
  specimen == o.specimen &&
380
391
  medication_administrations == o.medication_administrations &&
381
392
  procedure == o.procedure &&
393
+ procedures == o.procedures &&
382
394
  ordering_provider == o.ordering_provider &&
383
395
  result_copy_providers == o.result_copy_providers &&
384
396
  ordering_facility == o.ordering_facility &&
@@ -402,7 +414,7 @@ module PrimaryConnectClient
402
414
  # Calculates hash code according to all attributes.
403
415
  # @return [Integer] Hash code
404
416
  def hash
405
- [id, application_order_id, status, transaction_date_time, collection_date_time, collection_start_date_time, completion_date_time, accession_date_time, expiration_date, specimen, medication_administrations, procedure, ordering_provider, result_copy_providers, ordering_facility, priority, diagnoses, clinical_comments, notes, clinical_info, results_status, response_flag, external_ids, results].hash
417
+ [id, application_order_id, status, transaction_date_time, collection_date_time, collection_start_date_time, completion_date_time, accession_date_time, expiration_date, specimen, medication_administrations, procedure, procedures, ordering_provider, result_copy_providers, ordering_facility, priority, diagnoses, clinical_comments, notes, clinical_info, results_status, response_flag, external_ids, results].hash
406
418
  end
407
419
 
408
420
  # Builds the object from hash
@@ -14,92 +14,214 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module PrimaryConnectClient
17
- module Subject
18
- class << self
19
- # List of class defined in oneOf (OpenAPI v3)
20
- def openapi_one_of
21
- [
22
- :'SubjectOneOf',
23
- :'SubjectOneOf1'
24
- ]
17
+ class Subject
18
+ attr_accessor :patient
19
+
20
+ attr_accessor :device
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'patient' => :'patient',
26
+ :'device' => :'device'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'patient' => :'Patient',
39
+ :'device' => :'Device'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::Subject` initialize method"
25
54
  end
26
55
 
27
- # Builds the object
28
- # @param [Mixed] Data to be matched against the list of oneOf items
29
- # @return [Object] Returns the model or the data itself
30
- def build(data)
31
- # Go through the list of oneOf items and attempt to identify the appropriate one.
32
- # Note:
33
- # - We do not attempt to check whether exactly one item matches.
34
- # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
- # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
- # - TODO: scalar values are de facto behaving as if they were nullable.
37
- # - TODO: logging when debugging is set.
38
- openapi_one_of.each do |klass|
39
- begin
40
- next if klass == :AnyType # "nullable: true"
41
- typed_data = find_and_cast_into_type(klass, data)
42
- return typed_data if typed_data
43
- rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
- end
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::Subject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
60
  end
61
+ h[k.to_sym] = v
62
+ }
46
63
 
47
- openapi_one_of.include?(:AnyType) ? data : nil
64
+ if attributes.key?(:'patient')
65
+ self.patient = attributes[:'patient']
48
66
  end
49
67
 
50
- private
51
-
52
- SchemaMismatchError = Class.new(StandardError)
53
-
54
- # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
- def find_and_cast_into_type(klass, data)
56
- return if data.nil?
57
-
58
- case klass.to_s
59
- when 'Boolean'
60
- return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
- when 'Float'
62
- return data if data.instance_of?(Float)
63
- when 'Integer'
64
- return data if data.instance_of?(Integer)
65
- when 'Time'
66
- return Time.parse(data)
67
- when 'Date'
68
- return Date.parse(data)
69
- when 'String'
70
- return data if data.instance_of?(String)
71
- when 'Object' # "type: object"
72
- return data if data.instance_of?(Hash)
73
- when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
- if data.instance_of?(Array)
75
- sub_type = Regexp.last_match[:sub_type]
76
- return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
- end
78
- when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
- if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
- sub_type = Regexp.last_match[:sub_type]
81
- return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
68
+ if attributes.key?(:'device')
69
+ self.device = attributes[:'device']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ patient == o.patient &&
92
+ device == o.device
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [patient, device].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
82
127
  end
83
- else # model
84
- const = PrimaryConnectClient.const_get(klass)
85
- if const
86
- if const.respond_to?(:openapi_one_of) # nested oneOf model
87
- model = const.build(data)
88
- return model if model
89
- else
90
- # raise if data contains keys that are not known to the model
91
- raise unless (data.keys - const.acceptable_attributes).empty?
92
- model = const.build_from_hash(data)
93
- return model if model && model.valid?
94
- end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
95
170
  end
96
171
  end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = PrimaryConnectClient.const_get(type)
175
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
97
178
 
98
- raise # if no match by now, raise
99
- rescue
100
- raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
101
203
  end
204
+ hash
102
205
  end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
103
225
  end
104
226
 
105
227
  end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.3.0
11
11
  =end
12
12
 
13
13
  module PrimaryConnectClient
14
- VERSION = '1.4.0'
14
+ VERSION = '1.5.1'
15
15
  end
@@ -28,7 +28,9 @@ require 'primary_connect_client/models/error'
28
28
  require 'primary_connect_client/models/event'
29
29
  require 'primary_connect_client/models/events'
30
30
  require 'primary_connect_client/models/identifier'
31
+ require 'primary_connect_client/models/ids'
31
32
  require 'primary_connect_client/models/location'
33
+ require 'primary_connect_client/models/measurement'
32
34
  require 'primary_connect_client/models/medication'
33
35
  require 'primary_connect_client/models/medication_administration'
34
36
  require 'primary_connect_client/models/meta'
@@ -57,8 +59,6 @@ require 'primary_connect_client/models/result_report'
57
59
  require 'primary_connect_client/models/results'
58
60
  require 'primary_connect_client/models/specimen'
59
61
  require 'primary_connect_client/models/subject'
60
- require 'primary_connect_client/models/subject_one_of'
61
- require 'primary_connect_client/models/subject_one_of1'
62
62
  require 'primary_connect_client/models/v2_device'
63
63
  require 'primary_connect_client/models/v2_dosage'
64
64
  require 'primary_connect_client/models/v2_medication'
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.required_ruby_version = ">= 2.4"
29
29
 
30
30
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
31
+ s.add_runtime_dependency 'primary_connect_proto', '~> 0.17.0', '>= 0.17.0'
31
32
 
32
33
  s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
33
34
 
@@ -67,6 +67,16 @@ describe 'DefaultApi' do
67
67
  end
68
68
  end
69
69
 
70
+ # unit tests for create_measurement
71
+ # create Measurement
72
+ # @param [Hash] opts the optional parameters
73
+ # @return [Ids]
74
+ describe 'create_measurement test' do
75
+ it 'should work' do
76
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
77
+ end
78
+ end
79
+
70
80
  # unit tests for create_order
71
81
  # create order
72
82
  # @param [Hash] opts the optional parameters
@@ -101,6 +111,17 @@ describe 'DefaultApi' do
101
111
  end
102
112
  end
103
113
 
114
+ # unit tests for get_measurement
115
+ # show measurement
116
+ # @param id Measurement ID
117
+ # @param [Hash] opts the optional parameters
118
+ # @return [Measurement]
119
+ describe 'get_measurement test' do
120
+ it 'should work' do
121
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
122
+ end
123
+ end
124
+
104
125
  # unit tests for get_order
105
126
  # show order
106
127
  # @param id Order ID
@@ -0,0 +1,34 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PrimaryConnectClient::Ids
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PrimaryConnectClient::Ids do
21
+ let(:instance) { PrimaryConnectClient::Ids.new }
22
+
23
+ describe 'test an instance of Ids' do
24
+ it 'should create an instance of Ids' do
25
+ expect(instance).to be_instance_of(PrimaryConnectClient::Ids)
26
+ end
27
+ end
28
+ describe 'test attribute "ids"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
31
+ end
32
+ end
33
+
34
+ end
@@ -0,0 +1,46 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for PrimaryConnectClient::Measurement
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe PrimaryConnectClient::Measurement do
21
+ let(:instance) { PrimaryConnectClient::Measurement.new }
22
+
23
+ describe 'test an instance of Measurement' do
24
+ it 'should create an instance of Measurement' do
25
+ expect(instance).to be_instance_of(PrimaryConnectClient::Measurement)
26
+ end
27
+ end
28
+ describe 'test attribute "meta"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
31
+ end
32
+ end
33
+
34
+ describe 'test attribute "subject"' do
35
+ it 'should work' do
36
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
37
+ end
38
+ end
39
+
40
+ describe 'test attribute "metrics"' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ end
@@ -101,6 +101,12 @@ describe PrimaryConnectClient::OrderOrder do
101
101
  end
102
102
  end
103
103
 
104
+ describe 'test attribute "procedures"' do
105
+ it 'should work' do
106
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
107
+ end
108
+ end
109
+
104
110
  describe 'test attribute "ordering_provider"' do
105
111
  it 'should work' do
106
112
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -18,14 +18,23 @@ require 'date'
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
20
  describe PrimaryConnectClient::Subject do
21
- describe '.openapi_one_of' do
22
- it 'lists the items referenced in the oneOf array' do
23
- expect(described_class.openapi_one_of).to_not be_empty
21
+ let(:instance) { PrimaryConnectClient::Subject.new }
22
+
23
+ describe 'test an instance of Subject' do
24
+ it 'should create an instance of Subject' do
25
+ expect(instance).to be_instance_of(PrimaryConnectClient::Subject)
26
+ end
27
+ end
28
+ describe 'test attribute "patient"' do
29
+ it 'should work' do
30
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
24
31
  end
25
32
  end
26
33
 
27
- describe '.build' do
28
- it 'returns the correct model' do
34
+ describe 'test attribute "device"' do
35
+ it 'should work' do
36
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
29
37
  end
30
38
  end
39
+
31
40
  end