fuse_client 1.0.1 → 1.0.3

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: 628afaeb261c0f8ccd640b9db4ee825377761444dd444fb64d68846a4ab8ab7a
4
- data.tar.gz: 37cb4afb9961af40906da1e336609ce9639f128a1983bd3bdaa4f5ea27e209a2
3
+ metadata.gz: 0dae65e9276d44e14f6989663bd0215a58d6b0fd3e912c5c26461b2e4aa5f21b
4
+ data.tar.gz: 32f2b4be1e2bf095eba7477ae3d392efd278671e39668762703df99a389054e2
5
5
  SHA512:
6
- metadata.gz: 88d208df41f9955707ebe5d5b3face7a1397fa889cf6e504dec198d4b471d796ba41e3569255013d2bbf11ba80365f86f915f06f3439a559909c8084f7e7315d
7
- data.tar.gz: e632699c37f9153ac118c4d0c9d95763e3dca283409500dae80ca9b671a2523ce2dafa6fbb2af04842da602fd70e7a63975023d22820bb67ecf64d8bc3fe73e5
6
+ metadata.gz: 13b2a77e95e647c30a0fb628c915b2253ee8e8a66e145c68487eff1b30f4c945ebb2d7087cacf2bac2157ea2cb1be02c3676853419c2f8d72c6b8c8fdbb67f97
7
+ data.tar.gz: df25b11a4dc47d17bd33f15e9e38e1e1a18a9fb3798d39df580bc5a14ae63649be55a7c99b7c773fb52f475e161d999fd75a937d1dab2caef7d1bf46ff4ab471
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fuse_client (1.0.1)
4
+ fuse_client (1.0.3)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -4,12 +4,10 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **institution_id** | **String** | An id that is unique for an institution. | [optional] |
8
- | **entity_id** | **String** | Unique identifier for the user or business account. | |
9
- | **entity_name** | **String** | The name of the user or business account. | [optional] |
10
- | **entity_email** | **String** | Email address associated with the user or business account. | [optional] |
7
+ | **institution_id** | **String** | An id that is unique for an institution. | |
8
+ | **entity** | [**Entity**](Entity.md) | | |
11
9
  | **reconnection_url** | **String** | This field is used to provide the user with a link to reconnect their financial account. It may be included in an automated email sent by Fuse to the entity's registered email address. It's important to note that the reconnection_url should be a valid URL and can only be used once to reconnect the disconnected account. | [optional] |
12
- | **client_name** | **String** | The name of your application. | [optional] |
10
+ | **client_name** | **String** | The name of your application. | |
13
11
  | **session_client_secret** | **String** | The session client secret created from the 'Create session client secret' endpoint | |
14
12
  | **mx** | [**CreateLinkTokenRequestMx**](CreateLinkTokenRequestMx.md) | | [optional] |
15
13
  | **plaid** | [**CreateLinkTokenRequestPlaid**](CreateLinkTokenRequestPlaid.md) | | [optional] |
@@ -21,9 +19,7 @@ require 'fuse_client'
21
19
 
