ynab 1.31.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/DEVELOPMENT.md +11 -0
  3. data/Gemfile +8 -0
  4. data/Gemfile.lock +42 -0
  5. data/README.md +3 -3
  6. data/Rakefile +58 -0
  7. data/config.json +9 -0
  8. data/docs/Account.md +25 -0
  9. data/docs/AccountResponse.md +8 -0
  10. data/docs/AccountResponseData.md +8 -0
  11. data/docs/AccountType.md +7 -0
  12. data/docs/AccountWrapper.md +8 -0
  13. data/docs/AccountsApi.md +70 -0
  14. data/docs/AccountsResponse.md +8 -0
  15. data/docs/AccountsResponseData.md +9 -0
  16. data/docs/AccountsWrapper.md +9 -0
  17. data/docs/BudgetDetail.md +24 -0
  18. data/docs/BudgetDetailAllOf.md +17 -0
  19. data/docs/BudgetDetailResponse.md +8 -0
  20. data/docs/BudgetDetailResponseData.md +9 -0
  21. data/docs/BudgetDetailWrapper.md +9 -0
  22. data/docs/BudgetSettings.md +9 -0
  23. data/docs/BudgetSettingsResponse.md +8 -0
  24. data/docs/BudgetSettingsResponseData.md +8 -0
  25. data/docs/BudgetSettingsWrapper.md +8 -0
  26. data/docs/BudgetSummary.md +15 -0
  27. data/docs/BudgetSummaryResponse.md +8 -0
  28. data/docs/BudgetSummaryResponseData.md +9 -0
  29. data/docs/BudgetSummaryWrapper.md +9 -0
  30. data/docs/BudgetsApi.md +68 -0
  31. data/docs/BulkIdWrapper.md +8 -0
  32. data/docs/BulkIds.md +9 -0
  33. data/docs/BulkResponse.md +8 -0
  34. data/docs/BulkResponseData.md +8 -0
  35. data/docs/BulkResponseDataBulk.md +9 -0
  36. data/docs/BulkTransactionCreateResponse.md +8 -0
  37. data/docs/BulkTransactionIds.md +8 -0
  38. data/docs/BulkTransactions.md +8 -0
  39. data/docs/CategoriesApi.md +94 -0
  40. data/docs/CategoriesResponse.md +8 -0
  41. data/docs/CategoriesResponseData.md +9 -0
  42. data/docs/Category.md +30 -0
  43. data/docs/CategoryGroup.md +11 -0
  44. data/docs/CategoryGroupWithCategories.md +12 -0
  45. data/docs/CategoryGroupWithCategoriesAllOf.md +8 -0
  46. data/docs/CategoryGroupsWrapper.md +9 -0
  47. data/docs/CategoryResponse.md +8 -0
  48. data/docs/CategoryResponseData.md +8 -0
  49. data/docs/CategoryWrapper.md +9 -0
  50. data/docs/CurrencyFormat.md +15 -0
  51. data/docs/DateFormat.md +8 -0
  52. data/docs/DeprecatedApi.md +28 -0
  53. data/docs/ErrorDetail.md +10 -0
  54. data/docs/ErrorResponse.md +8 -0
  55. data/docs/HybridTransaction.md +30 -0
  56. data/docs/HybridTransactionAllOf.md +12 -0
  57. data/docs/HybridTransactionsResponse.md +8 -0
  58. data/docs/HybridTransactionsResponseData.md +9 -0
  59. data/docs/HybridTransactionsWrapper.md +8 -0
  60. data/docs/LoanAccountPeriodicValue.md +7 -0
  61. data/docs/MonthDetail.md +16 -0
  62. data/docs/MonthDetailAllOf.md +8 -0
  63. data/docs/MonthDetailResponse.md +8 -0
  64. data/docs/MonthDetailResponseData.md +8 -0
  65. data/docs/MonthDetailWrapper.md +8 -0
  66. data/docs/MonthSummariesResponse.md +8 -0
  67. data/docs/MonthSummariesResponseData.md +9 -0
  68. data/docs/MonthSummariesWrapper.md +9 -0
  69. data/docs/MonthSummary.md +15 -0
  70. data/docs/MonthsApi.md +49 -0
  71. data/docs/PatchMonthCategoryWrapper.md +8 -0
  72. data/docs/PatchTransactionsWrapper.md +8 -0
  73. data/docs/Payee.md +11 -0
  74. data/docs/PayeeLocation.md +12 -0
  75. data/docs/PayeeLocationResponse.md +8 -0
  76. data/docs/PayeeLocationResponseData.md +8 -0
  77. data/docs/PayeeLocationWrapper.md +8 -0
  78. data/docs/PayeeLocationsApi.md +69 -0
  79. data/docs/PayeeLocationsResponse.md +8 -0
  80. data/docs/PayeeLocationsResponseData.md +8 -0
  81. data/docs/PayeeLocationsWrapper.md +8 -0
  82. data/docs/PayeeResponse.md +8 -0
  83. data/docs/PayeeResponseData.md +8 -0
  84. data/docs/PayeeWrapper.md +8 -0
  85. data/docs/PayeesApi.md +49 -0
  86. data/docs/PayeesResponse.md +8 -0
  87. data/docs/PayeesResponseData.md +9 -0
  88. data/docs/PayeesWrapper.md +9 -0
  89. data/docs/PostAccountWrapper.md +8 -0
  90. data/docs/PostTransactionsWrapper.md +9 -0
  91. data/docs/PutTransactionWrapper.md +8 -0
  92. data/docs/SaveAccount.md +10 -0
  93. data/docs/SaveAccountWrapper.md +8 -0
  94. data/docs/SaveCategoryResponse.md +8 -0
  95. data/docs/SaveCategoryResponseData.md +9 -0
  96. data/docs/SaveMonthCategory.md +8 -0
  97. data/docs/SaveMonthCategoryWrapper.md +8 -0
  98. data/docs/SaveSubTransaction.md +12 -0
  99. data/docs/SaveTransaction.md +19 -0
  100. data/docs/SaveTransactionWithId.md +20 -0
  101. data/docs/SaveTransactionWithIdAllOf.md +8 -0
  102. data/docs/SaveTransactionWithOptionalFields.md +19 -0
  103. data/docs/SaveTransactionWrapper.md +8 -0
  104. data/docs/SaveTransactionsResponse.md +8 -0
  105. data/docs/SaveTransactionsResponseData.md +12 -0
  106. data/docs/SaveTransactionsWrapper.md +9 -0
  107. data/docs/ScheduledSubTransaction.md +15 -0
  108. data/docs/ScheduledTransactionDetail.md +23 -0
  109. data/docs/ScheduledTransactionDetailAllOf.md +11 -0
  110. data/docs/ScheduledTransactionResponse.md +8 -0
  111. data/docs/ScheduledTransactionResponseData.md +8 -0
  112. data/docs/ScheduledTransactionSummary.md +19 -0
  113. data/docs/ScheduledTransactionWrapper.md +8 -0
  114. data/docs/ScheduledTransactionsApi.md +49 -0
  115. data/docs/ScheduledTransactionsResponse.md +8 -0
  116. data/docs/ScheduledTransactionsResponseData.md +9 -0
  117. data/docs/ScheduledTransactionsWrapper.md +8 -0
  118. data/docs/SubTransaction.md +18 -0
  119. data/docs/TransactionDetail.md +29 -0
  120. data/docs/TransactionDetailAllOf.md +11 -0
  121. data/docs/TransactionResponse.md +8 -0
  122. data/docs/TransactionResponseData.md +8 -0
  123. data/docs/TransactionSummary.md +25 -0
  124. data/docs/TransactionWrapper.md +8 -0
  125. data/docs/TransactionsApi.md +228 -0
  126. data/docs/TransactionsImportResponse.md +8 -0
  127. data/docs/TransactionsImportResponseData.md +8 -0
  128. data/docs/TransactionsResponse.md +8 -0
  129. data/docs/TransactionsResponseData.md +9 -0
  130. data/docs/TransactionsWrapper.md +9 -0
  131. data/docs/UpdateTransaction.md +20 -0
  132. data/docs/UpdateTransactionsWrapper.md +8 -0
  133. data/docs/User.md +8 -0
  134. data/docs/UserApi.md +25 -0
  135. data/docs/UserResponse.md +8 -0
  136. data/docs/UserResponseData.md +8 -0
  137. data/docs/UserWrapper.md +8 -0
  138. data/examples/budget-list.rb +21 -0
  139. data/examples/budget-month.rb +33 -0
  140. data/examples/category-balance.rb +23 -0
  141. data/examples/create-multiple-transactions.rb +42 -0
  142. data/examples/create-transaction.rb +30 -0
  143. data/examples/update-category-budgeted.rb +25 -0
  144. data/examples/update-multiple-transactions.rb +20 -0
  145. data/lib/ynab/api/accounts_api.rb +78 -41
  146. data/lib/ynab/api/budgets_api.rb +68 -36
  147. data/lib/ynab/api/categories_api.rb +108 -60
  148. data/lib/ynab/api/deprecated_api.rb +32 -17
  149. data/lib/ynab/api/months_api.rb +49 -28
  150. data/lib/ynab/api/payee_locations_api.rb +73 -41
  151. data/lib/ynab/api/payees_api.rb +49 -28
  152. data/lib/ynab/api/scheduled_transactions_api.rb +49 -28
  153. data/lib/ynab/api/transactions_api.rb +268 -140
  154. data/lib/ynab/api/user_api.rb +22 -12
  155. data/lib/ynab/api_client.rb +97 -95
  156. data/lib/ynab/configuration.rb +101 -14
  157. data/lib/ynab/models/account.rb +117 -55
  158. data/lib/ynab/models/account_response.rb +53 -18
  159. data/lib/ynab/models/account_response_data.rb +53 -18
  160. data/lib/ynab/models/account_type.rb +30 -20
  161. data/lib/ynab/models/accounts_response.rb +53 -18
  162. data/lib/ynab/models/accounts_response_data.rb +54 -19
  163. data/lib/ynab/models/budget_detail.rb +80 -35
  164. data/lib/ynab/models/budget_detail_all_of.rb +320 -0
  165. data/lib/ynab/models/budget_detail_response.rb +53 -18
  166. data/lib/ynab/models/budget_detail_response_data.rb +54 -19
  167. data/lib/ynab/models/budget_settings.rb +56 -29
  168. data/lib/ynab/models/budget_settings_response.rb +53 -18
  169. data/lib/ynab/models/budget_settings_response_data.rb +53 -18
  170. data/lib/ynab/models/budget_summary.rb +63 -26
  171. data/lib/ynab/models/budget_summary_response.rb +53 -18
  172. data/lib/ynab/models/budget_summary_response_data.rb +54 -20
  173. data/lib/ynab/models/bulk_response.rb +53 -18
  174. data/lib/ynab/models/bulk_response_data.rb +53 -18
  175. data/lib/ynab/models/bulk_response_data_bulk.rb +54 -19
  176. data/lib/ynab/models/bulk_transactions.rb +53 -18
  177. data/lib/ynab/models/categories_response.rb +53 -18
  178. data/lib/ynab/models/categories_response_data.rb +54 -19
  179. data/lib/ynab/models/category.rb +110 -48
  180. data/lib/ynab/models/category_group.rb +58 -23
  181. data/lib/ynab/models/category_group_with_categories.rb +67 -24
  182. data/lib/ynab/models/{save_month_category_wrapper.rb → category_group_with_categories_all_of.rb} +67 -29
  183. data/lib/ynab/models/category_response.rb +53 -18
  184. data/lib/ynab/models/category_response_data.rb +53 -18
  185. data/lib/ynab/models/currency_format.rb +62 -27
  186. data/lib/ynab/models/date_format.rb +53 -18
  187. data/lib/ynab/models/error_detail.rb +55 -20
  188. data/lib/ynab/models/error_response.rb +53 -18
  189. data/lib/ynab/models/hybrid_transaction.rb +118 -46
  190. data/lib/ynab/models/hybrid_transaction_all_of.rb +304 -0
  191. data/lib/ynab/models/hybrid_transactions_response.rb +53 -18
  192. data/lib/ynab/models/hybrid_transactions_response_data.rb +54 -19
  193. data/lib/ynab/models/month_detail.rb +72 -27
  194. data/lib/ynab/models/{update_transactions_wrapper.rb → month_detail_all_of.rb} +66 -30
  195. data/lib/ynab/models/month_detail_response.rb +53 -18
  196. data/lib/ynab/models/month_detail_response_data.rb +53 -18
  197. data/lib/ynab/models/month_summaries_response.rb +53 -18
  198. data/lib/ynab/models/month_summaries_response_data.rb +54 -19
  199. data/lib/ynab/models/month_summary.rb +63 -26
  200. data/lib/ynab/models/patch_month_category_wrapper.rb +53 -18
  201. data/lib/ynab/models/patch_transactions_wrapper.rb +53 -18
  202. data/lib/ynab/models/payee.rb +58 -22
  203. data/lib/ynab/models/payee_location.rb +58 -23
  204. data/lib/ynab/models/payee_location_response.rb +53 -18
  205. data/lib/ynab/models/payee_location_response_data.rb +53 -18
  206. data/lib/ynab/models/payee_locations_response.rb +53 -18
  207. data/lib/ynab/models/payee_locations_response_data.rb +53 -18
  208. data/lib/ynab/models/payee_response.rb +53 -18
  209. data/lib/ynab/models/payee_response_data.rb +53 -18
  210. data/lib/ynab/models/payees_response.rb +53 -18
  211. data/lib/ynab/models/payees_response_data.rb +54 -19
  212. data/lib/ynab/models/post_account_wrapper.rb +53 -18
  213. data/lib/ynab/models/post_transactions_wrapper.rb +54 -19
  214. data/lib/ynab/models/put_transaction_wrapper.rb +53 -18
  215. data/lib/ynab/models/save_account.rb +77 -20
  216. data/lib/ynab/models/save_category_response.rb +53 -18
  217. data/lib/ynab/models/save_category_response_data.rb +54 -19
  218. data/lib/ynab/models/save_month_category.rb +53 -18
  219. data/lib/ynab/models/save_sub_transaction.rb +61 -22
  220. data/lib/ynab/models/save_transaction.rb +88 -33
  221. data/lib/ynab/models/save_transaction_with_id.rb +102 -46
  222. data/lib/ynab/models/{save_transactions_wrapper.rb → save_transaction_with_id_all_of.rb} +60 -36
  223. data/lib/ynab/models/save_transaction_with_optional_fields.rb +81 -33
  224. data/lib/ynab/models/save_transactions_response.rb +53 -18
  225. data/lib/ynab/models/save_transactions_response_data.rb +57 -23
  226. data/lib/ynab/models/scheduled_sub_transaction.rb +66 -27
  227. data/lib/ynab/models/scheduled_transaction_detail.rb +94 -36
  228. data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +262 -0
  229. data/lib/ynab/models/scheduled_transaction_response.rb +53 -18
  230. data/lib/ynab/models/scheduled_transaction_response_data.rb +53 -18
  231. data/lib/ynab/models/scheduled_transaction_summary.rb +80 -32
  232. data/lib/ynab/models/scheduled_transactions_response.rb +53 -18
  233. data/lib/ynab/models/scheduled_transactions_response_data.rb +54 -19
  234. data/lib/ynab/models/sub_transaction.rb +71 -29
  235. data/lib/ynab/models/transaction_detail.rb +112 -44
  236. data/lib/ynab/models/{save_transaction_wrapper.rb → transaction_detail_all_of.rb} +102 -29
  237. data/lib/ynab/models/transaction_response.rb +53 -18
  238. data/lib/ynab/models/transaction_response_data.rb +53 -18
  239. data/lib/ynab/models/transaction_summary.rb +98 -40
  240. data/lib/ynab/models/transactions_import_response.rb +53 -18
  241. data/lib/ynab/models/transactions_import_response_data.rb +53 -18
  242. data/lib/ynab/models/transactions_response.rb +53 -18
  243. data/lib/ynab/models/transactions_response_data.rb +54 -19
  244. data/lib/ynab/models/user.rb +53 -18
  245. data/lib/ynab/models/user_response.rb +53 -18
  246. data/lib/ynab/models/user_response_data.rb +53 -18
  247. data/lib/ynab/version.rb +1 -1
  248. data/lib/ynab.rb +19 -14
  249. data/open_api_spec.yaml +3012 -0
  250. data/templates/api_client.mustache +274 -0
  251. data/templates/api_client_typhoeus_partial.mustache +156 -0
  252. data/templates/api_doc.mustache +44 -0
  253. data/templates/gem.mustache +84 -0
  254. data/templates/partial_model_generic_doc.mustache +9 -0
  255. data/ynab.gemspec +38 -0
  256. metadata +192 -85
  257. data/lib/ynab/models/loan_account_periodic_value.rb +0 -175
  258. data/lib/ynab/models/save_account_wrapper.rb +0 -189
  259. data/lib/ynab/models/update_transaction.rb +0 -407
  260. data/spec/models/transaction_detail_spec.rb +0 -11
