primary_connect_client 1.12.0 → 1.13.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc7c8d64d34288e19f3be0333f90299472f061ac3479970b6de8bf5a62d15f4b
4
- data.tar.gz: abadc44e5964ac49d732947e68d9b12231c617c549d57960d55bf2e8031a8549
3
+ metadata.gz: 6aa696f97be55a4e2eff939984ea8379dd7f1365601a934bfe150f00a3cc05a3
4
+ data.tar.gz: ee004bc59cffb65da2049acc9c97d557d5dc03f85cebb1b552f003c9a730bb16
5
5
  SHA512:
6
- metadata.gz: 4390f1caf05f6341f6717d4998aac5bd50d85aa3e0db39fafcf315ad039afde47a568a0ad87e2749001ae9a4af95fa006c422d72b0a70270916bed2f3bf3902d
7
- data.tar.gz: 2368fb916550e41c397a39c85ebaa1191ec7178cd5dd8aa490144462bdde681d1583845ee74a58ec4ac69799f0a284075fe899b6659a0c908305a65a1571ada8
6
+ metadata.gz: aed7c6835ee808f9208a4dc471b3acc10d441f44ed9c847e8b3940942b7f9e0de2535e4519f163e397d656e459b7255c01809b7ca2c70a4b2e3325ccc9580da2
7
+ data.tar.gz: 73b80491f7a8eed883da692e5199799c231f2f10f7351bc0caee23b52703b9f793be921805b90385443ff22bda3ec62a21f93667216b1b222f0ae391b03c7616
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.13.0
4
+
5
+ - Added Queries API
6
+
3
7
  ## 1.12.0
4
8
 
5
9
  - Updated dependency on `primary_connect_proto` 0.24.0
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.12.0
10
+ - Package version: 1.13.0
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.12.0.gem
26
+ gem install ./primary_connect_client-1.13.0.gem
27
27
  ```
28
28
 
29
- (for development, run `gem install --dev ./primary_connect_client-1.12.0.gem` to install the development dependencies)
29
+ (for development, run `gem install --dev ./primary_connect_client-1.13.0.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.12.0'
35
+ gem 'primary_connect_client', '~> 1.13.0'
36
36
 
37
37
  ### Install from Git
38
38
 
