ynab 1.31.0 → 2.0.0.rc1

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 +194 -87
  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 Category
@@ -18,12 +19,14 @@ module YNAB
18
19
 
19
20
  attr_accessor :category_group_id
20
21
 
22
+ attr_accessor :category_group_name
23
+
21
24
  attr_accessor :name
22
25
 
23
26
  # Whether or not the category is hidden
24
27
  attr_accessor :hidden
25
28
 
26
- # If category is hidden this is the id of the category group it originally belonged to before it was hidden.
29
+ # DEPRECATED: No longer used. Value will always be null.
27
30
  attr_accessor :original_category_group_id
28
31
 
29
32
  attr_accessor :note
@@ -40,13 +43,13 @@ module YNAB
40
43
  # The type of goal, if the category has a goal (TB='Target Category Balance', TBD='Target Category Balance by Date', MF='Monthly Funding', NEED='Plan Your Spending')
41
44
  attr_accessor :goal_type
42
45
 
43
- # The day of the goal
46
+ # A day offset modifier for the goal's due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month).
44
47
  attr_accessor :goal_day
45
48
 
46
- # The goal cadence
49
+ # The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal's due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal's due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years.
47
50
  attr_accessor :goal_cadence
48
51
 
49
- # The goal cadence frequency
52
+ # The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal's due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored.
50
53
  attr_accessor :goal_cadence_frequency
51
54
 
52
55
  # The month a goal was created
@@ -64,7 +67,7 @@ module YNAB
64
67
  # The number of months, including the current month, left in the current goal period.
65
68
  attr_accessor :goal_months_to_budget
66
69
 
67
- # The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month.
70
+ # The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month.
68
71
  attr_accessor :goal_under_funded
69
72
 
70
73
  # The total amount funded towards the goal within the current goal period.
@@ -103,6 +106,7 @@ module YNAB
103
106
  {
104
107
  :'id' => :'id',
105
108
  :'category_group_id' => :'category_group_id',
109
+ :'category_group_name' => :'category_group_name',
106
110
  :'name' => :'name',
107
111
  :'hidden' => :'hidden',
108
112
  :'original_category_group_id' => :'original_category_group_id',
@@ -126,13 +130,19 @@ module YNAB
126
130
  }
127
131
  end
128
132
 
133
+ # Returns all the JSON keys this model knows about
134
+ def self.acceptable_attributes
135
+ attribute_map.values
136
+ end
137
+
129
138
  # Attribute type mapping.
130
- def self.swagger_types
139
+ def self.openapi_types
131
140
  {
132
141
  :'id' => :'String',
133
142
  :'category_group_id' => :'String',
143
+ :'category_group_name' => :'String',
134
144
  :'name' => :'String',
135
- :'hidden' => :'BOOLEAN',
145
+ :'hidden' => :'Boolean',
136
146
  :'original_category_group_id' => :'String',
137
147
  :'note' => :'String',
138
148
  :'budgeted' => :'Integer',
@@ -150,103 +160,134 @@ module YNAB
150
160
  :'goal_under_funded' => :'Integer',
151
161
  :'goal_overall_funded' => :'Integer',
152
162
  :'goal_overall_left' => :'Integer',
153
- :'deleted' => :'BOOLEAN'
163
+ :'deleted' => :'Boolean'
154
164
  }
155
165
  end
156
166
 
167
+ # List of attributes with nullable: true
168
+ def self.openapi_nullable
169
+ Set.new([
170
+ :'original_category_group_id',
171
+ :'note',
172
+ :'goal_type',
173
+ :'goal_day',
174
+ :'goal_cadence',
175
+ :'goal_cadence_frequency',
176
+ :'goal_creation_month',
177
+ :'goal_target',
178
+ :'goal_target_month',
179
+ :'goal_percentage_complete',
180
+ :'goal_months_to_budget',
181
+ :'goal_under_funded',
182
+ :'goal_overall_funded',
183
+ :'goal_overall_left',
184
+ ])
185
+ end
186
+
157
187
  # Initializes the object
158
188
  # @param [Hash] attributes Model attributes in the form of hash
159
189
  def initialize(attributes = {})
