fuse_client 1.0.37 → 1.0.40
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/docs/{SpendPower.md → ConsumerRiskReport.md} +5 -5
- data/docs/{SpendPowerCustomization.md → ConsumerRiskReportCustomization.md} +6 -6
- data/docs/{SpendPowerTimeFrame.md → ConsumerRiskReportTimeFrame.md} +2 -2
- data/docs/{CreateSpendPowerCustomizationRequest.md → CreateConsumerRiskReportCustomizationRequest.md} +5 -5
- data/docs/{CreateSpendPowerCustomizationResponse.md → CreateConsumerRiskReportCustomizationResponse.md} +2 -2
- data/docs/CreateConsumerRiskReportRequest.md +24 -0
- data/docs/{DeleteSpendPowerResponse.md → CreateConsumerRiskReportResponse.md} +3 -3
- data/docs/CreateLinkTokenRequest.md +3 -1
- data/docs/CreateLinkTokenRequestSnaptrade.md +18 -0
- data/docs/CreateLinkTokenRequestSnaptradeConfig.md +18 -0
- data/docs/{CreateSpendPowerResponse.md → DeleteConsumerRiskReportResponse.md} +3 -3
- data/docs/EnrichedTransaction.md +4 -26
- data/docs/EvalConsumerRiskReportRequest.md +22 -0
- data/docs/{EvalSpendPowerRequestEventsInner.md → EvalConsumerRiskReportRequestEventsInner.md} +2 -2
- data/docs/{EvalSpendPowerResponse.md → EvalConsumerRiskReportResponse.md} +2 -2
- data/docs/ExternalTransactionEvent.md +8 -2
- data/docs/FinancialConnectionDetails.md +5 -1
- data/docs/FinancialConnectionDetailsBasiq.md +20 -0
- data/docs/FinancialConnectionDetailsBelvo.md +20 -0
- data/docs/FinancialConnectionsAccount.md +2 -0
- data/docs/FinancialConnectionsAccountLiability.md +2 -0
- data/docs/FinancialConnectionsInvestmentSecurityExchange.md +3 -1
- data/docs/FinancialConnectionsOwnerAddressesInnerData.md +2 -0
- data/docs/FuseApi.md +153 -149
- data/docs/{GetSpendPowerCustomizationResponse.md → GetConsumerRiskReportCustomizationResponse.md} +4 -4
- data/docs/{GetSpendPowerResponse.md → GetConsumerRiskReportResponse.md} +4 -4
- data/docs/InAppTransactionEvent.md +1 -1
- data/docs/RiskReportApi.md +165 -0
- data/docs/Transaction.md +1 -1
- data/docs/TransactionToEnrich.md +13 -5
- data/docs/{UpdateSpendPowerCustomizationRequest.md → UpdateConsumerRiskReportCustomizationRequest.md} +5 -5
- data/docs/{UpdateSpendPowerCustomizationResponse.md → UpdateConsumerRiskReportCustomizationResponse.md} +2 -2
- data/docs/UpdatedBalanceEvent.md +2 -2
- data/lib/fuse_client/api/fuse_api.rb +142 -139
- data/lib/fuse_client/api/{spend_power_api.rb → risk_report_api.rb} +39 -39
- data/lib/fuse_client/configuration.rb +5 -1
- data/lib/fuse_client/models/account_subtype.rb +3 -2
- data/lib/fuse_client/models/aggregator.rb +3 -1
- data/lib/fuse_client/models/{spend_power.rb → consumer_risk_report.rb} +4 -6
- data/lib/fuse_client/models/{spend_power_customization.rb → consumer_risk_report_customization.rb} +6 -7
- data/lib/fuse_client/models/{spend_power_time_frame.rb → consumer_risk_report_time_frame.rb} +3 -3
- data/lib/fuse_client/models/{create_spend_power_customization_request.rb → create_consumer_risk_report_customization_request.rb} +6 -6
- data/lib/fuse_client/models/{create_spend_power_customization_response.rb → create_consumer_risk_report_customization_response.rb} +3 -3
- data/lib/fuse_client/models/{create_spend_power_request.rb → create_consumer_risk_report_request.rb} +16 -6
- data/lib/fuse_client/models/{delete_spend_power_response.rb → create_consumer_risk_report_response.rb} +3 -4
- data/lib/fuse_client/models/create_link_token_request.rb +13 -4
- data/lib/fuse_client/models/create_link_token_request_snaptrade.rb +220 -0
- data/lib/fuse_client/models/create_link_token_request_snaptrade_config.rb +256 -0
- data/lib/fuse_client/models/{create_spend_power_response.rb → delete_consumer_risk_report_response.rb} +3 -4
- data/lib/fuse_client/models/enriched_transaction.rb +17 -158
- data/lib/fuse_client/models/{eval_spend_power_request.rb → eval_consumer_risk_report_request.rb} +5 -5
- data/lib/fuse_client/models/{eval_spend_power_request_events_inner.rb → eval_consumer_risk_report_request_events_inner.rb} +3 -3
- data/lib/fuse_client/models/{eval_spend_power_response.rb → eval_consumer_risk_report_response.rb} +3 -3
- data/lib/fuse_client/models/external_transaction_event.rb +45 -7
- data/lib/fuse_client/models/financial_connection_details.rb +22 -4
- data/lib/fuse_client/models/financial_connection_details_basiq.rb +241 -0
- data/lib/fuse_client/models/financial_connection_details_belvo.rb +236 -0
- data/lib/fuse_client/models/financial_connections_account.rb +16 -1
- data/lib/fuse_client/models/financial_connections_account_balance.rb +2 -0
- data/lib/fuse_client/models/financial_connections_account_cached_balance.rb +2 -0
- data/lib/fuse_client/models/financial_connections_account_liability.rb +16 -1
- data/lib/fuse_client/models/financial_connections_investment_security_exchange.rb +14 -4
- data/lib/fuse_client/models/financial_connections_owner_addresses_inner_data.rb +11 -1
- data/lib/fuse_client/models/fuse_api_error_code.rb +6 -3
- data/lib/fuse_client/models/get_consumer_risk_report_customization_response.rb +239 -0
- data/lib/fuse_client/models/{get_spend_power_response.rb → get_consumer_risk_report_response.rb} +13 -13
- data/lib/fuse_client/models/in_app_transaction_event.rb +0 -5
- data/lib/fuse_client/models/transaction.rb +1 -1
- data/lib/fuse_client/models/transaction_to_enrich.rb +130 -27
- data/lib/fuse_client/models/{update_spend_power_customization_request.rb → update_consumer_risk_report_customization_request.rb} +6 -6
- data/lib/fuse_client/models/{update_spend_power_customization_response.rb → update_consumer_risk_report_customization_response.rb} +3 -3
- data/lib/fuse_client/models/updated_balance_event.rb +2 -2
- data/lib/fuse_client/version.rb +1 -1
- data/lib/fuse_client.rb +20 -16
- data/spec/api/fuse_api_spec.rb +37 -36
- data/spec/api/{spend_power_api_spec.rb → risk_report_api_spec.rb} +16 -16
- data/spec/models/asset_report_transaction_spec.rb +1 -1
- data/spec/models/{spend_power_customization_spec.rb → consumer_risk_report_customization_spec.rb} +6 -6
- data/spec/models/{spend_power_spec.rb → consumer_risk_report_spec.rb} +6 -6
- data/spec/models/{spend_power_time_frame_spec.rb → consumer_risk_report_time_frame_spec.rb} +6 -6
- data/spec/models/{create_spend_power_customization_request_spec.rb → create_consumer_risk_report_customization_request_spec.rb} +6 -6
- data/spec/models/{create_spend_power_customization_response_spec.rb → create_consumer_risk_report_customization_response_spec.rb} +6 -6
- data/spec/models/{create_spend_power_request_spec.rb → create_consumer_risk_report_request_spec.rb} +12 -6
- data/spec/models/{delete_spend_power_response_spec.rb → create_consumer_risk_report_response_spec.rb} +6 -6
- data/spec/models/create_link_token_request_snaptrade_config_spec.rb +38 -0
- data/spec/models/create_link_token_request_snaptrade_spec.rb +34 -0
- data/spec/models/create_link_token_request_spec.rb +6 -0
- data/spec/models/{create_spend_power_response_spec.rb → delete_consumer_risk_report_response_spec.rb} +6 -6
- data/spec/models/enriched_transaction_spec.rb +2 -72
- data/spec/models/{eval_spend_power_request_events_inner_spec.rb → eval_consumer_risk_report_request_events_inner_spec.rb} +6 -6
- data/spec/models/{eval_spend_power_request_spec.rb → eval_consumer_risk_report_request_spec.rb} +6 -6
- data/spec/models/{eval_spend_power_response_spec.rb → eval_consumer_risk_report_response_spec.rb} +6 -6
- data/spec/models/external_transaction_event_spec.rb +22 -0
- data/spec/models/financial_connection_details_basiq_spec.rb +40 -0
- data/spec/models/financial_connection_details_belvo_spec.rb +40 -0
- data/spec/models/financial_connection_details_spec.rb +12 -0
- data/spec/models/financial_connections_account_liability_spec.rb +6 -0
- data/spec/models/financial_connections_account_spec.rb +6 -0
- data/spec/models/financial_connections_investment_security_exchange_spec.rb +6 -0
- data/spec/models/financial_connections_owner_addresses_inner_data_spec.rb +6 -0
- data/spec/models/{get_spend_power_customization_response_spec.rb → get_consumer_risk_report_customization_response_spec.rb} +7 -7
- data/spec/models/{get_spend_power_response_spec.rb → get_consumer_risk_report_response_spec.rb} +7 -7
- data/spec/models/transaction_spec.rb +1 -1
- data/spec/models/transaction_to_enrich_spec.rb +32 -4
- data/spec/models/{update_spend_power_customization_request_spec.rb → update_consumer_risk_report_customization_request_spec.rb} +6 -6
- data/spec/models/{update_spend_power_customization_response_spec.rb → update_consumer_risk_report_customization_response_spec.rb} +6 -6
- metadata +92 -76
- data/docs/CreateSpendPowerRequest.md +0 -22
- data/docs/EvalSpendPowerRequest.md +0 -22
- data/docs/SpendPowerApi.md +0 -165
- data/lib/fuse_client/models/get_spend_power_customization_response.rb +0 -239
data/docs/SpendPowerApi.md
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
# FuseClient::SpendPowerApi
|
2
|
-
|
3
|
-
All URIs are relative to *https://sandbox-api.letsfuse.com*
|
4
|
-
|
5
|
-
| Method | HTTP request | Description |
|
6
|
-
| ------ | ------------ | ----------- |
|
7
|
-
| [**delete_spend_power**](SpendPowerApi.md#delete_spend_power) | **DELETE** /v1/spend_power/{spend_power_id} | Delete spend power customization |
|
8
|
-
| [**get_spend_power_customization**](SpendPowerApi.md#get_spend_power_customization) | **GET** /v1/spend_power/customization/{spend_power_customization_id} | Get spend power customization |
|
9
|
-
|
10
|
-
|
11
|
-
## delete_spend_power
|
12
|
-
|
13
|
-
> <DeleteSpendPowerResponse> delete_spend_power(spend_power_id, fuse_client_id, fuse_api_key)
|
14
|
-
|
15
|
-
Delete spend power customization
|
16
|
-
|
17
|
-
### Examples
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
require 'time'
|
21
|
-
require 'fuse_client'
|
22
|
-
# setup authorization
|
23
|
-
FuseClient.configure do |config|
|
24
|
-
# Configure API key authorization: fuseApiKey
|
25
|
-
config.api_key['fuseApiKey'] = 'YOUR API KEY'
|
26
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
27
|
-
# config.api_key_prefix['fuseApiKey'] = 'Bearer'
|
28
|
-
|
29
|
-
# Configure API key authorization: fuseClientId
|
30
|
-
config.api_key['fuseClientId'] = 'YOUR API KEY'
|
31
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
32
|
-
# config.api_key_prefix['fuseClientId'] = 'Bearer'
|
33
|
-
end
|
34
|
-
|
35
|
-
api_instance = FuseClient::SpendPowerApi.new
|
36
|
-
spend_power_id = 'spend_power_id_example' # String |
|
37
|
-
fuse_client_id = 'fuse_client_id_example' # String |
|
38
|
-
fuse_api_key = 'fuse_api_key_example' # String |
|
39
|
-
|
40
|
-
begin
|
41
|
-
# Delete spend power customization
|
42
|
-
result = api_instance.delete_spend_power(spend_power_id, fuse_client_id, fuse_api_key)
|
43
|
-
p result
|
44
|
-
rescue FuseClient::ApiError => e
|
45
|
-
puts "Error when calling SpendPowerApi->delete_spend_power: #{e}"
|
46
|
-
end
|
47
|
-
```
|
48
|
-
|
49
|
-
#### Using the delete_spend_power_with_http_info variant
|
50
|
-
|
51
|
-
This returns an Array which contains the response data, status code and headers.
|
52
|
-
|
53
|
-
> <Array(<DeleteSpendPowerResponse>, Integer, Hash)> delete_spend_power_with_http_info(spend_power_id, fuse_client_id, fuse_api_key)
|
54
|
-
|
55
|
-
```ruby
|
56
|
-
begin
|
57
|
-
# Delete spend power customization
|
58
|
-
data, status_code, headers = api_instance.delete_spend_power_with_http_info(spend_power_id, fuse_client_id, fuse_api_key)
|
59
|
-
p status_code # => 2xx
|
60
|
-
p headers # => { ... }
|
61
|
-
p data # => <DeleteSpendPowerResponse>
|
62
|
-
rescue FuseClient::ApiError => e
|
63
|
-
puts "Error when calling SpendPowerApi->delete_spend_power_with_http_info: #{e}"
|
64
|
-
end
|
65
|
-
```
|
66
|
-
|
67
|
-
### Parameters
|
68
|
-
|
69
|
-
| Name | Type | Description | Notes |
|
70
|
-
| ---- | ---- | ----------- | ----- |
|
71
|
-
| **spend_power_id** | **String** | | |
|
72
|
-
| **fuse_client_id** | **String** | | |
|
73
|
-
| **fuse_api_key** | **String** | | |
|
74
|
-
|
75
|
-
### Return type
|
76
|
-
|
77
|
-
[**DeleteSpendPowerResponse**](DeleteSpendPowerResponse.md)
|
78
|
-
|
79
|
-
### Authorization
|
80
|
-
|
81
|
-
[fuseApiKey](../README.md#fuseApiKey), [fuseClientId](../README.md#fuseClientId)
|
82
|
-
|
83
|
-
### HTTP request headers
|
84
|
-
|
85
|
-
- **Content-Type**: Not defined
|
86
|
-
- **Accept**: application/json
|
87
|
-
|
88
|
-
|
89
|
-
## get_spend_power_customization
|
90
|
-
|
91
|
-
> <GetSpendPowerCustomizationResponse> get_spend_power_customization(spend_power_customization_id, fuse_client_id, fuse_api_key)
|
92
|
-
|
93
|
-
Get spend power customization
|
94
|
-
|
95
|
-
### Examples
|
96
|
-
|
97
|
-
```ruby
|
98
|
-
require 'time'
|
99
|
-
require 'fuse_client'
|
100
|
-
# setup authorization
|
101
|
-
FuseClient.configure do |config|
|
102
|
-
# Configure API key authorization: fuseApiKey
|
103
|
-
config.api_key['fuseApiKey'] = 'YOUR API KEY'
|
104
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
105
|
-
# config.api_key_prefix['fuseApiKey'] = 'Bearer'
|
106
|
-
|
107
|
-
# Configure API key authorization: fuseClientId
|
108
|
-
config.api_key['fuseClientId'] = 'YOUR API KEY'
|
109
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
110
|
-
# config.api_key_prefix['fuseClientId'] = 'Bearer'
|
111
|
-
end
|
112
|
-
|
113
|
-
api_instance = FuseClient::SpendPowerApi.new
|
114
|
-
spend_power_customization_id = 'spend_power_customization_id_example' # String |
|
115
|
-
fuse_client_id = 'fuse_client_id_example' # String |
|
116
|
-
fuse_api_key = 'fuse_api_key_example' # String |
|
117
|
-
|
118
|
-
begin
|
119
|
-
# Get spend power customization
|
120
|
-
result = api_instance.get_spend_power_customization(spend_power_customization_id, fuse_client_id, fuse_api_key)
|
121
|
-
p result
|
122
|
-
rescue FuseClient::ApiError => e
|
123
|
-
puts "Error when calling SpendPowerApi->get_spend_power_customization: #{e}"
|
124
|
-
end
|
125
|
-
```
|
126
|
-
|
127
|
-
#### Using the get_spend_power_customization_with_http_info variant
|
128
|
-
|
129
|
-
This returns an Array which contains the response data, status code and headers.
|
130
|
-
|
131
|
-
> <Array(<GetSpendPowerCustomizationResponse>, Integer, Hash)> get_spend_power_customization_with_http_info(spend_power_customization_id, fuse_client_id, fuse_api_key)
|
132
|
-
|
133
|
-
```ruby
|
134
|
-
begin
|
135
|
-
# Get spend power customization
|
136
|
-
data, status_code, headers = api_instance.get_spend_power_customization_with_http_info(spend_power_customization_id, fuse_client_id, fuse_api_key)
|
137
|
-
p status_code # => 2xx
|
138
|
-
p headers # => { ... }
|
139
|
-
p data # => <GetSpendPowerCustomizationResponse>
|
140
|
-
rescue FuseClient::ApiError => e
|
141
|
-
puts "Error when calling SpendPowerApi->get_spend_power_customization_with_http_info: #{e}"
|
142
|
-
end
|
143
|
-
```
|
144
|
-
|
145
|
-
### Parameters
|
146
|
-
|
147
|
-
| Name | Type | Description | Notes |
|
148
|
-
| ---- | ---- | ----------- | ----- |
|
149
|
-
| **spend_power_customization_id** | **String** | | |
|
150
|
-
| **fuse_client_id** | **String** | | |
|
151
|
-
| **fuse_api_key** | **String** | | |
|
152
|
-
|
153
|
-
### Return type
|
154
|
-
|
155
|
-
[**GetSpendPowerCustomizationResponse**](GetSpendPowerCustomizationResponse.md)
|
156
|
-
|
157
|
-
### Authorization
|
158
|
-
|
159
|
-
[fuseApiKey](../README.md#fuseApiKey), [fuseClientId](../README.md#fuseClientId)
|
160
|
-
|
161
|
-
### HTTP request headers
|
162
|
-
|
163
|
-
- **Content-Type**: Not defined
|
164
|
-
- **Accept**: application/json
|
165
|
-
|
@@ -1,239 +0,0 @@
|
|
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.6.0
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
require 'time'
|
15
|
-
|
16
|
-
module FuseClient
|
17
|
-
class GetSpendPowerCustomizationResponse
|
18
|
-
attr_accessor :spend_power_customization
|
19
|
-
|
20
|
-
# An identifier that is exclusive to the request and can serve as a means for investigating and resolving issues.
|
21
|
-
attr_accessor :request_id
|
22
|
-
|
23
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
-
def self.attribute_map
|
25
|
-
{
|
26
|
-
:'spend_power_customization' => :'spend_power_customization',
|
27
|
-
:'request_id' => :'request_id'
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
# Returns all the JSON keys this model knows about
|
32
|
-
def self.acceptable_attributes
|
33
|
-
attribute_map.values
|
34
|
-
end
|
35
|
-
|
36
|
-
# Attribute type mapping.
|
37
|
-
def self.openapi_types
|
38
|
-
{
|
39
|
-
:'spend_power_customization' => :'SpendPowerCustomization',
|
40
|
-
:'request_id' => :'String'
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
# List of attributes with nullable: true
|
45
|
-
def self.openapi_nullable
|
46
|
-
Set.new([
|
47
|
-
])
|
48
|
-
end
|
49
|
-
|
50
|
-
# Initializes the object
|
51
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
-
def initialize(attributes = {})
|
53
|
-
if (!attributes.is_a?(Hash))
|
54
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::GetSpendPowerCustomizationResponse` initialize method"
|
55
|
-
end
|
56
|
-
|
57
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::GetSpendPowerCustomizationResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
-
end
|
62
|
-
h[k.to_sym] = v
|
63
|
-
}
|
64
|
-
|
65
|
-
if attributes.key?(:'spend_power_customization')
|
66
|
-
self.spend_power_customization = attributes[:'spend_power_customization']
|
67
|
-
end
|
68
|
-
|
69
|
-
if attributes.key?(:'request_id')
|
70
|
-
self.request_id = attributes[:'request_id']
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
-
# @return Array for valid properties with the reasons
|
76
|
-
def list_invalid_properties
|
77
|
-
invalid_properties = Array.new
|
78
|
-
if @spend_power_customization.nil?
|
79
|
-
invalid_properties.push('invalid value for "spend_power_customization", spend_power_customization cannot be nil.')
|
80
|
-
end
|
81
|
-
|
82
|
-
if @request_id.nil?
|
83
|
-
invalid_properties.push('invalid value for "request_id", request_id cannot be nil.')
|
84
|
-
end
|
85
|
-
|
86
|
-
invalid_properties
|
87
|
-
end
|
88
|
-
|
89
|
-
# Check to see if the all the properties in the model are valid
|
90
|
-
# @return true if the model is valid
|
91
|
-
def valid?
|
92
|
-
return false if @spend_power_customization.nil?
|
93
|
-
return false if @request_id.nil?
|
94
|
-
true
|
95
|
-
end
|
96
|
-
|
97
|
-
# Checks equality by comparing each attribute.
|
98
|
-
# @param [Object] Object to be compared
|
99
|
-
def ==(o)
|
100
|
-
return true if self.equal?(o)
|
101
|
-
self.class == o.class &&
|
102
|
-
spend_power_customization == o.spend_power_customization &&
|
103
|
-
request_id == o.request_id
|
104
|
-
end
|
105
|
-
|
106
|
-
# @see the `==` method
|
107
|
-
# @param [Object] Object to be compared
|
108
|
-
def eql?(o)
|
109
|
-
self == o
|
110
|
-
end
|
111
|
-
|
112
|
-
# Calculates hash code according to all attributes.
|
113
|
-
# @return [Integer] Hash code
|
114
|
-
def hash
|
115
|
-
[spend_power_customization, request_id].hash
|
116
|
-
end
|
117
|
-
|
118
|
-
# Builds the object from hash
|
119
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
-
# @return [Object] Returns the model itself
|
121
|
-
def self.build_from_hash(attributes)
|
122
|
-
new.build_from_hash(attributes)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Builds the object from hash
|
126
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
-
# @return [Object] Returns the model itself
|
128
|
-
def build_from_hash(attributes)
|
129
|
-
return nil unless attributes.is_a?(Hash)
|
130
|
-
attributes = attributes.transform_keys(&:to_sym)
|
131
|
-
self.class.openapi_types.each_pair do |key, type|
|
132
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
133
|
-
self.send("#{key}=", nil)
|
134
|
-
elsif type =~ /\AArray<(.*)>/i
|
135
|
-
# check to ensure the input is an array given that the attribute
|
136
|
-
# is documented as an array but the input is not
|
137
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
138
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
139
|
-
end
|
140
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
141
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
self
|
146
|
-
end
|
147
|
-
|
148
|
-
# Deserializes the data based on type
|
149
|
-
# @param string type Data type
|
150
|
-
# @param string value Value to be deserialized
|
151
|
-
# @return [Object] Deserialized data
|
152
|
-
def _deserialize(type, value)
|
153
|
-
case type.to_sym
|
154
|
-
when :Time
|
155
|
-
Time.parse(value)
|
156
|
-
when :Date
|
157
|
-
Date.parse(value)
|
158
|
-
when :String
|
159
|
-
value.to_s
|
160
|
-
when :Integer
|
161
|
-
value.to_i
|
162
|
-
when :Float
|
163
|
-
value.to_f
|
164
|
-
when :Boolean
|
165
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
166
|
-
true
|
167
|
-
else
|
168
|
-
false
|
169
|
-
end
|
170
|
-
when :Object
|
171
|
-
# generic object (usually a Hash), return directly
|
172
|
-
value
|
173
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
174
|
-
inner_type = Regexp.last_match[:inner_type]
|
175
|
-
value.map { |v| _deserialize(inner_type, v) }
|
176
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
177
|
-
k_type = Regexp.last_match[:k_type]
|
178
|
-
v_type = Regexp.last_match[:v_type]
|
179
|
-
{}.tap do |hash|
|
180
|
-
value.each do |k, v|
|
181
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
else # model
|
185
|
-
# models (e.g. Pet) or oneOf
|
186
|
-
klass = FuseClient.const_get(type)
|
187
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
# Returns the string representation of the object
|
192
|
-
# @return [String] String presentation of the object
|
193
|
-
def to_s
|
194
|
-
to_hash.to_s
|
195
|
-
end
|
196
|
-
|
197
|
-
# to_body is an alias to to_hash (backward compatibility)
|
198
|
-
# @return [Hash] Returns the object in the form of hash
|
199
|
-
def to_body
|
200
|
-
to_hash
|
201
|
-
end
|
202
|
-
|
203
|
-
# Returns the object in the form of hash
|
204
|
-
# @return [Hash] Returns the object in the form of hash
|
205
|
-
def to_hash
|
206
|
-
hash = {}
|
207
|
-
self.class.attribute_map.each_pair do |attr, param|
|
208
|
-
value = self.send(attr)
|
209
|
-
if value.nil?
|
210
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
211
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
212
|
-
end
|
213
|
-
|
214
|
-
hash[param] = _to_hash(value)
|
215
|
-
end
|
216
|
-
hash
|
217
|
-
end
|
218
|
-
|
219
|
-
# Outputs non-array value in the form of hash
|
220
|
-
# For object, use to_hash. Otherwise, just return the value
|
221
|
-
# @param [Object] value Any valid value
|
222
|
-
# @return [Hash] Returns the value in the form of hash
|
223
|
-
def _to_hash(value)
|
224
|
-
if value.is_a?(Array)
|
225
|
-
value.compact.map { |v| _to_hash(v) }
|
226
|
-
elsif value.is_a?(Hash)
|
227
|
-
{}.tap do |hash|
|
228
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
229
|
-
end
|
230
|
-
elsif value.respond_to? :to_hash
|
231
|
-
value.to_hash
|
232
|
-
else
|
233
|
-
value
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
end
|
238
|
-
|
239
|
-
end
|