@@ -3,14 +3,15 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 1.0.0
6
+ The version of the OpenAPI document: 1.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module YNAB
16
17
  class SaveTransactionWithOptionalFields
@@ -45,7 +46,7 @@ module YNAB
45
46
  # 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).
46
47
  attr_accessor :import_id
47
48
 
48
- # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
49
+ # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported.
49
50
  attr_accessor :subtransactions
50
51
 
51
52
  class EnumAttributeValidator
@@ -88,8 +89,13 @@ module YNAB
88
89
  }
89
90
  end
90
91
 
92
+ # Returns all the JSON keys this model knows about
93
+ def self.acceptable_attributes
94
+ attribute_map.values
95
+ end
96
+
91
97
  # Attribute type mapping.
92
- def self.swagger_types
98
+ def self.openapi_types
93
99
  {
94
100
  :'account_id' => :'String',
95
101
  :'date' => :'Date',
@@ -99,66 +105,84 @@ module YNAB
99
105
  :'category_id' => :'String',
100
106
  :'memo' => :'String',
101
107
  :'cleared' => :'String',
102
- :'approved' => :'BOOLEAN',
108
+ :'approved' => :'Boolean',
103
109
  :'flag_color' => :'String',
104
110
  :'import_id' => :'String',
105
111
  :'subtransactions' => :'Array<SaveSubTransaction>'
106
112
  }
