ynab 3.2.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +2 -0
  4. data/Rakefile +6 -5
  5. data/config.yaml +11 -0
  6. data/docs/ExistingTransaction.md +1 -1
  7. data/docs/NewTransaction.md +1 -1
  8. data/docs/PostScheduledTransactionWrapper.md +8 -0
  9. data/docs/SaveScheduledTransaction.md +16 -0
  10. data/docs/SaveTransactionWithIdOrImportId.md +1 -1
  11. data/docs/SaveTransactionWithOptionalFields.md +1 -1
  12. data/docs/{SaveTransactionWithIdAllOf.md → ScheduledTransactionFrequency.md} +1 -2
  13. data/docs/ScheduledTransactionsApi.md +21 -0
  14. data/docs/TransactionsApi.md +25 -1
  15. data/lib/ynab/api/accounts_api.rb +1 -4
  16. data/lib/ynab/api/budgets_api.rb +1 -4
  17. data/lib/ynab/api/categories_api.rb +1 -4
  18. data/lib/ynab/api/months_api.rb +1 -4
  19. data/lib/ynab/api/payee_locations_api.rb +1 -4
  20. data/lib/ynab/api/payees_api.rb +1 -4
  21. data/lib/ynab/api/scheduled_transactions_api.rb +75 -4
  22. data/lib/ynab/api/transactions_api.rb +81 -6
  23. data/lib/ynab/api/user_api.rb +1 -4
  24. data/lib/ynab/api_client.rb +1 -4
  25. data/lib/ynab/api_error.rb +0 -12
  26. data/lib/ynab/configuration.rb +11 -4
  27. data/lib/ynab/models/account.rb +1 -4
  28. data/lib/ynab/models/account_response.rb +1 -4
  29. data/lib/ynab/models/account_response_data.rb +1 -4
  30. data/lib/ynab/models/account_type.rb +1 -4
  31. data/lib/ynab/models/accounts_response.rb +1 -4
  32. data/lib/ynab/models/accounts_response_data.rb +1 -4
  33. data/lib/ynab/models/budget_detail.rb +1 -4
  34. data/lib/ynab/models/budget_detail_response.rb +1 -4
  35. data/lib/ynab/models/budget_detail_response_data.rb +1 -4
  36. data/lib/ynab/models/budget_settings.rb +1 -4
  37. data/lib/ynab/models/budget_settings_response.rb +1 -4
  38. data/lib/ynab/models/budget_settings_response_data.rb +1 -4
  39. data/lib/ynab/models/budget_summary.rb +1 -4
  40. data/lib/ynab/models/budget_summary_response.rb +1 -4
  41. data/lib/ynab/models/budget_summary_response_data.rb +1 -4
  42. data/lib/ynab/models/bulk_response.rb +1 -4
  43. data/lib/ynab/models/bulk_response_data.rb +1 -4
  44. data/lib/ynab/models/bulk_response_data_bulk.rb +1 -4
  45. data/lib/ynab/models/bulk_transactions.rb +1 -4
  46. data/lib/ynab/models/categories_response.rb +1 -4
  47. data/lib/ynab/models/categories_response_data.rb +1 -4
  48. data/lib/ynab/models/category.rb +1 -4
  49. data/lib/ynab/models/category_group.rb +1 -4
  50. data/lib/ynab/models/category_group_with_categories.rb +1 -4
  51. data/lib/ynab/models/category_response.rb +1 -4
  52. data/lib/ynab/models/category_response_data.rb +1 -4
  53. data/lib/ynab/models/currency_format.rb +1 -4
  54. data/lib/ynab/models/date_format.rb +1 -4
  55. data/lib/ynab/models/error_detail.rb +1 -4
  56. data/lib/ynab/models/error_response.rb +1 -4
  57. data/lib/ynab/models/existing_transaction.rb +2 -5
  58. data/lib/ynab/models/hybrid_transaction.rb +1 -4
  59. data/lib/ynab/models/hybrid_transactions_response.rb +1 -4
  60. data/lib/ynab/models/hybrid_transactions_response_data.rb +1 -4
  61. data/lib/ynab/models/month_detail.rb +1 -4
  62. data/lib/ynab/models/month_detail_response.rb +1 -4
  63. data/lib/ynab/models/month_detail_response_data.rb +1 -4
  64. data/lib/ynab/models/month_summaries_response.rb +1 -4
  65. data/lib/ynab/models/month_summaries_response_data.rb +1 -4
  66. data/lib/ynab/models/month_summary.rb +1 -4
  67. data/lib/ynab/models/new_transaction.rb +2 -5
  68. data/lib/ynab/models/patch_category_wrapper.rb +1 -4
  69. data/lib/ynab/models/patch_month_category_wrapper.rb +1 -4
  70. data/lib/ynab/models/patch_payee_wrapper.rb +1 -4
  71. data/lib/ynab/models/patch_transactions_wrapper.rb +1 -4
  72. data/lib/ynab/models/payee.rb +1 -4
  73. data/lib/ynab/models/payee_location.rb +1 -4
  74. data/lib/ynab/models/payee_location_response.rb +1 -4
  75. data/lib/ynab/models/payee_location_response_data.rb +1 -4
  76. data/lib/ynab/models/payee_locations_response.rb +1 -4
  77. data/lib/ynab/models/payee_locations_response_data.rb +1 -4
  78. data/lib/ynab/models/payee_response.rb +1 -4
  79. data/lib/ynab/models/payee_response_data.rb +1 -4
  80. data/lib/ynab/models/payees_response.rb +1 -4
  81. data/lib/ynab/models/payees_response_data.rb +1 -4
  82. data/lib/ynab/models/post_account_wrapper.rb +1 -4
  83. data/lib/ynab/models/{save_transaction_with_id_all_of.rb → post_scheduled_transaction_wrapper.rb} +23 -32
  84. data/lib/ynab/models/post_transactions_wrapper.rb +1 -4
  85. data/lib/ynab/models/put_transaction_wrapper.rb +1 -4
  86. data/lib/ynab/models/save_account.rb +1 -4
  87. data/lib/ynab/models/save_category.rb +1 -4
  88. data/lib/ynab/models/save_category_response.rb +1 -4
  89. data/lib/ynab/models/save_category_response_data.rb +1 -4
  90. data/lib/ynab/models/save_month_category.rb +1 -4
  91. data/lib/ynab/models/save_payee.rb +1 -4
  92. data/lib/ynab/models/save_payee_response.rb +1 -4
  93. data/lib/ynab/models/save_payee_response_data.rb +1 -4
  94. data/lib/ynab/models/{hybrid_transaction_all_of.rb → save_scheduled_transaction.rb} +99 -62
  95. data/lib/ynab/models/save_sub_transaction.rb +1 -4
  96. data/lib/ynab/models/save_transaction_with_id_or_import_id.rb +2 -5
  97. data/lib/ynab/models/save_transaction_with_optional_fields.rb +2 -5
  98. data/lib/ynab/models/save_transactions_response.rb +1 -4
  99. data/lib/ynab/models/save_transactions_response_data.rb +1 -4
  100. data/lib/ynab/models/scheduled_sub_transaction.rb +1 -4
  101. data/lib/ynab/models/scheduled_transaction_detail.rb +1 -4
  102. data/lib/ynab/models/scheduled_transaction_frequency.rb +48 -0
  103. data/lib/ynab/models/scheduled_transaction_response.rb +1 -4
  104. data/lib/ynab/models/scheduled_transaction_response_data.rb +1 -4
  105. data/lib/ynab/models/scheduled_transaction_summary.rb +1 -4
  106. data/lib/ynab/models/scheduled_transactions_response.rb +1 -4
  107. data/lib/ynab/models/scheduled_transactions_response_data.rb +1 -4
  108. data/lib/ynab/models/sub_transaction.rb +1 -4
  109. data/lib/ynab/models/transaction_cleared_status.rb +1 -4
  110. data/lib/ynab/models/transaction_detail.rb +1 -4
  111. data/lib/ynab/models/transaction_flag_color.rb +1 -4
  112. data/lib/ynab/models/transaction_response.rb +1 -4
  113. data/lib/ynab/models/transaction_response_data.rb +1 -4
  114. data/lib/ynab/models/transaction_summary.rb +1 -4
  115. data/lib/ynab/models/transactions_import_response.rb +1 -4
  116. data/lib/ynab/models/transactions_import_response_data.rb +1 -4
  117. data/lib/ynab/models/transactions_response.rb +1 -4
  118. data/lib/ynab/models/transactions_response_data.rb +1 -4
  119. data/lib/ynab/models/user.rb +1 -4
  120. data/lib/ynab/models/user_response.rb +1 -4
  121. data/lib/ynab/models/user_response_data.rb +1 -4
  122. data/lib/ynab/overrides/transactions_api.rb +0 -12
  123. data/lib/ynab/version.rb +1 -13
  124. data/lib/ynab.rb +4 -4
  125. data/open_api_spec.yaml +190 -4
  126. data/spec/api/scheduled_transactions_spec.rb +20 -2
  127. data/spec/api/transactions_spec.rb +10 -0
  128. data/spec/fixtures/vcr_cassettes/create_scheduled_transaction.yml +63 -0
  129. data/spec/fixtures/vcr_cassettes/month_transactions.yml +46 -0
  130. data/templates/README.md +3 -0
  131. data/templates/api_info.mustache +9 -0
  132. data/templates/gemspec.mustache +41 -0
  133. data/ynab.gemspec +3 -6
  134. metadata +50 -84
  135. data/docs/AccountWrapper.md +0 -8
  136. data/docs/AccountsWrapper.md +0 -9
  137. data/docs/BudgetDetailAllOf.md +0 -17
  138. data/docs/BudgetDetailWrapper.md +0 -9
  139. data/docs/BudgetSettingsWrapper.md +0 -8
  140. data/docs/BudgetSummaryWrapper.md +0 -9
  141. data/docs/BulkIdWrapper.md +0 -8
  142. data/docs/BulkIds.md +0 -9
  143. data/docs/BulkTransactionCreateResponse.md +0 -8
  144. data/docs/BulkTransactionIds.md +0 -8
  145. data/docs/CategoryGroupWithCategoriesAllOf.md +0 -8
  146. data/docs/CategoryGroupsWrapper.md +0 -9
  147. data/docs/CategoryWrapper.md +0 -9
  148. data/docs/DeprecatedApi.md +0 -28
  149. data/docs/HybridTransactionAllOf.md +0 -12
  150. data/docs/HybridTransactionsWrapper.md +0 -8
  151. data/docs/LoanAccountPeriodicValue.md +0 -7
  152. data/docs/MonthDetailAllOf.md +0 -8
  153. data/docs/MonthDetailWrapper.md +0 -8
  154. data/docs/MonthSummariesWrapper.md +0 -9
  155. data/docs/PayeeLocationWrapper.md +0 -8
  156. data/docs/PayeeLocationsWrapper.md +0 -8
  157. data/docs/PayeeWrapper.md +0 -8
  158. data/docs/PayeesWrapper.md +0 -9
  159. data/docs/SaveAccountWrapper.md +0 -8
  160. data/docs/SaveMonthCategoryWrapper.md +0 -8
  161. data/docs/SaveTransaction.md +0 -19
  162. data/docs/SaveTransactionWithId.md +0 -20
  163. data/docs/SaveTransactionWrapper.md +0 -8
  164. data/docs/SaveTransactionsWrapper.md +0 -9
  165. data/docs/ScheduledTransactionDetailAllOf.md +0 -11
  166. data/docs/ScheduledTransactionWrapper.md +0 -8
  167. data/docs/ScheduledTransactionsWrapper.md +0 -8
  168. data/docs/TransactionDetailAllOf.md +0 -11
  169. data/docs/TransactionWrapper.md +0 -8
  170. data/docs/TransactionsWrapper.md +0 -9
  171. data/docs/UpdateTransaction.md +0 -20
  172. data/docs/UpdateTransactionsWrapper.md +0 -8
  173. data/docs/UserWrapper.md +0 -8
  174. data/lib/ynab/models/budget_detail_all_of.rb +0 -320
  175. data/lib/ynab/models/category_group_with_categories_all_of.rb +0 -223
  176. data/lib/ynab/models/month_detail_all_of.rb +0 -223
  177. data/lib/ynab/models/save_transaction.rb +0 -401
  178. data/lib/ynab/models/save_transaction_with_id.rb +0 -411
  179. data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +0 -254
  180. data/lib/ynab/models/transaction_detail_all_of.rb +0 -254
