primary_connect_client 1.5.0 → 1.5.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fba2c726308c0fd123e99a5d2ceca4efc2f9dc09d9b572809e7a44480efd46a
4
- data.tar.gz: 162b1b9fad3431aaa2d20cc0610aac70982cb781c9a1527fceb8cfd686e07ded
3
+ metadata.gz: c21b6c5d8e7df842065531543644b17933fc1e96ddd6a90649be582f1331ad98
4
+ data.tar.gz: 711d0a09341d53c78db0b9c4762cfbc92bbec5b12faf103f857581a82d32056c
5
5
  SHA512:
6
- metadata.gz: 925c18ed682db7211dec940a87cff4ece2f31ac66e91f3e74ef00acd8223fcba7e04c69378d6a8ebb6c59e10b2f6dfd74943d9c5b3e9ef7e3b32fd323f4794da
7
- data.tar.gz: bdeb83007e34eac9b0fa1c72f9ece5b9b1f550e5040feaf28bb7e0944cd2b4ca3e4936477bcb9e5002679dcb479d85022ef1f04bb2d141df286b8afae2095faf
6
+ metadata.gz: aec6d001df9b89210d9a24ddd345e707fd3ac0dbfbf3ac0c3c5ed908c2628c68c65181adf6fc3887d170d3aebb7c5029ce93b46cf11f90d40efbc974b212a6c0
7
+ data.tar.gz: 071b97faec6f8a08dfe35899b9c080d0e485b6809092ba955ffe53aab6065f66cb712f36ee57aad39fda8c86cc821eaf986eef461146925e0df5a589615905f4
data/README.md CHANGED
@@ -7,7 +7,7 @@ Client Library to interface with Primary Connect
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
9
  - API version: v1
10
- - Package version: 1.5.0
10
+ - Package version: 1.5.1
11
11
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
12
 
13
13
  ## Installation
@@ -23,16 +23,16 @@ gem build primary_connect_client.gemspec
23
23
  Then either install the gem locally:
24
24
 
25
25
  ```shell
26
- gem install ./primary_connect_client-1.5.0.gem
26
+ gem install ./primary_connect_client-1.5.1.gem
27
27
  ```
28
28
 
29
- (for development, run `gem install --dev ./primary_connect_client-1.5.0.gem` to install the development dependencies)
29
+ (for development, run `gem install --dev ./primary_connect_client-1.5.1.gem` to install the development dependencies)
30
30
 
31
31
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
32
32
 
33
33
  Finally add this to the Gemfile:
34
34
 
35
- gem 'primary_connect_client', '~> 1.5.0'
35
+ gem 'primary_connect_client', '~> 1.5.1'
36
36
 
37
37
  ### Install from Git
38
38
 
@@ -142,8 +142,6 @@ Class | Method | HTTP request | Description
142
142
  - [PrimaryConnectClient::Results](docs/Results.md)
143
143
  - [PrimaryConnectClient::Specimen](docs/Specimen.md)
144
144
  - [PrimaryConnectClient::Subject](docs/Subject.md)
145
- - [PrimaryConnectClient::SubjectOneOf](docs/SubjectOneOf.md)
146
- - [PrimaryConnectClient::SubjectOneOf1](docs/SubjectOneOf1.md)
147
145
  - [PrimaryConnectClient::V2Device](docs/V2Device.md)
148
146
  - [PrimaryConnectClient::V2Dosage](docs/V2Dosage.md)
149
147
  - [PrimaryConnectClient::V2Medication](docs/V2Medication.md)
data/docs/OrderOrder.md CHANGED
@@ -16,7 +16,7 @@
16
16
  | **specimen** | [**Specimen**](Specimen.md) | | [optional] |
17
17
  | **medication_administrations** | [**Array<MedicationAdministration>**](MedicationAdministration.md) | Array of medications administered to the subject | [optional] |
18
18
  | **procedure** | [**CodedValue**](CodedValue.md) | | [optional] |
19
- | **procedures** | [**Array<CodedValues>**](CodedValues.md) | Array of Procedures ordered | [optional] |
19
+ | **procedures** | [**Array<CodedValue>**](CodedValue.md) | Array of Procedures ordered | [optional] |
20
20
  | **ordering_provider** | [**Provider**](Provider.md) | | [optional] |
21
21
  | **result_copy_providers** | [**Array<Provider>**](Provider.md) | Array of providers to be copied on the results | [optional] |
22
22
  | **ordering_facility** | [**OrderOrderOrderingFacility**](OrderOrderOrderingFacility.md) | | [optional] |
data/docs/Subject.md CHANGED
@@ -1,49 +1,20 @@
1
1
  # PrimaryConnectClient::Subject
2
2
 
3
- ## Class instance methods
3
+ ## Properties
4
4
 
5
- ### `openapi_one_of`
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **patient** | [**Patient**](Patient.md) | | [optional] |
8
+ | **device** | [**Device**](Device.md) | | [optional] |
6
9
 