107
113
  end
108
114
 
115
+ # List of attributes with nullable: true
116
+ def self.openapi_nullable
117
+ Set.new([
118
+ :'payee_id',
119
+ :'payee_name',
120
+ :'category_id',
121
+ :'memo',
122
+ :'import_id',
123
+ ])
124
+ end
125
+
109
126
  # Initializes the object
110
127
  # @param [Hash] attributes Model attributes in the form of hash
111
128
  def initialize(attributes = {})
112
- return unless attributes.is_a?(Hash)
129
+ if (!attributes.is_a?(Hash))
130
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionWithOptionalFields` initialize method"
131
+ end
113
132
 
114
- # convert string to symbol for hash key
115
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
133
+ # check to see if the attribute exists and convert string to symbol for hash key
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!self.class.attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionWithOptionalFields`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
116
140
 
117
- if attributes.has_key?(:'account_id')
141
+ if attributes.key?(:'account_id')
118
142
  self.account_id = attributes[:'account_id']
119
143
  end
120
144
 
121
- if attributes.has_key?(:'date')
145
+ if attributes.key?(:'date')
122
146
  self.date = attributes[:'date']
123
147
  end
124
148
 
125
- if attributes.has_key?(:'amount')
149
+ if attributes.key?(:'amount')
126
150
  self.amount = attributes[:'amount']
