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
@@ -0,0 +1,25 @@
1
+ require 'date'
2
+ require 'ynab'
3
+
4
+ access_token = ENV['YNAB_ACCESS_TOKEN']
5
+ ynab = YNAB::API.new(access_token)
6
+
7
+ budget_id = ENV['YNAB_BUDGET_ID']
8
+ category_id = 'a191ac84-de09-not-real-6c5ed8cfdabe'
9
+ month = '2019-01-01'
10
+
11
+ data = {
12
+ category: {
13
+ budgeted: 20382
14
+ }
15
+ }
16
+
17
+ begin
18
+ # Update budgeted amount to 203.82 in 2018-09-01 for category_id
19
+ response = ynab.categories.update_month_category(budget_id, month, category_id, data)
20
+ month_category_response = response.data.category
21
+ puts "[budgeted: #{month_category_response.budgeted}, balance: #{month_category_response.balance}]"
22
+ rescue YNAB::ApiError => e
23
+ puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}"
24
+ end
25
+
@@ -0,0 +1,20 @@
1
+ require 'ynab'
2
+
3
+ access_token = ENV['YNAB_ACCESS_TOKEN']
4
+ ynab = YNAB::API.new(access_token)
5
+
6
+ budget_id = ENV['YNAB_BUDGET_ID']
7
+
8
+ begin
9
+ # Fetch all unapproved transactions and update them all as approved
10
+ unapproved_transaction_data = ynab.transactions.get_transactions(budget_id, { type: 'unapproved' }).data
11
+
12
+ data = unapproved_transaction_data.clone
13
+ data.transactions.each do |t|
14
+ t.approved = true
15
+ end
16
+
17
+ ynab.transactions.update_transactions(budget_id, update_data)
18
+ rescue YNAB::ApiError => e
19
+ puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}"
20
+ end
@@ -3,14 +3,14 @@
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
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module YNAB
16
16
  class AccountsApi
@@ -21,8 +21,8 @@ module YNAB
21
21
  end
22
22
  # Create a new account
23
23
  # Creates a new account
24
- # @param budget_id The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget)
25
- # @param data The account to create.
24
+ # @param budget_id [String] The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget)
25
+ # @param data [PostAccountWrapper] The account to create.
26
26
  # @param [Hash] opts the optional parameters
27
27
  # @return [AccountResponse]
28
28
  def create_account(budget_id, data, opts = {})
@@ -32,10 +32,10 @@ module YNAB
32
32
 
33
33
  # Create a new account
34
34
  # Creates a new account
35
- # @param budget_id The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget)
36
- # @param data The account to create.
35
+ # @param budget_id [String] The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget)
36
+ # @param data [PostAccountWrapper] The account to create.
37
37
  # @param [Hash] opts the optional parameters
38
- # @return [Array<(AccountResponse, Fixnum, Hash)>] AccountResponse data, response status code and response headers
38
+ # @return [Array<(AccountResponse, Integer, Hash)>] AccountResponse data, response status code and response headers
39
39
  def create_account_with_http_info(budget_id, data, opts = {})
40
40
  if @api_client.config.debugging
41
41
  @api_client.config.logger.debug 'Calling API: AccountsApi.create_account ...'
@@ -49,38 +49,54 @@ module YNAB
49
49
  fail ArgumentError, "Missing the required parameter 'data' when calling AccountsApi.create_account"
50
50
  end
51
51
  # resource path
52
- local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', budget_id.to_s)
52
+ local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s))
53
53
 
54
54
  # query parameters
55
- query_params = {}
55
+ query_params = opts[:query_params] || {}
56
56
 
57
57
  # header parameters
58
- header_params = {}
58
+ header_params = opts[:header_params] || {}
59
59
  # HTTP header 'Accept' (if needed)
60
60
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
61
66
 
62
67
  # form parameters
63
- form_params = {}
68
+ form_params = opts[:form_params] || {}
64
69
 
65
70
  # http body (model)
66
- post_body = @api_client.object_to_http_body(data)
67
- auth_names = ['bearer']
68
- data, status_code, headers = @api_client.call_api(:POST, local_var_path,
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(data)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'AccountResponse'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['bearer']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"AccountsApi.create_account",
69
81
  :header_params => header_params,
70
82
  :query_params => query_params,
71
83
  :form_params => form_params,
72
84
  :body => post_body,
73
85
  :auth_names => auth_names,
74
- :return_type => 'AccountResponse')
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
75
90
  if @api_client.config.debugging
76
91
  @api_client.config.logger.debug "API called: AccountsApi#create_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
77
92
  end
78
93
  return data, status_code, headers
