moneykit 0.1.9 → 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 (154) 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/AccountNumbersApi.md +9 -9
  10. data/docs/AccountResponse.md +28 -0
  11. data/docs/AccountWithAccountNumbersLegacy20230218.md +2 -0
  12. data/docs/AccountsApi.md +9 -9
  13. data/docs/Address.md +1 -1
  14. data/docs/AppClientResponse.md +2 -2
  15. data/docs/AppLinkStateChangedWebhook.md +36 -0
  16. data/docs/AppResponse.md +2 -2
  17. data/docs/Body.md +3 -3
  18. data/docs/CreateAccessTokenResponse.md +22 -0
  19. data/docs/CreateLinkSessionRequest.md +1 -1
  20. data/docs/CustomerUser.md +22 -0
  21. data/docs/CustomerUserEmail.md +20 -0
  22. data/docs/CustomerUserPhone.md +22 -0
  23. data/docs/Date.md +15 -0
  24. data/docs/Email.md +1 -1
  25. data/docs/GetAccountResponse.md +1 -1
  26. data/docs/GetAccountsResponse.md +1 -1
  27. data/docs/GetHoldingsResponse.md +1 -1
  28. data/docs/GetInvestmentTransactionsResponse.md +1 -1
  29. data/docs/GetTransactionsResponse.md +2 -2
  30. data/docs/GetUserTransactionsResponse.md +1 -1
  31. data/docs/ImportLinkRequest.md +26 -0
  32. data/docs/Institution.md +1 -1
  33. data/docs/LinkCommon.md +3 -3
  34. data/docs/LinkProductError.md +15 -0
  35. data/docs/LinkProductRefreshWebhook.md +2 -2
  36. data/docs/LinkProductResponse.md +28 -0
  37. data/docs/LinkProducts.md +7 -5
  38. data/docs/LinkResponse.md +3 -3
  39. data/docs/LinkSessionApi.md +1 -1
  40. data/docs/LinksApi.md +79 -9
  41. data/docs/PhoneNumber.md +1 -1
  42. data/docs/PublicLinkState.md +15 -0
  43. data/docs/Response401DeleteLinkLinksIdDelete.md +22 -0
  44. data/docs/Response401GetAccountNumbers.md +22 -0
  45. data/docs/Response401GetTransactionsSyncLinksIdTransactionsSyncGet.md +22 -0
  46. data/docs/Response401ImportLinkLinksImportPost.md +22 -0
  47. data/docs/ResponseHandleLinkWebhookEventRequestBodyWebhookPost.md +3 -3
  48. data/docs/TransactionCategoryResponse.md +20 -0
  49. data/docs/TransactionEnrichmentResponse.md +26 -0
  50. data/docs/TransactionImportData.md +28 -0
  51. data/docs/TransactionMerchantResponse.md +24 -0
  52. data/docs/TransactionProcessorResponse.md +24 -0
  53. data/docs/TransactionRecurrenceResponse.md +20 -0
  54. data/docs/TransactionResponse.md +42 -0
  55. data/docs/TransactionSubcategoryResponse.md +20 -0
  56. data/docs/TransactionSync.md +22 -0
  57. data/docs/TransactionSyncResponse.md +1 -1
  58. data/docs/TransactionUpdatesAvailableWebhook.md +4 -2
  59. data/docs/TransactionsApi.md +15 -15
  60. data/docs/TransactionsLinkProduct.md +1 -1
  61. data/lib/moneykit/api/access_token_api.rb +19 -16
  62. data/lib/moneykit/api/account_numbers_api.rb +7 -7
  63. data/lib/moneykit/api/accounts_api.rb +7 -7
  64. data/lib/moneykit/api/links_api.rb +75 -7
  65. data/lib/moneykit/api/transactions_api.rb +17 -17
  66. data/lib/moneykit/models/account_balances.rb +2 -30
  67. data/lib/moneykit/models/account_group.rb +1 -1
  68. data/lib/moneykit/models/account_identity.rb +11 -1
  69. data/lib/moneykit/models/account_import_data.rb +280 -0
  70. data/lib/moneykit/models/account_response.rb +290 -0
  71. data/lib/moneykit/models/account_with_account_numbers_legacy20230218.rb +11 -1
  72. data/lib/moneykit/models/address.rb +0 -2
  73. data/lib/moneykit/models/app_client_response.rb +1 -1
  74. data/lib/moneykit/models/app_link_state_changed_webhook.rb +394 -0
  75. data/lib/moneykit/models/body.rb +1 -1
  76. data/lib/moneykit/models/create_access_token_response.rb +255 -0
  77. data/lib/moneykit/models/create_link_session_request.rb +1 -1
  78. data/lib/moneykit/models/customer_user.rb +266 -0
  79. data/lib/moneykit/models/customer_user_email.rb +258 -0
  80. data/lib/moneykit/models/customer_user_phone.rb +289 -0
  81. data/lib/moneykit/models/date.rb +104 -0
  82. data/lib/moneykit/models/email.rb +0 -2
  83. data/lib/moneykit/models/get_account_response.rb +1 -1
  84. data/lib/moneykit/models/get_accounts_response.rb +1 -1
  85. data/lib/moneykit/models/get_holdings_response.rb +1 -1
  86. data/lib/moneykit/models/get_investment_transactions_response.rb +1 -1
  87. data/lib/moneykit/models/get_transactions_response.rb +2 -2
  88. data/lib/moneykit/models/get_user_transactions_response.rb +1 -1
  89. data/lib/moneykit/models/import_link_request.rb +303 -0
  90. data/lib/moneykit/models/institution.rb +0 -7
  91. data/lib/moneykit/models/link_common.rb +3 -3
  92. data/lib/moneykit/models/link_product_error.rb +46 -0
  93. data/lib/moneykit/models/link_product_refresh_webhook.rb +24 -24
  94. data/lib/moneykit/models/link_product_response.rb +283 -0
  95. data/lib/moneykit/models/link_product_state.rb +3 -1
  96. data/lib/moneykit/models/link_products.rb +16 -7
  97. data/lib/moneykit/models/link_response.rb +3 -3
  98. data/lib/moneykit/models/phone_number.rb +0 -2
  99. data/lib/moneykit/models/product.rb +2 -1
  100. data/lib/moneykit/models/provider.rb +1 -2
  101. data/lib/moneykit/models/public_link_error.rb +1 -1
  102. data/lib/moneykit/models/public_link_state.rb +43 -0
  103. data/lib/moneykit/models/response401_delete_link_links_id_delete.rb +104 -0
  104. data/lib/moneykit/models/response401_get_account_numbers.rb +104 -0
  105. data/lib/moneykit/models/response401_get_transactions_sync_links_id_transactions_sync_get.rb +104 -0
  106. data/lib/moneykit/models/response401_import_link_links_import_post.rb +103 -0
  107. data/lib/moneykit/models/response_handle_link_webhook_event_request_body_webhook_post.rb +1 -1
  108. data/lib/moneykit/models/transaction_category_response.rb +230 -0
  109. data/lib/moneykit/models/transaction_enrichment_response.rb +255 -0
  110. data/lib/moneykit/models/transaction_import_data.rb +283 -0
  111. data/lib/moneykit/models/transaction_merchant_response.rb +243 -0
  112. data/lib/moneykit/models/transaction_processor_response.rb +243 -0
  113. data/lib/moneykit/models/transaction_recurrence_response.rb +223 -0
  114. data/lib/moneykit/models/transaction_response.rb +402 -0
  115. data/lib/moneykit/models/transaction_subcategory_response.rb +230 -0
  116. data/lib/moneykit/models/transaction_sync.rb +257 -0
  117. data/lib/moneykit/models/transaction_sync_response.rb +1 -1
  118. data/lib/moneykit/models/transaction_updates_available_webhook.rb +42 -24
  119. data/lib/moneykit/models/transactions_link_product.rb +1 -1
  120. data/lib/moneykit/version.rb +1 -1
  121. data/lib/moneykit.rb +26 -17
  122. data/spec/models/account_import_data_spec.rb +60 -0
  123. data/spec/models/account_response_spec.rb +66 -0
  124. data/spec/models/app_link_state_changed_webhook_spec.rb +102 -0
  125. data/spec/models/create_access_token_response_spec.rb +48 -0
  126. data/spec/models/customer_user_email_spec.rb +42 -0
  127. data/spec/models/customer_user_phone_spec.rb +48 -0
  128. data/spec/models/customer_user_spec.rb +48 -0
  129. data/spec/models/date_spec.rb +21 -0
  130. data/spec/models/import_link_request_spec.rb +60 -0
  131. data/spec/models/link_product_error_spec.rb +30 -0
  132. data/spec/models/link_product_response_spec.rb +66 -0
  133. data/spec/models/public_link_error_spec.rb +30 -0
  134. data/spec/models/public_link_state_spec.rb +30 -0
  135. data/spec/models/response401_delete_link_links_id_delete_spec.rb +21 -0
  136. data/spec/models/response401_get_account_numbers_spec.rb +21 -0
  137. data/spec/models/response401_get_transactions_sync_links_id_transactions_sync_get_spec.rb +21 -0
  138. data/spec/models/response401_import_link_links_import_post_spec.rb +21 -0
  139. data/spec/models/transaction_category_response_spec.rb +42 -0
  140. data/spec/models/transaction_enrichment_response_spec.rb +60 -0
  141. data/spec/models/transaction_import_data_spec.rb +66 -0
  142. data/spec/models/transaction_merchant_response_spec.rb +54 -0
  143. data/spec/models/transaction_processor_response_spec.rb +54 -0
  144. data/spec/models/transaction_recurrence_response_spec.rb +42 -0
  145. data/spec/models/transaction_response_spec.rb +108 -0
  146. data/spec/models/transaction_subcategory_response_spec.rb +42 -0
  147. data/spec/models/transaction_sync_spec.rb +48 -0
  148. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  149. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  150. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
  151. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/mkmf.log +2 -2
  152. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
  153. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
  154. metadata +222 -120