127
151
  end
128
152
 
129
- if attributes.has_key?(:'payee_id')
153
+ if attributes.key?(:'payee_id')
130
154
  self.payee_id = attributes[:'payee_id']
131
155
  end
132
156
 
133
- if attributes.has_key?(:'payee_name')
157
+ if attributes.key?(:'payee_name')
134
158
  self.payee_name = attributes[:'payee_name']
135
159
  end
136
160
 
137
- if attributes.has_key?(:'category_id')
161
+ if attributes.key?(:'category_id')
138
162
  self.category_id = attributes[:'category_id']
139
163
  end
140
164
 
141
- if attributes.has_key?(:'memo')
165
+ if attributes.key?(:'memo')
142
166
  self.memo = attributes[:'memo']
143
167
  end
144
168
 
145
- if attributes.has_key?(:'cleared')
169
+ if attributes.key?(:'cleared')
146
170
  self.cleared = attributes[:'cleared']
147
171
  end
148
172
 
149
- if attributes.has_key?(:'approved')
173
+ if attributes.key?(:'approved')
150
174
  self.approved = attributes[:'approved']
151
175
  end
152
176
 
153
- if attributes.has_key?(:'flag_color')
177
+ if attributes.key?(:'flag_color')
154
178
  self.flag_color = attributes[:'flag_color']
