moneykit 0.1.10 → 0.1.11

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 (147) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +1 -1
  4. data/docs/AccessTokenApi.md +26 -21
  5. data/docs/AccountBalances.md +2 -2
  6. data/docs/AccountGroup.md +1 -1
  7. data/docs/AccountIdentity.md +2 -0
  8. data/docs/AccountImportData.md +26 -0
  9. data/docs/AccountResponse.md +28 -0
  10. data/docs/AccountWithAccountNumbersLegacy20230218.md +2 -0
  11. data/docs/Address.md +1 -1
  12. data/docs/AppClientResponse.md +2 -2
  13. data/docs/AppLinkStateChangedWebhook.md +36 -0
  14. data/docs/AppResponse.md +2 -2
  15. data/docs/Body.md +3 -3
  16. data/docs/CreateAccessTokenResponse.md +22 -0
  17. data/docs/CreateLinkSessionRequest.md +1 -1
  18. data/docs/CustomerUser.md +22 -0
  19. data/docs/CustomerUserEmail.md +20 -0
  20. data/docs/CustomerUserPhone.md +22 -0
  21. data/docs/Date.md +15 -0
  22. data/docs/Email.md +1 -1
  23. data/docs/GetAccountResponse.md +1 -1
  24. data/docs/GetAccountsResponse.md +1 -1
  25. data/docs/GetHoldingsResponse.md +1 -1
  26. data/docs/GetInvestmentTransactionsResponse.md +1 -1
  27. data/docs/GetTransactionsResponse.md +2 -2
  28. data/docs/GetUserTransactionsResponse.md +1 -1
  29. data/docs/ImportLinkRequest.md +26 -0
  30. data/docs/Institution.md +1 -1
  31. data/docs/LinkCommon.md +3 -3
  32. data/docs/LinkProductError.md +15 -0
  33. data/docs/LinkProductRefreshWebhook.md +2 -2
  34. data/docs/LinkProductResponse.md +28 -0
  35. data/docs/LinkProducts.md +7 -5
  36. data/docs/LinkResponse.md +3 -3
  37. data/docs/LinkSessionApi.md +1 -1
  38. data/docs/LinksApi.md +79 -9
  39. data/docs/PhoneNumber.md +1 -1
  40. data/docs/PublicLinkState.md +15 -0
  41. data/docs/Response401DeleteLinkLinksIdDelete.md +22 -0
  42. data/docs/Response401GetTransactionsSyncLinksIdTransactionsSyncGet.md +22 -0
  43. data/docs/Response401ImportLinkLinksImportPost.md +22 -0
  44. data/docs/ResponseHandleLinkWebhookEventRequestBodyWebhookPost.md +3 -3
  45. data/docs/TransactionCategoryResponse.md +20 -0
  46. data/docs/TransactionEnrichmentResponse.md +26 -0
  47. data/docs/TransactionImportData.md +28 -0
  48. data/docs/TransactionMerchantResponse.md +24 -0
  49. data/docs/TransactionProcessorResponse.md +24 -0
  50. data/docs/TransactionRecurrenceResponse.md +20 -0
  51. data/docs/TransactionResponse.md +42 -0
  52. data/docs/TransactionSubcategoryResponse.md +20 -0
  53. data/docs/TransactionSync.md +22 -0
  54. data/docs/TransactionSyncResponse.md +1 -1
  55. data/docs/TransactionUpdatesAvailableWebhook.md +4 -2
  56. data/docs/TransactionsApi.md +15 -15
  57. data/docs/TransactionsLinkProduct.md +1 -1
  58. data/lib/moneykit/api/access_token_api.rb +19 -16
  59. data/lib/moneykit/api/links_api.rb +75 -7
  60. data/lib/moneykit/api/transactions_api.rb +17 -17
  61. data/lib/moneykit/models/account_balances.rb +2 -30
  62. data/lib/moneykit/models/account_group.rb +1 -1
  63. data/lib/moneykit/models/account_identity.rb +11 -1
  64. data/lib/moneykit/models/account_import_data.rb +280 -0
  65. data/lib/moneykit/models/account_response.rb +290 -0
  66. data/lib/moneykit/models/account_with_account_numbers_legacy20230218.rb +11 -1
  67. data/lib/moneykit/models/address.rb +0 -2
  68. data/lib/moneykit/models/app_client_response.rb +1 -1
  69. data/lib/moneykit/models/app_link_state_changed_webhook.rb +394 -0
  70. data/lib/moneykit/models/body.rb +1 -1
  71. data/lib/moneykit/models/create_access_token_response.rb +255 -0
  72. data/lib/moneykit/models/create_link_session_request.rb +1 -1
  73. data/lib/moneykit/models/customer_user.rb +266 -0
  74. data/lib/moneykit/models/customer_user_email.rb +258 -0
  75. data/lib/moneykit/models/customer_user_phone.rb +289 -0
  76. data/lib/moneykit/models/date.rb +104 -0
  77. data/lib/moneykit/models/email.rb +0 -2
  78. data/lib/moneykit/models/get_account_response.rb +1 -1
  79. data/lib/moneykit/models/get_accounts_response.rb +1 -1
  80. data/lib/moneykit/models/get_holdings_response.rb +1 -1
  81. data/lib/moneykit/models/get_investment_transactions_response.rb +1 -1
  82. data/lib/moneykit/models/get_transactions_response.rb +2 -2
  83. data/lib/moneykit/models/get_user_transactions_response.rb +1 -1
  84. data/lib/moneykit/models/import_link_request.rb +303 -0
  85. data/lib/moneykit/models/institution.rb +0 -7
  86. data/lib/moneykit/models/link_common.rb +3 -3
  87. data/lib/moneykit/models/link_product_error.rb +46 -0
  88. data/lib/moneykit/models/link_product_refresh_webhook.rb +24 -24
  89. data/lib/moneykit/models/link_product_response.rb +283 -0
  90. data/lib/moneykit/models/link_product_state.rb +3 -1
  91. data/lib/moneykit/models/link_products.rb +16 -7
  92. data/lib/moneykit/models/link_response.rb +3 -3
  93. data/lib/moneykit/models/phone_number.rb +0 -2
  94. data/lib/moneykit/models/product.rb +2 -1
  95. data/lib/moneykit/models/provider.rb +1 -2
  96. data/lib/moneykit/models/public_link_error.rb +1 -1
  97. data/lib/moneykit/models/public_link_state.rb +43 -0
  98. data/lib/moneykit/models/response401_delete_link_links_id_delete.rb +104 -0
  99. data/lib/moneykit/models/response401_get_transactions_sync_links_id_transactions_sync_get.rb +104 -0
  100. data/lib/moneykit/models/response401_import_link_links_import_post.rb +103 -0
  101. data/lib/moneykit/models/response_handle_link_webhook_event_request_body_webhook_post.rb +1 -1
  102. data/lib/moneykit/models/transaction_category_response.rb +230 -0
  103. data/lib/moneykit/models/transaction_enrichment_response.rb +255 -0
  104. data/lib/moneykit/models/transaction_import_data.rb +283 -0
  105. data/lib/moneykit/models/transaction_merchant_response.rb +243 -0
  106. data/lib/moneykit/models/transaction_processor_response.rb +243 -0
  107. data/lib/moneykit/models/transaction_recurrence_response.rb +223 -0
  108. data/lib/moneykit/models/transaction_response.rb +402 -0
  109. data/lib/moneykit/models/transaction_subcategory_response.rb +230 -0
  110. data/lib/moneykit/models/transaction_sync.rb +257 -0
  111. data/lib/moneykit/models/transaction_sync_response.rb +1 -1
  112. data/lib/moneykit/models/transaction_updates_available_webhook.rb +42 -24
  113. data/lib/moneykit/models/transactions_link_product.rb +1 -1
  114. data/lib/moneykit/version.rb +1 -1
  115. data/lib/moneykit.rb +25 -16
  116. data/spec/models/account_import_data_spec.rb +60 -0
  117. data/spec/models/account_response_spec.rb +66 -0
  118. data/spec/models/app_link_state_changed_webhook_spec.rb +102 -0
  119. data/spec/models/create_access_token_response_spec.rb +48 -0
  120. data/spec/models/customer_user_email_spec.rb +42 -0
  121. data/spec/models/customer_user_phone_spec.rb +48 -0
  122. data/spec/models/customer_user_spec.rb +48 -0
  123. data/spec/models/date_spec.rb +21 -0
  124. data/spec/models/import_link_request_spec.rb +60 -0
  125. data/spec/models/link_product_error_spec.rb +30 -0
  126. data/spec/models/link_product_response_spec.rb +66 -0
  127. data/spec/models/public_link_error_spec.rb +30 -0
  128. data/spec/models/public_link_state_spec.rb +30 -0
  129. data/spec/models/response401_delete_link_links_id_delete_spec.rb +21 -0
  130. data/spec/models/response401_get_transactions_sync_links_id_transactions_sync_get_spec.rb +21 -0
  131. data/spec/models/response401_import_link_links_import_post_spec.rb +21 -0
  132. data/spec/models/transaction_category_response_spec.rb +42 -0
  133. data/spec/models/transaction_enrichment_response_spec.rb +60 -0
  134. data/spec/models/transaction_import_data_spec.rb +66 -0
  135. data/spec/models/transaction_merchant_response_spec.rb +54 -0
  136. data/spec/models/transaction_processor_response_spec.rb +54 -0
  137. data/spec/models/transaction_recurrence_response_spec.rb +42 -0
  138. data/spec/models/transaction_response_spec.rb +108 -0
  139. data/spec/models/transaction_subcategory_response_spec.rb +42 -0
  140. data/spec/models/transaction_sync_spec.rb +48 -0
  141. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  142. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  143. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
  144. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/mkmf.log +2 -2
  145. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
  146. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
  147. metadata +219 -121
