fuse_client 1.0.33 → 1.0.34

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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +6 -1
  4. data/docs/AddAccountEventsRequest.md +18 -0
  5. data/docs/AddAccountEventsRequestEventsInner.md +51 -0
  6. data/docs/{AddSpendPowerTransactionResponse.md → AddAccountEventsResponse.md} +2 -2
  7. data/docs/AssetReportTransaction.md +1 -1
  8. data/docs/CreateSessionRequest.md +1 -1
  9. data/docs/CreateSpendPowerCustomizationRequest.md +22 -0
  10. data/docs/CreateSpendPowerRequest.md +5 -5
  11. data/docs/CreateSpendPowerResponse.md +1 -1
  12. data/docs/DeleteSpendPowerResponse.md +2 -2
  13. data/docs/EnrichTransactionsRequest.md +18 -0
  14. data/docs/EnrichTransactionsResponse.md +18 -0
  15. data/docs/EnrichedTransaction.md +46 -0
  16. data/docs/EnrichedTransactionLogo.md +18 -0
  17. data/docs/EvalSpendPowerRequest.md +22 -0
  18. data/docs/EvalSpendPowerRequestEventsInner.md +20 -0
  19. data/docs/EvalSpendPowerResponse.md +20 -0
  20. data/docs/ExternalTransactionEvent.md +36 -0
  21. data/docs/ExternalTransactionEventStatus.md +15 -0
  22. data/docs/FinancialConnectionsAccountBalance.md +2 -2
  23. data/docs/FinancialConnectionsAccountCachedBalance.md +2 -2
  24. data/docs/FinancialConnectionsHolding.md +3 -3
  25. data/docs/FinancialConnectionsInvestmentSecurity.md +1 -1
  26. data/docs/FinancialConnectionsInvestmentTransaction.md +5 -3
  27. data/docs/FinancialConnectionsInvestmentTransactionSubtype.md +15 -0
  28. data/docs/FuseApi.md +193 -35
  29. data/docs/GetFinanceScoreResponse.md +20 -0
  30. data/docs/GetInvestmentTransactionsRequest.md +4 -4
  31. data/docs/GetSpendPowerCustomizationResponse.md +20 -0
  32. data/docs/InAppTransactionEvent.md +34 -0
  33. data/docs/InAppTransactionEventStatus.md +15 -0
  34. data/docs/SpendPower.md +6 -6
  35. data/docs/SpendPowerApi.md +87 -44
  36. data/docs/SpendPowerCustomization.md +5 -3
  37. data/docs/SpendPowerTimeFrame.md +15 -0
  38. data/docs/Transaction.md +1 -1
  39. data/docs/TransactionCategory.md +20 -0
  40. data/docs/TransactionCategoryDetailed.md +15 -0
  41. data/docs/TransactionCategoryPrimary.md +15 -0
  42. data/docs/TransactionEventType.md +15 -0
  43. data/docs/TransactionToEnrich.md +26 -0
  44. data/docs/UpdateSpendPowerCustomizationRequest.md +22 -0
  45. data/docs/UpdatedBalanceEvent.md +26 -0
  46. data/lib/fuse_client/api/fuse_api.rb +176 -31
  47. data/lib/fuse_client/api/spend_power_api.rb +78 -52
  48. data/lib/fuse_client/models/add_account_events_request.rb +254 -0
  49. data/lib/fuse_client/models/add_account_events_request_events_inner.rb +106 -0
  50. data/lib/fuse_client/models/{add_spend_power_transaction_response.rb → add_account_events_response.rb} +3 -3
  51. data/lib/fuse_client/models/asset_report_transaction.rb +1 -1
  52. data/lib/fuse_client/models/country_code.rb +2 -1
  53. data/lib/fuse_client/models/create_session_request.rb +1 -1
  54. data/lib/fuse_client/models/create_spend_power_customization_request.rb +314 -0
  55. data/lib/fuse_client/models/create_spend_power_request.rb +22 -22
  56. data/lib/fuse_client/models/create_spend_power_response.rb +1 -1
  57. data/lib/fuse_client/models/delete_spend_power_response.rb +11 -10
  58. data/lib/fuse_client/models/enrich_transactions_request.rb +226 -0
  59. data/lib/fuse_client/models/enrich_transactions_response.rb +222 -0
  60. data/lib/fuse_client/models/enriched_transaction.rb +397 -0
  61. data/lib/fuse_client/models/enriched_transaction_logo.rb +220 -0
  62. data/lib/fuse_client/models/eval_spend_power_request.rb +296 -0
  63. data/lib/fuse_client/models/eval_spend_power_request_events_inner.rb +239 -0
  64. data/lib/fuse_client/models/eval_spend_power_response.rb +230 -0
  65. data/lib/fuse_client/models/external_transaction_event.rb +384 -0
  66. data/lib/fuse_client/models/external_transaction_event_status.rb +40 -0
  67. data/lib/fuse_client/models/financial_connections_account_balance.rb +2 -2
  68. data/lib/fuse_client/models/financial_connections_account_cached_balance.rb +2 -2
  69. data/lib/fuse_client/models/financial_connections_holding.rb +3 -3
  70. data/lib/fuse_client/models/financial_connections_investment_security.rb +1 -1
  71. data/lib/fuse_client/models/financial_connections_investment_transaction.rb +13 -4
  72. data/lib/fuse_client/models/financial_connections_investment_transaction_subtype.rb +87 -0
  73. data/lib/fuse_client/models/fuse_api_error_code.rb +3 -1
  74. data/lib/fuse_client/models/get_finance_score_response.rb +240 -0
  75. data/lib/fuse_client/models/get_investment_transactions_request.rb +37 -9
  76. data/lib/fuse_client/models/get_spend_power_customization_response.rb +239 -0
  77. data/lib/fuse_client/models/in_app_transaction_event.rb +364 -0
  78. data/lib/fuse_client/models/in_app_transaction_event_status.rb +41 -0
  79. data/lib/fuse_client/models/spend_power.rb +18 -18
  80. data/lib/fuse_client/models/spend_power_customization.rb +54 -14
  81. data/lib/fuse_client/models/spend_power_time_frame.rb +41 -0
  82. data/lib/fuse_client/models/transaction.rb +1 -1
  83. data/lib/fuse_client/models/transaction_category.rb +260 -0
  84. data/lib/fuse_client/models/transaction_category_detailed.rb +135 -0
  85. data/lib/fuse_client/models/transaction_category_primary.rb +59 -0
  86. data/lib/fuse_client/models/transaction_event_type.rb +65 -0
  87. data/lib/fuse_client/models/{add_spend_power_transaction_request.rb → transaction_to_enrich.rb} +47 -27
  88. data/lib/fuse_client/models/update_spend_power_customization_request.rb +291 -0
  89. data/lib/fuse_client/models/updated_balance_event.rb +308 -0
  90. data/lib/fuse_client/version.rb +1 -1
  91. data/lib/fuse_client.rb +26 -2
  92. data/spec/api/fuse_api_spec.rb +33 -7
  93. data/spec/api/spend_power_api_spec.rb +14 -17
  94. data/spec/models/add_account_events_request_events_inner_spec.rb +31 -0
  95. data/spec/models/add_account_events_request_spec.rb +34 -0
  96. data/spec/models/{add_spend_power_transaction_response_spec.rb → add_account_events_response_spec.rb} +6 -6
  97. data/spec/models/create_spend_power_customization_request_spec.rb +46 -0
  98. data/spec/models/create_spend_power_request_spec.rb +2 -2
  99. data/spec/models/delete_spend_power_response_spec.rb +1 -1
  100. data/spec/models/enrich_transactions_request_spec.rb +34 -0
  101. data/spec/models/enrich_transactions_response_spec.rb +34 -0
  102. data/spec/models/enriched_transaction_logo_spec.rb +34 -0
  103. data/spec/models/enriched_transaction_spec.rb +122 -0
  104. data/spec/models/eval_spend_power_request_events_inner_spec.rb +40 -0
  105. data/spec/models/eval_spend_power_request_spec.rb +46 -0
  106. data/spec/models/eval_spend_power_response_spec.rb +40 -0
  107. data/spec/models/external_transaction_event_spec.rb +92 -0
  108. data/spec/models/external_transaction_event_status_spec.rb +28 -0
  109. data/spec/models/financial_connections_investment_transaction_spec.rb +6 -0
  110. data/spec/models/financial_connections_investment_transaction_subtype_spec.rb +28 -0
  111. data/spec/models/get_finance_score_response_spec.rb +40 -0
  112. data/spec/models/get_spend_power_customization_response_spec.rb +40 -0
  113. data/spec/models/in_app_transaction_event_spec.rb +86 -0
  114. data/spec/models/in_app_transaction_event_status_spec.rb +28 -0
  115. data/spec/models/spend_power_customization_spec.rb +6 -4
  116. data/spec/models/spend_power_spec.rb +1 -1
  117. data/spec/models/spend_power_time_frame_spec.rb +28 -0
  118. data/spec/models/transaction_category_detailed_spec.rb +28 -0
  119. data/spec/models/transaction_category_primary_spec.rb +28 -0
  120. data/spec/models/transaction_category_spec.rb +40 -0
  121. data/spec/models/transaction_event_type_spec.rb +28 -0
  122. data/spec/models/{add_spend_power_transaction_request_spec.rb → transaction_to_enrich_spec.rb} +23 -11
  123. data/spec/models/update_spend_power_customization_request_spec.rb +46 -0
  124. data/spec/models/updated_balance_event_spec.rb +62 -0
  125. metadata +106 -10
  126. data/docs/AddSpendPowerTransactionRequest.md +0 -22