155
179
  end
156
180
 
157
- if attributes.has_key?(:'import_id')
181
+ if attributes.key?(:'import_id')
158
182
  self.import_id = attributes[:'import_id']
159
183
  end
160
184
 
161
- if attributes.has_key?(:'subtransactions')
185
+ if attributes.key?(:'subtransactions')
162
186
  if (value = attributes[:'subtransactions']).is_a?(Array)
163
187
  self.subtransactions = value
164
188
  end
@@ -189,9 +213,9 @@ module YNAB
189
213
  def valid?
190
214
  return false if !@payee_name.nil? && @payee_name.to_s.length > 50
191
215
  return false if !@memo.nil? && @memo.to_s.length > 200
192
- cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
216
+ cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
193
217
  return false unless cleared_validator.valid?(@cleared)
194
- flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
218
+ flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
195
219
  return false unless flag_color_validator.valid?(@flag_color)
196
220
  return false if !@import_id.nil? && @import_id.to_s.length > 36
197
221
  true
@@ -220,12 +244,20 @@ module YNAB
220
244
  # Custom attribute writer method checking allowed values (enum).
221
245
  # @param [Object] cleared Object to be assigned
222
246
  def cleared=(cleared)
247
+ validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"])
248
+ unless validator.valid?(cleared)
249
+ fail ArgumentError, "invalid value for \"cleared\", must be one of #{validator.allowable_values}."
250
+ end
223
251
  @cleared = cleared
