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,283 @@
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 TransactionImportData
18
+ # Your internal ID for the account this transaction belongs to. The `account_id` **must** match one of the IDs provided in the `accounts` list.
19
+ attr_accessor :account_id
20
+
21
+ # Your internal ID for this transaction. If supplied, this ID will be returned as the `original_id` of the transaction in future requests.
22
+ attr_accessor :transaction_id
23
+
24
+ # The amount of this transaction, denominated in account currency. Use positive numbers for credits (deposits), and negative numbers of debits (withdrawals).
25
+ attr_accessor :amount
26
+
27
+ attr_accessor :date
28
+
29
+ # A description of this transaction.
30
+ attr_accessor :description
31
+
32
+ # A type or category for this transaction. Does not need to match MoneyKit types, but see <a href=/pages/categories>Transaction Categories</a> if you want to match our current schema.
33
+ attr_accessor :type
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'account_id' => :'account_id',
39
+ :'transaction_id' => :'transaction_id',
40
+ :'amount' => :'amount',
41
+ :'date' => :'date',
42
+ :'description' => :'description',
43
+ :'type' => :'type'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'account_id' => :'String',
56
+ :'transaction_id' => :'String',
57
+ :'amount' => :'String',
58
+ :'date' => :'Date',
59
+ :'description' => :'String',
60
+ :'type' => :'String'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::TransactionImportData` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::TransactionImportData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'account_id')
86
+ self.account_id = attributes[:'account_id']
87
+ else
88
+ self.account_id = nil
89
+ end
90
+
91
+ if attributes.key?(:'transaction_id')
92
+ self.transaction_id = attributes[:'transaction_id']
93
+ end
94
+
95
+ if attributes.key?(:'amount')
96
+ self.amount = attributes[:'amount']
97
+ else
98
+ self.amount = nil
99
+ end
100
+
101
+ if attributes.key?(:'date')
102
+ self.date = attributes[:'date']
103
+ else
104
+ self.date = nil
105
+ end
106
+
107
+ if attributes.key?(:'description')
108
+ self.description = attributes[:'description']
109
+ end
110
+
111
+ if attributes.key?(:'type')
112
+ self.type = attributes[:'type']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if @account_id.nil?
122
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
123
+ end
124
+
125
+ if @amount.nil?
126
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
127
+ end
128
+
129
+ if @date.nil?
130
+ invalid_properties.push('invalid value for "date", date cannot be nil.')
131
+ end
132
+
133
+ invalid_properties
134
+ end
135
+
136
+ # Check to see if the all the properties in the model are valid
137
+ # @return true if the model is valid
138
+ def valid?
139
+ warn '[DEPRECATED] the `valid?` method is obsolete'
140
+ return false if @account_id.nil?
141
+ return false if @amount.nil?
142
+ return false if @date.nil?
143
+ true
144
+ end
145
+
146
+ # Checks equality by comparing each attribute.
147
+ # @param [Object] Object to be compared
148
+ def ==(o)
149
+ return true if self.equal?(o)
150
+ self.class == o.class &&
151
+ account_id == o.account_id &&
152
+ transaction_id == o.transaction_id &&
153
+ amount == o.amount &&
154
+ date == o.date &&
155
+ description == o.description &&
156
+ type == o.type
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Integer] Hash code
167
+ def hash
168
+ [account_id, transaction_id, amount, date, description, type].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def self.build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ attributes = attributes.transform_keys(&:to_sym)
177
+ transformed_hash = {}
178
+ openapi_types.each_pair do |key, type|
179
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
180
+ transformed_hash["#{key}"] = nil
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[attribute_map[key]].is_a?(Array)
185
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
186
+ end
187
+ elsif !attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
189
+ end
190
+ end
191
+ new(transformed_hash)
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def self._deserialize(type, value)
199
+ case type.to_sym
200
+ when :Time
201
+ Time.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ # models (e.g. Pet) or oneOf
232
+ klass = MoneyKit.const_get(type)
233
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+ end
283
+ end
@@ -0,0 +1,243 @@
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 TransactionMerchantResponse
18
+ # Unique identifier for the merchant
19
+ attr_accessor :id
20
+
21
+ # Merchant name
22
+ attr_accessor :name
23
+
24
+ # Merchant logo URL
25
+ attr_accessor :logo
26
+
27
+ # Confidence score. Estimated accuracy of this data point (as a percentage).
28
+ attr_accessor :confidence
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'id' => :'id',
34
+ :'name' => :'name',
35
+ :'logo' => :'logo',
36
+ :'confidence' => :'confidence'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'id' => :'String',
49
+ :'name' => :'String',
50
+ :'logo' => :'String',
51
+ :'confidence' => :'Integer'
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 `MoneyKit::TransactionMerchantResponse` 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 `MoneyKit::TransactionMerchantResponse`. 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?(:'id')
77
+ self.id = attributes[:'id']
78
+ end
79
+
80
+ if attributes.key?(:'name')
81
+ self.name = attributes[:'name']
82
+ end
83
+
84
+ if attributes.key?(:'logo')
85
+ self.logo = attributes[:'logo']
86
+ end
87
+
88
+ if attributes.key?(:'confidence')
89
+ self.confidence = attributes[:'confidence']
90
+ end
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properties with the reasons
95
+ def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
97
+ invalid_properties = Array.new
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ warn '[DEPRECATED] the `valid?` method is obsolete'
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ id == o.id &&
114
+ name == o.name &&
115
+ logo == o.logo &&
116
+ confidence == o.confidence
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [id, name, logo, confidence].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ attributes = attributes.transform_keys(&:to_sym)
137
+ transformed_hash = {}
138
+ openapi_types.each_pair do |key, type|
139
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
140
+ transformed_hash["#{key}"] = nil
141
+ elsif type =~ /\AArray<(.*)>/i
142
+ # check to ensure the input is an array given that the attribute
143
+ # is documented as an array but the input is not
144
+ if attributes[attribute_map[key]].is_a?(Array)
145
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
146
+ end
147
+ elsif !attributes[attribute_map[key]].nil?
148
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
149
+ end
150
+ end
151
+ new(transformed_hash)
152
+ end
153
+
154
+ # Deserializes the data based on type
155
+ # @param string type Data type
156
+ # @param string value Value to be deserialized
157
+ # @return [Object] Deserialized data
158
+ def self._deserialize(type, value)
159
+ case type.to_sym
160
+ when :Time
161
+ Time.parse(value)
162
+ when :Date
163
+ Date.parse(value)
164
+ when :String
165
+ value.to_s
166
+ when :Integer
167
+ value.to_i
168
+ when :Float
169
+ value.to_f
170
+ when :Boolean
171
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
172
+ true
173
+ else
174
+ false
175
+ end
176
+ when :Object
177
+ # generic object (usually a Hash), return directly
178
+ value
179
+ when /\AArray<(?<inner_type>.+)>\z/
180
+ inner_type = Regexp.last_match[:inner_type]
181
+ value.map { |v| _deserialize(inner_type, v) }
182
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
183
+ k_type = Regexp.last_match[:k_type]
184
+ v_type = Regexp.last_match[:v_type]
185
+ {}.tap do |hash|
186
+ value.each do |k, v|
187
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
188
+ end
189
+ end
190
+ else # model
191
+ # models (e.g. Pet) or oneOf
192
+ klass = MoneyKit.const_get(type)
193
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
+ end
195
+ end
196
+
197
+ # Returns the string representation of the object
198
+ # @return [String] String presentation of the object
199
+ def to_s
200
+ to_hash.to_s
201
+ end
202
+
203
+ # to_body is an alias to to_hash (backward compatibility)
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_body
206
+ to_hash
207
+ end
208
+
209
+ # Returns the object in the form of hash
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_hash
212
+ hash = {}
213
+ self.class.attribute_map.each_pair do |attr, param|
214
+ value = self.send(attr)
215
+ if value.nil?
216
+ is_nullable = self.class.openapi_nullable.include?(attr)
217
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
218
+ end
219
+
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ # Outputs non-array value in the form of hash
226
+ # For object, use to_hash. Otherwise, just return the value
227
+ # @param [Object] value Any valid value
228
+ # @return [Hash] Returns the value in the form of hash
229
+ def _to_hash(value)
230
+ if value.is_a?(Array)
231
+ value.compact.map { |v| _to_hash(v) }
232
+ elsif value.is_a?(Hash)
233
+ {}.tap do |hash|
234
+ value.each { |k, v| hash[k] = _to_hash(v) }
235
+ end
236
+ elsif value.respond_to? :to_hash
237
+ value.to_hash
238
+ else
239
+ value
240
+ end
241
+ end
242
+ end
243
+ end