@@ -0,0 +1,59 @@
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.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FuseClient
17
+ class TransactionCategoryPrimary
18
+ AUTO_AND_TRANSPORT = "auto_and_transport".freeze
19
+ BILLS_AND_UTILITIES = "bills_and_utilities".freeze
20
+ BUSINESS_SERVICES = "business_services".freeze
21
+ EDUCATION = "education".freeze
22
+ ENTERTAINMENT = "entertainment".freeze
23
+ FEES_AND_CHARGES = "fees_and_charges".freeze
24
+ FINANCIAL = "financial".freeze
25
+ FOOD_AND_DINING = "food_and_dining".freeze
26
+ GIFTS_AND_DONATIONS = "gifts_and_donations".freeze
27
+ HEALTH_AND_FITNESS = "health_and_fitness".freeze
28
+ HOME = "home".freeze
29
+ INCOME = "income".freeze
30
+ INVESTMENTS = "investments".freeze
31
+ KIDS = "kids".freeze
32
+ PERSONAL_CARE = "personal_care".freeze
33
+ PETS = "pets".freeze
34
+ SHOPPING = "shopping".freeze
35
+ TAXES = "taxes".freeze
36
+ TRANSFER = "transfer".freeze
37
+ TRAVEL = "travel".freeze
38
+ UNCATEGORIZED = "uncategorized".freeze
39
+
40
+ def self.all_vars
41
+ @all_vars ||= [AUTO_AND_TRANSPORT, BILLS_AND_UTILITIES, BUSINESS_SERVICES, EDUCATION, ENTERTAINMENT, FEES_AND_CHARGES, FINANCIAL, FOOD_AND_DINING, GIFTS_AND_DONATIONS, HEALTH_AND_FITNESS, HOME, INCOME, INVESTMENTS, KIDS, PERSONAL_CARE, PETS, SHOPPING, TAXES, TRANSFER, TRAVEL, UNCATEGORIZED].freeze
42
+ end
43
+
44
+ # Builds the enum from string
45
+ # @param [String] The enum value in the form of the string
46
+ # @return [String] The enum value
47
+ def self.build_from_hash(value)
48
+ new.build_from_hash(value)
49
+ end
50
+
51
+ # Builds the enum from string
52
+ # @param [String] The enum value in the form of the string
53
+ # @return [String] The enum value
54
+ def build_from_hash(value)
55
+ return value if TransactionCategoryPrimary.all_vars.include?(value)
56
+ raise "Invalid ENUM value #{value} for class #TransactionCategoryPrimary"
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,65 @@
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.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FuseClient
17
+ class TransactionEventType
18
+ ACH = "ach".freeze
19
+ ADJUSTMENT = "adjustment".freeze
20
+ ATM = "atm".freeze
21
+ BANK_CHARGE = "bank_charge".freeze
22
+ BILL_PAYMENT = "bill_payment".freeze
23
+ CARD_PAYMENT = "card_payment".freeze
24
+ CASH = "cash".freeze
25
+ CASHBACK = "cashback".freeze
26
+ CHARGE = "charge".freeze
27
+ CHEQUE = "cheque".freeze
28
+ CREDIT = "credit".freeze
29
+ DEBIT = "debit".freeze
30
+ DEPOSIT = "deposit".freeze
31
+ DIGITAL_PAYMENT = "digital_payment".freeze
32
+ DIRECT_DEBIT = "direct_debit".freeze
33
+ FEE = "fee".freeze
34
+ IN_STORE = "in_store".freeze
35
+ INTEREST = "interest".freeze
36
+ ONLINE = "online".freeze
37
+ OTHER = "other".freeze
38
+ PAYMENT = "payment".freeze
39
+ PURCHASE = "purchase".freeze
40
+ STANDING_ORDER = "standing_order".freeze
41
+ TRANSACTION = "transaction".freeze
42
+ TRANSFER = "transfer".freeze
43
+ WIRE = "wire".freeze
44
+ WITHDRAWAL = "withdrawal".freeze
45
+
46
+ def self.all_vars
47
+ @all_vars ||= [ACH, ADJUSTMENT, ATM, BANK_CHARGE, BILL_PAYMENT, CARD_PAYMENT, CASH, CASHBACK, CHARGE, CHEQUE, CREDIT, DEBIT, DEPOSIT, DIGITAL_PAYMENT, DIRECT_DEBIT, FEE, IN_STORE, INTEREST, ONLINE, OTHER, PAYMENT, PURCHASE, STANDING_ORDER, TRANSACTION, TRANSFER, WIRE, WITHDRAWAL].freeze
48
+ end
49
+
50
+ # Builds the enum from string
51
+ # @param [String] The enum value in the form of the string
52
+ # @return [String] The enum value
53
+ def self.build_from_hash(value)
54
+ new.build_from_hash(value)
55
+ end
56
+
57
+ # Builds the enum from string
58
+ # @param [String] The enum value in the form of the string
59
+ # @return [String] The enum value
60
+ def build_from_hash(value)
61
+ return value if TransactionEventType.all_vars.include?(value)
62
+ raise "Invalid ENUM value #{value} for class #TransactionEventType"
63
+ end
64
+ end
65
+ end
@@ -14,16 +14,22 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module FuseClient
17
- class AddSpendPowerTransactionRequest
18
- # Id of the transaction
17
+ class TransactionToEnrich
18
+ # A unique ID for the transaction that to help you tie data back to your systems.
19
19
  attr_accessor :id
