primary_connect_client 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +15 -4
- data/docs/DefaultApi.md +5 -3
- data/docs/Device.md +30 -0
- data/docs/Dosage.md +30 -0
- data/docs/Location.md +3 -1
- data/docs/Medication.md +22 -0
- data/docs/MedicationAdministration.md +32 -0
- data/docs/Meta.md +1 -1
- data/docs/Order.md +2 -0
- data/docs/OrderOrder.md +7 -3
- data/docs/OrderOrderDiagnoses.md +1 -1
- data/docs/Result.md +1 -1
- data/docs/Subject.md +49 -0
- data/docs/SubjectOneOf.md +18 -0
- data/docs/SubjectOneOf1.md +18 -0
- data/docs/V2Device.md +30 -0
- data/docs/V2Dosage.md +30 -0
- data/docs/V2Medication.md +22 -0
- data/docs/V2MedicationAdministration.md +32 -0
- data/docs/Visit.md +1 -1
- data/lib/primary_connect_client/api/default_api.rb +6 -3
- data/lib/primary_connect_client/models/device.rb +276 -0
- data/lib/primary_connect_client/models/dosage.rb +275 -0
- data/lib/primary_connect_client/models/location.rb +13 -4
- data/lib/primary_connect_client/models/medication.rb +238 -0
- data/lib/primary_connect_client/models/medication_administration.rb +286 -0
- data/lib/primary_connect_client/models/meta.rb +1 -0
- data/lib/primary_connect_client/models/order.rb +11 -1
- data/lib/primary_connect_client/models/order_order.rb +28 -6
- data/lib/primary_connect_client/models/order_order_diagnoses.rb +1 -1
- data/lib/primary_connect_client/models/result.rb +1 -1
- data/lib/primary_connect_client/models/subject.rb +105 -0
- data/lib/primary_connect_client/models/subject_one_of.rb +218 -0
- data/lib/primary_connect_client/models/subject_one_of1.rb +218 -0
- data/lib/primary_connect_client/models/v2_device.rb +276 -0
- data/lib/primary_connect_client/models/v2_dosage.rb +275 -0
- data/lib/primary_connect_client/models/v2_medication.rb +238 -0
- data/lib/primary_connect_client/models/v2_medication_administration.rb +286 -0
- data/lib/primary_connect_client/models/visit.rb +1 -1
- data/lib/primary_connect_client/version.rb +1 -1
- data/lib/primary_connect_client.rb +11 -0
- data/primary_connect_client.gemspec +1 -0
- data/spec/api/default_api_spec.rb +2 -1
- data/spec/models/device_spec.rb +70 -0
- data/spec/models/dosage_spec.rb +70 -0
- data/spec/models/location_spec.rb +6 -0
- data/spec/models/medication_administration_spec.rb +76 -0
- data/spec/models/medication_spec.rb +46 -0
- data/spec/models/order_order_spec.rb +13 -1
- data/spec/models/order_spec.rb +6 -0
- data/spec/models/subject_one_of1_spec.rb +34 -0
- data/spec/models/subject_one_of_spec.rb +34 -0
- data/spec/models/subject_spec.rb +31 -0
- data/spec/models/v2_device_spec.rb +70 -0
- data/spec/models/v2_dosage_spec.rb +70 -0
- data/spec/models/v2_medication_administration_spec.rb +76 -0
- data/spec/models/v2_medication_spec.rb +46 -0
- metadata +67 -3
@@ -24,13 +24,16 @@ module PrimaryConnectClient
|
|
24
24
|
# The status of an order.
|
25
25
|
attr_accessor :status
|
26
26
|
|
27
|
-
# Timestamp when the order was placed
|
27
|
+
# Timestamp when the order was placed (ISO-8601)
|
28
28
|
attr_accessor :transaction_date_time
|
29
29
|
|
30
|
-
# Timestamp when the specimen was collected
|
30
|
+
# Timestamp when the specimen was collected (ISO-8601)
|
31
31
|
attr_accessor :collection_date_time
|
32
32
|
|
33
|
-
# Timestamp when the
|
33
|
+
# Timestamp when the specimen was collected (ISO-8601)
|
34
|
+
attr_accessor :collection_start_date_time
|
35
|
+
|
36
|
+
# Timestamp when the results were composed into a report and released. (ISO-8601)
|
34
37
|
attr_accessor :completion_date_time
|
35
38
|
|
36
39
|
# YYYY-MM-DD, Date when the order becomes invalid
|
@@ -38,6 +41,9 @@ module PrimaryConnectClient
|
|
38
41
|
|
39
42
|
attr_accessor :specimen
|
40
43
|
|
44
|
+
# Array of medications administered to the subject
|
45
|
+
attr_accessor :medication_administrations
|
46
|
+
|
41
47
|
attr_accessor :procedure
|
42
48
|
|
43
49
|
attr_accessor :ordering_provider
|
@@ -103,9 +109,11 @@ module PrimaryConnectClient
|
|
103
109
|
:'status' => :'status',
|
104
110
|
:'transaction_date_time' => :'transactionDateTime',
|
105
111
|
:'collection_date_time' => :'collectionDateTime',
|
112
|
+
:'collection_start_date_time' => :'collectionStartDateTime',
|
106
113
|
:'completion_date_time' => :'completionDateTime',
|
107
114
|
:'expiration_date' => :'expirationDate',
|
108
115
|
:'specimen' => :'specimen',
|
116
|
+
:'medication_administrations' => :'medicationAdministrations',
|
109
117
|
:'procedure' => :'procedure',
|
110
118
|
:'ordering_provider' => :'orderingProvider',
|
111
119
|
:'result_copy_providers' => :'resultCopyProviders',
|
@@ -135,9 +143,11 @@ module PrimaryConnectClient
|
|
135
143
|
:'status' => :'String',
|
136
144
|
:'transaction_date_time' => :'Time',
|
137
145
|
:'collection_date_time' => :'Time',
|
146
|
+
:'collection_start_date_time' => :'Time',
|
138
147
|
:'completion_date_time' => :'Time',
|
139
148
|
:'expiration_date' => :'String',
|
140
149
|
:'specimen' => :'Specimen',
|
150
|
+
:'medication_administrations' => :'Array<MedicationAdministration>',
|
141
151
|
:'procedure' => :'CodedValue',
|
142
152
|
:'ordering_provider' => :'Provider',
|
143
153
|
:'result_copy_providers' => :'Array<Provider>',
|
@@ -195,6 +205,10 @@ module PrimaryConnectClient
|
|
195
205
|
self.collection_date_time = attributes[:'collection_date_time']
|
196
206
|
end
|
197
207
|
|
208
|
+
if attributes.key?(:'collection_start_date_time')
|
209
|
+
self.collection_start_date_time = attributes[:'collection_start_date_time']
|
210
|
+
end
|
211
|
+
|
198
212
|
if attributes.key?(:'completion_date_time')
|
199
213
|
self.completion_date_time = attributes[:'completion_date_time']
|
200
214
|
end
|
@@ -207,6 +221,12 @@ module PrimaryConnectClient
|
|
207
221
|
self.specimen = attributes[:'specimen']
|
208
222
|
end
|
209
223
|
|
224
|
+
if attributes.key?(:'medication_administrations')
|
225
|
+
if (value = attributes[:'medication_administrations']).is_a?(Array)
|
226
|
+
self.medication_administrations = value
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
210
230
|
if attributes.key?(:'procedure')
|
211
231
|
self.procedure = attributes[:'procedure']
|
212
232
|
end
|
@@ -282,7 +302,7 @@ module PrimaryConnectClient
|
|
282
302
|
# Check to see if the all the properties in the model are valid
|
283
303
|
# @return true if the model is valid
|
284
304
|
def valid?
|
285
|
-
status_validator = EnumAttributeValidator.new('String', ["STATUS_UNKNOWN", "STATUS_UPDATE", "STATUS_CANCEL", "STATUS_RESULTED", "STATUS_NEW"])
|
305
|
+
status_validator = EnumAttributeValidator.new('String', ["STATUS_UNKNOWN", "STATUS_UPDATE", "STATUS_CANCEL", "STATUS_RESULTED", "STATUS_NEW", "STATUS_REPORTED"])
|
286
306
|
return false unless status_validator.valid?(@status)
|
287
307
|
priority_validator = EnumAttributeValidator.new('String', ["PRIORITY_UNKNOWN", "PRIORITY_ASAP", "PRIORITY_ROUTINE", "PRIORITY_PREOPERATIVE", "PRIORITY_TIMING_CRITICAL", "PRIORITY_STAT"])
|
288
308
|
return false unless priority_validator.valid?(@priority)
|
@@ -296,7 +316,7 @@ module PrimaryConnectClient
|
|
296
316
|
# Custom attribute writer method checking allowed values (enum).
|
297
317
|
# @param [Object] status Object to be assigned
|
298
318
|
def status=(status)
|
299
|
-
validator = EnumAttributeValidator.new('String', ["STATUS_UNKNOWN", "STATUS_UPDATE", "STATUS_CANCEL", "STATUS_RESULTED", "STATUS_NEW"])
|
319
|
+
validator = EnumAttributeValidator.new('String', ["STATUS_UNKNOWN", "STATUS_UPDATE", "STATUS_CANCEL", "STATUS_RESULTED", "STATUS_NEW", "STATUS_REPORTED"])
|
300
320
|
unless validator.valid?(status)
|
301
321
|
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
302
322
|
end
|
@@ -343,9 +363,11 @@ module PrimaryConnectClient
|
|
343
363
|
status == o.status &&
|
344
364
|
transaction_date_time == o.transaction_date_time &&
|
345
365
|
collection_date_time == o.collection_date_time &&
|
366
|
+
collection_start_date_time == o.collection_start_date_time &&
|
346
367
|
completion_date_time == o.completion_date_time &&
|
347
368
|
expiration_date == o.expiration_date &&
|
348
369
|
specimen == o.specimen &&
|
370
|
+
medication_administrations == o.medication_administrations &&
|
349
371
|
procedure == o.procedure &&
|
350
372
|
ordering_provider == o.ordering_provider &&
|
351
373
|
result_copy_providers == o.result_copy_providers &&
|
@@ -370,7 +392,7 @@ module PrimaryConnectClient
|
|
370
392
|
# Calculates hash code according to all attributes.
|
371
393
|
# @return [Integer] Hash code
|
372
394
|
def hash
|
373
|
-
[id, application_order_id, status, transaction_date_time, collection_date_time, completion_date_time, expiration_date, specimen, procedure, ordering_provider, result_copy_providers, ordering_facility, priority, diagnoses, clinical_comments, notes, clinical_info, results_status, response_flag, external_ids, results].hash
|
395
|
+
[id, application_order_id, status, transaction_date_time, collection_date_time, collection_start_date_time, completion_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
|
374
396
|
end
|
375
397
|
|
376
398
|
# Builds the object from hash
|
@@ -20,7 +20,7 @@ module PrimaryConnectClient
|
|
20
20
|
# Type of the diagnosis
|
21
21
|
attr_accessor :type
|
22
22
|
|
23
|
-
# Timestamp of the the diagnosis was documented
|
23
|
+
# Timestamp of the the diagnosis was documented (ISO-8601)
|
24
24
|
attr_accessor :documented_date_time
|
25
25
|
|
26
26
|
class EnumAttributeValidator
|
@@ -28,7 +28,7 @@ module PrimaryConnectClient
|
|
28
28
|
# Data type for the result value
|
29
29
|
attr_accessor :value_type
|
30
30
|
|
31
|
-
# Timestamp when the results were composed into a report and released
|
31
|
+
# Timestamp when the results were composed into a report and released (ISO-8601)
|
32
32
|
attr_accessor :completion_date_time
|
33
33
|
|
34
34
|
attr_accessor :report
|
@@ -0,0 +1,105 @@
|
|
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
|
+
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
|
+
]
|
25
|
+
end
|
26
|
+
|
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
|
45
|
+
end
|
46
|
+
|
47
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
48
|
+
end
|
49
|
+
|
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) }
|
82
|
+
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
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
raise # if no match by now, raise
|
99
|
+
rescue
|
100
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,218 @@
|
|
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 SubjectOneOf
|
18
|
+
attr_accessor :patient
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'patient' => :'patient'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'patient' => :'Patient'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::SubjectOneOf` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::SubjectOneOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'patient')
|
61
|
+
self.patient = attributes[:'patient']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
true
|
76
|
+
end
|
77
|
+
|
78
|
+
# Checks equality by comparing each attribute.
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
patient == o.patient
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def eql?(o)
|
89
|
+
self == o
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calculates hash code according to all attributes.
|
93
|
+
# @return [Integer] Hash code
|
94
|
+
def hash
|
95
|
+
[patient].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
new.build_from_hash(attributes)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
108
|
+
def build_from_hash(attributes)
|
109
|
+
return nil unless attributes.is_a?(Hash)
|
110
|
+
self.class.openapi_types.each_pair do |key, type|
|
111
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
112
|
+
self.send("#{key}=", nil)
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
114
|
+
# check to ensure the input is an array given that the attribute
|
115
|
+
# is documented as an array but the input is not
|
116
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
117
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
118
|
+
end
|
119
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
120
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
self
|
125
|
+
end
|
126
|
+
|
127
|
+
# Deserializes the data based on type
|
128
|
+
# @param string type Data type
|
129
|
+
# @param string value Value to be deserialized
|
130
|
+
# @return [Object] Deserialized data
|
131
|
+
def _deserialize(type, value)
|
132
|
+
case type.to_sym
|
133
|
+
when :Time
|
134
|
+
Time.parse(value)
|
135
|
+
when :Date
|
136
|
+
Date.parse(value)
|
137
|
+
when :String
|
138
|
+
value.to_s
|
139
|
+
when :Integer
|
140
|
+
value.to_i
|
141
|
+
when :Float
|
142
|
+
value.to_f
|
143
|
+
when :Boolean
|
144
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
|
+
true
|
146
|
+
else
|
147
|
+
false
|
148
|
+
end
|
149
|
+
when :Object
|
150
|
+
# generic object (usually a Hash), return directly
|
151
|
+
value
|
152
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
153
|
+
inner_type = Regexp.last_match[:inner_type]
|
154
|
+
value.map { |v| _deserialize(inner_type, v) }
|
155
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
156
|
+
k_type = Regexp.last_match[:k_type]
|
157
|
+
v_type = Regexp.last_match[:v_type]
|
158
|
+
{}.tap do |hash|
|
159
|
+
value.each do |k, v|
|
160
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
else # model
|
164
|
+
# models (e.g. Pet) or oneOf
|
165
|
+
klass = PrimaryConnectClient.const_get(type)
|
166
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the string representation of the object
|
171
|
+
# @return [String] String presentation of the object
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the object in the form of hash
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_hash
|
185
|
+
hash = {}
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
187
|
+
value = self.send(attr)
|
188
|
+
if value.nil?
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
191
|
+
end
|
192
|
+
|
193
|
+
hash[param] = _to_hash(value)
|
194
|
+
end
|
195
|
+
hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Outputs non-array value in the form of hash
|
199
|
+
# For object, use to_hash. Otherwise, just return the value
|
200
|
+
# @param [Object] value Any valid value
|
201
|
+
# @return [Hash] Returns the value in the form of hash
|
202
|
+
def _to_hash(value)
|
203
|
+
if value.is_a?(Array)
|
204
|
+
value.compact.map { |v| _to_hash(v) }
|
205
|
+
elsif value.is_a?(Hash)
|
206
|
+
{}.tap do |hash|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
208
|
+
end
|
209
|
+
elsif value.respond_to? :to_hash
|
210
|
+
value.to_hash
|
211
|
+
else
|
212
|
+
value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
@@ -0,0 +1,218 @@
|
|
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 SubjectOneOf1
|
18
|
+
attr_accessor :device
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'device' => :'device'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'device' => :'Device'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PrimaryConnectClient::SubjectOneOf1` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PrimaryConnectClient::SubjectOneOf1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'device')
|
61
|
+
self.device = attributes[:'device']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
true
|
76
|
+
end
|
77
|
+
|
78
|
+
# Checks equality by comparing each attribute.
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
device == o.device
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def eql?(o)
|
89
|
+
self == o
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calculates hash code according to all attributes.
|
93
|
+
# @return [Integer] Hash code
|
94
|
+
def hash
|
95
|
+
[device].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
new.build_from_hash(attributes)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
108
|
+
def build_from_hash(attributes)
|
109
|
+
return nil unless attributes.is_a?(Hash)
|
110
|
+
self.class.openapi_types.each_pair do |key, type|
|
111
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
112
|
+
self.send("#{key}=", nil)
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
114
|
+
# check to ensure the input is an array given that the attribute
|
115
|
+
# is documented as an array but the input is not
|
116
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
117
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
118
|
+
end
|
119
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
120
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
self
|
125
|
+
end
|
126
|
+
|
127
|
+
# Deserializes the data based on type
|
128
|
+
# @param string type Data type
|
129
|
+
# @param string value Value to be deserialized
|
130
|
+
# @return [Object] Deserialized data
|
131
|
+
def _deserialize(type, value)
|
132
|
+
case type.to_sym
|
133
|
+
when :Time
|
134
|
+
Time.parse(value)
|
135
|
+
when :Date
|
136
|
+
Date.parse(value)
|
137
|
+
when :String
|
138
|
+
value.to_s
|
139
|
+
when :Integer
|
140
|
+
value.to_i
|
141
|
+
when :Float
|
142
|
+
value.to_f
|
143
|
+
when :Boolean
|
144
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
|
+
true
|
146
|
+
else
|
147
|
+
false
|
148
|
+
end
|
149
|
+
when :Object
|
150
|
+
# generic object (usually a Hash), return directly
|
151
|
+
value
|
152
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
153
|
+
inner_type = Regexp.last_match[:inner_type]
|
154
|
+
value.map { |v| _deserialize(inner_type, v) }
|
155
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
156
|
+
k_type = Regexp.last_match[:k_type]
|
157
|
+
v_type = Regexp.last_match[:v_type]
|
158
|
+
{}.tap do |hash|
|
159
|
+
value.each do |k, v|
|
160
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
else # model
|
164
|
+
# models (e.g. Pet) or oneOf
|
165
|
+
klass = PrimaryConnectClient.const_get(type)
|
166
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the string representation of the object
|
171
|
+
# @return [String] String presentation of the object
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the object in the form of hash
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_hash
|
185
|
+
hash = {}
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
187
|
+
value = self.send(attr)
|
188
|
+
if value.nil?
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
191
|
+
end
|
192
|
+
|
193
|
+
hash[param] = _to_hash(value)
|
194
|
+
end
|
195
|
+
hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Outputs non-array value in the form of hash
|
199
|
+
# For object, use to_hash. Otherwise, just return the value
|
200
|
+
# @param [Object] value Any valid value
|
201
|
+
# @return [Hash] Returns the value in the form of hash
|
202
|
+
def _to_hash(value)
|
203
|
+
if value.is_a?(Array)
|
204
|
+
value.compact.map { |v| _to_hash(v) }
|
205
|
+
elsif value.is_a?(Hash)
|
206
|
+
{}.tap do |hash|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
208
|
+
end
|
209
|
+
elsif value.respond_to? :to_hash
|
210
|
+
value.to_hash
|
211
|
+
else
|
212
|
+
value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|