79
94
  end
95
+
80
96
  # Single account
81
97
  # Returns a single account
82
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
83
- # @param account_id The id of the account
98
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
99
+ # @param account_id [String] The id of the account
84
100
  # @param [Hash] opts the optional parameters
85
101
  # @return [AccountResponse]
86
102
  def get_account_by_id(budget_id, account_id, opts = {})
@@ -90,10 +106,10 @@ module YNAB
90
106
 
91
107
  # Single account
92
108
  # Returns a single account
93
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
94
- # @param account_id The id of the account
109
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
110
+ # @param account_id [String] The id of the account
95
111
  # @param [Hash] opts the optional parameters
96
- # @return [Array<(AccountResponse, Fixnum, Hash)>] AccountResponse data, response status code and response headers
112
+ # @return [Array<(AccountResponse, Integer, Hash)>] AccountResponse data, response status code and response headers
97
113
  def get_account_by_id_with_http_info(budget_id, account_id, opts = {})
98
114
  if @api_client.config.debugging
99
115
  @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_by_id ...'
@@ -107,37 +123,48 @@ module YNAB
107
123
  fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_by_id"
108
124
  end
109
125
  # resource path
110
- local_var_path = '/budgets/{budget_id}/accounts/{account_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'account_id' + '}', account_id.to_s)
126
+ local_var_path = '/budgets/{budget_id}/accounts/{account_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s))
111
127
 
112
128
  # query parameters
113
- query_params = {}
129
+ query_params = opts[:query_params] || {}
114
130
 
115
131
  # header parameters
116
- header_params = {}
132
+ header_params = opts[:header_params] || {}
117
133
  # HTTP header 'Accept' (if needed)
118
134
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
119
135
 
120
136
  # form parameters
121
- form_params = {}
137
+ form_params = opts[:form_params] || {}
122
138
 
123
139
  # http body (model)
124
- post_body = nil
125
- auth_names = ['bearer']
126
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
140
+ post_body = opts[:debug_body]
141
+
142
+ # return_type
143
+ return_type = opts[:debug_return_type] || 'AccountResponse'
144
+
145
+ # auth_names
146
+ auth_names = opts[:debug_auth_names] || ['bearer']
147
+
148
+ new_options = opts.merge(
149
+ :operation => :"AccountsApi.get_account_by_id",
127
150
  :header_params => header_params,
128
151
  :query_params => query_params,
129
152
  :form_params => form_params,
130
153
  :body => post_body,
131
154
  :auth_names => auth_names,
132
- :return_type => 'AccountResponse')
155
+ :return_type => return_type
156
+ )
157
+
158
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
133
159
  if @api_client.config.debugging
134
160
  @api_client.config.logger.debug "API called: AccountsApi#get_account_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
135
161
  end
136
162
  return data, status_code, headers
137
163
  end
164
+
138
165
  # Account list
139
166
  # Returns all accounts
140
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
167
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
141
168
  # @param [Hash] opts the optional parameters
142
169
  # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.
143
170
  # @return [AccountsResponse]
@@ -148,10 +175,10 @@ module YNAB
148
175
 
149
176
  # Account list
150
177
  # Returns all accounts
151
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
178
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
152
179
  # @param [Hash] opts the optional parameters
153
180
  # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.
154
- # @return [Array<(AccountsResponse, Fixnum, Hash)>] AccountsResponse data, response status code and response headers
181
+ # @return [Array<(AccountsResponse, Integer, Hash)>] AccountsResponse data, response status code and response headers
155
182
  def get_accounts_with_http_info(budget_id, opts = {})
156
183
  if @api_client.config.debugging
157
184
  @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'
@@ -161,30 +188,40 @@ module YNAB
161
188
  fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_accounts"
162
189
  end
163
190
  # resource path
164
- local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', budget_id.to_s)
191
+ local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s))
165
192
 
166
193
  # query parameters
167
- query_params = {}
194
+ query_params = opts[:query_params] || {}
168
195
  query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?
169
196
 
170
197
  # header parameters
171
- header_params = {}
198
+ header_params = opts[:header_params] || {}
172
199
  # HTTP header 'Accept' (if needed)
173
200
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
174
201
 
175
202
  # form parameters
176
- form_params = {}
203
+ form_params = opts[:form_params] || {}
177
204
 
178
205
  # http body (model)