20
20
 
21
- # The status of the transaction. This will be either pending, posted or cancelled.
22
- attr_accessor :status
21
+ # The name of the merchant.
22
+ attr_accessor :merchant_name
23
23
 
24
- # The amount of the transaction, in cents. Use positive numbers to represent money going out and negative numbers to represent money coming in.
24
+ # The merchant category code.
25
+ attr_accessor :mcc
26
+
27
+ # The amount of the transaction in cents, in the currency of the account.
25
28
  attr_accessor :amount
26
29
 
30
+ # The type of the transaction
31
+ attr_accessor :type
32
+
27
33
  class EnumAttributeValidator
28
34
  attr_reader :datatype
29
35
  attr_reader :allowable_values
@@ -50,8 +56,10 @@ module FuseClient
50
56
  def self.attribute_map
51
57
  {
52
58
  :'id' => :'id',
53
- :'status' => :'status',
54
- :'amount' => :'amount'
59
+ :'merchant_name' => :'merchant_name',
60
+ :'mcc' => :'mcc',
61
+ :'amount' => :'amount',
62
+ :'type' => :'type'
55
63
  }
56
64
  end
57
65
 
@@ -64,8 +72,10 @@ module FuseClient
64
72
  def self.openapi_types
65
73
  {
66
74
  :'id' => :'String',
67
- :'status' => :'String',
68
- :'amount' => :'String'
75
+ :'merchant_name' => :'String',
76
+ :'mcc' => :'String',
77
+ :'amount' => :'Float',
78
+ :'type' => :'String'
69
79
  }
