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.
- checksums.yaml +4 -4
- data/DEVELOPMENT.md +11 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +42 -0
- data/README.md +3 -3
- data/Rakefile +58 -0
- data/config.json +9 -0
- data/docs/Account.md +25 -0
- data/docs/AccountResponse.md +8 -0
- data/docs/AccountResponseData.md +8 -0
- data/docs/AccountType.md +7 -0
- data/docs/AccountWrapper.md +8 -0
- data/docs/AccountsApi.md +70 -0
- data/docs/AccountsResponse.md +8 -0
- data/docs/AccountsResponseData.md +9 -0
- data/docs/AccountsWrapper.md +9 -0
- data/docs/BudgetDetail.md +24 -0
- data/docs/BudgetDetailAllOf.md +17 -0
- data/docs/BudgetDetailResponse.md +8 -0
- data/docs/BudgetDetailResponseData.md +9 -0
- data/docs/BudgetDetailWrapper.md +9 -0
- data/docs/BudgetSettings.md +9 -0
- data/docs/BudgetSettingsResponse.md +8 -0
- data/docs/BudgetSettingsResponseData.md +8 -0
- data/docs/BudgetSettingsWrapper.md +8 -0
- data/docs/BudgetSummary.md +15 -0
- data/docs/BudgetSummaryResponse.md +8 -0
- data/docs/BudgetSummaryResponseData.md +9 -0
- data/docs/BudgetSummaryWrapper.md +9 -0
- data/docs/BudgetsApi.md +68 -0
- data/docs/BulkIdWrapper.md +8 -0
- data/docs/BulkIds.md +9 -0
- data/docs/BulkResponse.md +8 -0
- data/docs/BulkResponseData.md +8 -0
- data/docs/BulkResponseDataBulk.md +9 -0
- data/docs/BulkTransactionCreateResponse.md +8 -0
- data/docs/BulkTransactionIds.md +8 -0
- data/docs/BulkTransactions.md +8 -0
- data/docs/CategoriesApi.md +94 -0
- data/docs/CategoriesResponse.md +8 -0
- data/docs/CategoriesResponseData.md +9 -0
- data/docs/Category.md +30 -0
- data/docs/CategoryGroup.md +11 -0
- data/docs/CategoryGroupWithCategories.md +12 -0
- data/docs/CategoryGroupWithCategoriesAllOf.md +8 -0
- data/docs/CategoryGroupsWrapper.md +9 -0
- data/docs/CategoryResponse.md +8 -0
- data/docs/CategoryResponseData.md +8 -0
- data/docs/CategoryWrapper.md +9 -0
- data/docs/CurrencyFormat.md +15 -0
- data/docs/DateFormat.md +8 -0
- data/docs/DeprecatedApi.md +28 -0
- data/docs/ErrorDetail.md +10 -0
- data/docs/ErrorResponse.md +8 -0
- data/docs/HybridTransaction.md +30 -0
- data/docs/HybridTransactionAllOf.md +12 -0
- data/docs/HybridTransactionsResponse.md +8 -0
- data/docs/HybridTransactionsResponseData.md +9 -0
- data/docs/HybridTransactionsWrapper.md +8 -0
- data/docs/LoanAccountPeriodicValue.md +7 -0
- data/docs/MonthDetail.md +16 -0
- data/docs/MonthDetailAllOf.md +8 -0
- data/docs/MonthDetailResponse.md +8 -0
- data/docs/MonthDetailResponseData.md +8 -0
- data/docs/MonthDetailWrapper.md +8 -0
- data/docs/MonthSummariesResponse.md +8 -0
- data/docs/MonthSummariesResponseData.md +9 -0
- data/docs/MonthSummariesWrapper.md +9 -0
- data/docs/MonthSummary.md +15 -0
- data/docs/MonthsApi.md +49 -0
- data/docs/PatchMonthCategoryWrapper.md +8 -0
- data/docs/PatchTransactionsWrapper.md +8 -0
- data/docs/Payee.md +11 -0
- data/docs/PayeeLocation.md +12 -0
- data/docs/PayeeLocationResponse.md +8 -0
- data/docs/PayeeLocationResponseData.md +8 -0
- data/docs/PayeeLocationWrapper.md +8 -0
- data/docs/PayeeLocationsApi.md +69 -0
- data/docs/PayeeLocationsResponse.md +8 -0
- data/docs/PayeeLocationsResponseData.md +8 -0
- data/docs/PayeeLocationsWrapper.md +8 -0
- data/docs/PayeeResponse.md +8 -0
- data/docs/PayeeResponseData.md +8 -0
- data/docs/PayeeWrapper.md +8 -0
- data/docs/PayeesApi.md +49 -0
- data/docs/PayeesResponse.md +8 -0
- data/docs/PayeesResponseData.md +9 -0
- data/docs/PayeesWrapper.md +9 -0
- data/docs/PostAccountWrapper.md +8 -0
- data/docs/PostTransactionsWrapper.md +9 -0
- data/docs/PutTransactionWrapper.md +8 -0
- data/docs/SaveAccount.md +10 -0
- data/docs/SaveAccountWrapper.md +8 -0
- data/docs/SaveCategoryResponse.md +8 -0
- data/docs/SaveCategoryResponseData.md +9 -0
- data/docs/SaveMonthCategory.md +8 -0
- data/docs/SaveMonthCategoryWrapper.md +8 -0
- data/docs/SaveSubTransaction.md +12 -0
- data/docs/SaveTransaction.md +19 -0
- data/docs/SaveTransactionWithId.md +20 -0
- data/docs/SaveTransactionWithIdAllOf.md +8 -0
- data/docs/SaveTransactionWithOptionalFields.md +19 -0
- data/docs/SaveTransactionWrapper.md +8 -0
- data/docs/SaveTransactionsResponse.md +8 -0
- data/docs/SaveTransactionsResponseData.md +12 -0
- data/docs/SaveTransactionsWrapper.md +9 -0
- data/docs/ScheduledSubTransaction.md +15 -0
- data/docs/ScheduledTransactionDetail.md +23 -0
- data/docs/ScheduledTransactionDetailAllOf.md +11 -0
- data/docs/ScheduledTransactionResponse.md +8 -0
- data/docs/ScheduledTransactionResponseData.md +8 -0
- data/docs/ScheduledTransactionSummary.md +19 -0
- data/docs/ScheduledTransactionWrapper.md +8 -0
- data/docs/ScheduledTransactionsApi.md +49 -0
- data/docs/ScheduledTransactionsResponse.md +8 -0
- data/docs/ScheduledTransactionsResponseData.md +9 -0
- data/docs/ScheduledTransactionsWrapper.md +8 -0
- data/docs/SubTransaction.md +18 -0
- data/docs/TransactionDetail.md +29 -0
- data/docs/TransactionDetailAllOf.md +11 -0
- data/docs/TransactionResponse.md +8 -0
- data/docs/TransactionResponseData.md +8 -0
- data/docs/TransactionSummary.md +25 -0
- data/docs/TransactionWrapper.md +8 -0
- data/docs/TransactionsApi.md +228 -0
- data/docs/TransactionsImportResponse.md +8 -0
- data/docs/TransactionsImportResponseData.md +8 -0
- data/docs/TransactionsResponse.md +8 -0
- data/docs/TransactionsResponseData.md +9 -0
- data/docs/TransactionsWrapper.md +9 -0
- data/docs/UpdateTransaction.md +20 -0
- data/docs/UpdateTransactionsWrapper.md +8 -0
- data/docs/User.md +8 -0
- data/docs/UserApi.md +25 -0
- data/docs/UserResponse.md +8 -0
- data/docs/UserResponseData.md +8 -0
- data/docs/UserWrapper.md +8 -0
- data/examples/budget-list.rb +21 -0
- data/examples/budget-month.rb +33 -0
- data/examples/category-balance.rb +23 -0
- data/examples/create-multiple-transactions.rb +42 -0
- data/examples/create-transaction.rb +30 -0
- data/examples/update-category-budgeted.rb +25 -0
- data/examples/update-multiple-transactions.rb +20 -0
- data/lib/ynab/api/accounts_api.rb +78 -41
- data/lib/ynab/api/budgets_api.rb +68 -36
- data/lib/ynab/api/categories_api.rb +108 -60
- data/lib/ynab/api/deprecated_api.rb +32 -17
- data/lib/ynab/api/months_api.rb +49 -28
- data/lib/ynab/api/payee_locations_api.rb +73 -41
- data/lib/ynab/api/payees_api.rb +49 -28
- data/lib/ynab/api/scheduled_transactions_api.rb +49 -28
- data/lib/ynab/api/transactions_api.rb +268 -140
- data/lib/ynab/api/user_api.rb +22 -12
- data/lib/ynab/api_client.rb +97 -95
- data/lib/ynab/configuration.rb +101 -14
- data/lib/ynab/models/account.rb +117 -55
- data/lib/ynab/models/account_response.rb +53 -18
- data/lib/ynab/models/account_response_data.rb +53 -18
- data/lib/ynab/models/account_type.rb +30 -20
- data/lib/ynab/models/accounts_response.rb +53 -18
- data/lib/ynab/models/accounts_response_data.rb +54 -19
- data/lib/ynab/models/budget_detail.rb +80 -35
- data/lib/ynab/models/budget_detail_all_of.rb +320 -0
- data/lib/ynab/models/budget_detail_response.rb +53 -18
- data/lib/ynab/models/budget_detail_response_data.rb +54 -19
- data/lib/ynab/models/budget_settings.rb +56 -29
- data/lib/ynab/models/budget_settings_response.rb +53 -18
- data/lib/ynab/models/budget_settings_response_data.rb +53 -18
- data/lib/ynab/models/budget_summary.rb +63 -26
- data/lib/ynab/models/budget_summary_response.rb +53 -18
- data/lib/ynab/models/budget_summary_response_data.rb +54 -20
- data/lib/ynab/models/bulk_response.rb +53 -18
- data/lib/ynab/models/bulk_response_data.rb +53 -18
- data/lib/ynab/models/bulk_response_data_bulk.rb +54 -19
- data/lib/ynab/models/bulk_transactions.rb +53 -18
- data/lib/ynab/models/categories_response.rb +53 -18
- data/lib/ynab/models/categories_response_data.rb +54 -19
- data/lib/ynab/models/category.rb +110 -48
- data/lib/ynab/models/category_group.rb +58 -23
- data/lib/ynab/models/category_group_with_categories.rb +67 -24
- data/lib/ynab/models/{save_month_category_wrapper.rb → category_group_with_categories_all_of.rb} +67 -29
- data/lib/ynab/models/category_response.rb +53 -18
- data/lib/ynab/models/category_response_data.rb +53 -18
- data/lib/ynab/models/currency_format.rb +62 -27
- data/lib/ynab/models/date_format.rb +53 -18
- data/lib/ynab/models/error_detail.rb +55 -20
- data/lib/ynab/models/error_response.rb +53 -18
- data/lib/ynab/models/hybrid_transaction.rb +118 -46
- data/lib/ynab/models/hybrid_transaction_all_of.rb +304 -0
- data/lib/ynab/models/hybrid_transactions_response.rb +53 -18
- data/lib/ynab/models/hybrid_transactions_response_data.rb +54 -19
- data/lib/ynab/models/month_detail.rb +72 -27
- data/lib/ynab/models/{update_transactions_wrapper.rb → month_detail_all_of.rb} +66 -30
- data/lib/ynab/models/month_detail_response.rb +53 -18
- data/lib/ynab/models/month_detail_response_data.rb +53 -18
- data/lib/ynab/models/month_summaries_response.rb +53 -18
- data/lib/ynab/models/month_summaries_response_data.rb +54 -19
- data/lib/ynab/models/month_summary.rb +63 -26
- data/lib/ynab/models/patch_month_category_wrapper.rb +53 -18
- data/lib/ynab/models/patch_transactions_wrapper.rb +53 -18
- data/lib/ynab/models/payee.rb +58 -22
- data/lib/ynab/models/payee_location.rb +58 -23
- data/lib/ynab/models/payee_location_response.rb +53 -18
- data/lib/ynab/models/payee_location_response_data.rb +53 -18
- data/lib/ynab/models/payee_locations_response.rb +53 -18
- data/lib/ynab/models/payee_locations_response_data.rb +53 -18
- data/lib/ynab/models/payee_response.rb +53 -18
- data/lib/ynab/models/payee_response_data.rb +53 -18
- data/lib/ynab/models/payees_response.rb +53 -18
- data/lib/ynab/models/payees_response_data.rb +54 -19
- data/lib/ynab/models/post_account_wrapper.rb +53 -18
- data/lib/ynab/models/post_transactions_wrapper.rb +54 -19
- data/lib/ynab/models/put_transaction_wrapper.rb +53 -18
- data/lib/ynab/models/save_account.rb +77 -20
- data/lib/ynab/models/save_category_response.rb +53 -18
- data/lib/ynab/models/save_category_response_data.rb +54 -19
- data/lib/ynab/models/save_month_category.rb +53 -18
- data/lib/ynab/models/save_sub_transaction.rb +61 -22
- data/lib/ynab/models/save_transaction.rb +88 -33
- data/lib/ynab/models/save_transaction_with_id.rb +102 -46
- data/lib/ynab/models/{save_transactions_wrapper.rb → save_transaction_with_id_all_of.rb} +60 -36
- data/lib/ynab/models/save_transaction_with_optional_fields.rb +81 -33
- data/lib/ynab/models/save_transactions_response.rb +53 -18
- data/lib/ynab/models/save_transactions_response_data.rb +57 -23
- data/lib/ynab/models/scheduled_sub_transaction.rb +66 -27
- data/lib/ynab/models/scheduled_transaction_detail.rb +94 -36
- data/lib/ynab/models/scheduled_transaction_detail_all_of.rb +262 -0
- data/lib/ynab/models/scheduled_transaction_response.rb +53 -18
- data/lib/ynab/models/scheduled_transaction_response_data.rb +53 -18
- data/lib/ynab/models/scheduled_transaction_summary.rb +80 -32
- data/lib/ynab/models/scheduled_transactions_response.rb +53 -18
- data/lib/ynab/models/scheduled_transactions_response_data.rb +54 -19
- data/lib/ynab/models/sub_transaction.rb +71 -29
- data/lib/ynab/models/transaction_detail.rb +112 -44
- data/lib/ynab/models/{save_transaction_wrapper.rb → transaction_detail_all_of.rb} +102 -29
- data/lib/ynab/models/transaction_response.rb +53 -18
- data/lib/ynab/models/transaction_response_data.rb +53 -18
- data/lib/ynab/models/transaction_summary.rb +98 -40
- data/lib/ynab/models/transactions_import_response.rb +53 -18
- data/lib/ynab/models/transactions_import_response_data.rb +53 -18
- data/lib/ynab/models/transactions_response.rb +53 -18
- data/lib/ynab/models/transactions_response_data.rb +54 -19
- data/lib/ynab/models/user.rb +53 -18
- data/lib/ynab/models/user_response.rb +53 -18
- data/lib/ynab/models/user_response_data.rb +53 -18
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +19 -14
- data/open_api_spec.yaml +3012 -0
- data/templates/api_client.mustache +274 -0
- data/templates/api_client_typhoeus_partial.mustache +156 -0
- data/templates/api_doc.mustache +44 -0
- data/templates/gem.mustache +84 -0
- data/templates/partial_model_generic_doc.mustache +9 -0
- data/ynab.gemspec +38 -0
- metadata +194 -87
- data/lib/ynab/models/loan_account_periodic_value.rb +0 -175
- data/lib/ynab/models/save_account_wrapper.rb +0 -189
- data/lib/ynab/models/update_transaction.rb +0 -407
- 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
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require '
|
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,
|
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
|
-
|
68
|
-
|
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 =>
|
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. \"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).
|
83
|
-
# @param account_id The id of the account
|
98
|
+
# @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).
|
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. \"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).
|
94
|
-
# @param account_id The id of the account
|
109
|
+
# @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).
|
110
|
+
# @param account_id [String] The id of the account
|
95
111
|
# @param [Hash] opts the optional parameters
|
96
|
-
# @return [Array<(AccountResponse,
|
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 =
|
125
|
-
|
126
|
-
|
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 =>
|
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. \"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).
|
167
|
+
# @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).
|
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 `last_knowledge_of_server` 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. \"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).
|
178
|
+
# @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).
|
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 `last_knowledge_of_server` will be included.
|
154
|
-
# @return [Array<(AccountsResponse,
|
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 =
|
180
|
-
|
181
|
-
|
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 =>
|
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
|
data/lib/ynab/api/budgets_api.rb
CHANGED
@@ -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
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require '
|
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. \"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).
|
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
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 `last_knowledge_of_server` 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. \"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).
|
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
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 `last_knowledge_of_server` will be included.
|
38
|
-
# @return [Array<(BudgetDetailResponse,
|
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 =
|
64
|
-
|
65
|
-
|
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 =>
|
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. \"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).
|
90
|
+
# @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).
|
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. \"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).
|
100
|
+
# @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).
|
90
101
|
# @param [Hash] opts the optional parameters
|
91
|
-
# @return [Array<(BudgetSettingsResponse,
|
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 =
|
116
|
-
|
117
|
-
|
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 =>
|
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 [
|
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 [
|
143
|
-
# @return [Array<(BudgetSummaryResponse,
|
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 =
|
165
|
-
|
166
|
-
|
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 =>
|
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
|