fuse_client 1.0.40 → 1.0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/docs/ExchangeFinancialConnectionsPublicTokenResponse.md +4 -0
  4. data/docs/FinancialConnectionData.md +1 -1
  5. data/docs/FinancialConnectionDetails.md +3 -1
  6. data/docs/FinancialConnectionDetailsFinicity.md +20 -0
  7. data/docs/FinancialConnectionsAccountDetails.md +1 -1
  8. data/docs/FinancialConnectionsAccountDetailsAccountNumber.md +1 -1
  9. data/docs/FuseApi.md +7 -84
  10. data/docs/Transaction.md +1 -1
  11. data/lib/fuse_client/api/fuse_api.rb +10 -67
  12. data/lib/fuse_client/configuration.rb +32 -11
  13. data/lib/fuse_client/models/aggregator.rb +9 -8
  14. data/lib/fuse_client/models/exchange_financial_connections_public_token_response.rb +46 -1
  15. data/lib/fuse_client/models/financial_connection_data.rb +1 -5
  16. data/lib/fuse_client/models/financial_connection_details.rb +13 -4
  17. data/lib/fuse_client/models/{fin_ql_top_merchants_feature_inner.rb → financial_connection_details_finicity.rb} +29 -25
  18. data/lib/fuse_client/models/financial_connections_account.rb +1 -0
  19. data/lib/fuse_client/models/financial_connections_account_balance.rb +2 -0
  20. data/lib/fuse_client/models/financial_connections_account_cached_balance.rb +2 -0
  21. data/lib/fuse_client/models/financial_connections_account_details.rb +0 -5
  22. data/lib/fuse_client/models/financial_connections_account_details_account_number.rb +5 -0
  23. data/lib/fuse_client/models/financial_connections_account_liability.rb +1 -0
  24. data/lib/fuse_client/models/fuse_api_aggregator_error.rb +5 -0
  25. data/lib/fuse_client/models/fuse_api_error_code.rb +4 -1
  26. data/lib/fuse_client/models/transaction.rb +1 -1
  27. data/lib/fuse_client/version.rb +1 -1
  28. data/lib/fuse_client.rb +1 -20
  29. data/spec/api/fuse_api_spec.rb +1 -12
  30. data/spec/models/exchange_financial_connections_public_token_response_spec.rb +12 -0
  31. data/spec/models/{fin_ql_prompt_response_spec.rb → financial_connection_details_finicity_spec.rb} +8 -8
  32. data/spec/models/financial_connection_details_spec.rb +6 -0
  33. metadata +6 -82
  34. data/docs/FinQLComparisonFeature.md +0 -26
  35. data/docs/FinQLFeature.md +0 -61
  36. data/docs/FinQLFeatureOneOf.md +0 -18
  37. data/docs/FinQLFeatureOneOf1.md +0 -18
  38. data/docs/FinQLFeatureOneOf2.md +0 -18
  39. data/docs/FinQLFeatureOneOf3.md +0 -18
  40. data/docs/FinQLFeatureOneOf4.md +0 -18
  41. data/docs/FinQLFeatureOneOf5.md +0 -18
  42. data/docs/FinQLFeatureOneOf6.md +0 -18
  43. data/docs/FinQLFeatureOneOf7.md +0 -18
  44. data/docs/FinQLFeatureRequest.md +0 -15
  45. data/docs/FinQLFrequencyFeature.md +0 -20
  46. data/docs/FinQLIndividualMerchantFeature.md +0 -20
  47. data/docs/FinQLInterestFeature.md +0 -18
  48. data/docs/FinQLMerchantCategoriesFeatureInner.md +0 -20
  49. data/docs/FinQLMerchantCategoriesFeatureInnerResultInner.md +0 -20
  50. data/docs/FinQLPromptRequest.md +0 -22
  51. data/docs/FinQLPromptResponse.md +0 -20
  52. data/docs/FinQLTimeBasedFeatureInner.md +0 -20
  53. data/docs/FinQLTopMerchantsFeatureInner.md +0 -22
  54. data/lib/fuse_client/models/fin_ql_comparison_feature.rb +0 -255
  55. data/lib/fuse_client/models/fin_ql_feature.rb +0 -111
  56. data/lib/fuse_client/models/fin_ql_feature_one_of.rb +0 -219
  57. data/lib/fuse_client/models/fin_ql_feature_one_of1.rb +0 -219
  58. data/lib/fuse_client/models/fin_ql_feature_one_of2.rb +0 -221
  59. data/lib/fuse_client/models/fin_ql_feature_one_of3.rb +0 -219
  60. data/lib/fuse_client/models/fin_ql_feature_one_of4.rb +0 -219
  61. data/lib/fuse_client/models/fin_ql_feature_one_of5.rb +0 -221
  62. data/lib/fuse_client/models/fin_ql_feature_one_of6.rb +0 -219
  63. data/lib/fuse_client/models/fin_ql_feature_one_of7.rb +0 -221
  64. data/lib/fuse_client/models/fin_ql_feature_request.rb +0 -46
  65. data/lib/fuse_client/models/fin_ql_frequency_feature.rb +0 -262
  66. data/lib/fuse_client/models/fin_ql_individual_merchant_feature.rb +0 -228
  67. data/lib/fuse_client/models/fin_ql_interest_feature.rb +0 -219
  68. data/lib/fuse_client/models/fin_ql_merchant_categories_feature_inner.rb +0 -230
  69. data/lib/fuse_client/models/fin_ql_merchant_categories_feature_inner_result_inner.rb +0 -228
  70. data/lib/fuse_client/models/fin_ql_prompt_request.rb +0 -276
  71. data/lib/fuse_client/models/fin_ql_prompt_response.rb +0 -234
  72. data/lib/fuse_client/models/fin_ql_time_based_feature_inner.rb +0 -228
  73. data/spec/models/fin_ql_comparison_feature_spec.rb +0 -58
  74. data/spec/models/fin_ql_feature_one_of1_spec.rb +0 -34
  75. data/spec/models/fin_ql_feature_one_of2_spec.rb +0 -34
  76. data/spec/models/fin_ql_feature_one_of3_spec.rb +0 -34
  77. data/spec/models/fin_ql_feature_one_of4_spec.rb +0 -34
  78. data/spec/models/fin_ql_feature_one_of5_spec.rb +0 -34
  79. data/spec/models/fin_ql_feature_one_of6_spec.rb +0 -34
  80. data/spec/models/fin_ql_feature_one_of7_spec.rb +0 -34
  81. data/spec/models/fin_ql_feature_one_of_spec.rb +0 -34
  82. data/spec/models/fin_ql_feature_request_spec.rb +0 -28
  83. data/spec/models/fin_ql_feature_spec.rb +0 -31
  84. data/spec/models/fin_ql_frequency_feature_spec.rb +0 -44
  85. data/spec/models/fin_ql_individual_merchant_feature_spec.rb +0 -40
  86. data/spec/models/fin_ql_interest_feature_spec.rb +0 -34
  87. data/spec/models/fin_ql_merchant_categories_feature_inner_result_inner_spec.rb +0 -40
  88. data/spec/models/fin_ql_merchant_categories_feature_inner_spec.rb +0 -40
  89. data/spec/models/fin_ql_prompt_request_spec.rb +0 -46
  90. data/spec/models/fin_ql_time_based_feature_inner_spec.rb +0 -40
  91. data/spec/models/fin_ql_top_merchants_feature_inner_spec.rb +0 -46