7
- Returns the list of classes defined in oneOf.
8
-
9
- #### Example
10
-
11
- ```ruby
12
- require 'primary_connect_client'
13
-
14
- PrimaryConnectClient::Subject.openapi_one_of
15
- # =>
16
- # [
17
- # :'SubjectOneOf',
18
- # :'SubjectOneOf1'
19
- # ]
20
- ```
21
-
22
- ### build
23
-
24
- Find the appropriate object from the `openapi_one_of` list and casts the data into it.
25
-
26
- #### Example
10
+ ## Example
27
11
 
28
12
  ```ruby
29
13
  require 'primary_connect_client'
30
14
 
31
- PrimaryConnectClient::Subject.build(data)
32
- # => #<SubjectOneOf:0x00007fdd4aab02a0>
33
-
34
- PrimaryConnectClient::Subject.build(data_that_doesnt_match)
35
- # => nil
15
+ instance = PrimaryConnectClient::Subject.new(
16
+ patient: null,
17
+ device: null
18
+ )
36
19
  ```
37
20
 
38
- #### Parameters
39
-
40
- | Name | Type | Description |
41
- | ---- | ---- | ----------- |
42
- | **data** | **Mixed** | data to be matched against the list of oneOf items |
43
-
44
- #### Return type
45
-
46
- - `SubjectOneOf`
47
- - `SubjectOneOf1`
48
- - `nil` (if no type matches)
49
-
@@ -48,7 +48,6 @@ module PrimaryConnectClient
48
48
  # List of attributes with nullable: true
49
49
  def self.openapi_nullable
50
50
  Set.new([
51
- :'subject',
52
51
  ])
53
52
  end
54
53
 
@@ -55,7 +55,6 @@ module PrimaryConnectClient
55
55
  # List of attributes with nullable: true
56
56
  def self.openapi_nullable
57
57
  Set.new([
58
- :'subject',
59
58
  ])
60
59
  end
61
60
 
@@ -158,7 +158,7 @@ module PrimaryConnectClient
158
158
  :'specimen' => :'Specimen',
159
159
  :'medication_administrations' => :'Array<MedicationAdministration>',
160
160
  :'procedure' => :'CodedValue',
161
- :'procedures' => :'Array<CodedValues>',
161
+ :'procedures' => :'Array<CodedValue>',
162
162
  :'ordering_provider' => :'Provider',
163
163
  :'result_copy_providers' => :'Array<Provider>',
164
164
  :'ordering_facility' => :'OrderOrderOrderingFacility',
@@ -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.5.0'
14
+ VERSION = '1.5.1'
15
15
  end
@@ -59,8 +59,6 @@ require 'primary_connect_client/models/result_report'
59
59
  require 'primary_connect_client/models/results'
60
60
  require 'primary_connect_client/models/specimen'
61
61
  require 'primary_connect_client/models/subject'
62
- require 'primary_connect_client/models/subject_one_of'
63
- require 'primary_connect_client/models/subject_one_of1'
64
62
  require 'primary_connect_client/models/v2_device'
65
63
  require 'primary_connect_client/models/v2_dosage'
66
64
  require 'primary_connect_client/models/v2_medication'
@@ -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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primary_connect_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-01 00:00:00.000000000 Z
11
+ date: 2022-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -174,25 +174,20 @@ files:
174
174
  - lib/primary_connect_client/models/order_order_clinical_info.rb
175
175
  - lib/primary_connect_client/models/order_order_diagnoses.rb
176
176
  - lib/primary_connect_client/models/order_order_ordering_facility.rb
177
- - lib/primary_connect_client/models/order_order_specimen.rb
178
177
  - lib/primary_connect_client/models/order_with_event_errors.rb
179
178
  - lib/primary_connect_client/models/orders.rb
180
179
  - lib/primary_connect_client/models/orders_orders.rb
181
180
  - lib/primary_connect_client/models/patient.rb
182
181
  - lib/primary_connect_client/models/patient_contacts.rb
183
- - lib/primary_connect_client/models/patient_demographics.rb
184
182
  - lib/primary_connect_client/models/phone_number.rb
185
183
  - lib/primary_connect_client/models/provider.rb
186
184
  - lib/primary_connect_client/models/result.rb
187
185
  - lib/primary_connect_client/models/result_ids.rb
188
186
  - lib/primary_connect_client/models/result_reference_range.rb
189
187
  - lib/primary_connect_client/models/result_report.rb
190
- - lib/primary_connect_client/models/result_specimen.rb
191
188
  - lib/primary_connect_client/models/results.rb
192
189
  - lib/primary_connect_client/models/specimen.rb
193
190
  - lib/primary_connect_client/models/subject.rb
194
- - lib/primary_connect_client/models/subject_one_of.rb
195
- - lib/primary_connect_client/models/subject_one_of1.rb
196
191
  - lib/primary_connect_client/models/v2_device.rb
197
192
  - lib/primary_connect_client/models/v2_dosage.rb
198
193
  - lib/primary_connect_client/models/v2_medication.rb