@@ -97,6 +97,7 @@ Class | Method | HTTP request | Description
97
97
  *PrimaryConnectClient::DefaultApi* | [**list_results**](docs/DefaultApi.md#list_results) | **GET** /api/v1/orders/{order_id}/results | list results
98
98
  *PrimaryConnectClient::DefaultApi* | [**reroute_order**](docs/DefaultApi.md#reroute_order) | **POST** /api/v1/orders/reroute | reroute Order identified in the payload
99
99
  *PrimaryConnectClient::DefaultApi* | [**reroute_order_by_ulid**](docs/DefaultApi.md#reroute_order_by_ulid) | **POST** /api/v1/orders/{id}/reroute | Reroute order by ULID
100
+ *PrimaryConnectClient::DefaultApi* | [**send_query**](docs/DefaultApi.md#send_query) | **POST** /api/v1/queries | send query
100
101
  *PrimaryConnectClient::DefaultApi* | [**update_order**](docs/DefaultApi.md#update_order) | **PUT** /api/v1/orders/{id} | update order
101
102
 
102
103
 
@@ -105,6 +106,7 @@ Class | Method | HTTP request | Description
105
106
  - [PrimaryConnectClient::Accession](docs/Accession.md)
106
107
  - [PrimaryConnectClient::AccessionOrder](docs/AccessionOrder.md)
107
108
  - [PrimaryConnectClient::Address](docs/Address.md)
109
+ - [PrimaryConnectClient::Candidates](docs/Candidates.md)
108
110
  - [PrimaryConnectClient::CodedValue](docs/CodedValue.md)
109
111
  - [PrimaryConnectClient::Demographics](docs/Demographics.md)
110
112
  - [PrimaryConnectClient::Device](docs/Device.md)
@@ -114,6 +116,7 @@ Class | Method | HTTP request | Description
114
116
  - [PrimaryConnectClient::Events](docs/Events.md)
115
117
  - [PrimaryConnectClient::Identifier](docs/Identifier.md)
116
118
  - [PrimaryConnectClient::Ids](docs/Ids.md)
119
+ - [PrimaryConnectClient::Immunizations](docs/Immunizations.md)
117
120
  - [PrimaryConnectClient::Location](docs/Location.md)
118
121
  - [PrimaryConnectClient::Measurement](docs/Measurement.md)
119
122
  - [PrimaryConnectClient::Medication](docs/Medication.md)
@@ -140,6 +143,7 @@ Class | Method | HTTP request | Description
140
143
  - [PrimaryConnectClient::Patient](docs/Patient.md)
141
144
  - [PrimaryConnectClient::PhoneNumber](docs/PhoneNumber.md)
142
145
  - [PrimaryConnectClient::Provider](docs/Provider.md)
146
+ - [PrimaryConnectClient::Query](docs/Query.md)
143
147
  - [PrimaryConnectClient::Result](docs/Result.md)
144
148
  - [PrimaryConnectClient::ResultIds](docs/ResultIds.md)
145
149
  - [PrimaryConnectClient::ResultReferenceRange](docs/ResultReferenceRange.md)
@@ -0,0 +1,18 @@
1
+ # PrimaryConnectClient::Candidates
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **candidates** | [**Array<Patient>**](Patient.md) | List of possible matches for the query | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'primary_connect_client'
13
+
14
+ instance = PrimaryConnectClient::Candidates.new(
15
+ candidates: null
16
+ )
17
+ ```
18
+
data/docs/CodedValue.md CHANGED
@@ -7,6 +7,12 @@
7
7
  | **value** | **String** | E.g. 260373001 (SCT), 3006F (CPT), etc. | [optional] |
8
8
  | **code_set** | **String** | E.g. SCT, LN, NDC, CPT, CVX, etc. | [optional] |
9
9
  | **description** | **String** | | [optional] |
10
+ | **alt_value** | **String** | | [optional] |
11
+ | **alt_code_set** | **String** | | [optional] |
12
+ | **alt_description** | **String** | | [optional] |
13
+ | **code_set_version** | **String** | | [optional] |
14
+ | **alt_code_set_version** | **String** | | [optional] |
15
+ | **original_text** | **String** | | [optional] |
10
16
 
11
17
  ## Example
12
18
 
@@ -16,7 +22,13 @@ require 'primary_connect_client'
16
22
  instance = PrimaryConnectClient::CodedValue.new(
17
23
  value: 260373001,
18
24
  code_set: SCT,
19
- description: null
25
+ description: null,
26
+ alt_value: null,
27
+ alt_code_set: null,
28
+ alt_description: null,
29
+ code_set_version: null,
30
+ alt_code_set_version: null,
31
+ original_text: null
20
32
  )
21
33
  ```
22
34
 
data/docs/DefaultApi.md CHANGED
@@ -18,6 +18,7 @@ All URIs are relative to *https://connect.primary.health*
18
18
  | [**list_results**](DefaultApi.md#list_results) | **GET** /api/v1/orders/{order_id}/results | list results |
19
19
  | [**reroute_order**](DefaultApi.md#reroute_order) | **POST** /api/v1/orders/reroute | reroute Order identified in the payload |
20
20
  | [**reroute_order_by_ulid**](DefaultApi.md#reroute_order_by_ulid) | **POST** /api/v1/orders/{id}/reroute | Reroute order by ULID |
21
+ | [**send_query**](DefaultApi.md#send_query) | **POST** /api/v1/queries | send query |
21
22
  | [**update_order**](DefaultApi.md#update_order) | **PUT** /api/v1/orders/{id} | update order |
22
23
 
23
24
 
@@ -723,7 +724,10 @@ api_instance = PrimaryConnectClient::DefaultApi.new
723
724
  opts = {
724
725
  last_order_id: '01FGD30NTPNNZE9MKGMWZGHGTZ', # String | Paginate orders with order id. 26 character, sortable id.
725
726
  state: 'new,resulted', # String | Filter orders by state, comma delimited.[new, updated, delivered, processing, resulted, errored, canceled, unprocessable]
726
- specimen_id: 'PB1234567' # String | Find an order by specimen/accession id. If found, will redirect to show order endpoint.
727
+ specimen_id: 'PB1234567', # String | Find an order by specimen/accession id. If found, will redirect to show order endpoint.
728
+ without_order_body: true, # Boolean | Exclude order body from the response
729
+ sent_only: true, # Boolean | Filter orders sent by the current entity
730
+ received_only: true # Boolean | Filter orders received by the current entity
727
731
  }
728
732
 
729
733
  begin
@@ -760,6 +764,9 @@ end
760
764
  | **last_order_id** | **String** | Paginate orders with order id. 26 character, sortable id. | [optional] |
761
765
  | **state** | **String** | Filter orders by state, comma delimited.[new, updated, delivered, processing, resulted, errored, canceled, unprocessable] | [optional] |
762
766
  | **specimen_id** | **String** | Find an order by specimen/accession id. If found, will redirect to show order endpoint. | [optional] |
767
+ | **without_order_body** | **Boolean** | Exclude order body from the response | [optional] |
768
+ | **sent_only** | **Boolean** | Filter orders sent by the current entity | [optional] |
769
+ | **received_only** | **Boolean** | Filter orders received by the current entity | [optional] |
763
770
 
764
771
  ### Return type
765
772
 
@@ -980,6 +987,75 @@ nil (empty response body)
980
987
  - **Accept**: Not defined
981
988
 
982
989
 
990
+ ## send_query
991
+
992
+ > <Immunizations> send_query(opts)
993
+
994
+ send query
995
+
996
+ ### Examples
997
+
998
+ ```ruby
999
+ require 'time'
1000
+ require 'primary_connect_client'
1001
+ # setup authorization
1002
+ PrimaryConnectClient.configure do |config|
1003
+ # Configure Bearer authorization: bearer_auth
1004
+ config.access_token = 'YOUR_BEARER_TOKEN'
1005
+ end
1006
+
1007
+ api_instance = PrimaryConnectClient::DefaultApi.new
1008
+ opts = {
1009
+ query: PrimaryConnectClient::Query.new # Query |
1010
+ }
1011
+
1012
+ begin
1013
+ # send query
1014
+ result = api_instance.send_query(opts)
1015
+ p result
1016
+ rescue PrimaryConnectClient::ApiError => e
1017
+ puts "Error when calling DefaultApi->send_query: #{e}"
1018
+ end
1019
+ ```
1020
+
1021
+ #### Using the send_query_with_http_info variant
1022
+
1023
+ This returns an Array which contains the response data, status code and headers.
1024
+
1025
+ > <Array(<Immunizations>, Integer, Hash)> send_query_with_http_info(opts)
1026
+
1027
+ ```ruby
1028
+ begin
1029
+ # send query
1030
+ data, status_code, headers = api_instance.send_query_with_http_info(opts)
1031
+ p status_code # => 2xx
1032
+ p headers # => { ... }
1033
+ p data # => <Immunizations>
1034
+ rescue PrimaryConnectClient::ApiError => e
1035
+ puts "Error when calling DefaultApi->send_query_with_http_info: #{e}"
1036
+ end
1037
+ ```
1038
+
1039
+ ### Parameters
1040
+
1041
+ | Name | Type | Description | Notes |
1042
+ | ---- | ---- | ----------- | ----- |
1043
+ | **query** | [**Query**](Query.md) | | [optional] |
1044
+
1045
+ ### Return type
1046
+
1047
+ [**Immunizations**](Immunizations.md)
1048
+
1049
+ ### Authorization
1050
+
1051
+ [bearer_auth](../README.md#bearer_auth)
1052
+
1053
+ ### HTTP request headers
1054
+
1055
+ - **Content-Type**: application/json
1056
+ - **Accept**: application/json
1057
+
1058
+
983
1059
  ## update_order
984
1060
 
985
1061
  > <OrderIds> update_order(id, opts)
@@ -0,0 +1,18 @@
1
+ # PrimaryConnectClient::Immunizations
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **immunizations** | [**Array&lt;MedicationAdministration&gt;**](MedicationAdministration.md) | List of Immunizations | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'primary_connect_client'
13
+
14
+ instance = PrimaryConnectClient::Immunizations.new(
15
+ immunizations: null
16
+ )
17
+ ```
18
+
data/docs/Query.md ADDED
@@ -0,0 +1,20 @@
1
+ # PrimaryConnectClient::Query
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **meta** | [**Meta**](Meta.md) | | [optional] |
8
+ | **subject** | [**Subject**](Subject.md) | | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'primary_connect_client'
14
+
15
+ instance = PrimaryConnectClient::Query.new(
16
+ meta: null,
17
+ subject: null
18
+ )
19
+ ```
20
+
@@ -647,6 +647,9 @@ module PrimaryConnectClient
647
647
  # @option opts [String] :last_order_id Paginate orders with order id. 26 character, sortable id.
648
648
  # @option opts [String] :state Filter orders by state, comma delimited.[new, updated, delivered, processing, resulted, errored, canceled, unprocessable]
649
649
  # @option opts [String] :specimen_id Find an order by specimen/accession id. If found, will redirect to show order endpoint.
650
+ # @option opts [Boolean] :without_order_body Exclude order body from the response
651
+ # @option opts [Boolean] :sent_only Filter orders sent by the current entity
652
+ # @option opts [Boolean] :received_only Filter orders received by the current entity
650
653
  # @return [Orders]
651
654
  def list_orders(opts = {})
652
655
  data, _status_code, _headers = list_orders_with_http_info(opts)
@@ -658,6 +661,9 @@ module PrimaryConnectClient
658
661
  # @option opts [String] :last_order_id Paginate orders with order id. 26 character, sortable id.
659
662
  # @option opts [String] :state Filter orders by state, comma delimited.[new, updated, delivered, processing, resulted, errored, canceled, unprocessable]
660
663
  # @option opts [String] :specimen_id Find an order by specimen/accession id. If found, will redirect to show order endpoint.
664
+ # @option opts [Boolean] :without_order_body Exclude order body from the response
665
+ # @option opts [Boolean] :sent_only Filter orders sent by the current entity
666
+ # @option opts [Boolean] :received_only Filter orders received by the current entity
661
667
  # @return [Array<(Orders, Integer, Hash)>] Orders data, response status code and response headers
662
668
  def list_orders_with_http_info(opts = {})
663
669
  if @api_client.config.debugging
@@ -671,6 +677,9 @@ module PrimaryConnectClient
671
677
  query_params[:'last_order_id'] = opts[:'last_order_id'] if !opts[:'last_order_id'].nil?
672
678
  query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
673
679
  query_params[:'specimen_id'] = opts[:'specimen_id'] if !opts[:'specimen_id'].nil?
680
+ query_params[:'without_order_body'] = opts[:'without_order_body'] if !opts[:'without_order_body'].nil?
681
+ query_params[:'sent_only'] = opts[:'sent_only'] if !opts[:'sent_only'].nil?
682
+ query_params[:'received_only'] = opts[:'received_only'] if !opts[:'received_only'].nil?
674
683
 
675
684
  # header parameters
676
685
  header_params = opts[:header_params] || {}
@@ -893,6 +902,68 @@ module PrimaryConnectClient
893
902
  return data, status_code, headers
894
903
  end
895
904
 
905
+ # send query
906
+ # @param [Hash] opts the optional parameters
907
+ # @option opts [Query] :query
908
+ # @return [Immunizations]
909
+ def send_query(opts = {})
910
+ data, _status_code, _headers = send_query_with_http_info(opts)
911
+ data
912
+ end
913
+
914
+ # send query
915
+ # @param [Hash] opts the optional parameters
916
+ # @option opts [Query] :query
917
+ # @return [Array<(Immunizations, Integer, Hash)>] Immunizations data, response status code and response headers
918
+ def send_query_with_http_info(opts = {})
919
+ if @api_client.config.debugging
920
+ @api_client.config.logger.debug 'Calling API: DefaultApi.send_query ...'
921
+ end
922
+ # resource path
923
+ local_var_path = '/api/v1/queries'
924
+
925
+ # query parameters
926
+ query_params = opts[:query_params] || {}
927
+
928
+ # header parameters
929
+ header_params = opts[:header_params] || {}
930
+ # HTTP header 'Accept' (if needed)
931
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
932
+ # HTTP header 'Content-Type'
933
+ content_type = @api_client.select_header_content_type(['application/json'])
934
+ if !content_type.nil?
935
+ header_params['Content-Type'] = content_type
936
+ end
937
+
938
+ # form parameters
939
+ form_params = opts[:form_params] || {}
940
+
941
+ # http body (model)
942
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'query'])
943
+
944
+ # return_type
945
+ return_type = opts[:debug_return_type] || 'Immunizations'
946
+
947
+ # auth_names
948
+ auth_names = opts[:debug_auth_names] || ['bearer_auth']
949
+
950
+ new_options = opts.merge(
951
+ :operation => :"DefaultApi.send_query",
952
+ :header_params => header_params,
953
+ :query_params => query_params,
954
+ :form_params => form_params,
955
+ :body => post_body,
956
+ :auth_names => auth_names,
957
+ :return_type => return_type
958
+ )
959
+
960
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
961
+ if @api_client.config.debugging
962
+ @api_client.config.logger.debug "API called: DefaultApi#send_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
963
+ end
964
+ return data, status_code, headers
965
+ end
966
+
896
967
  # update order
897
968
  # @param id [String] Order ID
898
969
  # @param [Hash] opts the optional parameters
@@ -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 Candidates
18
+ # List of possible matches for the query
19
+ attr_accessor :candidates
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'candidates' => :'candidates'
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
+ :'candidates' => :'Array<Patient>'
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::Candidates` 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::Candidates`. 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?(:'candidates')
62
+ if (value = attributes[:'candidates']).is_a?(Array)
63
+ self.candidates = 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
+ candidates == o.candidates
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
+ [candidates].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