data/docs/FinQLFeature.md DELETED
@@ -1,61 +0,0 @@
1
- # FuseClient::FinQLFeature
2
-
3
- ## Class instance methods
4
-
5
- ### `openapi_one_of`
6
-
7
- Returns the list of classes defined in oneOf.
8
-
9
- #### Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- FuseClient::FinQLFeature.openapi_one_of
15
- # =>
16
- # [
17
- # :'FinQLFeatureOneOf',
18
- # :'FinQLFeatureOneOf1',
19
- # :'FinQLFeatureOneOf2',
20
- # :'FinQLFeatureOneOf3',
21
- # :'FinQLFeatureOneOf4',
22
- # :'FinQLFeatureOneOf5',
23
- # :'FinQLFeatureOneOf6',
24
- # :'FinQLFeatureOneOf7'
25
- # ]
26
- ```
27
-
28
- ### build
29
-
30
- Find the appropriate object from the `openapi_one_of` list and casts the data into it.
31
-
32
- #### Example
33
-
34
- ```ruby
35
- require 'fuse_client'
36
-
37
- FuseClient::FinQLFeature.build(data)
38
- # => #<FinQLFeatureOneOf:0x00007fdd4aab02a0>
39
-
40
- FuseClient::FinQLFeature.build(data_that_doesnt_match)
41
- # => nil
42
- ```
43
-
44
- #### Parameters
45
-
46
- | Name | Type | Description |
47
- | ---- | ---- | ----------- |
48
- | **data** | **Mixed** | data to be matched against the list of oneOf items |
49
-
50
- #### Return type
51
-
52
- - `FinQLFeatureOneOf`
53
- - `FinQLFeatureOneOf1`
54
- - `FinQLFeatureOneOf2`
55
- - `FinQLFeatureOneOf3`
56
- - `FinQLFeatureOneOf4`
57
- - `FinQLFeatureOneOf5`
58
- - `FinQLFeatureOneOf6`
59
- - `FinQLFeatureOneOf7`
60
- - `nil` (if no type matches)
61
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **text** | **String** | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf.new(
15
- text: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf1
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **individual_merchant** | [**FinQLIndividualMerchantFeature**](FinQLIndividualMerchantFeature.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf1.new(
15
- individual_merchant: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf2
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **time_based** | [**Array&lt;FinQLTimeBasedFeatureInner&gt;**](FinQLTimeBasedFeatureInner.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf2.new(
15
- time_based: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf3
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **interest** | [**FinQLInterestFeature**](FinQLInterestFeature.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf3.new(
15
- interest: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf4
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **frequency** | [**FinQLFrequencyFeature**](FinQLFrequencyFeature.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf4.new(
15
- frequency: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf5
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **top_merchants** | [**Array&lt;FinQLTopMerchantsFeatureInner&gt;**](FinQLTopMerchantsFeatureInner.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf5.new(
15
- top_merchants: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf6
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **comparison** | [**FinQLComparisonFeature**](FinQLComparisonFeature.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf6.new(
15
- comparison: null
16
- )
17
- ```
18
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLFeatureOneOf7
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **merchant_categories** | [**Array&lt;FinQLMerchantCategoriesFeatureInner&gt;**](FinQLMerchantCategoriesFeatureInner.md) | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLFeatureOneOf7.new(
15
- merchant_categories: null
16
- )
17
- ```
18
-
@@ -1,15 +0,0 @@
1
- # FuseClient::FinQLFeatureRequest
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
-
8
- ## Example
9
-
10
- ```ruby
11
- require 'fuse_client'
12
-
13
- instance = FuseClient::FinQLFeatureRequest.new()
14
- ```
15
-
@@ -1,20 +0,0 @@
1
- # FuseClient::FinQLFrequencyFeature
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **time_period** | **String** | | [optional] |
8
- | **frequency** | **Float** | | [optional] |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'fuse_client'
14
-
15
- instance = FuseClient::FinQLFrequencyFeature.new(
16
- time_period: null,
17
- frequency: null
18
- )
19
- ```
20
-
@@ -1,20 +0,0 @@
1
- # FuseClient::FinQLIndividualMerchantFeature
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **merchant** | [**Merchant**](Merchant.md) | | [optional] |
8
- | **value** | **String** | | [optional] |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'fuse_client'
14
-
15
- instance = FuseClient::FinQLIndividualMerchantFeature.new(
16
- merchant: null,
17
- value: null
18
- )
19
- ```
20
-
@@ -1,18 +0,0 @@
1
- # FuseClient::FinQLInterestFeature
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **interest_level** | **Float** | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'fuse_client'
13
-
14
- instance = FuseClient::FinQLInterestFeature.new(
15
- interest_level: null
16
- )
17
- ```
18
-
@@ -1,20 +0,0 @@
1
- # FuseClient::FinQLMerchantCategoriesFeatureInner
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **category** | **String** | | [optional] |
8
- | **result** | [**Array&lt;FinQLMerchantCategoriesFeatureInnerResultInner&gt;**](FinQLMerchantCategoriesFeatureInnerResultInner.md) | | [optional] |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'fuse_client'
14
-
15
- instance = FuseClient::FinQLMerchantCategoriesFeatureInner.new(
16
- category: null,
17
- result: null
18
- )
19
- ```
20
-
@@ -1,20 +0,0 @@
1
- # FuseClient::FinQLMerchantCategoriesFeatureInnerResultInner
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **merchant** | [**Merchant**](Merchant.md) | | [optional] |
8
- | **value** | **String** | | [optional] |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'fuse_client'
14
-
15
- instance = FuseClient::FinQLMerchantCategoriesFeatureInnerResultInner.new(
16
- merchant: null,
17
- value: null
18
- )
19
- ```
20
-
@@ -1,22 +0,0 @@
1
- # FuseClient::FinQLPromptRequest
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **prompt** | **String** | Description of the search in natural language. | |
8
- | **account_id** | **String** | ID of account to be queried | |
9
- | **feature** | [**FinQLFeatureRequest**](FinQLFeatureRequest.md) | | |
10
-
11
- ## Example
12
-
13
- ```ruby
14
- require 'fuse_client'
15
-
16
- instance = FuseClient::FinQLPromptRequest.new(
17
- prompt: null,
18
- account_id: null,
19
- feature: null
20
- )
21
- ```
22
-
@@ -1,20 +0,0 @@
1
- # FuseClient::FinQLPromptResponse
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **feature** | [**FinQLFeature**](FinQLFeature.md) | | [optional] |
8
- | **request_id** | **String** | An identifier that is exclusive to the request and can serve as a means for investigating and resolving issues. | |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'fuse_client'
14
-
15
- instance = FuseClient::FinQLPromptResponse.new(
16
- feature: null,
17
- request_id: null
18
- )
19
- ```
20
-
@@ -1,20 +0,0 @@
1
- # FuseClient::FinQLTimeBasedFeatureInner
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **time_period** | **String** | | [optional] |
8
- | **value** | **Float** | | [optional] |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'fuse_client'
14
-
15
- instance = FuseClient::FinQLTimeBasedFeatureInner.new(
16
- time_period: null,
17
- value: null
18
- )
19
- ```
20
-
@@ -1,22 +0,0 @@
1
- # FuseClient::FinQLTopMerchantsFeatureInner
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **rank** | **Float** | | [optional] |
8
- | **merchant** | [**Merchant**](Merchant.md) | | [optional] |
9
- | **value** | **String** | | [optional] |
10
-
11
- ## Example
12
-
13
- ```ruby
14
- require 'fuse_client'
15
-
16
- instance = FuseClient::FinQLTopMerchantsFeatureInner.new(
17
- rank: null,
18
- merchant: null,
19
- value: null
20
- )
21
- ```
22
-
@@ -1,255 +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 FinQLComparisonFeature
18
- attr_accessor :merchant_a
19
-
20
- attr_accessor :merchant_b
21
-
22
- attr_accessor :comparison_metric
23
-
24
- attr_accessor :value_a
25
-
26
- attr_accessor :value_b
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'merchant_a' => :'merchant_a',
32
- :'merchant_b' => :'merchant_b',
33
- :'comparison_metric' => :'comparison_metric',
34
- :'value_a' => :'value_a',
35
- :'value_b' => :'value_b'
36
- }
37
- end
38
-
39
- # Returns all the JSON keys this model knows about
40
- def self.acceptable_attributes
41
- attribute_map.values
42
- end
43
-
44
- # Attribute type mapping.
45
- def self.openapi_types
46
- {
47
- :'merchant_a' => :'Merchant',
48
- :'merchant_b' => :'Merchant',
49
- :'comparison_metric' => :'String',
50
- :'value_a' => :'String',
51
- :'value_b' => :'String'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::FinQLComparisonFeature` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}) { |(k, v), h|
70
- if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::FinQLComparisonFeature`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
- end
73
- h[k.to_sym] = v
74
- }
75
-
76
- if attributes.key?(:'merchant_a')
77
- self.merchant_a = attributes[:'merchant_a']
78
- end
79
-
80
- if attributes.key?(:'merchant_b')
81
- self.merchant_b = attributes[:'merchant_b']
82
- end
83
-
84
- if attributes.key?(:'comparison_metric')
85
- self.comparison_metric = attributes[:'comparison_metric']
86
- end
87
-
88
- if attributes.key?(:'value_a')
89
- self.value_a = attributes[:'value_a']
90
- end
91
-
92
- if attributes.key?(:'value_b')
93
- self.value_b = attributes[:'value_b']
94
- end
95
- end
96
-
97
- # Show invalid properties with the reasons. Usually used together with valid?
98
- # @return Array for valid properties with the reasons
99
- def list_invalid_properties
100
- invalid_properties = Array.new
101
- invalid_properties
102
- end
103
-
104
- # Check to see if the all the properties in the model are valid
105
- # @return true if the model is valid
106
- def valid?
107
- true
108
- end
109
-
110
- # Checks equality by comparing each attribute.
111
- # @param [Object] Object to be compared
112
- def ==(o)
113
- return true if self.equal?(o)
114
- self.class == o.class &&
115
- merchant_a == o.merchant_a &&
116
- merchant_b == o.merchant_b &&
117
- comparison_metric == o.comparison_metric &&
118
- value_a == o.value_a &&
119
- value_b == o.value_b
120
- end
121
-
122
- # @see the `==` method
123
- # @param [Object] Object to be compared
124
- def eql?(o)
125
- self == o
126
- end
127
-
128
- # Calculates hash code according to all attributes.
129
- # @return [Integer] Hash code
130
- def hash
131
- [merchant_a, merchant_b, comparison_metric, value_a, value_b].hash
132
- end
133
-
134
- # Builds the object from hash
135
- # @param [Hash] attributes Model attributes in the form of hash
136
- # @return [Object] Returns the model itself
137
- def self.build_from_hash(attributes)
138
- new.build_from_hash(attributes)
139
- end
140
-
141
- # Builds the object from hash
142
- # @param [Hash] attributes Model attributes in the form of hash
143
- # @return [Object] Returns the model itself
144
- def build_from_hash(attributes)
145
- return nil unless attributes.is_a?(Hash)
146
- attributes = attributes.transform_keys(&:to_sym)
147
- self.class.openapi_types.each_pair do |key, type|
148
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
149
- self.send("#{key}=", nil)
150
- elsif type =~ /\AArray<(.*)>/i
151
- # check to ensure the input is an array given that the attribute
152
- # is documented as an array but the input is not
153
- if attributes[self.class.attribute_map[key]].is_a?(Array)
154
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
155
- end
156
- elsif !attributes[self.class.attribute_map[key]].nil?
157
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
- end
159
- end
160
-
161
- self
162
- end
163
-
164
- # Deserializes the data based on type
165
- # @param string type Data type
166
- # @param string value Value to be deserialized
167
- # @return [Object] Deserialized data
168
- def _deserialize(type, value)
169
- case type.to_sym
170
- when :Time
171
- Time.parse(value)
172
- when :Date
173
- Date.parse(value)
174
- when :String
175
- value.to_s
176
- when :Integer
177
- value.to_i
178
- when :Float
179
- value.to_f
180
- when :Boolean
181
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
182
- true
183
- else
184
- false
185
- end
186
- when :Object
187
- # generic object (usually a Hash), return directly
188
- value
189
- when /\AArray<(?<inner_type>.+)>\z/
190
- inner_type = Regexp.last_match[:inner_type]
191
- value.map { |v| _deserialize(inner_type, v) }
192
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
193
- k_type = Regexp.last_match[:k_type]
194
- v_type = Regexp.last_match[:v_type]
195
- {}.tap do |hash|
196
- value.each do |k, v|
197
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
- end
199
- end
200
- else # model
201
- # models (e.g. Pet) or oneOf
202
- klass = FuseClient.const_get(type)
203
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
204
- end
205
- end
206
-
207
- # Returns the string representation of the object
208
- # @return [String] String presentation of the object
209
- def to_s
210
- to_hash.to_s
211
- end
212
-
213
- # to_body is an alias to to_hash (backward compatibility)
214
- # @return [Hash] Returns the object in the form of hash
215
- def to_body
216
- to_hash
217
- end
218
-
219
- # Returns the object in the form of hash
220
- # @return [Hash] Returns the object in the form of hash
221
- def to_hash
222
- hash = {}
223
- self.class.attribute_map.each_pair do |attr, param|
224
- value = self.send(attr)
225
- if value.nil?
226
- is_nullable = self.class.openapi_nullable.include?(attr)
227
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
228
- end
229
-
230
- hash[param] = _to_hash(value)
231
- end
232
- hash
233
- end
234
-
235
- # Outputs non-array value in the form of hash
236
- # For object, use to_hash. Otherwise, just return the value
237
- # @param [Object] value Any valid value
238
- # @return [Hash] Returns the value in the form of hash
239
- def _to_hash(value)
240
- if value.is_a?(Array)
241
- value.compact.map { |v| _to_hash(v) }
242
- elsif value.is_a?(Hash)
243
- {}.tap do |hash|
244
- value.each { |k, v| hash[k] = _to_hash(v) }
245
- end
246
- elsif value.respond_to? :to_hash
247
- value.to_hash
248
- else
249
- value
250
- end
251
- end
252
-
253
- end
254
-
255
- end