160
- return unless attributes.is_a?(Hash)
190
+ if (!attributes.is_a?(Hash))
191
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::Category` initialize method"
192
+ end
161
193
 
162
- # convert string to symbol for hash key
163
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
194
+ # check to see if the attribute exists and convert string to symbol for hash key
195
+ attributes = attributes.each_with_object({}) { |(k, v), h|
196
+ if (!self.class.attribute_map.key?(k.to_sym))
197
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
198
+ end
199
+ h[k.to_sym] = v
200
+ }
164
201
 
165
- if attributes.has_key?(:'id')
202
+ if attributes.key?(:'id')
166
203
  self.id = attributes[:'id']
167
204
  end
168
205
 
169
- if attributes.has_key?(:'category_group_id')
206
+ if attributes.key?(:'category_group_id')
170
207
  self.category_group_id = attributes[:'category_group_id']
171
208
  end
172
209
 
173
- if attributes.has_key?(:'name')
210
+ if attributes.key?(:'category_group_name')
211
+ self.category_group_name = attributes[:'category_group_name']
212
+ end
213
+
214
+ if attributes.key?(:'name')
174
215
  self.name = attributes[:'name']
175
216
  end
176
217
 
177
- if attributes.has_key?(:'hidden')
218
+ if attributes.key?(:'hidden')
178
219
  self.hidden = attributes[:'hidden']
179
220
  end
180
221
 
181
- if attributes.has_key?(:'original_category_group_id')
222
+ if attributes.key?(:'original_category_group_id')
182
223
  self.original_category_group_id = attributes[:'original_category_group_id']
183
224
  end
184
225
 
185
- if attributes.has_key?(:'note')
226
+ if attributes.key?(:'note')
186
227
  self.note = attributes[:'note']
187
228
  end
188
229
 
189
- if attributes.has_key?(:'budgeted')
230
+ if attributes.key?(:'budgeted')
190
231
  self.budgeted = attributes[:'budgeted']
191
232
  end
192
233
 
193
- if attributes.has_key?(:'activity')
234
+ if attributes.key?(:'activity')
194
235
  self.activity = attributes[:'activity']
195
236
  end
196
237
 
197
- if attributes.has_key?(:'balance')
238
+ if attributes.key?(:'balance')
198
239
  self.balance = attributes[:'balance']
199
240
  end
200
241
 
201
- if attributes.has_key?(:'goal_type')
242
+ if attributes.key?(:'goal_type')
202
243
  self.goal_type = attributes[:'goal_type']
203
244
  end
204
245
 
205
- if attributes.has_key?(:'goal_day')
246
+ if attributes.key?(:'goal_day')
206
247
  self.goal_day = attributes[:'goal_day']
207
248
  end
208
249
 
209
- if attributes.has_key?(:'goal_cadence')
250
+ if attributes.key?(:'goal_cadence')
210
251
  self.goal_cadence = attributes[:'goal_cadence']
211
252
  end
212
253
 
213
- if attributes.has_key?(:'goal_cadence_frequency')
254
+ if attributes.key?(:'goal_cadence_frequency')
214
255
  self.goal_cadence_frequency = attributes[:'goal_cadence_frequency']
215
256
  end
216
257
 
217
- if attributes.has_key?(:'goal_creation_month')
258
+ if attributes.key?(:'goal_creation_month')
218
259
  self.goal_creation_month = attributes[:'goal_creation_month']
219
260
  end
220
261
 
221
- if attributes.has_key?(:'goal_target')
262
+ if attributes.key?(:'goal_target')
222
263
  self.goal_target = attributes[:'goal_target']
223
264
  end
224
265
 
225
- if attributes.has_key?(:'goal_target_month')
266
+ if attributes.key?(:'goal_target_month')
226
267
  self.goal_target_month = attributes[:'goal_target_month']
227
268
  end
228
269
 
229
- if attributes.has_key?(:'goal_percentage_complete')
270
+ if attributes.key?(:'goal_percentage_complete')
230
271
  self.goal_percentage_complete = attributes[:'goal_percentage_complete']
231
272
  end
232
273
 
233
- if attributes.has_key?(:'goal_months_to_budget')
274
+ if attributes.key?(:'goal_months_to_budget')
234
275
  self.goal_months_to_budget = attributes[:'goal_months_to_budget']
235
276
  end
236
277
 
237
- if attributes.has_key?(:'goal_under_funded')
278
+ if attributes.key?(:'goal_under_funded')
238
279
  self.goal_under_funded = attributes[:'goal_under_funded']
239
280
  end
240
281
 
241
- if attributes.has_key?(:'goal_overall_funded')
282
+ if attributes.key?(:'goal_overall_funded')
242
283
  self.goal_overall_funded = attributes[:'goal_overall_funded']
243
284
  end
244
285
 
245
- if attributes.has_key?(:'goal_overall_left')
286
+ if attributes.key?(:'goal_overall_left')
246
287
  self.goal_overall_left = attributes[:'goal_overall_left']
247
288
  end
248
289
 
249
- if attributes.has_key?(:'deleted')
290
+ if attributes.key?(:'deleted')
250
291
  self.deleted = attributes[:'deleted']
251
292
  end
252
293
  end
@@ -300,7 +341,7 @@ module YNAB
300
341
  return false if @budgeted.nil?
301
342
  return false if @activity.nil?
302
343
  return false if @balance.nil?
303
- goal_type_validator = EnumAttributeValidator.new('String', ['TB', 'TBD', 'MF', 'NEED', 'DEBT'])
344
+ goal_type_validator = EnumAttributeValidator.new('String', ["TB", "TBD", "MF", "NEED", "DEBT", "null"])
304
345
  return false unless goal_type_validator.valid?(@goal_type)
305
346
  return false if @deleted.nil?
306
347
  true
@@ -309,6 +350,10 @@ module YNAB
309
350
  # Custom attribute writer method checking allowed values (enum).
310
351
  # @param [Object] goal_type Object to be assigned
311
352
  def goal_type=(goal_type)
353
+ validator = EnumAttributeValidator.new('String', ["TB", "TBD", "MF", "NEED", "DEBT", "null"])
354
+ unless validator.valid?(goal_type)
355
+ fail ArgumentError, "invalid value for \"goal_type\", must be one of #{validator.allowable_values}."
356
+ end
312
357
  @goal_type = goal_type
313
358
  end
314
359
 
@@ -319,6 +364,7 @@ module YNAB
319
364
  self.class == o.class &&
320
365
  id == o.id &&
321
366
  category_group_id == o.category_group_id &&
367
+ category_group_name == o.category_group_name &&
322
368
  name == o.name &&
323
369
  hidden == o.hidden &&
324
370
  original_category_group_id == o.original_category_group_id &&
@@ -348,17 +394,28 @@ module YNAB
348
394
  end
349
395
 
350
396
  # Calculates hash code according to all attributes.
351
- # @return [Fixnum] Hash code
397
+ # @return [Integer] Hash code
352
398
  def hash
353
- [id, category_group_id, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, deleted].hash
399
+ [id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, deleted].hash
400
+ end
401
+
402
+ # Builds the object from hash
403
+ # @param [Hash] attributes Model attributes in the form of hash
404
+ # @return [Object] Returns the model itself
405
+ def self.build_from_hash(attributes)
406
+ new.build_from_hash(attributes)
354
407
  end
408
+
355
409
  # Builds the object from hash
356
410
  # @param [Hash] attributes Model attributes in the form of hash
357
411
  # @return [Object] Returns the model itself
358
412
  def build_from_hash(attributes)
359
413
  return nil unless attributes.is_a?(Hash)
360
- self.class.swagger_types.each_pair do |key, type|
361
- if type =~ /\AArray<(.*)>/i
414
+ attributes = attributes.transform_keys(&:to_sym)
415
+ self.class.openapi_types.each_pair do |key, type|
416
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
417
+ self.send("#{key}=", nil)
418
+ elsif type =~ /\AArray<(.*)>/i
362
419
  # check to ensure the input is an array given that the attribute
363
420
  # is documented as an array but the input is not
364
421
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -366,7 +423,7 @@ module YNAB
366
423
  end
367
424
  elsif !attributes[self.class.attribute_map[key]].nil?
368
425
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
369
- end # or else data not found in attributes(hash), not an issue as the data can be optional
426
+ end
370
427
  end
371
428
 
372
429
  self
@@ -378,8 +435,8 @@ module YNAB
378
435
  # @return [Object] Deserialized data
379
436
  def _deserialize(type, value)
380
437
  case type.to_sym
381
- when :DateTime
382
- DateTime.parse(value)
438
+ when :Time
439
+ Time.parse(value)
383
440
  when :Date
384
441
  Date.parse(value)
385
442
  when :String
@@ -388,7 +445,7 @@ module YNAB
388
445
  value.to_i
389
446
  when :Float
390
447
  value.to_f
391
- when :BOOLEAN
448
+ when :Boolean
392
449
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
393
450
  true
394
451
  else
@@ -409,8 +466,9 @@ module YNAB
409
466
  end
410
467
  end
411
468
  else # model
412
- temp_model = YNAB.const_get(type).new
413
- temp_model.build_from_hash(value)
469
+ # models (e.g. Pet) or oneOf
470
+ klass = YNAB.const_get(type)
471
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
414
472
  end
415
473
  end
416
474
 
@@ -432,7 +490,11 @@ module YNAB
432
490
  hash = {}
433
491
  self.class.attribute_map.each_pair do |attr, param|
434
492
  value = self.send(attr)
435
- next if value.nil?
493
+ if value.nil?
494
+ is_nullable = self.class.openapi_nullable.include?(attr)
495
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
496
+ end
497
+
436
498
  hash[param] = _to_hash(value)
437
499
  end
438
500
  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 CategoryGroup
@@ -34,37 +35,55 @@ module YNAB
34
35
  }
35
36
  end
36
37
 
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ attribute_map.values
41
+ end
42
+
37
43
  # Attribute type mapping.
38
- def self.swagger_types
44
+ def self.openapi_types
39
45
  {
40
46
  :'id' => :'String',
41
47
  :'name' => :'String',
42
- :'hidden' => :'BOOLEAN',
43
- :'deleted' => :'BOOLEAN'
48
+ :'hidden' => :'Boolean',
49
+ :'deleted' => :'Boolean'
44
50
  }
45
51
  end
46
52
 
53
+ # List of attributes with nullable: true
54
+ def self.openapi_nullable
55
+ Set.new([
56
+ ])
57
+ end
58
+
47
59
  # Initializes the object
48
60
  # @param [Hash] attributes Model attributes in the form of hash
49
61
  def initialize(attributes = {})
50
- return unless attributes.is_a?(Hash)
62
+ if (!attributes.is_a?(Hash))
63
+ fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::CategoryGroup` initialize method"
64
+ end
51
65
 
