ynab 1.15.0 → 1.20.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.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/lib/ynab.rb +13 -8
  4. data/lib/ynab/api/accounts_api.rb +65 -7
  5. data/lib/ynab/api/budgets_api.rb +10 -7
  6. data/lib/ynab/api/categories_api.rb +15 -15
  7. data/lib/ynab/api/deprecated_api.rb +3 -3
  8. data/lib/ynab/api/months_api.rb +7 -7
  9. data/lib/ynab/api/payee_locations_api.rb +7 -7
  10. data/lib/ynab/api/payees_api.rb +7 -7
  11. data/lib/ynab/api/scheduled_transactions_api.rb +7 -7
  12. data/lib/ynab/api/transactions_api.rb +93 -41
  13. data/lib/ynab/api/user_api.rb +1 -1
  14. data/lib/ynab/api_client.rb +3 -2
  15. data/lib/ynab/configuration.rb +2 -3
  16. data/lib/ynab/models/account.rb +4 -7
  17. data/lib/ynab/models/account_response.rb +4 -3
  18. data/lib/ynab/models/account_response_data.rb +4 -3
  19. data/lib/ynab/models/accounts_response.rb +4 -3
  20. data/lib/ynab/models/accounts_response_data.rb +4 -3
  21. data/lib/ynab/models/budget_detail.rb +4 -3
  22. data/lib/ynab/models/budget_detail_response.rb +4 -3
  23. data/lib/ynab/models/budget_detail_response_data.rb +4 -3
  24. data/lib/ynab/models/budget_settings.rb +4 -3
  25. data/lib/ynab/models/budget_settings_response.rb +4 -3
  26. data/lib/ynab/models/budget_settings_response_data.rb +4 -3
  27. data/lib/ynab/models/budget_summary.rb +20 -7
  28. data/lib/ynab/models/budget_summary_response.rb +4 -3
  29. data/lib/ynab/models/budget_summary_response_data.rb +4 -3
  30. data/lib/ynab/models/bulk_response.rb +4 -3
  31. data/lib/ynab/models/bulk_response_data.rb +4 -3
  32. data/lib/ynab/models/bulk_response_data_bulk.rb +5 -4
  33. data/lib/ynab/models/bulk_transactions.rb +4 -3
  34. data/lib/ynab/models/categories_response.rb +4 -3
  35. data/lib/ynab/models/categories_response_data.rb +4 -3
  36. data/lib/ynab/models/category.rb +6 -9
  37. data/lib/ynab/models/category_group.rb +4 -3
  38. data/lib/ynab/models/category_group_with_categories.rb +4 -3
  39. data/lib/ynab/models/category_response.rb +4 -3
  40. data/lib/ynab/models/category_response_data.rb +4 -3
  41. data/lib/ynab/models/currency_format.rb +4 -3
  42. data/lib/ynab/models/date_format.rb +4 -3
  43. data/lib/ynab/models/error_detail.rb +4 -3
  44. data/lib/ynab/models/error_response.rb +4 -3
  45. data/lib/ynab/models/hybrid_transaction.rb +4 -15
  46. data/lib/ynab/models/hybrid_transactions_response.rb +4 -3
  47. data/lib/ynab/models/hybrid_transactions_response_data.rb +4 -3
  48. data/lib/ynab/models/month_detail.rb +6 -5
  49. data/lib/ynab/models/month_detail_response.rb +4 -3
  50. data/lib/ynab/models/month_detail_response_data.rb +4 -3
  51. data/lib/ynab/models/month_summaries_response.rb +4 -3
  52. data/lib/ynab/models/month_summaries_response_data.rb +4 -3
  53. data/lib/ynab/models/month_summary.rb +6 -5
  54. data/lib/ynab/models/payee.rb +5 -4
  55. data/lib/ynab/models/payee_location.rb +4 -3
  56. data/lib/ynab/models/payee_location_response.rb +4 -3
  57. data/lib/ynab/models/payee_location_response_data.rb +4 -3
  58. data/lib/ynab/models/payee_locations_response.rb +4 -3
  59. data/lib/ynab/models/payee_locations_response_data.rb +4 -3
  60. data/lib/ynab/models/payee_response.rb +4 -3
  61. data/lib/ynab/models/payee_response_data.rb +4 -3
  62. data/lib/ynab/models/payees_response.rb +4 -3
  63. data/lib/ynab/models/payees_response_data.rb +4 -3
  64. data/lib/ynab/models/save_account.rb +250 -0
  65. data/lib/ynab/models/save_account_wrapper.rb +189 -0
  66. data/lib/ynab/models/save_category_response.rb +4 -3
  67. data/lib/ynab/models/save_category_response_data.rb +4 -3
  68. data/lib/ynab/models/save_month_category.rb +4 -3
  69. data/lib/ynab/models/save_month_category_wrapper.rb +4 -3
  70. data/lib/ynab/models/save_sub_transaction.rb +259 -0
  71. data/lib/ynab/models/save_transaction.rb +24 -19
  72. data/lib/ynab/models/save_transaction_wrapper.rb +4 -3
  73. data/lib/ynab/models/save_transactions_response.rb +4 -3
  74. data/lib/ynab/models/save_transactions_response_data.rb +5 -4
  75. data/lib/ynab/models/save_transactions_wrapper.rb +4 -3
  76. data/lib/ynab/models/scheduled_sub_transaction.rb +4 -3
  77. data/lib/ynab/models/scheduled_transaction_detail.rb +4 -11
  78. data/lib/ynab/models/scheduled_transaction_response.rb +4 -3
  79. data/lib/ynab/models/scheduled_transaction_response_data.rb +4 -3
  80. data/lib/ynab/models/scheduled_transaction_summary.rb +4 -11
  81. data/lib/ynab/models/scheduled_transactions_response.rb +4 -3
  82. data/lib/ynab/models/scheduled_transactions_response_data.rb +4 -3
  83. data/lib/ynab/models/sub_transaction.rb +33 -4
  84. data/lib/ynab/models/transaction_detail.rb +4 -11
  85. data/lib/ynab/models/transaction_response.rb +4 -3
  86. data/lib/ynab/models/transaction_response_data.rb +4 -3
  87. data/lib/ynab/models/transaction_summary.rb +4 -11
  88. data/lib/ynab/models/transactions_import_response.rb +189 -0
  89. data/lib/ynab/models/transactions_import_response_data.rb +192 -0
  90. data/lib/ynab/models/transactions_response.rb +4 -3
  91. data/lib/ynab/models/transactions_response_data.rb +4 -3
  92. data/lib/ynab/models/update_transaction.rb +18 -27
  93. data/lib/ynab/models/update_transactions_wrapper.rb +4 -3
  94. data/lib/ynab/models/user.rb +4 -3
  95. data/lib/ynab/models/user_response.rb +4 -3
  96. data/lib/ynab/models/user_response_data.rb +4 -3
  97. data/lib/ynab/version.rb +1 -1
  98. data/spec/api/accounts_spec.rb +19 -10
  99. data/spec/api/budgets_spec.rb +4 -4
  100. data/spec/api/categories_spec.rb +5 -5
  101. data/spec/api/months_spec.rb +4 -4
  102. data/spec/api/payee_locations_spec.rb +4 -4
  103. data/spec/api/payees_spec.rb +4 -4
  104. data/spec/api/scheduled_transactions_spec.rb +4 -4
  105. data/spec/api/transactions_spec.rb +23 -13
  106. data/spec/fixtures/vcr_cassettes/create_account.yml +51 -0
  107. data/spec/fixtures/vcr_cassettes/import_transactions.yml +50 -0
  108. data/spec/models/transaction_detail_spec.rb +11 -0
  109. metadata +26 -15
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.15
10
10
 