70
80
  end
71
81
 
@@ -79,13 +89,13 @@ module FuseClient
79
89
  # @param [Hash] attributes Model attributes in the form of hash
80
90
  def initialize(attributes = {})
81
91
  if (!attributes.is_a?(Hash))
82
- fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::AddSpendPowerTransactionRequest` initialize method"
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::TransactionToEnrich` initialize method"
83
93
  end
84
94
 
85
95
  # check to see if the attribute exists and convert string to symbol for hash key
86
96
  attributes = attributes.each_with_object({}) { |(k, v), h|
87
97
  if (!self.class.attribute_map.key?(k.to_sym))
88
- fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::AddSpendPowerTransactionRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::TransactionToEnrich`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
99
  end
90
100
  h[k.to_sym] = v
91
101
  }
@@ -94,13 +104,21 @@ module FuseClient
94
104
  self.id = attributes[:'id']
95
105
  end
96
106
 
97
- if attributes.key?(:'status')
98
- self.status = attributes[:'status']
107
+ if attributes.key?(:'merchant_name')
108
+ self.merchant_name = attributes[:'merchant_name']
109
+ end
110
+
111
+ if attributes.key?(:'mcc')
112
+ self.mcc = attributes[:'mcc']
99
113
  end
100
114
 
101
115
  if attributes.key?(:'amount')
102
116
  self.amount = attributes[:'amount']
103
117
  end
118
+
119
+ if attributes.key?(:'type')
120
+ self.type = attributes[:'type']
121
+ end
104
122
  end
105
123
 
106
124
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -111,8 +129,8 @@ module FuseClient
111
129
  invalid_properties.push('invalid value for "id", id cannot be nil.')
112
130
  end
113
131
 
114
- if @status.nil?
115
- invalid_properties.push('invalid value for "status", status cannot be nil.')
132
+ if @merchant_name.nil?
133
+ invalid_properties.push('invalid value for "merchant_name", merchant_name cannot be nil.')
116
134
  end
117
135
 
118
136
  invalid_properties
@@ -122,20 +140,20 @@ module FuseClient
122
140
  # @return true if the model is valid
123
141
  def valid?
124
142
  return false if @id.nil?
125
- return false if @status.nil?
126
- status_validator = EnumAttributeValidator.new('String', ["pending", "posted", "cancelled"])
127
- return false unless status_validator.valid?(@status)
143
+ return false if @merchant_name.nil?
144
+ type_validator = EnumAttributeValidator.new('String', ["debit", "credit"])
145
+ return false unless type_validator.valid?(@type)
128
146
  true
129
147
  end
130
148
 
131
149
  # Custom attribute writer method checking allowed values (enum).
132
- # @param [Object] status Object to be assigned
133
- def status=(status)
134
- validator = EnumAttributeValidator.new('String', ["pending", "posted", "cancelled"])
135
- unless validator.valid?(status)
136
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
150
+ # @param [Object] type Object to be assigned
151
+ def type=(type)
152
+ validator = EnumAttributeValidator.new('String', ["debit", "credit"])
153
+ unless validator.valid?(type)
154
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
137
155
  end
138
- @status = status
156
+ @type = type
139
157
  end
140
158
 
141
159
  # Checks equality by comparing each attribute.
@@ -144,8 +162,10 @@ module FuseClient
144
162
  return true if self.equal?(o)
145
163
  self.class == o.class &&
146
164
  id == o.id &&
147
- status == o.status &&
148
- amount == o.amount
165
+ merchant_name == o.merchant_name &&
166
+ mcc == o.mcc &&
167
+ amount == o.amount &&
168
+ type == o.type
149
169
  end
150
170
 
151
171
  # @see the `==` method
@@ -157,7 +177,7 @@ module FuseClient
157
177
  # Calculates hash code according to all attributes.
158
178
  # @return [Integer] Hash code
159
179
  def hash
160
- [id, status, amount].hash
180
+ [id, merchant_name, mcc, amount, type].hash
161
181
  end
162
182
 
163
183
  # Builds the object from hash
@@ -0,0 +1,291 @@
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.5.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module FuseClient
17
+ class UpdateSpendPowerCustomizationRequest
18
+ attr_accessor :timeframe
19
+
20
+ # The minimum allowed limit for the spend power, in cents.
21
+ attr_accessor :min_limit
22
+
23
+ # The maximum allowed limit for the spend power, in cents.
24
+ attr_accessor :max_limit
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'timeframe' => :'timeframe',
52
+ :'min_limit' => :'min_limit',
53
+ :'max_limit' => :'max_limit'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'timeframe' => :'SpendPowerTimeFrame',
66
+ :'min_limit' => :'Float',
67
+ :'max_limit' => :'Float'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.openapi_nullable
73
+ Set.new([
74
+ ])
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ if (!attributes.is_a?(Hash))
81
+ fail ArgumentError, "The input argument (attributes) must be a hash in `FuseClient::UpdateSpendPowerCustomizationRequest` initialize method"
82
+ end
83
+
84
+ # check to see if the attribute exists and convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!self.class.attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `FuseClient::UpdateSpendPowerCustomizationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'timeframe')
93
+ self.timeframe = attributes[:'timeframe']
94
+ end
95
+
96
+ if attributes.key?(:'min_limit')
97
+ self.min_limit = attributes[:'min_limit']
98
+ end
99
+
100
+ if attributes.key?(:'max_limit')
101
+ self.max_limit = attributes[:'max_limit']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ invalid_properties = Array.new
109
+ if !@min_limit.nil? && @min_limit < 0
110
+ invalid_properties.push('invalid value for "min_limit", must be greater than or equal to 0.')
111
+ end
112
+
113
+ if !@max_limit.nil? && @max_limit < 1
114
+ invalid_properties.push('invalid value for "max_limit", must be greater than or equal to 1.')
115
+ end
116
+
117
+ invalid_properties
118
+ end
119
+
120
+ # Check to see if the all the properties in the model are valid
121
+ # @return true if the model is valid
122
+ def valid?
123
+ return false if !@min_limit.nil? && @min_limit < 0
124
+ return false if !@max_limit.nil? && @max_limit < 1
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] min_limit Value to be assigned
130
+ def min_limit=(min_limit)
131
+ if !min_limit.nil? && min_limit < 0
132
+ fail ArgumentError, 'invalid value for "min_limit", must be greater than or equal to 0.'
133
+ end
134
+
135
+ @min_limit = min_limit
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] max_limit Value to be assigned
140
+ def max_limit=(max_limit)
141
+ if !max_limit.nil? && max_limit < 1
142
+ fail ArgumentError, 'invalid value for "max_limit", must be greater than or equal to 1.'
143
+ end
144
+
145
+ @max_limit = max_limit
146
+ end
147
+
148
+ # Checks equality by comparing each attribute.
149
+ # @param [Object] Object to be compared
150
+ def ==(o)
151
+ return true if self.equal?(o)
152
+ self.class == o.class &&
153
+ timeframe == o.timeframe &&
154
+ min_limit == o.min_limit &&
155
+ max_limit == o.max_limit
156
+ end
157
+
158
+ # @see the `==` method
159
+ # @param [Object] Object to be compared
160
+ def eql?(o)
161
+ self == o
162
+ end
163
+
164
+ # Calculates hash code according to all attributes.
165
+ # @return [Integer] Hash code
166
+ def hash
167
+ [timeframe, min_limit, max_limit].hash
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def self.build_from_hash(attributes)
174
+ new.build_from_hash(attributes)
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def build_from_hash(attributes)
181
+ return nil unless attributes.is_a?(Hash)
182
+ attributes = attributes.transform_keys(&:to_sym)
183
+ self.class.openapi_types.each_pair do |key, type|
184
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
185
+ self.send("#{key}=", nil)
186
+ elsif type =~ /\AArray<(.*)>/i
187
+ # check to ensure the input is an array given that the attribute
188
+ # is documented as an array but the input is not
189
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
190
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
191
+ end
192
+ elsif !attributes[self.class.attribute_map[key]].nil?
193
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
194
+ end
195
+ end
196
+
197
+ self
198
+ end
199
+
200
+ # Deserializes the data based on type
201
+ # @param string type Data type
202
+ # @param string value Value to be deserialized
203
+ # @return [Object] Deserialized data
204
+ def _deserialize(type, value)
205
+ case type.to_sym
206
+ when :Time
207
+ Time.parse(value)
208
+ when :Date
209
+ Date.parse(value)
210
+ when :String
211
+ value.to_s
212
+ when :Integer
213
+ value.to_i
214
+ when :Float
215
+ value.to_f
216
+ when :Boolean
217
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
218
+ true
219
+ else
220
+ false
221
+ end
222
+ when :Object
223
+ # generic object (usually a Hash), return directly
224
+ value
225
+ when /\AArray<(?<inner_type>.+)>\z/
226
+ inner_type = Regexp.last_match[:inner_type]
227
+ value.map { |v| _deserialize(inner_type, v) }
228
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
229
+ k_type = Regexp.last_match[:k_type]
230
+ v_type = Regexp.last_match[:v_type]
231
+ {}.tap do |hash|
232
+ value.each do |k, v|
233
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
234
+ end
235
+ end
236
+ else # model
237
+ # models (e.g. Pet) or oneOf
238
+ klass = FuseClient.const_get(type)
239
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
240
+ end
241
+ end
242
+
243
+ # Returns the string representation of the object
244
+ # @return [String] String presentation of the object
245
+ def to_s
246
+ to_hash.to_s
247
+ end
248
+
249
+ # to_body is an alias to to_hash (backward compatibility)
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_body
252
+ to_hash
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ # Outputs non-array value in the form of hash
272
+ # For object, use to_hash. Otherwise, just return the value
273
+ # @param [Object] value Any valid value
274
+ # @return [Hash] Returns the value in the form of hash
275
+ def _to_hash(value)
276
+ if value.is_a?(Array)
277
+ value.compact.map { |v| _to_hash(v) }
278
+ elsif value.is_a?(Hash)
279
+ {}.tap do |hash|
280
+ value.each { |k, v| hash[k] = _to_hash(v) }
281
+ end
282
+ elsif value.respond_to? :to_hash
283
+ value.to_hash
284
+ else
285
+ value
286
+ end
287
+ end
288
+
289
+ end
290
+
291
+ end