179
- post_body = nil
180
- auth_names = ['bearer']
181
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
206
+ post_body = opts[:debug_body]
207
+
208
+ # return_type
209
+ return_type = opts[:debug_return_type] || 'AccountsResponse'
210
+
211
+ # auth_names
212
+ auth_names = opts[:debug_auth_names] || ['bearer']
213
+
214
+ new_options = opts.merge(
215
+ :operation => :"AccountsApi.get_accounts",
182
216
  :header_params => header_params,
183
217
  :query_params => query_params,
184
218
  :form_params => form_params,
185
219
  :body => post_body,
186
220
  :auth_names => auth_names,
187
- :return_type => 'AccountsResponse')
221
+ :return_type => return_type
222
+ )
223
+
224
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
188
225
  if @api_client.config.debugging
189
226
  @api_client.config.logger.debug "API called: AccountsApi#get_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
190
227
  end
@@ -3,14 +3,14 @@
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
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module YNAB
16
16
  class BudgetsApi
@@ -21,7 +21,7 @@ module YNAB
21
21
  end
22
22
  # Single budget
23
23
  # Returns a single budget with all related entities. This resource is effectively a full budget export.
24
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
24
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
25
25
  # @param [Hash] opts the optional parameters
26
26
  # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.
27
27
  # @return [BudgetDetailResponse]
@@ -32,10 +32,10 @@ module YNAB
32
32
 
33
33
  # Single budget
34
34
  # Returns a single budget with all related entities. This resource is effectively a full budget export.
35
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
35
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
36
36
  # @param [Hash] opts the optional parameters
37
37
  # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.
38
- # @return [Array<(BudgetDetailResponse, Fixnum, Hash)>] BudgetDetailResponse data, response status code and response headers
38
+ # @return [Array<(BudgetDetailResponse, Integer, Hash)>] BudgetDetailResponse data, response status code and response headers
39
39
  def get_budget_by_id_with_http_info(budget_id, opts = {})
40
40
  if @api_client.config.debugging
41
41
  @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_by_id ...'
@@ -45,38 +45,49 @@ module YNAB
45
45
  fail ArgumentError, "Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_by_id"
46
46
  end
47
47
  # resource path
48
- local_var_path = '/budgets/{budget_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s)
48
+ local_var_path = '/budgets/{budget_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s))
49
49
 
50
50
  # query parameters
51
- query_params = {}
51
+ query_params = opts[:query_params] || {}
52
52
  query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?
53
53
 
54
54
  # header parameters
55
- header_params = {}
55
+ header_params = opts[:header_params] || {}
56
56
  # HTTP header 'Accept' (if needed)
57
57
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
58
58
 
59
59
  # form parameters
60
- form_params = {}
60
+ form_params = opts[:form_params] || {}
61
61
 
62
62
  # http body (model)
63
- post_body = nil
64
- auth_names = ['bearer']
65
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
63
+ post_body = opts[:debug_body]
64
+
65
+ # return_type
66
+ return_type = opts[:debug_return_type] || 'BudgetDetailResponse'
67
+
68
+ # auth_names
69
+ auth_names = opts[:debug_auth_names] || ['bearer']
70
+
71
+ new_options = opts.merge(
72
+ :operation => :"BudgetsApi.get_budget_by_id",
66
73
  :header_params => header_params,
67
74
  :query_params => query_params,
68
75
  :form_params => form_params,
69
76
  :body => post_body,
70
77
  :auth_names => auth_names,
71
- :return_type => 'BudgetDetailResponse')
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
72
82
  if @api_client.config.debugging
73
83
  @api_client.config.logger.debug "API called: BudgetsApi#get_budget_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
74
84
  end
75
85
  return data, status_code, headers
76
86
  end
87
+
77
88
  # Budget Settings
78
89
  # Returns settings for a budget
79
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
90
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
80
91
  # @param [Hash] opts the optional parameters
81
92
  # @return [BudgetSettingsResponse]
82
93
  def get_budget_settings_by_id(budget_id, opts = {})
@@ -86,9 +97,9 @@ module YNAB
86
97
 
87
98
  # Budget Settings
88
99
  # Returns settings for a budget
89
- # @param budget_id The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
100
+ # @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
90
101
  # @param [Hash] opts the optional parameters
91
- # @return [Array<(BudgetSettingsResponse, Fixnum, Hash)>] BudgetSettingsResponse data, response status code and response headers
102
+ # @return [Array<(BudgetSettingsResponse, Integer, Hash)>] BudgetSettingsResponse data, response status code and response headers
92
103
  def get_budget_settings_by_id_with_http_info(budget_id, opts = {})
93
104
  if @api_client.config.debugging
94
105
  @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_settings_by_id ...'
@@ -98,38 +109,49 @@ module YNAB
98
109
  fail ArgumentError, "Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_settings_by_id"
99
110
  end