@@ -0,0 +1,303 @@
1
+ =begin
2
+ #MoneyKit API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2023-02-18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MoneyKit
17
+ class ImportLinkRequest
18
+ attr_accessor :customer_user
19
+
20
+ attr_accessor :provider
21
+
22
+ # MoneyKit's unique ID for this institution. If the imported link is synced with a data provider later, it will be connected to this institution.
23
+ attr_accessor :institution_id
24
+
25
+ attr_accessor :accounts
26
+
27
+ attr_accessor :transactions
28
+
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'customer_user' => :'customer_user',
55
+ :'provider' => :'provider',
56
+ :'institution_id' => :'institution_id',
57
+ :'accounts' => :'accounts',
58
+ :'transactions' => :'transactions'
59
+ }
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'customer_user' => :'CustomerUser',
71
+ :'provider' => :'Provider',
72
+ :'institution_id' => :'String',
73
+ :'accounts' => :'Array<AccountImportData>',
74
+ :'transactions' => :'Array<TransactionImportData>'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::ImportLinkRequest` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!self.class.attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::ImportLinkRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'customer_user')
100
+ self.customer_user = attributes[:'customer_user']
101
+ else
102
+ self.customer_user = nil
103
+ end
104
+
105
+ if attributes.key?(:'provider')
106
+ self.provider = attributes[:'provider']
107
+ end
108
+
109
+ if attributes.key?(:'institution_id')
110
+ self.institution_id = attributes[:'institution_id']
111
+ else
112
+ self.institution_id = nil
113
+ end
114
+
115
+ if attributes.key?(:'accounts')
116
+ if (value = attributes[:'accounts']).is_a?(Array)
117
+ self.accounts = value
118
+ end
119
+ else
120
+ self.accounts = nil
121
+ end
122
+
123
+ if attributes.key?(:'transactions')
124
+ if (value = attributes[:'transactions']).is_a?(Array)
125
+ self.transactions = value
126
+ end
127
+ else
128
+ self.transactions = nil
129
+ end
130
+ end
131
+
132
+ # Show invalid properties with the reasons. Usually used together with valid?
133
+ # @return Array for valid properties with the reasons
134
+ def list_invalid_properties
135
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
136
+ invalid_properties = Array.new
137
+ if @customer_user.nil?
138
+ invalid_properties.push('invalid value for "customer_user", customer_user cannot be nil.')
139
+ end
140
+
141
+ if @institution_id.nil?
142
+ invalid_properties.push('invalid value for "institution_id", institution_id cannot be nil.')
143
+ end
144
+
145
+ if @accounts.nil?
146
+ invalid_properties.push('invalid value for "accounts", accounts cannot be nil.')
147
+ end
148
+
149
+ if @transactions.nil?
150
+ invalid_properties.push('invalid value for "transactions", transactions cannot be nil.')
151
+ end
152
+
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ warn '[DEPRECATED] the `valid?` method is obsolete'
160
+ return false if @customer_user.nil?
161
+ return false if @institution_id.nil?
162
+ return false if @accounts.nil?
163
+ return false if @transactions.nil?
164
+ true
165
+ end
166
+
167
+ # Checks equality by comparing each attribute.
168
+ # @param [Object] Object to be compared
169
+ def ==(o)
170
+ return true if self.equal?(o)
171
+ self.class == o.class &&
172
+ customer_user == o.customer_user &&
173
+ provider == o.provider &&
174
+ institution_id == o.institution_id &&
175
+ accounts == o.accounts &&
176
+ transactions == o.transactions
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Integer] Hash code
187
+ def hash
188
+ [customer_user, provider, institution_id, accounts, transactions].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def self.build_from_hash(attributes)
195
+ return nil unless attributes.is_a?(Hash)
196
+ attributes = attributes.transform_keys(&:to_sym)
197
+ transformed_hash = {}
198
+ openapi_types.each_pair do |key, type|
199
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
200
+ transformed_hash["#{key}"] = nil
201
+ elsif type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[attribute_map[key]].is_a?(Array)
205
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
206
+ end
207
+ elsif !attributes[attribute_map[key]].nil?
208
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
209
+ end
210
+ end
211
+ new(transformed_hash)
212
+ end
213
+
214
+ # Deserializes the data based on type
215
+ # @param string type Data type
216
+ # @param string value Value to be deserialized
217
+ # @return [Object] Deserialized data
218
+ def self._deserialize(type, value)
219
+ case type.to_sym
220
+ when :Time
221
+ Time.parse(value)
222
+ when :Date
223
+ Date.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet) or oneOf
252
+ klass = MoneyKit.const_get(type)
253
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.openapi_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+ end
303
+ end
@@ -145,8 +145,6 @@ module MoneyKit
145
145
 
146
146
  if attributes.key?(:'color')
147
147
  self.color = attributes[:'color']
148
- else
149
- self.color = nil
150
148
  end
151
149
 
152
150
  if attributes.key?(:'color_dark')
@@ -181,10 +179,6 @@ module MoneyKit
181
179
  invalid_properties.push('invalid value for "country", country cannot be nil.')
182
180
  end
183
181
 
184
- if @color.nil?
185
- invalid_properties.push('invalid value for "color", color cannot be nil.')
186
- end
187
-
188
182
  if @is_featured.nil?
189
183
  invalid_properties.push('invalid value for "is_featured", is_featured cannot be nil.')
190
184
  end
@@ -200,7 +194,6 @@ module MoneyKit
200
194
  return false if @institution_id_aliases.nil?
201
195
  return false if @name.nil?
202
196
  return false if @country.nil?
203
- return false if @color.nil?
204
197
  return false if @is_featured.nil?
205
198
  true
206
199
  end
@@ -31,7 +31,7 @@ module MoneyKit
31
31
 
32
32
  attr_accessor :error_code
33
33
 
34
- # An ISO-8601 timestamp indicating the last time that the account was updated.
34
+ # (Deprecated) An ISO-8601 timestamp indicating the last time that the link was updated.
35
35
  attr_accessor :last_synced_at
36
36
 
37
37
  attr_accessor :tags
@@ -90,8 +90,8 @@ module MoneyKit
90
90
  :'institution_id' => :'String',
91
91
  :'institution_name' => :'String',
92
92
  :'institution_avatar' => :'String',
93
- :'state' => :'LinkState',
94
- :'error_code' => :'LinkError',
93
+ :'state' => :'PublicLinkState',
94
+ :'error_code' => :'PublicLinkError',
95
95
  :'last_synced_at' => :'Time',
96
96
  :'tags' => :'Array<String>',
97
97
  :'products' => :'LinkProducts',
@@ -0,0 +1,46 @@
1
+ =begin
2
+ #MoneyKit API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2023-02-18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MoneyKit
17
+ class LinkProductError
18
+ RATE_LIMIT = "rate_limit".freeze
19
+ AUTH_EXPIRED = "auth_expired".freeze
20
+ INVALID_CREDENTIALS = "invalid_credentials".freeze
21
+ NOT_SUPPORTED = "not_supported".freeze
22
+ TIMEOUT = "timeout".freeze
23
+ UNKNOWN = "unknown".freeze
24
+ NO_ACCOUNTS = "no_accounts".freeze
25
+ INSTITUTION_ERROR = "institution_error".freeze
26
+
27
+ def self.all_vars
28
+ @all_vars ||= [RATE_LIMIT, AUTH_EXPIRED, INVALID_CREDENTIALS, NOT_SUPPORTED, TIMEOUT, UNKNOWN, NO_ACCOUNTS, INSTITUTION_ERROR].freeze
29
+ end
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def self.build_from_hash(value)
35
+ new.build_from_hash(value)
36
+ end
37
+
38
+ # Builds the enum from string
39
+ # @param [String] The enum value in the form of the string
40
+ # @return [String] The enum value
41
+ def build_from_hash(value)
42
+ return value if LinkProductError.all_vars.include?(value)
43
+ raise "Invalid ENUM value #{value} for class #LinkProductError"
44
+ end
45
+ end
46
+ end
@@ -15,8 +15,6 @@ require 'time'
15
15
 
16
16
  module MoneyKit
17
17
  class LinkProductRefreshWebhook
18
- attr_accessor :webhook_event
19
-
20
18
  attr_accessor :webhook_major_version
21
19
 
22
20
  attr_accessor :webhook_minor_version
@@ -29,6 +27,8 @@ module MoneyKit
29
27
 
30
28
  attr_accessor :link_tags
31
29
 
30
+ attr_accessor :webhook_event
31
+
32
32
  attr_accessor :product
33
33
 
34
34
  attr_accessor :state
@@ -62,13 +62,13 @@ module MoneyKit
62
62
  # Attribute mapping from ruby-style variable name to JSON key.
63
63
  def self.attribute_map
64
64
  {
65
- :'webhook_event' => :'webhook_event',
66
65
  :'webhook_major_version' => :'webhook_major_version',
67
66
  :'webhook_minor_version' => :'webhook_minor_version',
68
67
  :'webhook_idempotency_key' => :'webhook_idempotency_key',
69
68
  :'webhook_timestamp' => :'webhook_timestamp',
70
69
  :'link_id' => :'link_id',
71
70
  :'link_tags' => :'link_tags',
71
+ :'webhook_event' => :'webhook_event',
72
72
  :'product' => :'product',
73
73
  :'state' => :'state',
74
74
  :'state_changed_at' => :'state_changed_at',
@@ -84,13 +84,13 @@ module MoneyKit
84
84
  # Attribute type mapping.
85
85
  def self.openapi_types
86
86
  {
87
- :'webhook_event' => :'String',
88
87
  :'webhook_major_version' => :'Integer',
89
88
  :'webhook_minor_version' => :'Integer',
90
89
  :'webhook_idempotency_key' => :'String',
91
90
  :'webhook_timestamp' => :'Time',
92
91
  :'link_id' => :'String',
93
92
  :'link_tags' => :'Array<String>',
93
+ :'webhook_event' => :'String',
94
94
  :'product' => :'Product',
95
95
  :'state' => :'LinkProductState',
96
96
  :'state_changed_at' => :'Time',
@@ -119,12 +119,6 @@ module MoneyKit
119
119
  h[k.to_sym] = v
120
120
  }
121
121
 
122
- if attributes.key?(:'webhook_event')
123
- self.webhook_event = attributes[:'webhook_event']
124
- else
125
- self.webhook_event = 'link.product_refresh'
126
- end
127
-
128
122
  if attributes.key?(:'webhook_major_version')
129
123
  self.webhook_major_version = attributes[:'webhook_major_version']
130
124
  else
@@ -163,6 +157,12 @@ module MoneyKit
163
157
  self.link_tags = nil
164
158
  end
165
159
 
160
+ if attributes.key?(:'webhook_event')
161
+ self.webhook_event = attributes[:'webhook_event']
162
+ else
163
+ self.webhook_event = 'link.product_refresh'
164
+ end
165
+
166
166
  if attributes.key?(:'product')
167
167
  self.product = attributes[:'product']
168
168
  else
@@ -226,8 +226,6 @@ module MoneyKit
226
226
  # @return true if the model is valid
227
227
  def valid?
228
228
  warn '[DEPRECATED] the `valid?` method is obsolete'
229
- webhook_event_validator = EnumAttributeValidator.new('String', ["link.product_refresh"])
230
- return false unless webhook_event_validator.valid?(@webhook_event)
231
229
  webhook_major_version_validator = EnumAttributeValidator.new('Integer', [1])
232
230
  return false unless webhook_major_version_validator.valid?(@webhook_major_version)
233
231
  webhook_minor_version_validator = EnumAttributeValidator.new('Integer', [0])
@@ -236,22 +234,14 @@ module MoneyKit
236
234
  return false if @webhook_timestamp.nil?
237
235
  return false if @link_id.nil?
238
236
  return false if @link_tags.nil?
237
+ webhook_event_validator = EnumAttributeValidator.new('String', ["link.product_refresh"])
238
+ return false unless webhook_event_validator.valid?(@webhook_event)
239
239
  return false if @product.nil?
240
240
  return false if @state.nil?
241
241
  return false if @state_changed_at.nil?
242
242
  true
243
243
  end
244
244
 
245
- # Custom attribute writer method checking allowed values (enum).
246
- # @param [Object] webhook_event Object to be assigned
247
- def webhook_event=(webhook_event)
248
- validator = EnumAttributeValidator.new('String', ["link.product_refresh"])
249
- unless validator.valid?(webhook_event)
250
- fail ArgumentError, "invalid value for \"webhook_event\", must be one of #{validator.allowable_values}."
251
- end
252
- @webhook_event = webhook_event
253
- end
254
-
255
245
  # Custom attribute writer method checking allowed values (enum).
256
246
  # @param [Object] webhook_major_version Object to be assigned
257
247
  def webhook_major_version=(webhook_major_version)
@@ -272,18 +262,28 @@ module MoneyKit
272
262
  @webhook_minor_version = webhook_minor_version
273
263
  end
274
264
 
265
+ # Custom attribute writer method checking allowed values (enum).
266
+ # @param [Object] webhook_event Object to be assigned
267
+ def webhook_event=(webhook_event)
268
+ validator = EnumAttributeValidator.new('String', ["link.product_refresh"])
269
+ unless validator.valid?(webhook_event)
270
+ fail ArgumentError, "invalid value for \"webhook_event\", must be one of #{validator.allowable_values}."
271
+ end
272
+ @webhook_event = webhook_event
273
+ end
274
+
275
275
  # Checks equality by comparing each attribute.
276
276
  # @param [Object] Object to be compared
277
277
  def ==(o)
278
278
  return true if self.equal?(o)
279
279
  self.class == o.class &&
280
- webhook_event == o.webhook_event &&
281
280
  webhook_major_version == o.webhook_major_version &&
282
281
  webhook_minor_version == o.webhook_minor_version &&
283
282
  webhook_idempotency_key == o.webhook_idempotency_key &&
284
283
  webhook_timestamp == o.webhook_timestamp &&
285
284
  link_id == o.link_id &&
286
285
  link_tags == o.link_tags &&
286
+ webhook_event == o.webhook_event &&
287
287
  product == o.product &&
288
288
  state == o.state &&
289
289
  state_changed_at == o.state_changed_at &&
@@ -299,7 +299,7 @@ module MoneyKit
299
299
  # Calculates hash code according to all attributes.
300
300
  # @return [Integer] Hash code
301
301
  def hash
302
- [webhook_event, webhook_major_version, webhook_minor_version, webhook_idempotency_key, webhook_timestamp, link_id, link_tags, product, state, state_changed_at, error_message].hash
302
+ [webhook_major_version, webhook_minor_version, webhook_idempotency_key, webhook_timestamp, link_id, link_tags, webhook_event, product, state, state_changed_at, error_message].hash
303
303
  end
304
304
 
305
305
  # Builds the object from hash