ynab 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile.lock +2 -2
- data/README.md +37 -27
- data/Rakefile +0 -6
- data/config.json +1 -1
- data/docs/Account.md +1 -0
- data/docs/AccountsApi.md +3 -3
- data/docs/BudgetsApi.md +4 -4
- data/docs/CategoriesApi.md +45 -4
- data/docs/HybridTransaction.md +2 -1
- data/docs/MonthDetail.md +1 -1
- data/docs/MonthsApi.md +3 -3
- data/docs/PayeeLocationsApi.md +4 -4
- data/docs/PayeesApi.md +3 -3
- data/docs/SaveMonthCategory.md +8 -0
- data/docs/SaveMonthCategoryWrapper.md +8 -0
- data/docs/SaveTransaction.md +2 -2
- data/docs/SaveTransactionsResponse.md +8 -0
- data/docs/SaveTransactionsResponseData.md +11 -0
- data/docs/SaveTransactionsWrapper.md +9 -0
- data/docs/ScheduledTransactionsApi.md +3 -3
- data/docs/TransactionDetail.md +2 -1
- data/docs/TransactionSummary.md +2 -1
- data/docs/TransactionsApi.md +25 -25
- data/docs/UserApi.md +1 -1
- data/examples/create-multiple-transactions.rb +44 -0
- data/examples/update-category-budgeted.rb +23 -0
- data/lib/ynab.rb +5 -0
- data/lib/ynab/api/accounts_api.rb +6 -6
- data/lib/ynab/api/budgets_api.rb +8 -8
- data/lib/ynab/api/categories_api.rb +142 -8
- data/lib/ynab/api/months_api.rb +6 -6
- data/lib/ynab/api/payee_locations_api.rb +8 -8
- data/lib/ynab/api/payees_api.rb +6 -6
- data/lib/ynab/api/scheduled_transactions_api.rb +6 -6
- data/lib/ynab/api/transactions_api.rb +54 -54
- data/lib/ynab/api/user_api.rb +2 -2
- data/lib/ynab/models/account.rb +16 -1
- data/lib/ynab/models/hybrid_transaction.rb +17 -1
- data/lib/ynab/models/month_detail.rb +1 -1
- data/lib/ynab/models/save_month_category.rb +189 -0
- data/lib/ynab/models/save_month_category_wrapper.rb +188 -0
- data/lib/ynab/models/save_transaction.rb +2 -2
- data/lib/ynab/models/save_transactions_response.rb +188 -0
- data/lib/ynab/models/save_transactions_response_data.rb +225 -0
- data/lib/ynab/models/save_transactions_wrapper.rb +194 -0
- data/lib/ynab/models/transaction_detail.rb +17 -1
- data/lib/ynab/models/transaction_summary.rb +17 -1
- data/lib/ynab/version.rb +1 -1
- data/pkg/ynab-1.4.0.gem +0 -0
- data/spec-v1-swagger.json +413 -245
- data/spec/api/categories_spec.rb +14 -2
- data/spec/api/transactions_spec.rb +31 -0
- data/spec/fixtures/vcr_cassettes/category.yml +1 -1
- data/spec/fixtures/vcr_cassettes/multiple_transactions.yml +46 -0
- data/spec/fixtures/vcr_cassettes/patch_month_category.yml +46 -0
- metadata +20 -3
data/docs/TransactionDetail.md
CHANGED
@@ -13,7 +13,8 @@ Name | Type | Description | Notes
|
|
13
13
|
**account_id** | **String** | |
|
14
14
|
**payee_id** | **String** | |
|
15
15
|
**category_id** | **String** | |
|
16
|
-
**transfer_account_id** | **String** |
|
16
|
+
**transfer_account_id** | **String** | If a transfer transaction, the account to which it transfers |
|
17
|
+
**transfer_transaction_id** | **String** | If a transfer transaction, the id of transaction on the other side of the transfer |
|
17
18
|
**import_id** | **String** | If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. |
|
18
19
|
**deleted** | **BOOLEAN** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. |
|
19
20
|
**account_name** | **String** | |
|
data/docs/TransactionSummary.md
CHANGED
@@ -13,7 +13,8 @@ Name | Type | Description | Notes
|
|
13
13
|
**account_id** | **String** | |
|
14
14
|
**payee_id** | **String** | |
|
15
15
|
**category_id** | **String** | |
|
16
|
-
**transfer_account_id** | **String** |
|
16
|
+
**transfer_account_id** | **String** | If a transfer transaction, the account to which it transfers |
|
17
|
+
**transfer_transaction_id** | **String** | If a transfer transaction, the id of transaction on the other side of the transfer |
|
17
18
|
**import_id** | **String** | If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. |
|
18
19
|
**deleted** | **BOOLEAN** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. |
|
19
20
|
|
data/docs/TransactionsApi.md
CHANGED
@@ -5,7 +5,7 @@ All URIs are relative to *https://api.youneedabudget.com/v1*
|
|
5
5
|
Method | HTTP request | Description
|
6
6
|
------------- | ------------- | -------------
|
7
7
|
[**bulk_create_transactions**](TransactionsApi.md#bulk_create_transactions) | **POST** /budgets/{budget_id}/transactions/bulk | Bulk create transactions
|
8
|
-
[**create_transaction**](TransactionsApi.md#create_transaction) | **POST** /budgets/{budget_id}/transactions | Create
|
8
|
+
[**create_transaction**](TransactionsApi.md#create_transaction) | **POST** /budgets/{budget_id}/transactions | Create a single transaction or multiple transactions
|
9
9
|
[**get_transaction_by_id**](TransactionsApi.md#get_transaction_by_id) | **GET** /budgets/{budget_id}/transactions/{transaction_id} | Single transaction
|
10
10
|
[**get_transactions**](TransactionsApi.md#get_transactions) | **GET** /budgets/{budget_id}/transactions | List transactions
|
11
11
|
[**get_transactions_by_account**](TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions
|
@@ -25,30 +25,30 @@ Creates multiple transactions
|
|
25
25
|
|
26
26
|
Name | Type | Description | Notes
|
27
27
|
------------- | ------------- | ------------- | -------------
|
28
|
-
**budget_id** | [**String**](.md)| The
|
29
|
-
**transactions** | [**BulkTransactions**](BulkTransactions.md)| The list of
|
28
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
29
|
+
**transactions** | [**BulkTransactions**](BulkTransactions.md)| The list of transactions to create |
|
30
30
|
|
31
31
|
### Return type
|
32
32
|
|
33
33
|
[**BulkResponse**](BulkResponse.md)
|
34
34
|
|
35
35
|
# **create_transaction**
|
36
|
-
>
|
36
|
+
> SaveTransactionsResponse create_transaction(budget_id, save_transactions)
|
37
37
|
|
38
|
-
Create
|
38
|
+
Create a single transaction or multiple transactions
|
39
39
|
|
40
|
-
Creates a transaction
|
40
|
+
Creates a single transaction or multiple transactions. If you provide a body containing a 'transaction' object, a single transaction will be created and if you provide a body containing a 'transactions' array, multiple transactions will be created.
|
41
41
|
|
42
42
|
### Parameters
|
43
43
|
|
44
44
|
Name | Type | Description | Notes
|
45
45
|
------------- | ------------- | ------------- | -------------
|
46
|
-
**budget_id** | [**String**](.md)| The
|
47
|
-
**
|
46
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
47
|
+
**save_transactions** | [**SaveTransactionsWrapper**](SaveTransactionsWrapper.md)| The transaction or transactions to create |
|
48
48
|
|
49
49
|
### Return type
|
50
50
|
|
51
|
-
[**
|
51
|
+
[**SaveTransactionsResponse**](SaveTransactionsResponse.md)
|
52
52
|
|
53
53
|
# **get_transaction_by_id**
|
54
54
|
> TransactionResponse get_transaction_by_id(budget_id, transaction_id)
|
@@ -61,8 +61,8 @@ Returns a single transaction
|
|
61
61
|
|
62
62
|
Name | Type | Description | Notes
|
63
63
|
------------- | ------------- | ------------- | -------------
|
64
|
-
**budget_id** | [**String**](.md)| The
|
65
|
-
**transaction_id** | [**String**](.md)| The
|
64
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
65
|
+
**transaction_id** | [**String**](.md)| The id of the transaction |
|
66
66
|
|
67
67
|
### Return type
|
68
68
|
|
@@ -79,8 +79,8 @@ Returns budget transactions
|
|
79
79
|
|
80
80
|
Name | Type | Description | Notes
|
81
81
|
------------- | ------------- | ------------- | -------------
|
82
|
-
**budget_id** | [**String**](.md)| The
|
83
|
-
**since_date** | **Date**| Only return transactions on or after this date
|
82
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
83
|
+
**since_date** | **Date**| Only return transactions on or after this date | [optional]
|
84
84
|
**type** | **String**| Only return transactions of a certain type ('uncategorized' and 'unapproved' are currently supported) | [optional]
|
85
85
|
|
86
86
|
### Return type
|
@@ -98,9 +98,9 @@ Returns all transactions for a specified account
|
|
98
98
|
|
99
99
|
Name | Type | Description | Notes
|
100
100
|
------------- | ------------- | ------------- | -------------
|
101
|
-
**budget_id** | [**String**](.md)| The
|
102
|
-
**account_id** | [**String**](.md)| The
|
103
|
-
**since_date** | **Date**| Only return transactions on or after this date
|
101
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
102
|
+
**account_id** | [**String**](.md)| The id of the account |
|
103
|
+
**since_date** | **Date**| Only return transactions on or after this date | [optional]
|
104
104
|
**type** | **String**| Only return transactions of a certain type (i.e. 'uncategorized', 'unapproved') | [optional]
|
105
105
|
|
106
106
|
### Return type
|
@@ -118,9 +118,9 @@ Returns all transactions for a specified category
|
|
118
118
|
|
119
119
|
Name | Type | Description | Notes
|
120
120
|
------------- | ------------- | ------------- | -------------
|
121
|
-
**budget_id** | [**String**](.md)| The
|
122
|
-
**category_id** | [**String**](.md)| The
|
123
|
-
**since_date** | **Date**| Only return transactions on or after this date
|
121
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
122
|
+
**category_id** | [**String**](.md)| The id of the category |
|
123
|
+
**since_date** | **Date**| Only return transactions on or after this date | [optional]
|
124
124
|
**type** | **String**| Only return transactions of a certain type (i.e. 'uncategorized', 'unapproved') | [optional]
|
125
125
|
|
126
126
|
### Return type
|
@@ -138,9 +138,9 @@ Returns all transactions for a specified payee
|
|
138
138
|
|
139
139
|
Name | Type | Description | Notes
|
140
140
|
------------- | ------------- | ------------- | -------------
|
141
|
-
**budget_id** | [**String**](.md)| The
|
142
|
-
**payee_id** | [**String**](.md)| The
|
143
|
-
**since_date** | **Date**| Only return transactions on or after this date
|
141
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
142
|
+
**payee_id** | [**String**](.md)| The id of the payee |
|
143
|
+
**since_date** | **Date**| Only return transactions on or after this date | [optional]
|
144
144
|
**type** | **String**| Only return transactions of a certain type (i.e. 'uncategorized', 'unapproved') | [optional]
|
145
145
|
|
146
146
|
### Return type
|
@@ -158,9 +158,9 @@ Updates a transaction
|
|
158
158
|
|
159
159
|
Name | Type | Description | Notes
|
160
160
|
------------- | ------------- | ------------- | -------------
|
161
|
-
**budget_id** | [**String**](.md)| The
|
162
|
-
**transaction_id** | [**String**](.md)| The
|
163
|
-
**transaction** | [**SaveTransactionWrapper**](SaveTransactionWrapper.md)| The
|
161
|
+
**budget_id** | [**String**](.md)| The id of the budget (\"last-used\" can also be used to specify the last used budget) |
|
162
|
+
**transaction_id** | [**String**](.md)| The id of the transaction |
|
163
|
+
**transaction** | [**SaveTransactionWrapper**](SaveTransactionWrapper.md)| The transaction to update |
|
164
164
|
|
165
165
|
### Return type
|
166
166
|
|
data/docs/UserApi.md
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'ynab'
|
3
|
+
|
4
|
+
def create_multiple_transactions
|
5
|
+
access_token = 'bf0cbb14b4330-not-real-3de12e66a389eaafe2'
|
6
|
+
ynab = YNAB::API.new(access_token)
|
7
|
+
|
8
|
+
budget_id = 'f968197b-2863-not-real-c2406dbe7f0d'
|
9
|
+
account_id = 'f6fe07cb-c895-not-real-acfac0b7f026'
|
10
|
+
category_id = 'a191ac84-de09-not-real-6c5ed8cfdabe'
|
11
|
+
|
12
|
+
begin
|
13
|
+
ynab.transactions.create_transaction(budget_id, {
|
14
|
+
transactions: [
|
15
|
+
{
|
16
|
+
account_id: account_id,
|
17
|
+
category_id: category_id,
|
18
|
+
date: Date.today,
|
19
|
+
payee_name: 'A Test Payee',
|
20
|
+
memo: 'I was created through the API',
|
21
|
+
cleared: 'Cleared',
|
22
|
+
approved: true,
|
23
|
+
flag_color: 'Blue',
|
24
|
+
amount: 20000
|
25
|
+
},
|
26
|
+
{
|
27
|
+
account_id: account_id,
|
28
|
+
category_id: category_id,
|
29
|
+
date: Date.today,
|
30
|
+
payee_name: 'Another Test Payee',
|
31
|
+
memo: 'I was also created through the API',
|
32
|
+
cleared: 'Uncleared',
|
33
|
+
approved: false,
|
34
|
+
flag_color: 'Red',
|
35
|
+
amount: 39453
|
36
|
+
}
|
37
|
+
]
|
38
|
+
})
|
39
|
+
rescue => e
|
40
|
+
puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
create_multiple_transactions
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'ynab'
|
3
|
+
|
4
|
+
def update_category_budgeted
|
5
|
+
access_token = 'bf0cbb14b4330-not-real-3de12e66a389eaafe2'
|
6
|
+
ynab = YNAB::API.new(access_token)
|
7
|
+
|
8
|
+
budget_id = 'f968197b-2863-not-real-c2406dbe7f0d'
|
9
|
+
category_id = 'a191ac84-de09-not-real-6c5ed8cfdabe'
|
10
|
+
month = '2018-09-01'
|
11
|
+
month_category = { budgeted: 20382 }
|
12
|
+
|
13
|
+
begin
|
14
|
+
# Update budgeted amount to 203.82 in 2018-09-01 for category_id
|
15
|
+
response = ynab.categories.update_month_category(budget_id, '2018-09-01', category_id, month_category: month_category)
|
16
|
+
month_category_response = response.data.category
|
17
|
+
puts "[budgeted: #{month_category_response.budgeted}, balance: #{month_category_response.balance}]"
|
18
|
+
rescue => e
|
19
|
+
puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
update_category_budgeted
|
data/lib/ynab.rb
CHANGED
@@ -61,8 +61,13 @@ require 'ynab/models/payee_response'
|
|
61
61
|
require 'ynab/models/payee_wrapper'
|
62
62
|
require 'ynab/models/payees_response'
|
63
63
|
require 'ynab/models/payees_wrapper'
|
64
|
+
require 'ynab/models/save_month_category'
|
65
|
+
require 'ynab/models/save_month_category_wrapper'
|
64
66
|
require 'ynab/models/save_transaction'
|
65
67
|
require 'ynab/models/save_transaction_wrapper'
|
68
|
+
require 'ynab/models/save_transactions_response'
|
69
|
+
require 'ynab/models/save_transactions_response_data'
|
70
|
+
require 'ynab/models/save_transactions_wrapper'
|
66
71
|
require 'ynab/models/scheduled_sub_transaction'
|
67
72
|
require 'ynab/models/scheduled_transaction_response'
|
68
73
|
require 'ynab/models/scheduled_transaction_summary'
|
@@ -21,8 +21,8 @@ module YNAB
|
|
21
21
|
end
|
22
22
|
# Single account
|
23
23
|
# Returns a single account
|
24
|
-
# @param budget_id The
|
25
|
-
# @param account_id The
|
24
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
25
|
+
# @param account_id The id of the account
|
26
26
|
# @param [Hash] opts the optional parameters
|
27
27
|
# @return [AccountResponse]
|
28
28
|
def get_account_by_id(budget_id, account_id, opts = {})
|
@@ -32,8 +32,8 @@ module YNAB
|
|
32
32
|
|
33
33
|
# Single account
|
34
34
|
# Returns a single account
|
35
|
-
# @param budget_id The
|
36
|
-
# @param account_id The
|
35
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
36
|
+
# @param account_id The id of the account
|
37
37
|
# @param [Hash] opts the optional parameters
|
38
38
|
# @return [Array<(AccountResponse, Fixnum, Hash)>] AccountResponse data, response status code and response headers
|
39
39
|
def get_account_by_id_with_http_info(budget_id, account_id, opts = {})
|
@@ -79,7 +79,7 @@ module YNAB
|
|
79
79
|
end
|
80
80
|
# Account list
|
81
81
|
# Returns all accounts
|
82
|
-
# @param budget_id The
|
82
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
83
83
|
# @param [Hash] opts the optional parameters
|
84
84
|
# @return [AccountsResponse]
|
85
85
|
def get_accounts(budget_id, opts = {})
|
@@ -89,7 +89,7 @@ module YNAB
|
|
89
89
|
|
90
90
|
# Account list
|
91
91
|
# Returns all accounts
|
92
|
-
# @param budget_id The
|
92
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
93
93
|
# @param [Hash] opts the optional parameters
|
94
94
|
# @return [Array<(AccountsResponse, Fixnum, Hash)>] AccountsResponse data, response status code and response headers
|
95
95
|
def get_accounts_with_http_info(budget_id, opts = {})
|
data/lib/ynab/api/budgets_api.rb
CHANGED
@@ -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
|
24
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used 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,7 +32,7 @@ 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
|
35
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used 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
38
|
# @return [Array<(BudgetDetailResponse, Fixnum, Hash)>] BudgetDetailResponse data, response status code and response headers
|
@@ -75,8 +75,8 @@ module YNAB
|
|
75
75
|
return data, status_code, headers
|
76
76
|
end
|
77
77
|
# Budget Settings
|
78
|
-
# Returns settings for a budget
|
79
|
-
# @param budget_id The
|
78
|
+
# Returns settings for a budget
|
79
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
80
80
|
# @param [Hash] opts the optional parameters
|
81
81
|
# @return [BudgetSettingsResponse]
|
82
82
|
def get_budget_settings_by_id(budget_id, opts = {})
|
@@ -85,8 +85,8 @@ module YNAB
|
|
85
85
|
end
|
86
86
|
|
87
87
|
# Budget Settings
|
88
|
-
# Returns settings for a budget
|
89
|
-
# @param budget_id The
|
88
|
+
# Returns settings for a budget
|
89
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
90
90
|
# @param [Hash] opts the optional parameters
|
91
91
|
# @return [Array<(BudgetSettingsResponse, Fixnum, Hash)>] BudgetSettingsResponse data, response status code and response headers
|
92
92
|
def get_budget_settings_by_id_with_http_info(budget_id, opts = {})
|
@@ -127,7 +127,7 @@ module YNAB
|
|
127
127
|
return data, status_code, headers
|
128
128
|
end
|
129
129
|
# List budgets
|
130
|
-
# Returns budgets list with summary information
|
130
|
+
# Returns budgets list with summary information
|
131
131
|
# @param [Hash] opts the optional parameters
|
132
132
|
# @return [BudgetSummaryResponse]
|
133
133
|
def get_budgets(opts = {})
|
@@ -136,7 +136,7 @@ module YNAB
|
|
136
136
|
end
|
137
137
|
|
138
138
|
# List budgets
|
139
|
-
# Returns budgets list with summary information
|
139
|
+
# Returns budgets list with summary information
|
140
140
|
# @param [Hash] opts the optional parameters
|
141
141
|
# @return [Array<(BudgetSummaryResponse, Fixnum, Hash)>] BudgetSummaryResponse data, response status code and response headers
|
142
142
|
def get_budgets_with_http_info(opts = {})
|
@@ -20,8 +20,8 @@ module YNAB
|
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
22
|
# List categories
|
23
|
-
# Returns all categories grouped by category group
|
24
|
-
# @param budget_id The
|
23
|
+
# Returns all categories grouped by category group
|
24
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
25
25
|
# @param [Hash] opts the optional parameters
|
26
26
|
# @return [CategoriesResponse]
|
27
27
|
def get_categories(budget_id, opts = {})
|
@@ -30,8 +30,8 @@ module YNAB
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# List categories
|
33
|
-
# Returns all categories grouped by category group
|
34
|
-
# @param budget_id The
|
33
|
+
# Returns all categories grouped by category group
|
34
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
35
35
|
# @param [Hash] opts the optional parameters
|
36
36
|
# @return [Array<(CategoriesResponse, Fixnum, Hash)>] CategoriesResponse data, response status code and response headers
|
37
37
|
def get_categories_with_http_info(budget_id, opts = {})
|
@@ -73,8 +73,8 @@ module YNAB
|
|
73
73
|
end
|
74
74
|
# Single category
|
75
75
|
# Returns a single category
|
76
|
-
# @param budget_id The
|
77
|
-
# @param category_id The
|
76
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
77
|
+
# @param category_id The id of the category
|
78
78
|
# @param [Hash] opts the optional parameters
|
79
79
|
# @return [CategoryResponse]
|
80
80
|
def get_category_by_id(budget_id, category_id, opts = {})
|
@@ -84,8 +84,8 @@ module YNAB
|
|
84
84
|
|
85
85
|
# Single category
|
86
86
|
# Returns a single category
|
87
|
-
# @param budget_id The
|
88
|
-
# @param category_id The
|
87
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
88
|
+
# @param category_id The id of the category
|
89
89
|
# @param [Hash] opts the optional parameters
|
90
90
|
# @return [Array<(CategoryResponse, Fixnum, Hash)>] CategoryResponse data, response status code and response headers
|
91
91
|
def get_category_by_id_with_http_info(budget_id, category_id, opts = {})
|
@@ -129,5 +129,139 @@ module YNAB
|
|
129
129
|
end
|
130
130
|
return data, status_code, headers
|
131
131
|
end
|
132
|
+
# Single category for a specific budget month
|
133
|
+
# Returns a single category for a specific budget month
|
134
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
135
|
+
# @param month the budget month in ISO format (e.g. 2016-12-30). (\"current\" can also be used to specify the current calendar month (UTC))
|
136
|
+
# @param category_id The id of the category
|
137
|
+
# @param [Hash] opts the optional parameters
|
138
|
+
# @return [CategoryResponse]
|
139
|
+
def get_month_category_by_id(budget_id, month, category_id, opts = {})
|
140
|
+
data, _status_code, _headers = get_month_category_by_id_with_http_info(budget_id, month, category_id, opts)
|
141
|
+
data
|
142
|
+
end
|
143
|
+
|
144
|
+
# Single category for a specific budget month
|
145
|
+
# Returns a single category for a specific budget month
|
146
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
147
|
+
# @param month the budget month in ISO format (e.g. 2016-12-30). (\"current\" can also be used to specify the current calendar month (UTC))
|
148
|
+
# @param category_id The id of the category
|
149
|
+
# @param [Hash] opts the optional parameters
|
150
|
+
# @return [Array<(CategoryResponse, Fixnum, Hash)>] CategoryResponse data, response status code and response headers
|
151
|
+
def get_month_category_by_id_with_http_info(budget_id, month, category_id, opts = {})
|
152
|
+
if @api_client.config.debugging
|
153
|
+
@api_client.config.logger.debug 'Calling API: CategoriesApi.get_month_category_by_id ...'
|
154
|
+
end
|
155
|
+
# verify the required parameter 'budget_id' is set
|
156
|
+
if @api_client.config.client_side_validation && budget_id.nil?
|
157
|
+
fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_month_category_by_id"
|
158
|
+
end
|
159
|
+
# verify the required parameter 'month' is set
|
160
|
+
if @api_client.config.client_side_validation && month.nil?
|
161
|
+
fail ArgumentError, "Missing the required parameter 'month' when calling CategoriesApi.get_month_category_by_id"
|
162
|
+
end
|
163
|
+
# verify the required parameter 'category_id' is set
|
164
|
+
if @api_client.config.client_side_validation && category_id.nil?
|
165
|
+
fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.get_month_category_by_id"
|
166
|
+
end
|
167
|
+
# resource path
|
168
|
+
local_var_path = '/budgets/{budget_id}/months/{month}/categories/{category_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'month' + '}', month.to_s).sub('{' + 'category_id' + '}', category_id.to_s)
|
169
|
+
|
170
|
+
# query parameters
|
171
|
+
query_params = {}
|
172
|
+
|
173
|
+
# header parameters
|
174
|
+
header_params = {}
|
175
|
+
# HTTP header 'Accept' (if needed)
|
176
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
177
|
+
|
178
|
+
# form parameters
|
179
|
+
form_params = {}
|
180
|
+
|
181
|
+
# http body (model)
|
182
|
+
post_body = nil
|
183
|
+
auth_names = ['bearer']
|
184
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
185
|
+
:header_params => header_params,
|
186
|
+
:query_params => query_params,
|
187
|
+
:form_params => form_params,
|
188
|
+
:body => post_body,
|
189
|
+
:auth_names => auth_names,
|
190
|
+
:return_type => 'CategoryResponse')
|
191
|
+
if @api_client.config.debugging
|
192
|
+
@api_client.config.logger.debug "API called: CategoriesApi#get_month_category_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
193
|
+
end
|
194
|
+
return data, status_code, headers
|
195
|
+
end
|
196
|
+
# Update an existing month category
|
197
|
+
# Update an existing month category
|
198
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
199
|
+
# @param month the budget month in ISO format (e.g. 2016-12-01). \"current\" can also be used to specify the current calendar month (UTC).
|
200
|
+
# @param category_id The id of the category
|
201
|
+
# @param month_category The month category to update
|
202
|
+
# @param [Hash] opts the optional parameters
|
203
|
+
# @return [CategoryResponse]
|
204
|
+
def update_month_category(budget_id, month, category_id, month_category, opts = {})
|
205
|
+
data, _status_code, _headers = update_month_category_with_http_info(budget_id, month, category_id, month_category, opts)
|
206
|
+
data
|
207
|
+
end
|
208
|
+
|
209
|
+
# Update an existing month category
|
210
|
+
# Update an existing month category
|
211
|
+
# @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget)
|
212
|
+
# @param month the budget month in ISO format (e.g. 2016-12-01). \"current\" can also be used to specify the current calendar month (UTC).
|
213
|
+
# @param category_id The id of the category
|
214
|
+
# @param month_category The month category to update
|
215
|
+
# @param [Hash] opts the optional parameters
|
216
|
+
# @return [Array<(CategoryResponse, Fixnum, Hash)>] CategoryResponse data, response status code and response headers
|
217
|
+
def update_month_category_with_http_info(budget_id, month, category_id, month_category, opts = {})
|
218
|
+
if @api_client.config.debugging
|
219
|
+
@api_client.config.logger.debug 'Calling API: CategoriesApi.update_month_category ...'
|
220
|
+
end
|
221
|
+
# verify the required parameter 'budget_id' is set
|
222
|
+
if @api_client.config.client_side_validation && budget_id.nil?
|
223
|
+
fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.update_month_category"
|
224
|
+
end
|
225
|
+
# verify the required parameter 'month' is set
|
226
|
+
if @api_client.config.client_side_validation && month.nil?
|
227
|
+
fail ArgumentError, "Missing the required parameter 'month' when calling CategoriesApi.update_month_category"
|
228
|
+
end
|
229
|
+
# verify the required parameter 'category_id' is set
|
230
|
+
if @api_client.config.client_side_validation && category_id.nil?
|
231
|
+
fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.update_month_category"
|
232
|
+
end
|
233
|
+
# verify the required parameter 'month_category' is set
|
234
|
+
if @api_client.config.client_side_validation && month_category.nil?
|
235
|
+
fail ArgumentError, "Missing the required parameter 'month_category' when calling CategoriesApi.update_month_category"
|
236
|
+
end
|
237
|
+
# resource path
|
238
|
+
local_var_path = '/budgets/{budget_id}/months/{month}/categories/{category_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'month' + '}', month.to_s).sub('{' + 'category_id' + '}', category_id.to_s)
|
239
|
+
|
240
|
+
# query parameters
|
241
|
+
query_params = {}
|
242
|
+
|
243
|
+
# header parameters
|
244
|
+
header_params = {}
|
245
|
+
# HTTP header 'Accept' (if needed)
|
246
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
247
|
+
|
248
|
+
# form parameters
|
249
|
+
form_params = {}
|
250
|
+
|
251
|
+
# http body (model)
|
252
|
+
post_body = @api_client.object_to_http_body(month_category)
|
253
|
+
auth_names = ['bearer']
|
254
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
|
255
|
+
:header_params => header_params,
|
256
|
+
:query_params => query_params,
|
257
|
+
:form_params => form_params,
|
258
|
+
:body => post_body,
|
259
|
+
:auth_names => auth_names,
|
260
|
+
:return_type => 'CategoryResponse')
|
261
|
+
if @api_client.config.debugging
|
262
|
+
@api_client.config.logger.debug "API called: CategoriesApi#update_month_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
263
|
+
end
|
264
|
+
return data, status_code, headers
|
265
|
+
end
|
132
266
|
end
|
133
267
|
end
|