11
11
  =end
12
12
 
@@ -80,7 +80,6 @@ module YNAB
80
80
  def hash
81
81
  [data].hash
82
82
  end
83
-
84
83
  # Builds the object from hash
85
84
  # @param [Hash] attributes Model attributes in the form of hash
86
85
  # @return [Object] Returns the model itself
@@ -88,7 +87,7 @@ module YNAB
88
87
  return nil unless attributes.is_a?(Hash)
89
88
  self.class.swagger_types.each_pair do |key, type|
90
89
  if type =~ /\AArray<(.*)>/i
91
- # check to ensure the input is an array given that the the attribute
90
+ # check to ensure the input is an array given that the attribute
92
91
  # is documented as an array but the input is not
93
92
  if attributes[self.class.attribute_map[key]].is_a?(Array)
94
93
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -184,5 +183,7 @@ module YNAB
184
183
  value
185
184
  end
186
185
  end
186
+
187
187
  end
188
+
188
189
  end
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.0-SNAPSHOT
9
+ Swagger Codegen version: 2.4.15
10
10
 
11
11
  =end
12
12
 
@@ -80,7 +80,6 @@ module YNAB
80
80
  def hash
81
81
  [user].hash
82
82
  end
83
-
84
83
  # Builds the object from hash
85
84
  # @param [Hash] attributes Model attributes in the form of hash