224
252
  end
225
253
 
226
254
  # Custom attribute writer method checking allowed values (enum).
227
255
  # @param [Object] flag_color Object to be assigned
228
256
  def flag_color=(flag_color)
257
+ validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"])
258
+ unless validator.valid?(flag_color)
259
+ fail ArgumentError, "invalid value for \"flag_color\", must be one of #{validator.allowable_values}."
260
+ end
229
261
  @flag_color = flag_color
230
262
  end
231
263
 
@@ -265,17 +297,28 @@ module YNAB
265
297
  end
266
298
 
267
299
  # Calculates hash code according to all attributes.
268
- # @return [Fixnum] Hash code
300
+ # @return [Integer] Hash code
269
301
  def hash
270
302
  [account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].hash
271
303
  end
304
+
305
+ # Builds the object from hash
306
+ # @param [Hash] attributes Model attributes in the form of hash
307
+ # @return [Object] Returns the model itself
308
+ def self.build_from_hash(attributes)
309
+ new.build_from_hash(attributes)
310
+ end
311
+
272
312
  # Builds the object from hash
273
313
  # @param [Hash] attributes Model attributes in the form of hash
274
314
  # @return [Object] Returns the model itself
275
315
  def build_from_hash(attributes)
276
316
  return nil unless attributes.is_a?(Hash)
277
- self.class.swagger_types.each_pair do |key, type|
278
- if type =~ /\AArray<(.*)>/i
317
+ attributes = attributes.transform_keys(&:to_sym)
318
+ self.class.openapi_types.each_pair do |key, type|
319
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
320
+ self.send("#{key}=", nil)
321
+ elsif type =~ /\AArray<(.*)>/i
279
322
  # check to ensure the input is an array given that the attribute
280
323
  # is documented as an array but the input is not
281
324
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -283,7 +326,7 @@ module YNAB
283
326
  end
284
327
  elsif !attributes[self.class.attribute_map[key]].nil?
285
328
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
286
- end # or else data not found in attributes(hash), not an issue as the data can be optional
329
+ end
287
330
  end
288
331
 
289
332
  self
@@ -295,8 +338,8 @@ module YNAB
295
338
  # @return [Object] Deserialized data
296
339
  def _deserialize(type, value)
297
340
  case type.to_sym
298
- when :DateTime
299
- DateTime.parse(value)
341
+ when :Time
342
+ Time.parse(value)
300
343
  when :Date
301
344
  Date.parse(value)
302
345
  when :String
@@ -305,7 +348,7 @@ module YNAB
305
348
  value.to_i
306
349
  when :Float
307
350
  value.to_f
308
- when :BOOLEAN
351
+ when :Boolean
309
352
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
310
353
  true
311
354
  else
@@ -326,8 +369,9 @@ module YNAB
326
369
  end
327
370
  end
328
371
  else # model
329
- temp_model = YNAB.const_get(type).new
330
- temp_model.build_from_hash(value)
372
+ # models (e.g. Pet) or oneOf
373
+ klass = YNAB.const_get(type)
374
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
331
375
  end
332
376
  end
333
377
 
@@ -349,7 +393,11 @@ module YNAB
349
393
  hash = {}
350
394
  self.class.attribute_map.each_pair do |attr, param|
351
395
  value = self.send(attr)
352
- next if value.nil?
396
+ if value.nil?
397
+ is_nullable = self.class.openapi_nullable.include?(attr)
398
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
399
+ end
400
+
353
401
  hash[param] = _to_hash(value)
354
402
  end
355
403
  hash
@@ -3,14 +3,15 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 1.0.0
6
+ The version of the OpenAPI document: 1.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module YNAB
16
17
  class SaveTransactionsResponse
@@ -23,22 +24,40 @@ module YNAB
23
24
  }
24
25
  end
25
26
 
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
26
32
  # Attribute type mapping.
27
- def self.swagger_types
33
+ def self.openapi_types
28
34
  {
29
35
  :'data' => :'SaveTransactionsResponseData'
30
36
  }
