ynab 1.19.0 → 1.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/ynab/api/accounts_api.rb +63 -5
- data/lib/ynab/api/budgets_api.rb +5 -5
- data/lib/ynab/api/categories_api.rb +9 -9
- data/lib/ynab/api/deprecated_api.rb +3 -3
- data/lib/ynab/api/months_api.rb +5 -5
- data/lib/ynab/api/payee_locations_api.rb +9 -9
- data/lib/ynab/api/payees_api.rb +7 -7
- data/lib/ynab/api/scheduled_transactions_api.rb +5 -5
- data/lib/ynab/api/transactions_api.rb +23 -23
- data/lib/ynab/api/user_api.rb +1 -1
- data/lib/ynab/api_client.rb +1 -1
- data/lib/ynab/configuration.rb +1 -1
- data/lib/ynab/models/account.rb +23 -34
- data/lib/ynab/models/account_response.rb +1 -1
- data/lib/ynab/models/account_response_data.rb +1 -1
- data/lib/ynab/models/account_type.rb +41 -0
- data/lib/ynab/models/accounts_response.rb +1 -1
- data/lib/ynab/models/accounts_response_data.rb +1 -1
- data/lib/ynab/models/budget_detail.rb +1 -1
- data/lib/ynab/models/budget_detail_response.rb +1 -1
- data/lib/ynab/models/budget_detail_response_data.rb +1 -1
- data/lib/ynab/models/budget_settings.rb +1 -1
- data/lib/ynab/models/budget_settings_response.rb +1 -1
- data/lib/ynab/models/budget_settings_response_data.rb +1 -1
- data/lib/ynab/models/budget_summary.rb +1 -1
- data/lib/ynab/models/budget_summary_response.rb +1 -1
- data/lib/ynab/models/budget_summary_response_data.rb +1 -1
- data/lib/ynab/models/bulk_response.rb +1 -1
- data/lib/ynab/models/bulk_response_data.rb +1 -1
- data/lib/ynab/models/bulk_response_data_bulk.rb +1 -1
- data/lib/ynab/models/bulk_transactions.rb +1 -1
- data/lib/ynab/models/categories_response.rb +1 -1
- data/lib/ynab/models/categories_response_data.rb +1 -1
- data/lib/ynab/models/category.rb +44 -4
- data/lib/ynab/models/category_group.rb +1 -1
- data/lib/ynab/models/category_group_with_categories.rb +1 -1
- data/lib/ynab/models/category_response.rb +1 -1
- data/lib/ynab/models/category_response_data.rb +1 -1
- data/lib/ynab/models/currency_format.rb +1 -1
- data/lib/ynab/models/date_format.rb +1 -1
- data/lib/ynab/models/error_detail.rb +1 -1
- data/lib/ynab/models/error_response.rb +1 -1
- data/lib/ynab/models/hybrid_transaction.rb +1 -1
- data/lib/ynab/models/hybrid_transactions_response.rb +1 -1
- data/lib/ynab/models/hybrid_transactions_response_data.rb +1 -1
- data/lib/ynab/models/month_detail.rb +4 -4
- data/lib/ynab/models/month_detail_response.rb +1 -1
- data/lib/ynab/models/month_detail_response_data.rb +1 -1
- data/lib/ynab/models/month_summaries_response.rb +1 -1
- data/lib/ynab/models/month_summaries_response_data.rb +1 -1
- data/lib/ynab/models/month_summary.rb +4 -4
- data/lib/ynab/models/payee.rb +1 -1
- data/lib/ynab/models/payee_location.rb +1 -1
- data/lib/ynab/models/payee_location_response.rb +1 -1
- data/lib/ynab/models/payee_location_response_data.rb +1 -1
- data/lib/ynab/models/payee_locations_response.rb +1 -1
- data/lib/ynab/models/payee_locations_response_data.rb +1 -1
- data/lib/ynab/models/payee_response.rb +1 -1
- data/lib/ynab/models/payee_response_data.rb +1 -1
- data/lib/ynab/models/payees_response.rb +1 -1
- data/lib/ynab/models/payees_response_data.rb +1 -1
- data/lib/ynab/models/save_account.rb +219 -0
- data/lib/ynab/models/save_account_wrapper.rb +189 -0
- data/lib/ynab/models/save_category_response.rb +1 -1
- data/lib/ynab/models/save_category_response_data.rb +1 -1
- data/lib/ynab/models/save_month_category.rb +1 -1
- data/lib/ynab/models/save_month_category_wrapper.rb +1 -1
- data/lib/ynab/models/save_sub_transaction.rb +1 -1
- data/lib/ynab/models/save_transaction.rb +1 -1
- data/lib/ynab/models/save_transaction_wrapper.rb +1 -1
- data/lib/ynab/models/save_transactions_response.rb +1 -1
- data/lib/ynab/models/save_transactions_response_data.rb +1 -1
- data/lib/ynab/models/save_transactions_wrapper.rb +1 -1
- data/lib/ynab/models/scheduled_sub_transaction.rb +1 -1
- data/lib/ynab/models/scheduled_transaction_detail.rb +1 -1
- data/lib/ynab/models/scheduled_transaction_response.rb +1 -1
- data/lib/ynab/models/scheduled_transaction_response_data.rb +1 -1
- data/lib/ynab/models/scheduled_transaction_summary.rb +1 -1
- data/lib/ynab/models/scheduled_transactions_response.rb +1 -1
- data/lib/ynab/models/scheduled_transactions_response_data.rb +1 -1
- data/lib/ynab/models/sub_transaction.rb +1 -1
- data/lib/ynab/models/transaction_detail.rb +1 -1
- data/lib/ynab/models/transaction_response.rb +1 -1
- data/lib/ynab/models/transaction_response_data.rb +1 -1
- data/lib/ynab/models/transaction_summary.rb +1 -1
- data/lib/ynab/models/transactions_import_response.rb +1 -1
- data/lib/ynab/models/transactions_import_response_data.rb +1 -1
- data/lib/ynab/models/transactions_response.rb +1 -1
- data/lib/ynab/models/transactions_response_data.rb +1 -1
- data/lib/ynab/models/update_transaction.rb +19 -5
- data/lib/ynab/models/update_transactions_wrapper.rb +1 -1
- data/lib/ynab/models/user.rb +1 -1
- data/lib/ynab/models/user_response.rb +1 -1
- data/lib/ynab/models/user_response_data.rb +1 -1
- data/lib/ynab/version.rb +1 -1
- data/lib/ynab.rb +11 -8
- data/spec/api/accounts_spec.rb +19 -10
- data/spec/api/budgets_spec.rb +4 -4
- data/spec/api/categories_spec.rb +5 -5
- data/spec/api/months_spec.rb +4 -4
- data/spec/api/payee_locations_spec.rb +4 -4
- data/spec/api/payees_spec.rb +4 -4
- data/spec/api/scheduled_transactions_spec.rb +4 -4
- data/spec/api/transactions_spec.rb +13 -14
- data/spec/fixtures/vcr_cassettes/create_account.yml +51 -0
- metadata +8 -3
data/spec/api/accounts_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe 'accounts' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'authorization' do
|
16
|
-
it
|
16
|
+
it 'sets the Bearer Auth header correctly' do
|
17
17
|
VCR.use_cassette("accounts") do
|
18
18
|
response = instance.get_accounts(budget_id)
|
19
19
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -21,7 +21,7 @@ describe 'accounts' do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'throws when unauthorized' do
|
25
25
|
VCR.use_cassette("accounts_unauthorized") do
|
26
26
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
27
27
|
begin
|
@@ -35,7 +35,7 @@ describe 'accounts' do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe 'GET /budgets/{budget_id}/accounts' do
|
38
|
-
it
|
38
|
+
it 'returns a list of accounts' do
|
39
39
|
VCR.use_cassette("accounts") do
|
40
40
|
response = instance.get_accounts(budget_id)
|
41
41
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -45,7 +45,7 @@ describe 'accounts' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe 'GET /budgets/{budget_id}/accounts/{account_id}' do
|
48
|
-
it
|
48
|
+
it 'returns an account' do
|
49
49
|
VCR.use_cassette("account") do
|
50
50
|
response = instance.get_account_by_id(budget_id, '5982e895-98e5-41ca-9681-0b6de1036a1c')
|
51
51
|
expect(response.data.account).to be
|
@@ -54,12 +54,21 @@ describe 'accounts' do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
describe 'POST /budgets/{budget_id}/accounts' do
|
58
|
+
it 'creates an account' do
|
59
|
+
VCR.use_cassette("create_account") do
|
60
|
+
response = instance.create_account(budget_id, {
|
61
|
+
account: {
|
62
|
+
name: 'New Checking Account',
|
63
|
+
type: 'checking',
|
64
|
+
balance: 215000
|
65
|
+
}
|
66
|
+
})
|
67
|
+
|
68
|
+
expect(client.last_request.response.options[:code]).to be 201
|
69
|
+
expect(response.data.account).to be
|
70
|
+
expect(response.data.account.balance).to eq 215000
|
71
|
+
end
|
63
72
|
end
|
64
73
|
end
|
65
74
|
end
|
data/spec/api/budgets_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe 'budgets' do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe 'authorization' do
|
15
|
-
it
|
15
|
+
it 'sets the Bearer Auth header correctly' do
|
16
16
|
VCR.use_cassette("budgets") do
|
17
17
|
response = instance.get_budgets
|
18
18
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -20,7 +20,7 @@ describe 'budgets' do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it 'throws when unauthorized' do
|
24
24
|
VCR.use_cassette("budgets_unauthorized") do
|
25
25
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
26
26
|
begin
|
@@ -34,7 +34,7 @@ describe 'budgets' do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe 'GET /budgets' do
|
37
|
-
it
|
37
|
+
it 'returns a list of budgets' do
|
38
38
|
VCR.use_cassette("budgets") do
|
39
39
|
response = instance.get_budgets
|
40
40
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -44,7 +44,7 @@ describe 'budgets' do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe 'GET /budgets/{budget_id}' do
|
47
|
-
it
|
47
|
+
it 'returns a budget' do
|
48
48
|
VCR.use_cassette("budget") do
|
49
49
|
response = instance.get_budget_by_id('f419ac25-6217-4175-88dc-c3136ff5f6fd')
|
50
50
|
expect(response.data.budget).to be
|
data/spec/api/categories_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe 'categories' do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe 'authorization' do
|
17
|
-
it
|
17
|
+
it 'sets the Bearer Auth header correctly' do
|
18
18
|
VCR.use_cassette("categories") do
|
19
19
|
response = instance.get_categories(budget_id)
|
20
20
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -22,7 +22,7 @@ describe 'categories' do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
25
|
+
it 'throws when unauthorized' do
|
26
26
|
VCR.use_cassette("categories_unauthorized") do
|
27
27
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
28
28
|
begin
|
@@ -36,7 +36,7 @@ describe 'categories' do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
describe 'GET /budgets/{budget_id}/categories' do
|
39
|
-
it
|
39
|
+
it 'returns a list of categories' do
|
40
40
|
VCR.use_cassette("categories") do
|
41
41
|
response = instance.get_categories(budget_id)
|
42
42
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -47,7 +47,7 @@ describe 'categories' do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
describe 'GET /budgets/{budget_id}/categories/{category_id}' do
|
50
|
-
it
|
50
|
+
it 'returns a category' do
|
51
51
|
VCR.use_cassette("category") do
|
52
52
|
response = instance.get_category_by_id(budget_id, category_id)
|
53
53
|
expect(response.data.category).to be
|
@@ -57,7 +57,7 @@ describe 'categories' do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
describe 'PATCH /budgets/{budget_id}/months/{month}/categories/{category_id}' do
|
60
|
-
it
|
60
|
+
it 'returns a category' do
|
61
61
|
VCR.use_cassette("patch_month_category") do
|
62
62
|
response = instance.update_month_category(budget_id, '2018-02-01', category_id, month_category: { budgeted: 20382 })
|
63
63
|
expect(response.data.category).to be
|
data/spec/api/months_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe 'months' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'authorization' do
|
16
|
-
it
|
16
|
+
it 'sets the Bearer Auth header correctly' do
|
17
17
|
VCR.use_cassette("months") do
|
18
18
|
response = instance.get_budget_months(budget_id)
|
19
19
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -21,7 +21,7 @@ describe 'months' do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'throws when unauthorized' do
|
25
25
|
VCR.use_cassette("months_unauthorized") do
|
26
26
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
27
27
|
begin
|
@@ -35,7 +35,7 @@ describe 'months' do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe 'GET /budgets/{budget_id}/months' do
|
38
|
-
it
|
38
|
+
it 'returns a list of months' do
|
39
39
|
VCR.use_cassette("months") do
|
40
40
|
response = instance.get_budget_months(budget_id)
|
41
41
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -45,7 +45,7 @@ describe 'months' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe 'GET /budgets/{budget_id}/months/{month}' do
|
48
|
-
it
|
48
|
+
it 'returns a month' do
|
49
49
|
VCR.use_cassette("month") do
|
50
50
|
response = instance.get_budget_month(budget_id, '2018-02-01')
|
51
51
|
expect(response.data.month).to be
|
@@ -13,7 +13,7 @@ describe 'payee locations' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'authorization' do
|
16
|
-
it
|
16
|
+
it 'sets the Bearer Auth header correctly' do
|
17
17
|
VCR.use_cassette("payee_locations") do
|
18
18
|
response = instance.get_payee_locations(budget_id)
|
19
19
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -21,7 +21,7 @@ describe 'payee locations' do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'throws when unauthorized' do
|
25
25
|
VCR.use_cassette("payee_locations_unauthorized") do
|
26
26
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
27
27
|
begin
|
@@ -35,7 +35,7 @@ describe 'payee locations' do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe 'GET /budgets/{budget_id}/payee_location' do
|
38
|
-
it
|
38
|
+
it 'returns a list of payee locations' do
|
39
39
|
VCR.use_cassette("payee_locations") do
|
40
40
|
response = instance.get_payee_locations(budget_id)
|
41
41
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -45,7 +45,7 @@ describe 'payee locations' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe 'GET /budgets/{budget_id}/payee_locations/{payee_id}' do
|
48
|
-
it
|
48
|
+
it 'returns a payee location' do
|
49
49
|
VCR.use_cassette("payee_location") do
|
50
50
|
response = instance.get_payee_location_by_id(budget_id, '052c7814-1797-44ce-9519-020e864e4928')
|
51
51
|
expect(response.data.payee_location).to be
|
data/spec/api/payees_spec.rb
CHANGED
@@ -13,7 +13,7 @@ describe 'payees' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'authorization' do
|
16
|
-
it
|
16
|
+
it 'sets the Bearer Auth header correctly' do
|
17
17
|
VCR.use_cassette("payees") do
|
18
18
|
response = instance.get_payees(budget_id)
|
19
19
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -21,7 +21,7 @@ describe 'payees' do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'throws when unauthorized' do
|
25
25
|
VCR.use_cassette("payees_unauthorized") do
|
26
26
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
27
27
|
begin
|
@@ -35,7 +35,7 @@ describe 'payees' do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe 'GET /budgets/{budget_id}/payees' do
|
38
|
-
it
|
38
|
+
it 'returns a list of payees' do
|
39
39
|
VCR.use_cassette("payees") do
|
40
40
|
response = instance.get_payees(budget_id)
|
41
41
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -45,7 +45,7 @@ describe 'payees' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe 'GET /budgets/{budget_id}/payees/{payee_id}' do
|
48
|
-
it
|
48
|
+
it 'returns a payee' do
|
49
49
|
VCR.use_cassette("payee") do
|
50
50
|
response = instance.get_payee_by_id(budget_id, '200e6eb1-02fc-4af6-be26-27c5740bb949')
|
51
51
|
expect(response.data.payee).to be
|
@@ -13,7 +13,7 @@ describe 'scheduled transactions' do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'authorization' do
|
16
|
-
it
|
16
|
+
it 'sets the Bearer Auth header correctly' do
|
17
17
|
VCR.use_cassette("scheduled_transactions") do
|
18
18
|
response = instance.get_scheduled_transactions(budget_id)
|
19
19
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -21,7 +21,7 @@ describe 'scheduled transactions' do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'throws when unauthorized' do
|
25
25
|
VCR.use_cassette("scheduled_transactions_unauthorized") do
|
26
26
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
27
27
|
begin
|
@@ -35,7 +35,7 @@ describe 'scheduled transactions' do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe 'GET /budgets/{budget_id}/transactions' do
|
38
|
-
it
|
38
|
+
it 'returns a list of transactions' do
|
39
39
|
VCR.use_cassette("scheduled_transactions") do
|
40
40
|
response = instance.get_scheduled_transactions(budget_id)
|
41
41
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -45,7 +45,7 @@ describe 'scheduled transactions' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe 'GET /budgets/{budget_id}/transaction/{payee_id}' do
|
48
|
-
it
|
48
|
+
it 'returns a payee' do
|
49
49
|
VCR.use_cassette("scheduled_transaction") do
|
50
50
|
response = instance.get_scheduled_transaction_by_id(budget_id, '1a8e4929-3ad1-4859-8443-2aeeab0684ab')
|
51
51
|
expect(response.data.scheduled_transaction).to be
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'pp'
|
3
2
|
|
4
3
|
describe 'transactions' do
|
5
4
|
let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' }
|
@@ -16,7 +15,7 @@ describe 'transactions' do
|
|
16
15
|
end
|
17
16
|
|
18
17
|
describe 'authorization' do
|
19
|
-
it
|
18
|
+
it 'sets the Bearer Auth header correctly' do
|
20
19
|
VCR.use_cassette("transactions") do
|
21
20
|
response = instance.get_transactions(budget_id)
|
22
21
|
expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}"
|
@@ -24,7 +23,7 @@ describe 'transactions' do
|
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
it
|
26
|
+
it 'throws when unauthorized' do
|
28
27
|
VCR.use_cassette("transactions_unauthorized") do
|
29
28
|
client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false)
|
30
29
|
begin
|
@@ -38,7 +37,7 @@ describe 'transactions' do
|
|
38
37
|
end
|
39
38
|
|
40
39
|
describe 'GET /budgets/{budget_id}/transactions' do
|
41
|
-
it
|
40
|
+
it 'returns a list of transactions' do
|
42
41
|
VCR.use_cassette("transactions") do
|
43
42
|
response = instance.get_transactions(budget_id)
|
44
43
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -48,7 +47,7 @@ describe 'transactions' do
|
|
48
47
|
end
|
49
48
|
|
50
49
|
describe 'GET /budgets/{budget_id}/category/{category_id}/transactions' do
|
51
|
-
it
|
50
|
+
it 'returns a list of transactions for a category' do
|
52
51
|
VCR.use_cassette("category_transactions") do
|
53
52
|
response = instance.get_transactions_by_category(budget_id, category_id)
|
54
53
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -58,7 +57,7 @@ describe 'transactions' do
|
|
58
57
|
end
|
59
58
|
|
60
59
|
describe 'GET /budgets/{budget_id}/category/{payee_id}/transactions' do
|
61
|
-
it
|
60
|
+
it 'returns a list of transactions for a payee' do
|
62
61
|
VCR.use_cassette("payee_transactions") do
|
63
62
|
response = instance.get_transactions_by_payee(budget_id, payee_id)
|
64
63
|
expect(client.last_request.response.options[:code]).to be 200
|
@@ -68,7 +67,7 @@ describe 'transactions' do
|
|
68
67
|
end
|
69
68
|
|
70
69
|
describe 'GET /budgets/{budget_id}/transaction/{transaction_id}' do
|
71
|
-
it
|
70
|
+
it 'returns a transaction' do
|
72
71
|
VCR.use_cassette("transaction") do
|
73
72
|
response = instance.get_transaction_by_id(budget_id, '81c374ff-74ab-4d6d-8d5a-ba3ad3fa68e4')
|
74
73
|
expect(response.data.transaction).to be
|
@@ -78,7 +77,7 @@ describe 'transactions' do
|
|
78
77
|
end
|
79
78
|
|
80
79
|
describe 'POST /budgets/{budget_id}/transactions' do
|
81
|
-
it
|
80
|
+
it 'creates a transaction' do
|
82
81
|
VCR.use_cassette("create_transaction") do
|
83
82
|
response = instance.create_transaction(budget_id, {
|
84
83
|
transaction: {
|
@@ -93,7 +92,7 @@ describe 'transactions' do
|
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
96
|
-
it
|
95
|
+
it 'creates multiple transactions' do
|
97
96
|
VCR.use_cassette("create_transaction") do
|
98
97
|
response = instance.create_transactions(budget_id, {
|
99
98
|
transactions: [
|
@@ -117,7 +116,7 @@ describe 'transactions' do
|
|
117
116
|
end
|
118
117
|
|
119
118
|
describe 'PUT /budgets/{budget_id}/transactions/{transaction_id}' do
|
120
|
-
it
|
119
|
+
it 'updates a transaction' do
|
121
120
|
VCR.use_cassette("update_transaction") do
|
122
121
|
response = instance.update_transaction(budget_id, '4cd63d34-3814-4f50-abd0-59ce05b40d91', {
|
123
122
|
transaction: {
|
@@ -134,7 +133,7 @@ describe 'transactions' do
|
|
134
133
|
end
|
135
134
|
|
136
135
|
describe 'PATCH /budgets/{budget_id}/transactions' do
|
137
|
-
it
|
136
|
+
it 'updates multiple transactions' do
|
138
137
|
VCR.use_cassette("update_transactions") do
|
139
138
|
response = instance.update_transactions(budget_id, {
|
140
139
|
transactions: [
|
@@ -158,7 +157,7 @@ describe 'transactions' do
|
|
158
157
|
end
|
159
158
|
|
160
159
|
describe 'POST /budgets/{budget_id}/transactions' do
|
161
|
-
it
|
160
|
+
it 'create multiple transactions' do
|
162
161
|
VCR.use_cassette("multiple_transactions") do
|
163
162
|
response = instance.create_transaction(budget_id, {
|
164
163
|
transactions: [
|
@@ -189,7 +188,7 @@ describe 'transactions' do
|
|
189
188
|
end
|
190
189
|
|
191
190
|
describe 'POST /budgets/{budget_id}/transactions/import' do
|
192
|
-
it
|
191
|
+
it 'import transactions' do
|
193
192
|
VCR.use_cassette("import_transactions") do
|
194
193
|
response = instance.import_transactions(budget_id)
|
195
194
|
expect(client.last_request.response.options[:code]).to be 201
|
@@ -200,7 +199,7 @@ describe 'transactions' do
|
|
200
199
|
end
|
201
200
|
|
202
201
|
describe 'POST /budgets/{budget_id}/transactions/bulk' do
|
203
|
-
it
|
202
|
+
it 'bulk creations transactions' do
|
204
203
|
VCR.use_cassette("bulk_transactions") do
|
205
204
|
response = instance.bulk_create_transactions(budget_id, {
|
206
205
|
transactions: [
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.localhost:3000/v1/budgets/f419ac25-6217-4175-88dc-c3136ff5f6fd/accounts
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"account":{"name":"New Checking Account","type":"checking","balance":215000}}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- api_client/ruby/1.19.0
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Accept:
|
15
|
+
- application/json
|
16
|
+
Authorization:
|
17
|
+
- Bearer 9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045
|
18
|
+
Expect:
|
19
|
+
- ''
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Content-Type:
|
26
|
+
- application/json; charset=utf-8
|
27
|
+
X-Content-Type-Options:
|
28
|
+
- nosniff
|
29
|
+
X-Frame-Options:
|
30
|
+
- deny
|
31
|
+
Vary:
|
32
|
+
- Accept-Encoding, Origin
|
33
|
+
ETag:
|
34
|
+
- W/"8b7ba673cfda40fd762ec996f0c8e515"
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=0, private, must-revalidate
|
37
|
+
X-Request-Id:
|
38
|
+
- b651ff3a-84d3-4f3a-b83d-e5738cfd8507
|
39
|
+
X-Runtime:
|
40
|
+
- '0.293182'
|
41
|
+
Transfer-Encoding:
|
42
|
+
- chunked
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: '{"data":{"account":{"id":"77d219fc-51e9-415e-89b4-e0d893529580","name":"New
|
46
|
+
Checking Account","type":"checking","on_budget":true,"closed":false,"note":null,"balance":215000,"cleared_balance":215000,"uncleared_balance":0,"transfer_payee_id":"50031af4-c7b0-4a97-a202-daeccf8e0b2f","deleted":false},"server_knowledge":45}}'
|
47
|
+
http_version: '1.1'
|
48
|
+
adapter_metadata:
|
49
|
+
effective_url: http://api.localhost:3000/v1/budgets/f419ac25-6217-4175-88dc-c3136ff5f6fd/accounts
|
50
|
+
recorded_at: Wed, 12 Aug 2020 15:04:29 GMT
|
51
|
+
recorded_with: VCR 3.0.3
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ynab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- You Need A Budget, LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/ynab/models/account.rb
|
117
117
|
- lib/ynab/models/account_response.rb
|
118
118
|
- lib/ynab/models/account_response_data.rb
|
119
|
+
- lib/ynab/models/account_type.rb
|
119
120
|
- lib/ynab/models/accounts_response.rb
|
120
121
|
- lib/ynab/models/accounts_response_data.rb
|
121
122
|
- lib/ynab/models/budget_detail.rb
|
@@ -161,6 +162,8 @@ files:
|
|
161
162
|
- lib/ynab/models/payee_response_data.rb
|
162
163
|
- lib/ynab/models/payees_response.rb
|
163
164
|
- lib/ynab/models/payees_response_data.rb
|
165
|
+
- lib/ynab/models/save_account.rb
|
166
|
+
- lib/ynab/models/save_account_wrapper.rb
|
164
167
|
- lib/ynab/models/save_category_response.rb
|
165
168
|
- lib/ynab/models/save_category_response_data.rb
|
166
169
|
- lib/ynab/models/save_month_category.rb
|
@@ -214,6 +217,7 @@ files:
|
|
214
217
|
- spec/fixtures/vcr_cassettes/categories_unauthorized.yml
|
215
218
|
- spec/fixtures/vcr_cassettes/category.yml
|
216
219
|
- spec/fixtures/vcr_cassettes/category_transactions.yml
|
220
|
+
- spec/fixtures/vcr_cassettes/create_account.yml
|
217
221
|
- spec/fixtures/vcr_cassettes/create_transaction.yml
|
218
222
|
- spec/fixtures/vcr_cassettes/create_transactions.yml
|
219
223
|
- spec/fixtures/vcr_cassettes/import_transactions.yml
|
@@ -258,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
262
|
- !ruby/object:Gem::Version
|
259
263
|
version: '0'
|
260
264
|
requirements: []
|
261
|
-
rubygems_version: 3.1.
|
265
|
+
rubygems_version: 3.1.6
|
262
266
|
signing_key:
|
263
267
|
specification_version: 4
|
264
268
|
summary: YNAB API Endpoints Ruby Gem
|
@@ -306,5 +310,6 @@ test_files:
|
|
306
310
|
- spec/fixtures/vcr_cassettes/month.yml
|
307
311
|
- spec/fixtures/vcr_cassettes/categories_unauthorized.yml
|
308
312
|
- spec/fixtures/vcr_cassettes/transactions_unauthorized.yml
|
313
|
+
- spec/fixtures/vcr_cassettes/create_account.yml
|
309
314
|
- spec/models/transaction_detail_spec.rb
|
310
315
|
- spec/spec_helper.rb
|