52
- # convert string to symbol for hash key
53
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
66
+ # check to see if the attribute exists and convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h|
68
+ if (!self.class.attribute_map.key?(k.to_sym))
69
+ fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::CategoryGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
70
+ end
71
+ h[k.to_sym] = v
72
+ }
54
73
 
55
- if attributes.has_key?(:'id')
74
+ if attributes.key?(:'id')
56
75
  self.id = attributes[:'id']
57
76
  end
58
77
 
59
- if attributes.has_key?(:'name')
78
+ if attributes.key?(:'name')
60
79
  self.name = attributes[:'name']
61
80
  end
62
81
 
63
- if attributes.has_key?(:'hidden')
82
+ if attributes.key?(:'hidden')
64
83
  self.hidden = attributes[:'hidden']
65
84
  end
66
85
 
67
- if attributes.has_key?(:'deleted')
86
+ if attributes.key?(:'deleted')
68
87
  self.deleted = attributes[:'deleted']
69
88
  end
70
89
  end
@@ -120,17 +139,28 @@ module YNAB
120
139
  end
121
140
 
122
141
  # Calculates hash code according to all attributes.
123
- # @return [Fixnum] Hash code
142
+ # @return [Integer] Hash code
124
143
  def hash
125
144
  [id, name, hidden, deleted].hash