22
20
  instance = FuseClient::CreateLinkTokenRequest.new(
23
21
  institution_id: null,
24
- entity_id: null,
25
- entity_name: null,
26
- entity_email: null,
22
+ entity: null,
27
23
  reconnection_url: null,
28
24
  client_name: null,
29
25
  session_client_secret: null,
data/docs/Entity.md ADDED
@@ -0,0 +1,22 @@
1
+ # FuseClient::Entity
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | Unique identifier for the user or business account. | |
8
+ | **name** | **String** | Name for the user or business account. | [optional] |
9
+ | **email** | **String** | Email address associated with the user or business account. | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'fuse_client'
15
+
16
+ instance = FuseClient::Entity.new(
17
+ id: null,
18
+ name: null,
19
+ email: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,24 @@
1
+ # FuseClient::FinancialInstitution
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | Unique identifier for the financial institution id. | |
8
+ | **name** | **String** | Name for the financial institution. | |
9
+ | **logo** | [**FinancialInstitutionLogo**](FinancialInstitutionLogo.md) | | [optional] |
10
+ | **website** | **String** | Website of the financial institution. | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'fuse_client'
16
+
17
+ instance = FuseClient::FinancialInstitution.new(
18
+ id: null,
19
+ name: null,
20
+ logo: null,
21
+ website: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,22 @@
1
+ # FuseClient::FinancialInstitutionLogo
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **image** | **String** | Base64-encoded image data or URL for the image. | |
8
+ | **type** | **String** | Type of the image. | |
9
+ | **format** | **String** | Optional format of the image, if known. | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'fuse_client'
15
+
16
+ instance = FuseClient::FinancialInstitutionLogo.new(
17
+ image: null,
18
+ type: null,
19
+ format: null
20
+ )
21
+ ```
22
+
data/docs/FuseApi.md CHANGED
@@ -16,6 +16,7 @@ All URIs are relative to *https://sandbox-api.letsfuse.com*
16
16
  | [**get_financial_connections_balances**](FuseApi.md#get_financial_connections_balances) | **POST** /v1/financial_connections/balances | Get balances |
17
17
  | [**get_financial_connections_owners**](FuseApi.md#get_financial_connections_owners) | **POST** /v1/financial_connections/owners | Get account owners |
18
18
  | [**get_financial_connections_transactions**](FuseApi.md#get_financial_connections_transactions) | **POST** /v1/financial_connections/transactions | Get transactions |
19
+ | [**get_financial_institution**](FuseApi.md#get_financial_institution) | **GET** /v1/financial_connections/institutions/{institution_id} | Get a financial institution |
19
20
  | [**get_investment_holdings**](FuseApi.md#get_investment_holdings) | **POST** /v1/financial_connections/investments/holdings | Get investment holdings |
20
21
  | [**get_investment_transactions**](FuseApi.md#get_investment_transactions) | **POST** /v1/financial_connections/investments/transactions | Get investment transactions |
21
22
  | [**refresh_asset_report**](FuseApi.md#refresh_asset_report) | **POST** /v1/asset_report/refresh | |
@@ -205,7 +206,7 @@ end
205
206
 
206
207
  api_instance = FuseClient::FuseApi.new
207
208
  opts = {
208
- create_link_token_request: FuseClient::CreateLinkTokenRequest.new({entity_id: 'entity_id_example', session_client_secret: 'session_client_secret_example'}) # CreateLinkTokenRequest |
209
+ create_link_token_request: FuseClient::CreateLinkTokenRequest.new({institution_id: 'institution_id_example', entity: FuseClient::Entity.new({id: 'id_example'}), client_name: 'client_name_example', session_client_secret: 'session_client_secret_example'}) # CreateLinkTokenRequest |
209
210
  }
210
211
 
211
212
  begin
@@ -933,6 +934,82 @@ end
933
934
  - **Accept**: application/json
934
935
 
935
936
 
937
+ ## get_financial_institution
938
+
939
+ > <FinancialInstitution> get_financial_institution(institution_id)
940
+
941
+ Get a financial institution
942
+
943
+ Receive metadata for a financial institution
944
+
945
+ ### Examples
946
+
947
+ ```ruby
948
+ require 'time'
949
+ require 'fuse_client'
950
+ # setup authorization
951
+ FuseClient.configure do |config|
952
+ # Configure API key authorization: fuseApiKey
953
+ config.api_key['fuseApiKey'] = 'YOUR API KEY'
954
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
955
+ # config.api_key_prefix['fuseApiKey'] = 'Bearer'
956
+
957
+ # Configure API key authorization: fuseClientId
958
+ config.api_key['fuseClientId'] = 'YOUR API KEY'
959
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
960
+ # config.api_key_prefix['fuseClientId'] = 'Bearer'
961
+ end
962
+
963
+ api_instance = FuseClient::FuseApi.new
964
+ institution_id = 'institution_id_example' # String |
965
+
966
+ begin
967
+ # Get a financial institution
968
+ result = api_instance.get_financial_institution(institution_id)
969
+ p result
970
+ rescue FuseClient::ApiError => e
971
+ puts "Error when calling FuseApi->get_financial_institution: #{e}"
972
+ end
973
+ ```
974
+
975
+ #### Using the get_financial_institution_with_http_info variant
976
+
977
+ This returns an Array which contains the response data, status code and headers.
978
+
979
+ > <Array(<FinancialInstitution>, Integer, Hash)> get_financial_institution_with_http_info(institution_id)
980
+
981
+ ```ruby
982
+ begin
983
+ # Get a financial institution
984
+ data, status_code, headers = api_instance.get_financial_institution_with_http_info(institution_id)
985
+ p status_code # => 2xx
986
+ p headers # => { ... }
987
+ p data # => <FinancialInstitution>
988
+ rescue FuseClient::ApiError => e
989
+ puts "Error when calling FuseApi->get_financial_institution_with_http_info: #{e}"
990
+ end
991
+ ```
992
+
993
+ ### Parameters
994
+
995
+ | Name | Type | Description | Notes |
996
+ | ---- | ---- | ----------- | ----- |
997
+ | **institution_id** | **String** | | |
998
+
999
+ ### Return type
1000
+
1001
+ [**FinancialInstitution**](FinancialInstitution.md)
1002
+
1003
+ ### Authorization
1004
+
1005
+ [fuseApiKey](../README.md#fuseApiKey), [fuseClientId](../README.md#fuseClientId)
1006
+
1007
+ ### HTTP request headers
1008
+
1009
+ - **Content-Type**: Not defined
1010
+ - **Accept**: application/json
1011
+
1012
+
936
1013
  ## get_investment_holdings
937
1014
 
938
1015
  > <GetInvestmentHoldingsResponse> get_investment_holdings(get_investment_holdings_request)
@@ -786,6 +786,69 @@ module FuseClient
786
786
  return data, status_code, headers
787
787
  end
788
788
 
789
+ # Get a financial institution
790
+ # Receive metadata for a financial institution
791
+ # @param institution_id [String]
792
+ # @param [Hash] opts the optional parameters
793
+ # @return [FinancialInstitution]
794
+ def get_financial_institution(institution_id, opts = {})
795
+ data, _status_code, _headers = get_financial_institution_with_http_info(institution_id, opts)
796
+ data
797
+ end
798
+
799
+ # Get a financial institution
800
+ # Receive metadata for a financial institution
801
+ # @param institution_id [String]
802
+ # @param [Hash] opts the optional parameters
803
+ # @return [Array<(FinancialInstitution, Integer, Hash)>] FinancialInstitution data, response status code and response headers
804
+ def get_financial_institution_with_http_info(institution_id, opts = {})
805
+ if @api_client.config.debugging
806
+ @api_client.config.logger.debug 'Calling API: FuseApi.get_financial_institution ...'
807
+ end
808
+ # verify the required parameter 'institution_id' is set
809
+ if @api_client.config.client_side_validation && institution_id.nil?
810
+ fail ArgumentError, "Missing the required parameter 'institution_id' when calling FuseApi.get_financial_institution"
811
+ end
812
+ # resource path
813
+ local_var_path = '/v1/financial_connections/institutions/{institution_id}'.sub('{' + 'institution_id' + '}', CGI.escape(institution_id.to_s))
814
+
815
+ # query parameters
816
+ query_params = opts[:query_params] || {}
817
+
818
+ # header parameters
819
+ header_params = opts[:header_params] || {}
820
+ # HTTP header 'Accept' (if needed)
821
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
822
+
823
+ # form parameters
824
+ form_params = opts[:form_params] || {}
825
+
826
+ # http body (model)
827
+ post_body = opts[:debug_body]
828
+
829
+ # return_type
830
+ return_type = opts[:debug_return_type] || 'FinancialInstitution'
831
+
832
+ # auth_names
833
+ auth_names = opts[:debug_auth_names] || ['fuseApiKey', 'fuseClientId']
834
+
835
+ new_options = opts.merge(
836
+ :operation => :"FuseApi.get_financial_institution",
837
+ :header_params => header_params,
838
+ :query_params => query_params,
839
+ :form_params => form_params,
840
+ :body => post_body,
841
+ :auth_names => auth_names,
842
+ :return_type => return_type
843
+ )
844
+
845
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
846
+ if @api_client.config.debugging
847
+ @api_client.config.logger.debug "API called: FuseApi#get_financial_institution\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
848
+ end
849
+ return data, status_code, headers
850
+ end
851
+
789
852
  # Get investment holdings
790
853
  # @param get_investment_holdings_request [GetInvestmentHoldingsRequest]
791
854
  # @param [Hash] opts the optional parameters
@@ -18,14 +18,7 @@ module FuseClient
18
18
  # An id that is unique for an institution.
19
19
  attr_accessor :institution_id
20
20
 
21
- # Unique identifier for the user or business account.
22
- attr_accessor :entity_id
23
-
24
- # The name of the user or business account.
25
- attr_accessor :entity_name
26
-
27
- # Email address associated with the user or business account.
28
- attr_accessor :entity_email
21
+ attr_accessor :entity
29
22
 
30
23
  # This field is used to provide the user with a link to reconnect their financial account. It may be included in an automated email sent by Fuse to the entity's registered email address. It's important to note that the reconnection_url should be a valid URL and can only be used once to reconnect the disconnected account.
31
24
  attr_accessor :reconnection_url
@@ -44,9 +37,7 @@ module FuseClient
44
37
  def self.attribute_map
45
38
  {
46
39
  :'institution_id' => :'institution_id',
47
- :'entity_id' => :'entity_id',
48
- :'entity_name' => :'entity_name',
49
- :'entity_email' => :'entity_email',
40
+ :'entity' => :'entity',
50
41
  :'reconnection_url' => :'reconnection_url',
51
42
  :'client_name' => :'client_name',
52
43
  :'session_client_secret' => :'session_client_secret',
@@ -64,9 +55,7 @@ module FuseClient
64
55
  def self.openapi_types
65
56
  {
66
57
  :'institution_id' => :'String',
67
- :'entity_id' => :'String',
68
- :'entity_name' => :'String',
69
- :'entity_email' => :'String',
58
+ :'entity' => :'Entity',
70
59
  :'reconnection_url' => :'String',
71
60
  :'client_name' => :'String',
72
61
  :'session_client_secret' => :'String',
@@ -100,16 +89,8 @@ module FuseClient
100
89
  self.institution_id = attributes[:'institution_id']
101
90
  end
102
91
 
103
- if attributes.key?(:'entity_id')
104
- self.entity_id = attributes[:'entity_id']
105
- end
106
-
107
- if attributes.key?(:'entity_name')
108
- self.entity_name = attributes[:'entity_name']
109
- end
110
-
111
- if attributes.key?(:'entity_email')
112
- self.entity_email = attributes[:'entity_email']
92
+ if attributes.key?(:'entity')
93
+ self.entity = attributes[:'entity']
113
94
  end
114
95
 
115
96
  if attributes.key?(:'reconnection_url')
@@ -137,8 +118,16 @@ module FuseClient
137
118
  # @return Array for valid properties with the reasons
138
119
  def list_invalid_properties
139
120
  invalid_properties = Array.new
140
- if @entity_id.nil?
141
- invalid_properties.push('invalid value for "entity_id", entity_id cannot be nil.')
121
+ if @institution_id.nil?
122
+ invalid_properties.push('invalid value for "institution_id", institution_id cannot be nil.')
123
+ end
124
+
125
+ if @entity.nil?
126
+ invalid_properties.push('invalid value for "entity", entity cannot be nil.')
127
+ end
128
+
129
+ if @client_name.nil?
130
+ invalid_properties.push('invalid value for "client_name", client_name cannot be nil.')
142
131
  end
143
132
 
144
133
  if @session_client_secret.nil?
@@ -151,7 +140,9 @@ module FuseClient
151
140
  # Check to see if the all the properties in the model are valid
152
141
  # @return true if the model is valid
153
142
  def valid?
154
- return false if @entity_id.nil?
143
+ return false if @institution_id.nil?
144
+ return false if @entity.nil?
145
+ return false if @client_name.nil?
155
146
  return false if @session_client_secret.nil?
156
147
  true
157
148
  end
@@ -162,9 +153,7 @@ module FuseClient
162
153
  return true if self.equal?(o)
163
154
  self.class == o.class &&
164
155
  institution_id == o.institution_id &&
165
- entity_id == o.entity_id &&
166
- entity_name == o.entity_name &&
167
- entity_email == o.entity_email &&
156
+ entity == o.entity &&
168
157
  reconnection_url == o.reconnection_url &&
169
158
  client_name == o.client_name &&
170
159
  session_client_secret == o.session_client_secret &&
@@ -181,7 +170,7 @@ module FuseClient
181
170
  # Calculates hash code according to all attributes.
182
171
  # @return [Integer] Hash code
183
172
  def hash
184
- [institution_id, entity_id, entity_name, entity_email, reconnection_url, client_name, session_client_secret, mx, plaid].hash
173
+ [institution_id, entity, reconnection_url, client_name, session_client_secret, mx, plaid].hash
185
174
  end
186
175
 
187
176
  # Builds the object from hash
@@ -0,0 +1,245 @@
1
+ =begin
2
+ #Fuse
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FuseClient
17
+ class Entity
18
+ # Unique identifier for the user or business account.
19
+ attr_accessor :id
20
+
21
+ # Name for the user or business account.
22
+ attr_accessor :name
23
+
24
+ # Email address associated with the user or business account.
25
+ attr_accessor :email
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'id' => :'id',
31
+ :'name' => :'name',
32
+ :'email' => :'email'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'id' => :'String',
45
+ :'name' => :'String',
46
+ :'email' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::Entity` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::Entity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'id')
72
+ self.id = attributes[:'id']
73
+ end
74
+
75
+ if attributes.key?(:'name')
76
+ self.name = attributes[:'name']
77
+ end
78
+
79
+ if attributes.key?(:'email')
80
+ self.email = attributes[:'email']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @id.nil?
89
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ return false if @id.nil?
99
+ true
100
+ end
101
+
102
+ # Checks equality by comparing each attribute.
103
+ # @param [Object] Object to be compared
104
+ def ==(o)
105
+ return true if self.equal?(o)
106
+ self.class == o.class &&
107
+ id == o.id &&
108
+ name == o.name &&
109
+ email == o.email
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Integer] Hash code
120
+ def hash
121
+ [id, name, email].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def self.build_from_hash(attributes)
128
+ new.build_from_hash(attributes)
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ attributes = attributes.transform_keys(&:to_sym)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
139
+ self.send("#{key}=", nil)
140
+ elsif type =~ /\AArray<(.*)>/i
141
+ # check to ensure the input is an array given that the attribute
142
+ # is documented as an array but the input is not
143
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
145
+ end
146
+ elsif !attributes[self.class.attribute_map[key]].nil?
147
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ end
149
+ end
150
+
151
+ self
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def _deserialize(type, value)
159
+ case type.to_sym
160
+ when :Time
161
+ Time.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ # models (e.g. Pet) or oneOf
192
+ klass = FuseClient.const_get(type)
193
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = self.send(attr)
215
+ if value.nil?
216
+ is_nullable = self.class.openapi_nullable.include?(attr)
217
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
218
+ end
219
+
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ # Outputs non-array value in the form of hash
226
+ # For object, use to_hash. Otherwise, just return the value
227
+ # @param [Object] value Any valid value
228
+ # @return [Hash] Returns the value in the form of hash
229
+ def _to_hash(value)
230
+ if value.is_a?(Array)
231
+ value.compact.map { |v| _to_hash(v) }
232
+ elsif value.is_a?(Hash)
233
+ {}.tap do |hash|
234
+ value.each { |k, v| hash[k] = _to_hash(v) }
235
+ end
236
+ elsif value.respond_to? :to_hash
237
+ value.to_hash
238
+ else
239
+ value
240
+ end
241
+ end
242
+
243
+ end
244
+
245
+ end