31
37
  end
32
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
33
45
  # Initializes the object
34
46
  # @param [Hash] attributes Model attributes in the form of hash
35
47
  def initialize(attributes = {})
36
- return unless attributes.is_a?(Hash)
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionsResponse` initialize method"
50
+ end
37
51
 
38
- # convert string to symbol for hash key
39
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
40
59
 
41
- if attributes.has_key?(:'data')
60
+ if attributes.key?(:'data')
42
61
  self.data = attributes[:'data']
43
62
  end
44
63
  end
@@ -76,17 +95,28 @@ module YNAB
76
95
  end
77
96
 
78
97
  # Calculates hash code according to all attributes.
79
- # @return [Fixnum] Hash code
98
+ # @return [Integer] Hash code
80
99
  def hash
81
100
  [data].hash
82
101
  end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
83
110
  # Builds the object from hash
84
111
  # @param [Hash] attributes Model attributes in the form of hash
85
112
  # @return [Object] Returns the model itself
86
113
  def build_from_hash(attributes)
87
114
  return nil unless attributes.is_a?(Hash)
88
- self.class.swagger_types.each_pair do |key, type|
89
- if type =~ /\AArray<(.*)>/i
115
+ attributes = attributes.transform_keys(&:to_sym)
116
+ self.class.openapi_types.each_pair do |key, type|
117
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
118
+ self.send("#{key}=", nil)
119
+ elsif type =~ /\AArray<(.*)>/i
90
120
  # check to ensure the input is an array given that the attribute
91
121
  # is documented as an array but the input is not
92
122
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -94,7 +124,7 @@ module YNAB
94
124
  end
95
125
  elsif !attributes[self.class.attribute_map[key]].nil?
96
126
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
- end # or else data not found in attributes(hash), not an issue as the data can be optional
127
+ end
98
128
  end
99
129
 
100
130
  self
@@ -106,8 +136,8 @@ module YNAB
106
136
  # @return [Object] Deserialized data
107
137
  def _deserialize(type, value)
108
138
  case type.to_sym
109
- when :DateTime
110
- DateTime.parse(value)
139
+ when :Time
140
+ Time.parse(value)
111
141
  when :Date
112
142
  Date.parse(value)
113
143
  when :String
@@ -116,7 +146,7 @@ module YNAB
116
146
  value.to_i
117
147
  when :Float
118
148
  value.to_f
119
- when :BOOLEAN
149
+ when :Boolean
120
150
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
151
  true
122
152
  else
@@ -137,8 +167,9 @@ module YNAB
137
167
  end
138
168
  end
139
169
  else # model
140
- temp_model = YNAB.const_get(type).new
141
- temp_model.build_from_hash(value)
170
+ # models (e.g. Pet) or oneOf
171
+ klass = YNAB.const_get(type)
172
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
142
173
  end
143
174
  end
144
175
 
@@ -160,7 +191,11 @@ module YNAB
160
191
  hash = {}
161
192
  self.class.attribute_map.each_pair do |attr, param|
162
193
  value = self.send(attr)
163
- next if value.nil?
194
+ if value.nil?
195
+ is_nullable = self.class.openapi_nullable.include?(attr)
196
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
197
+ end
198
+
164
199
  hash[param] = _to_hash(value)
165
200
  end
166
201
  hash
@@ -3,21 +3,21 @@
3
3
 
4
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
5
 
6
- OpenAPI spec version: 1.0.0
6
+ The version of the OpenAPI document: 1.0.0
7
7
 
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.14
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module YNAB
16
17
  class SaveTransactionsResponseData
17
18
  # The transaction ids that were saved
18
19
  attr_accessor :transaction_ids
19
20
 
20
- # If a single transaction was specified, the transaction that was saved
21
21
  attr_accessor :transaction
22
22
 
23
23
  # If multiple transactions were specified, the transactions that were saved
@@ -40,8 +40,13 @@ module YNAB
40
40
  }
41
41
  end
42
42
 
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ attribute_map.values
46
+ end
47
+
43
48
  # Attribute type mapping.
44
- def self.swagger_types
49
+ def self.openapi_types
45
50
  {
46
51
  :'transaction_ids' => :'Array<String>',
47
52
  :'transaction' => :'TransactionDetail',
@@ -51,37 +56,50 @@ module YNAB
51
56
  }
52
57
  end
53
58
 
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ ])
63
+ end
64
+
54
65
  # Initializes the object
55
66
  # @param [Hash] attributes Model attributes in the form of hash
56
67
  def initialize(attributes = {})
57
- return unless attributes.is_a?(Hash)
68
+ if (!attributes.is_a?(Hash))
69
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SaveTransactionsResponseData` initialize method"
70
+ end
58
71
 