86
85
  # @return [Object] Returns the model itself
@@ -88,7 +87,7 @@ module YNAB
88
87
  return nil unless attributes.is_a?(Hash)
89
88
  self.class.swagger_types.each_pair do |key, type|
90
89
  if type =~ /\AArray<(.*)>/i
91
- # check to ensure the input is an array given that the the attribute
90
+ # check to ensure the input is an array given that the attribute
92
91
  # is documented as an array but the input is not
93
92
  if attributes[self.class.attribute_map[key]].is_a?(Array)
94
93
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -184,5 +183,7 @@ module YNAB
184
183
  value
185
184
  end
186
185
  end
186
+
187
187
  end
188
+
188
189
  end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.0-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module YNAB
14
- VERSION = '1.15.0'
14
+ VERSION = '1.20.0'
15
15
  end
@@ -13,7 +13,7 @@ describe 'accounts' do
13
13
  end
14
14
 
15
15
  describe 'authorization' do
16
- it "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of accounts" do
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 "returns an account" do
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
- it "foobar" do
58
- VCR.use_cassette("accounts") do
59
- client = YnabApi::Client.new(access_token, 'api.localhost:3000', false)
60
- response = client.accounts.get_accounts(budget_id)
61
- expect(client.last_request.response.options[:code]).to be 200
62
- expect(response.data.accounts.length).to be 1
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
@@ -12,7 +12,7 @@ describe 'budgets' do
12
12
  end
13
13
 
14
14
  describe 'authorization' do
15
- it "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of budgets" do
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 "returns a budget" do
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
@@ -14,7 +14,7 @@ describe 'categories' do
14
14
  end
15
15
 
16
16
  describe 'authorization' do
17
- it "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of categories" do
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 "returns a category" do
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 "returns a category" do
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
@@ -13,7 +13,7 @@ describe 'months' do
13
13
  end
14
14
 
15
15
  describe 'authorization' do
16
- it "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of months" do
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 "returns a month" do
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 "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of payee locations" do
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 "returns a payee location" do
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
@@ -13,7 +13,7 @@ describe 'payees' do
13
13
  end
14
14
 
15
15
  describe 'authorization' do
16
- it "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of payees" do
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 "returns a payee" do
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 "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of transactions" do
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 "returns a payee" do
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 "sets the Bearer Auth header correctly" do
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 "throws when unauthorized" do
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 "returns a list of transactions" do
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 "returns a list of transactions for a category" do
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 "returns a list of transactions for a payee" do
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 "returns a transaction" do
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 "creates a transaction" do
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 "creates multiple transactions" do
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 "updates a transaction" do
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 "updates multiple transactions" do
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 "create multiple transactions" do
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: [
@@ -188,8 +187,19 @@ describe 'transactions' do
188
187
  end
189
188
  end
190
189
 
190
+ describe 'POST /budgets/{budget_id}/transactions/import' do
191
+ it 'import transactions' do
192
+ VCR.use_cassette("import_transactions") do
193
+ response = instance.import_transactions(budget_id)
194
+ expect(client.last_request.response.options[:code]).to be 201
195
+ expect(response.data.transaction_ids.length).to eq 1
196
+ expect(response.data.transaction_ids).to include '07b68f11-98bd-4184-8866-83268a654318'
197
+ end
198
+ end
199
+ end
200
+
191
201
  describe 'POST /budgets/{budget_id}/transactions/bulk' do
192
- it "bulk creations transactions" do
202
+ it 'bulk creations transactions' do
193
203
  VCR.use_cassette("bulk_transactions") do
194
204
  response = instance.bulk_create_transactions(budget_id, {
195
205
  transactions: [