@@ -0,0 +1,104 @@
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
+ module Response401GetTransactionsSyncLinksIdTransactionsSyncGet
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'APIErrorAuthExpiredAccessTokenResponse',
23
+ :'APIErrorAuthUnauthorizedResponse',
24
+ :'LinkErrorUnauthorizedAccessResponse'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = MoneyKit.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise unless (data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,103 @@
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
+ module Response401ImportLinkLinksImportPost
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'APIErrorAuthExpiredAccessTokenResponse',
23
+ :'APIErrorAuthUnauthorizedResponse'
24
+ ]
25
+ end
26
+
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of anyOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
34
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
35
+ # - TODO: scalar values are de facto behaving as if they were nullable.
36
+ # - TODO: logging when debugging is set.
37
+ openapi_any_of.each do |klass|
38
+ begin
39
+ next if klass == :AnyType # "nullable: true"
40
+ typed_data = find_and_cast_into_type(klass, data)
41
+ return typed_data if typed_data
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
44
+ end
45
+
46
+ openapi_any_of.include?(:AnyType) ? data : nil
47
+ end
48
+
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.parse(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = MoneyKit.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise unless (data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
94
+ end
95
+ end
96
+
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
100
+ end
101
+ end
102
+ end
103
+ end
@@ -19,8 +19,8 @@ module MoneyKit
19
19
  # List of class defined in anyOf (OpenAPI v3)
20
20
  def openapi_any_of
21
21
  [
22
+ :'AppLinkStateChangedWebhook',
22
23
  :'LinkProductRefreshWebhook',
23
- :'LinkStateChangedWebhook',
24
24
  :'TransactionUpdatesAvailableWebhook'
25
25
  ]
26
26
  end
@@ -0,0 +1,230 @@
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 TransactionCategoryResponse
18
+ # Transaction category
19
+ attr_accessor :value
20
+
21
+ # Confidence score. Estimated accuracy of this data point (as a percentage).
22
+ attr_accessor :confidence
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'value' => :'value',
28
+ :'confidence' => :'confidence'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'value' => :'String',
41
+ :'confidence' => :'Integer'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::TransactionCategoryResponse` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::TransactionCategoryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'value')
67
+ self.value = attributes[:'value']
68
+ else
69
+ self.value = nil
70
+ end
71
+
72
+ if attributes.key?(:'confidence')
73
+ self.confidence = attributes[:'confidence']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
+ invalid_properties = Array.new
82
+ if @value.nil?
83
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
84
+ end
85
+
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ return false if @value.nil?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ value == o.value &&
103
+ confidence == o.confidence
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [value, confidence].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ attributes = attributes.transform_keys(&:to_sym)
124
+ transformed_hash = {}
125
+ openapi_types.each_pair do |key, type|
126
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
127
+ transformed_hash["#{key}"] = nil
128
+ elsif type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[attribute_map[key]].is_a?(Array)
132
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
133
+ end
134
+ elsif !attributes[attribute_map[key]].nil?
135
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
136
+ end
137
+ end
138
+ new(transformed_hash)
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def self._deserialize(type, value)
146
+ case type.to_sym
147
+ when :Time
148
+ Time.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ # models (e.g. Pet) or oneOf
179
+ klass = MoneyKit.const_get(type)
180
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+ end
230
+ end
@@ -0,0 +1,255 @@
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 TransactionEnrichmentResponse
18
+ attr_accessor :category
19
+
20
+ attr_accessor :subcategory
21
+
22
+ attr_accessor :merchant
23
+
24
+ attr_accessor :processor
25
+
26
+ attr_accessor :recurrence
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'category' => :'category',
32
+ :'subcategory' => :'subcategory',
33
+ :'merchant' => :'merchant',
34
+ :'processor' => :'processor',
35
+ :'recurrence' => :'recurrence'
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
+ :'category' => :'TransactionCategoryResponse',
48
+ :'subcategory' => :'TransactionSubcategoryResponse',
49
+ :'merchant' => :'TransactionMerchantResponse',
50
+ :'processor' => :'TransactionProcessorResponse',
51
+ :'recurrence' => :'TransactionRecurrenceResponse'
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::TransactionEnrichmentResponse` 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::TransactionEnrichmentResponse`. 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?(:'category')
77
+ self.category = attributes[:'category']
78
+ else
79
+ self.category = nil
80
+ end
81
+
82
+ if attributes.key?(:'subcategory')
83
+ self.subcategory = attributes[:'subcategory']
84
+ end
85
+
86
+ if attributes.key?(:'merchant')
87
+ self.merchant = attributes[:'merchant']
88
+ end
89
+
90
+ if attributes.key?(:'processor')
91
+ self.processor = attributes[:'processor']
92
+ end
93
+
94
+ if attributes.key?(:'recurrence')
95
+ self.recurrence = attributes[:'recurrence']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @category.nil?
105
+ invalid_properties.push('invalid value for "category", category cannot be nil.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ return false if @category.nil?
116
+ true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ category == o.category &&
125
+ subcategory == o.subcategory &&
126
+ merchant == o.merchant &&
127
+ processor == o.processor &&
128
+ recurrence == o.recurrence
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [category, subcategory, merchant, processor, recurrence].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = MoneyKit.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+ end
255
+ end