100
111
  # resource path
101
- local_var_path = '/budgets/{budget_id}/settings'.sub('{' + 'budget_id' + '}', budget_id.to_s)
112
+ local_var_path = '/budgets/{budget_id}/settings'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s))
102
113
 
103
114
  # query parameters
104
- query_params = {}
115
+ query_params = opts[:query_params] || {}
105
116
 
106
117
  # header parameters
107
- header_params = {}
118
+ header_params = opts[:header_params] || {}
108
119
  # HTTP header 'Accept' (if needed)
109
120
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
110
121
 
111
122
  # form parameters
112
- form_params = {}
123
+ form_params = opts[:form_params] || {}
113
124
 
114
125
  # http body (model)
115
- post_body = nil
116
- auth_names = ['bearer']
117
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
126
+ post_body = opts[:debug_body]
127
+
128
+ # return_type
129
+ return_type = opts[:debug_return_type] || 'BudgetSettingsResponse'
130
+
131
+ # auth_names
132
+ auth_names = opts[:debug_auth_names] || ['bearer']
133
+
134
+ new_options = opts.merge(
135
+ :operation => :"BudgetsApi.get_budget_settings_by_id",
118
136
  :header_params => header_params,
119
137
  :query_params => query_params,
120
138
  :form_params => form_params,
121
139
  :body => post_body,
122
140
  :auth_names => auth_names,
123
- :return_type => 'BudgetSettingsResponse')
141
+ :return_type => return_type
142
+ )
143
+
144
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
124
145
  if @api_client.config.debugging
125
146
  @api_client.config.logger.debug "API called: BudgetsApi#get_budget_settings_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
126
147
  end
127
148
  return data, status_code, headers
128
149
  end
150
+
129
151
  # List budgets
130
152
  # Returns budgets list with summary information
131
153
  # @param [Hash] opts the optional parameters
132
- # @option opts [BOOLEAN] :include_accounts Whether to include the list of budget accounts
154
+ # @option opts [Boolean] :include_accounts Whether to include the list of budget accounts
133
155
  # @return [BudgetSummaryResponse]
134
156
  def get_budgets(opts = {})
135
157
  data, _status_code, _headers = get_budgets_with_http_info(opts)
@@ -139,8 +161,8 @@ module YNAB
139
161
  # List budgets
140
162
  # Returns budgets list with summary information
141
163
  # @param [Hash] opts the optional parameters
142
- # @option opts [BOOLEAN] :include_accounts Whether to include the list of budget accounts
143
- # @return [Array<(BudgetSummaryResponse, Fixnum, Hash)>] BudgetSummaryResponse data, response status code and response headers
164
+ # @option opts [Boolean] :include_accounts Whether to include the list of budget accounts
165
+ # @return [Array<(BudgetSummaryResponse, Integer, Hash)>] BudgetSummaryResponse data, response status code and response headers
144
166
  def get_budgets_with_http_info(opts = {})
145
167
  if @api_client.config.debugging
146
168
  @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budgets ...'
@@ -149,27 +171,37 @@ module YNAB
149
171
  local_var_path = '/budgets'
150
172
 
151
173
  # query parameters
152
- query_params = {}
174
+ query_params = opts[:query_params] || {}
153
175
  query_params[:'include_accounts'] = opts[:'include_accounts'] if !opts[:'include_accounts'].nil?
154
176
 
155
177
  # header parameters
156
- header_params = {}
178
+ header_params = opts[:header_params] || {}
157
179
  # HTTP header 'Accept' (if needed)
158
180
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
159
181
 
160
182
  # form parameters
161
- form_params = {}
183
+ form_params = opts[:form_params] || {}
162
184
 
163
185
  # http body (model)
164
- post_body = nil
165
- auth_names = ['bearer']
166
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
186
+ post_body = opts[:debug_body]
187
+
188
+ # return_type
189
+ return_type = opts[:debug_return_type] || 'BudgetSummaryResponse'
190
+
191
+ # auth_names
192
+ auth_names = opts[:debug_auth_names] || ['bearer']
193
+
194
+ new_options = opts.merge(
195
+ :operation => :"BudgetsApi.get_budgets",
167
196
  :header_params => header_params,
168
197
  :query_params => query_params,
169
198
  :form_params => form_params,
170
199
  :body => post_body,
171
200
  :auth_names => auth_names,
172
- :return_type => 'BudgetSummaryResponse')
201
+ :return_type => return_type
202
+ )
203
+
204
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
173
205
  if @api_client.config.debugging
174
206
  @api_client.config.logger.debug "API called: BudgetsApi#get_budgets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
175
207
  end