@@ -1,411 +0,0 @@
1
- =begin
2
- #YNAB API Endpoints
3
-
4
- #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
-
6
- The version of the OpenAPI document: 1.0.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module YNAB
17
- class SaveTransactionWithId
18
- attr_accessor :id
19
-
20
- attr_accessor :account_id
21
-
22
- # The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.
23
- attr_accessor :date
24
-
25
- # The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.
26
- attr_accessor :amount
27
-
28
- # The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `tranfer_payee_id` on the account resource.
29
- attr_accessor :payee_id
30
-
31
- # The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee.
32
- attr_accessor :payee_name
33
-
34
- # The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied.
35
- attr_accessor :category_id
36
-
37
- attr_accessor :memo
38
-
39
- # The cleared status of the transaction
40
- attr_accessor :cleared
41
-
42
- # Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default.
43
- attr_accessor :approved
44
-
45
- # The transaction flag
46
- attr_accessor :flag_color
47
-
48
- # If specified, the new transaction will be assigned this `import_id` and considered \"imported\". We will also attempt to match this imported transaction to an existing \"user-entered\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>Transactions imported through File Based Import or Direct Import (not through the API) are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. Using a consistent format will prevent duplicates through Direct Import and File Based Import.<br><br>If import_id is omitted or specified as null, the transaction will be treated as a \"user-entered\" transaction. As such, it will be eligible to be matched against transactions later being imported (via DI, FBI, or API).
49
- attr_accessor :import_id
50
-
51
- # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
52
- attr_accessor :subtransactions
53
-
54
- class EnumAttributeValidator
55
- attr_reader :datatype
56
- attr_reader :allowable_values
57
-
58
- def initialize(datatype, allowable_values)
59
- @allowable_values = allowable_values.map do |value|
60
- case datatype.to_s
61
- when /Integer/i
62
- value.to_i
63
- when /Float/i
64
- value.to_f
65
- else
66
- value
67
- end
68
- end
69
- end
70
-
71
- def valid?(value)
72
- !value || allowable_values.include?(value)
73
- end
74
- end
75
-
76
- # Attribute mapping from ruby-style variable name to JSON key.
77
- def self.attribute_map
78
- {
79
- :'id' => :'id',
80
- :'account_id' => :'account_id',
81
- :'date' => :'date',
82
- :'amount' => :'amount',
83
- :'payee_id' => :'payee_id',
84
- :'payee_name' => :'payee_name',
85
- :'category_id' => :'category_id',
86
- :'memo' => :'memo',
87
- :'cleared' => :'cleared',
88
- :'approved' => :'approved',
89
- :'flag_color' => :'flag_color',
90
- :'import_id' => :'import_id',
91
- :'subtransactions' => :'subtransactions'
92
- }
93
- end
94
-
95
- # Returns all the JSON keys this model knows about
96
- def self.acceptable_attributes
97
- attribute_map.values
98
- end
99
-
100
- # Attribute type mapping.
101
- def self.openapi_types
102
- {
103
- :'id' => :'String',
104
- :'account_id' => :'String',
105
- :'date' => :'Date',
106
- :'amount' => :'Integer',
107
- :'payee_id' => :'String',
108
- :'payee_name' => :'String',
109
- :'category_id' => :'String',
110
- :'memo' => :'String',
111
- :'cleared' => :'String',
112
- :'approved' => :'Boolean',
113
- :'flag_color' => :'String',
114
- :'import_id' => :'String',
115
- :'subtransactions' => :'Array<SaveSubTransaction>'
116
- }
117
- end
118
-
119
- # List of attributes with nullable: true
120
- def self.openapi_nullable
121
- Set.new([
122
- :'payee_id',
123
- :'payee_name',
124
- :'category_id',
125
- :'memo',
126
- :'import_id',
127
- ])
128
- end
129
-
130
- # List of class defined in allOf (OpenAPI v3)
131
- def self.openapi_all_of
132
- [
133
- :'SaveTransactionWithIdAllOf',
134
- :'SaveTransactionWithOptionalFields'
135
- ]
136
- end
137
-
138
- # Initializes the object
139
- # @param [Hash] attributes Model attributes in the form of hash
140
- def initialize(attributes = {})
141
- if (!attributes.is_a?(Hash))
142
- fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionWithId` initialize method"
143
- end
144
-
145
- # check to see if the attribute exists and convert string to symbol for hash key
146
- attributes = attributes.each_with_object({}) { |(k, v), h|
147
- if (!self.class.attribute_map.key?(k.to_sym))
148
- fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionWithId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
149
- end
150
- h[k.to_sym] = v
151
- }
152
-
153
- if attributes.key?(:'id')
154
- self.id = attributes[:'id']
155
- end
156
-
157
- if attributes.key?(:'account_id')
158
- self.account_id = attributes[:'account_id']
159
- end
160
-
161
- if attributes.key?(:'date')
162
- self.date = attributes[:'date']
163
- end
164
-
165
- if attributes.key?(:'amount')
166
- self.amount = attributes[:'amount']
167
- end
168
-
169
- if attributes.key?(:'payee_id')
170
- self.payee_id = attributes[:'payee_id']
171
- end
172
-
173
- if attributes.key?(:'payee_name')
174
- self.payee_name = attributes[:'payee_name']
175
- end
176
-
177
- if attributes.key?(:'category_id')
178
- self.category_id = attributes[:'category_id']
179
- end
180
-
181
- if attributes.key?(:'memo')
182
- self.memo = attributes[:'memo']
183
- end
184
-
185
- if attributes.key?(:'cleared')
186
- self.cleared = attributes[:'cleared']
187
- end
188
-
189
- if attributes.key?(:'approved')
190
- self.approved = attributes[:'approved']
191
- end
192
-
193
- if attributes.key?(:'flag_color')
194
- self.flag_color = attributes[:'flag_color']
195
- end
196
-
197
- if attributes.key?(:'import_id')
198
- self.import_id = attributes[:'import_id']
199
- end
200
-
201
- if attributes.key?(:'subtransactions')
202
- if (value = attributes[:'subtransactions']).is_a?(Array)
203
- self.subtransactions = value
204
- end
205
- end
206
- end
207
-
208
- # Show invalid properties with the reasons. Usually used together with valid?
209
- # @return Array for valid properties with the reasons
210
- def list_invalid_properties
211
- invalid_properties = Array.new
212
- invalid_properties
213
- end
214
-
215
- # Check to see if the all the properties in the model are valid
216
- # @return true if the model is valid
217
- def valid?
218
- return false if !@payee_name.nil? && @payee_name.to_s.length > 50
219
- return false if !@memo.nil? && @memo.to_s.length > 200
220
- cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
221
- return false unless cleared_validator.valid?(@cleared)
222
- flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
223
- return false unless flag_color_validator.valid?(@flag_color)
224
- return false if !@import_id.nil? && @import_id.to_s.length > 36
225
- true
226
- end
227
-
228
- # Custom attribute writer method with validation
229
- # @param [Object] payee_name Value to be assigned
230
- def payee_name=(payee_name)
231
- @payee_name = payee_name
232
- end
233
-
234
- # Custom attribute writer method with validation
235
- # @param [Object] memo Value to be assigned
236
- def memo=(memo)
237
- @memo = memo
238
- end
239
-
240
- # Custom attribute writer method checking allowed values (enum).
241
- # @param [Object] cleared Object to be assigned
242
- def cleared=(cleared)
243
- @cleared = cleared
244
- end
245
-
246
- # Custom attribute writer method checking allowed values (enum).
247
- # @param [Object] flag_color Object to be assigned
248
- def flag_color=(flag_color)
249
- @flag_color = flag_color
250
- end
251
-
252
- # Custom attribute writer method with validation
253
- # @param [Object] import_id Value to be assigned
254
- def import_id=(import_id)
255
- @import_id = import_id
256
- end
257
-
258
- # Checks equality by comparing each attribute.
259
- # @param [Object] Object to be compared
260
- def ==(o)
261
- return true if self.equal?(o)
262
- self.class == o.class &&
263
- id == o.id &&
264
- account_id == o.account_id &&
265
- date == o.date &&
266
- amount == o.amount &&
267
- payee_id == o.payee_id &&
268
- payee_name == o.payee_name &&
269
- category_id == o.category_id &&
270
- memo == o.memo &&
271
- cleared == o.cleared &&
272
- approved == o.approved &&
273
- flag_color == o.flag_color &&
274
- import_id == o.import_id &&
275
- subtransactions == o.subtransactions
276
- end
277
-
278
- # @see the `==` method
279
- # @param [Object] Object to be compared
280
- def eql?(o)
281
- self == o
282
- end
283
-
284
- # Calculates hash code according to all attributes.
285
- # @return [Integer] Hash code
286
- def hash
287
- [id, account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
288
- end
289
-
290
- # Builds the object from hash
291
- # @param [Hash] attributes Model attributes in the form of hash
292
- # @return [Object] Returns the model itself
293
- def self.build_from_hash(attributes)
294
- new.build_from_hash(attributes)
295
- end
296
-
297
- # Builds the object from hash
298
- # @param [Hash] attributes Model attributes in the form of hash
299
- # @return [Object] Returns the model itself
300
- def build_from_hash(attributes)
301
- return nil unless attributes.is_a?(Hash)
302
- attributes = attributes.transform_keys(&:to_sym)
303
- self.class.openapi_types.each_pair do |key, type|
304
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
305
- self.send("#{key}=", nil)
306
- elsif type =~ /\AArray<(.*)>/i
307
- # check to ensure the input is an array given that the attribute
308
- # is documented as an array but the input is not
309
- if attributes[self.class.attribute_map[key]].is_a?(Array)
310
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
311
- end
312
- elsif !attributes[self.class.attribute_map[key]].nil?
313
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
314
- end
315
- end
316
-
317
- self
318
- end
319
-
320
- # Deserializes the data based on type
321
- # @param string type Data type
322
- # @param string value Value to be deserialized
323
- # @return [Object] Deserialized data
324
- def _deserialize(type, value)
325
- case type.to_sym
326
- when :Time
327
- Time.parse(value)
328
- when :Date
329
- Date.parse(value)
330
- when :String
331
- value.to_s
332
- when :Integer
333
- value.to_i
334
- when :Float
335
- value.to_f
336
- when :Boolean
337
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
338
- true
339
- else
340
- false
341
- end
342
- when :Object
343
- # generic object (usually a Hash), return directly
344
- value
345
- when /\AArray<(?<inner_type>.+)>\z/
346
- inner_type = Regexp.last_match[:inner_type]
347
- value.map { |v| _deserialize(inner_type, v) }
348
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
349
- k_type = Regexp.last_match[:k_type]
350
- v_type = Regexp.last_match[:v_type]
351
- {}.tap do |hash|
352
- value.each do |k, v|
353
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
354
- end
355
- end
356
- else # model
357
- # models (e.g. Pet) or oneOf
358
- klass = YNAB.const_get(type)
359
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
360
- end
361
- end
362
-
363
- # Returns the string representation of the object
364
- # @return [String] String presentation of the object
365
- def to_s
366
- to_hash.to_s
367
- end
368
-
369
- # to_body is an alias to to_hash (backward compatibility)
370
- # @return [Hash] Returns the object in the form of hash
371
- def to_body
372
- to_hash
373
- end
374
-
375
- # Returns the object in the form of hash
376
- # @return [Hash] Returns the object in the form of hash
377
- def to_hash
378
- hash = {}
379
- self.class.attribute_map.each_pair do |attr, param|
380
- value = self.send(attr)
381
- if value.nil?
382
- is_nullable = self.class.openapi_nullable.include?(attr)
383
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
384
- end
385
-
386
- hash[param] = _to_hash(value)
387
- end
388
- hash
389
- end
390
-
391
- # Outputs non-array value in the form of hash
392
- # For object, use to_hash. Otherwise, just return the value
393
- # @param [Object] value Any valid value
394
- # @return [Hash] Returns the value in the form of hash
395
- def _to_hash(value)
396
- if value.is_a?(Array)
397
- value.compact.map { |v| _to_hash(v) }
398
- elsif value.is_a?(Hash)
399
- {}.tap do |hash|
400
- value.each { |k, v| hash[k] = _to_hash(v) }
401
- end
402
- elsif value.respond_to? :to_hash
403
- value.to_hash
404
- else
405
- value
406
- end
407
- end
408
-
409
- end
410
-
411
- end
@@ -1,254 +0,0 @@
1
- =begin
2
- #YNAB API Endpoints
3
-
4
- #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
5
-
6
- The version of the OpenAPI document: 1.0.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 6.6.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module YNAB
17
- class ScheduledTransactionDetailAllOf
18
- attr_accessor :account_name
19
-
20
- attr_accessor :payee_name
21
-
22
- # The name of the category. If a split scheduled transaction, this will be 'Split'.
23
- attr_accessor :category_name
24
-
25
- # If a split scheduled transaction, the subtransactions.
26
- attr_accessor :subtransactions
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'account_name' => :'account_name',
32
- :'payee_name' => :'payee_name',
33
- :'category_name' => :'category_name',
34
- :'subtransactions' => :'subtransactions'
35
- }
36
- end
37
-
38
- # Returns all the JSON keys this model knows about
39
- def self.acceptable_attributes
40
- attribute_map.values
41
- end
42
-
43
- # Attribute type mapping.
44
- def self.openapi_types
45
- {
46
- :'account_name' => :'String',
47
- :'payee_name' => :'String',
48
- :'category_name' => :'String',
49
- :'subtransactions' => :'Array<ScheduledSubTransaction>'
50
- }
51
- end
52
-
53
- # List of attributes with nullable: true
54
- def self.openapi_nullable
55
- Set.new([
56
- :'payee_name',
57
- :'category_name',
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 `YNAB::ScheduledTransactionDetailAllOf` 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 `YNAB::ScheduledTransactionDetailAllOf`. 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?(:'account_name')
77
- self.account_name = attributes[:'account_name']
78
- end
79
-
80
- if attributes.key?(:'payee_name')
81
- self.payee_name = attributes[:'payee_name']
82
- end
83
-
84
- if attributes.key?(:'category_name')
85
- self.category_name = attributes[:'category_name']
86
- end
87
-
88
- if attributes.key?(:'subtransactions')
89
- if (value = attributes[:'subtransactions']).is_a?(Array)
90
- self.subtransactions = value
91
- end
92
- end
93
- end
94
-
95
- # Show invalid properties with the reasons. Usually used together with valid?
96
- # @return Array for valid properties with the reasons
97
- def list_invalid_properties
98
- invalid_properties = Array.new
99
- invalid_properties
100
- end
101
-
102
- # Check to see if the all the properties in the model are valid
103
- # @return true if the model is valid
104
- def valid?
105
- return false if @account_name.nil?
106
- return false if @subtransactions.nil?
107
- true
108
- end
109
-
110
- # Checks equality by comparing each attribute.
111
- # @param [Object] Object to be compared
112
- def ==(o)
113
- return true if self.equal?(o)
114
- self.class == o.class &&
115
- account_name == o.account_name &&
116
- payee_name == o.payee_name &&
117
- category_name == o.category_name &&
118
- subtransactions == o.subtransactions
119
- end
120
-
121
- # @see the `==` method
122
- # @param [Object] Object to be compared
123
- def eql?(o)
124
- self == o
125
- end
126
-
127
- # Calculates hash code according to all attributes.
128
- # @return [Integer] Hash code
129
- def hash
130
- [account_name, payee_name, category_name, subtransactions].hash
131
- end
132
-
133
- # Builds the object from hash
134
- # @param [Hash] attributes Model attributes in the form of hash
135
- # @return [Object] Returns the model itself
136
- def self.build_from_hash(attributes)
137
- new.build_from_hash(attributes)
138
- end
139
-
140
- # Builds the object from hash
141
- # @param [Hash] attributes Model attributes in the form of hash
142
- # @return [Object] Returns the model itself
143
- def build_from_hash(attributes)
144
- return nil unless attributes.is_a?(Hash)
145
- attributes = attributes.transform_keys(&:to_sym)
146
- self.class.openapi_types.each_pair do |key, type|
147
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
148
- self.send("#{key}=", nil)
149
- elsif type =~ /\AArray<(.*)>/i
150
- # check to ensure the input is an array given that the attribute
151
- # is documented as an array but the input is not
152
- if attributes[self.class.attribute_map[key]].is_a?(Array)
153
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
154
- end
155
- elsif !attributes[self.class.attribute_map[key]].nil?
156
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
- end
158
- end
159
-
160
- self
161
- end
162
-
163
- # Deserializes the data based on type
164
- # @param string type Data type
165
- # @param string value Value to be deserialized
166
- # @return [Object] Deserialized data
167
- def _deserialize(type, value)
168
- case type.to_sym
169
- when :Time
170
- Time.parse(value)
171
- when :Date
172
- Date.parse(value)
173
- when :String
174
- value.to_s
175
- when :Integer
176
- value.to_i
177
- when :Float
178
- value.to_f
179
- when :Boolean
180
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
181
- true
182
- else
183
- false
184
- end
185
- when :Object
186
- # generic object (usually a Hash), return directly
187
- value
188
- when /\AArray<(?<inner_type>.+)>\z/
189
- inner_type = Regexp.last_match[:inner_type]
190
- value.map { |v| _deserialize(inner_type, v) }
191
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
192
- k_type = Regexp.last_match[:k_type]
193
- v_type = Regexp.last_match[:v_type]
194
- {}.tap do |hash|
195
- value.each do |k, v|
196
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
197
- end
198
- end
199
- else # model
200
- # models (e.g. Pet) or oneOf
201
- klass = YNAB.const_get(type)
202
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
- end
204
- end
205
-
206
- # Returns the string representation of the object
207
- # @return [String] String presentation of the object
208
- def to_s
209
- to_hash.to_s
210
- end
211
-
212
- # to_body is an alias to to_hash (backward compatibility)
213
- # @return [Hash] Returns the object in the form of hash
214
- def to_body
215
- to_hash
216
- end
217
-
218
- # Returns the object in the form of hash
219
- # @return [Hash] Returns the object in the form of hash
220
- def to_hash
221
- hash = {}
222
- self.class.attribute_map.each_pair do |attr, param|
223
- value = self.send(attr)
224
- if value.nil?
225
- is_nullable = self.class.openapi_nullable.include?(attr)
226
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
- end
228
-
229
- hash[param] = _to_hash(value)
230
- end
231
- hash
232
- end
233
-
234
- # Outputs non-array value in the form of hash
235
- # For object, use to_hash. Otherwise, just return the value
236
- # @param [Object] value Any valid value
237
- # @return [Hash] Returns the value in the form of hash
238
- def _to_hash(value)
239
- if value.is_a?(Array)
240
- value.compact.map { |v| _to_hash(v) }
241
- elsif value.is_a?(Hash)
242
- {}.tap do |hash|
243
- value.each { |k, v| hash[k] = _to_hash(v) }
244
- end
245
- elsif value.respond_to? :to_hash
246
- value.to_hash
247
- else
248
- value
249
- end
250
- end
251
-
252
- end
253
-
254
- end