126
145
  end
146
+
147
+ # Builds the object from hash
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @return [Object] Returns the model itself
150
+ def self.build_from_hash(attributes)
151
+ new.build_from_hash(attributes)
152
+ end
153
+
127
154
  # Builds the object from hash
128
155
  # @param [Hash] attributes Model attributes in the form of hash
129
156
  # @return [Object] Returns the model itself
130
157
  def build_from_hash(attributes)
131
158
  return nil unless attributes.is_a?(Hash)
132
- self.class.swagger_types.each_pair do |key, type|
133
- if type =~ /\AArray<(.*)>/i
159
+ attributes = attributes.transform_keys(&:to_sym)
160
+ self.class.openapi_types.each_pair do |key, type|
161
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
162
+ self.send("#{key}=", nil)
163
+ elsif type =~ /\AArray<(.*)>/i
134
164
  # check to ensure the input is an array given that the attribute
135
165
  # is documented as an array but the input is not
136
166
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -138,7 +168,7 @@ module YNAB
138
168
  end
139
169
  elsif !attributes[self.class.attribute_map[key]].nil?
140
170
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
- end # or else data not found in attributes(hash), not an issue as the data can be optional
171
+ end
142
172
  end
143
173
 
144
174
  self
@@ -150,8 +180,8 @@ module YNAB
150
180
  # @return [Object] Deserialized data
151
181
  def _deserialize(type, value)
152
182
  case type.to_sym
153
- when :DateTime
154
- DateTime.parse(value)
183
+ when :Time
184
+ Time.parse(value)
155
185
  when :Date
156
186
  Date.parse(value)
157
187
  when :String
@@ -160,7 +190,7 @@ module YNAB
160
190
  value.to_i
161
191
  when :Float
162
192
  value.to_f
163
- when :BOOLEAN
193
+ when :Boolean
164
194
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
195
  true
166
196
  else
@@ -181,8 +211,9 @@ module YNAB
181
211
  end
182
212
  end
183
213
  else # model
184
- temp_model = YNAB.const_get(type).new
185
- temp_model.build_from_hash(value)
214
+ # models (e.g. Pet) or oneOf
215
+ klass = YNAB.const_get(type)
216
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
217
  end
187
218
  end
188
219
 
@@ -204,7 +235,11 @@ module YNAB
204
235
  hash = {}
205
236
  self.class.attribute_map.each_pair do |attr, param|
206
237
  value = self.send(attr)
207
- next if value.nil?
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
208
243
  hash[param] = _to_hash(value)
209
244
  end
210
245
  hash