59
- # convert string to symbol for hash key
60
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+ # check to see if the attribute exists and convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!self.class.attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SaveTransactionsResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
61
79
 
62
- if attributes.has_key?(:'transaction_ids')
80
+ if attributes.key?(:'transaction_ids')
63
81
  if (value = attributes[:'transaction_ids']).is_a?(Array)
64
82
  self.transaction_ids = value
65
83
  end
66
84
  end
67
85
 
68
- if attributes.has_key?(:'transaction')
86
+ if attributes.key?(:'transaction')
69
87
  self.transaction = attributes[:'transaction']
70
88
  end
71
89
 
72
- if attributes.has_key?(:'transactions')
90
+ if attributes.key?(:'transactions')
73
91
  if (value = attributes[:'transactions']).is_a?(Array)
74
92
  self.transactions = value
75
93
  end
76
94
  end
77
95
 
78
- if attributes.has_key?(:'duplicate_import_ids')
96
+ if attributes.key?(:'duplicate_import_ids')
79
97
  if (value = attributes[:'duplicate_import_ids']).is_a?(Array)
80
98
  self.duplicate_import_ids = value
81
99
  end
82
100
  end
83
101
 
84
- if attributes.has_key?(:'server_knowledge')
102
+ if attributes.key?(:'server_knowledge')
85
103
  self.server_knowledge = attributes[:'server_knowledge']
86
104
  end
87
105
  end
@@ -128,17 +146,28 @@ module YNAB
128
146
  end
129
147
 
130
148
  # Calculates hash code according to all attributes.
131
- # @return [Fixnum] Hash code
149
+ # @return [Integer] Hash code
132
150
  def hash
133
151
  [transaction_ids, transaction, transactions, duplicate_import_ids, server_knowledge].hash
134
152
  end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ new.build_from_hash(attributes)
159
+ end
160
+
135
161
  # Builds the object from hash
136
162
  # @param [Hash] attributes Model attributes in the form of hash
137
163
  # @return [Object] Returns the model itself
138
164
  def build_from_hash(attributes)
139
165
  return nil unless attributes.is_a?(Hash)
140
- self.class.swagger_types.each_pair do |key, type|
141
- if type =~ /\AArray<(.*)>/i
166
+ attributes = attributes.transform_keys(&:to_sym)
167
+ self.class.openapi_types.each_pair do |key, type|
168
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ elsif type =~ /\AArray<(.*)>/i
142
171
  # check to ensure the input is an array given that the attribute
143
172
  # is documented as an array but the input is not
144
173
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -146,7 +175,7 @@ module YNAB
146
175
  end
147
176
  elsif !attributes[self.class.attribute_map[key]].nil?
148
177
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
- end # or else data not found in attributes(hash), not an issue as the data can be optional
178
+ end
150
179
  end
151
180
 
152
181
  self
@@ -158,8 +187,8 @@ module YNAB
158
187
  # @return [Object] Deserialized data
159
188
  def _deserialize(type, value)
160
189
  case type.to_sym
161
- when :DateTime
162
- DateTime.parse(value)
190
+ when :Time
191
+ Time.parse(value)
163
192
  when :Date
164
193
  Date.parse(value)
165
194
  when :String
@@ -168,7 +197,7 @@ module YNAB
168
197
  value.to_i
169
198
  when :Float
170
199
  value.to_f
171
- when :BOOLEAN
200
+ when :Boolean
172
201
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
173
202
  true
174
203
  else
@@ -189,8 +218,9 @@ module YNAB
189
218
  end
190
219
  end
191
220
  else # model
192
- temp_model = YNAB.const_get(type).new
193
- temp_model.build_from_hash(value)
221
+ # models (e.g. Pet) or oneOf
222
+ klass = YNAB.const_get(type)
223
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
194
224
  end
195
225
  end
196
226
 
@@ -212,7 +242,11 @@ module YNAB
212
242
  hash = {}
213
243
  self.class.attribute_map.each_pair do |attr, param|
214
244
  value = self.send(attr)
215
- next if value.nil?
245
+ if value.nil?
246
+ is_nullable = self.class.openapi_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
216
250
  hash[param] = _to_hash(value)
217
251
  end
218
252
  hash