ynab 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +2 -2
  3. data/README.md +37 -27
  4. data/Rakefile +0 -6
  5. data/config.json +1 -1
  6. data/docs/Account.md +1 -0
  7. data/docs/AccountsApi.md +3 -3
  8. data/docs/BudgetsApi.md +4 -4
  9. data/docs/CategoriesApi.md +45 -4
  10. data/docs/HybridTransaction.md +2 -1
  11. data/docs/MonthDetail.md +1 -1
  12. data/docs/MonthsApi.md +3 -3
  13. data/docs/PayeeLocationsApi.md +4 -4
  14. data/docs/PayeesApi.md +3 -3
  15. data/docs/SaveMonthCategory.md +8 -0
  16. data/docs/SaveMonthCategoryWrapper.md +8 -0
  17. data/docs/SaveTransaction.md +2 -2
  18. data/docs/SaveTransactionsResponse.md +8 -0
  19. data/docs/SaveTransactionsResponseData.md +11 -0
  20. data/docs/SaveTransactionsWrapper.md +9 -0
  21. data/docs/ScheduledTransactionsApi.md +3 -3
  22. data/docs/TransactionDetail.md +2 -1
  23. data/docs/TransactionSummary.md +2 -1
  24. data/docs/TransactionsApi.md +25 -25
  25. data/docs/UserApi.md +1 -1
  26. data/examples/create-multiple-transactions.rb +44 -0
  27. data/examples/update-category-budgeted.rb +23 -0
  28. data/lib/ynab.rb +5 -0
  29. data/lib/ynab/api/accounts_api.rb +6 -6
  30. data/lib/ynab/api/budgets_api.rb +8 -8
  31. data/lib/ynab/api/categories_api.rb +142 -8
  32. data/lib/ynab/api/months_api.rb +6 -6
  33. data/lib/ynab/api/payee_locations_api.rb +8 -8
  34. data/lib/ynab/api/payees_api.rb +6 -6
  35. data/lib/ynab/api/scheduled_transactions_api.rb +6 -6
  36. data/lib/ynab/api/transactions_api.rb +54 -54
  37. data/lib/ynab/api/user_api.rb +2 -2
  38. data/lib/ynab/models/account.rb +16 -1
  39. data/lib/ynab/models/hybrid_transaction.rb +17 -1
  40. data/lib/ynab/models/month_detail.rb +1 -1
  41. data/lib/ynab/models/save_month_category.rb +189 -0
  42. data/lib/ynab/models/save_month_category_wrapper.rb +188 -0
  43. data/lib/ynab/models/save_transaction.rb +2 -2
  44. data/lib/ynab/models/save_transactions_response.rb +188 -0
  45. data/lib/ynab/models/save_transactions_response_data.rb +225 -0
  46. data/lib/ynab/models/save_transactions_wrapper.rb +194 -0
  47. data/lib/ynab/models/transaction_detail.rb +17 -1
  48. data/lib/ynab/models/transaction_summary.rb +17 -1
  49. data/lib/ynab/version.rb +1 -1
  50. data/pkg/ynab-1.4.0.gem +0 -0
  51. data/spec-v1-swagger.json +413 -245
  52. data/spec/api/categories_spec.rb +14 -2
  53. data/spec/api/transactions_spec.rb +31 -0
  54. data/spec/fixtures/vcr_cassettes/category.yml +1 -1
  55. data/spec/fixtures/vcr_cassettes/multiple_transactions.yml +46 -0
  56. data/spec/fixtures/vcr_cassettes/patch_month_category.yml +46 -0
  57. metadata +20 -3
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe 'categories' do
4
4
  let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' }
5
5
  let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' }
6
+ let(:category_id) { 'acd2a771-0a56-4dba-97bd-3952b0879282' }
6
7
  let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) }
7
8
  let (:instance) { client.categories }
8
9
 
@@ -45,13 +46,24 @@ describe 'categories' do
45
46
  end
46
47
  end
47
48
 
48
- describe 'GET /budgets/{budget_id}/category/{category_id}' do
49
+ describe 'GET /budgets/{budget_id}/categories/{category_id}' do
49
50
  it "returns a category" do
50
51
  VCR.use_cassette("category") do
51
- response = instance.get_category_by_id(budget_id, '574fac19-537d-46a8-be2b-d2f875691165')
52
+ response = instance.get_category_by_id(budget_id, category_id)
52
53
  expect(response.data.category).to be
53
54
  expect(response.data.category.name).to eq 'Groceries'
54
55
  end
55
56
  end
56
57
  end
58
+
59
+ describe 'PATCH /budgets/{budget_id}/months/{month}/categories/{category_id}' do
60
+ it "returns a category" do
61
+ VCR.use_cassette("patch_month_category") do
62
+ response = instance.update_month_category(budget_id, '2018-02-01', category_id, month_category: { budgeted: 20382 })
63
+ expect(response.data.category).to be
64
+ expect(response.data.category.name).to eq 'Groceries'
65
+ expect(response.data.category.budgeted).to eq 20382
66
+ end
67
+ end
68
+ end
57
69
  end
@@ -111,6 +111,37 @@ describe 'transactions' do
111
111
  end
112
112
  end
113
113
 
114
+ describe 'POST /budgets/{budget_id}/transactions' do
115
+ it "create multiple transactions" do
116
+ VCR.use_cassette("multiple_transactions") do
117
+ response = instance.create_transaction(budget_id, {
118
+ transactions: [
119
+ {
120
+ date: '2018-01-01',
121
+ account_id: 'c15e474a-fff6-459f-82de-8e7ea1a3819e',
122
+ amount: 10000
123
+ },
124
+ {
125
+ date: '2018-01-02',
126
+ account_id: 'c15e474a-fff6-459f-82de-8e7ea1a3819e',
127
+ amount: 20000
128
+ },
129
+ {
130
+ date: '2018-01-03',
131
+ account_id: 'c15e474a-fff6-459f-82de-8e7ea1a3819e',
132
+ amount: 30000,
133
+ import_id: '123456'
134
+ }
135
+ ]
136
+ })
137
+ expect(client.last_request.response.options[:code]).to be 201
138
+ expect(response.data.transactions).to be
139
+ expect(response.data.transaction_ids.length).to eq 3
140
+ expect(response.data.duplicate_import_ids.length).to eq 0
141
+ end
142
+ end
143
+ end
144
+
114
145
  describe 'POST /budgets/{budget_id}/transactions/bulk' do
115
146
  it "bulk creations transactions" do
116
147
  VCR.use_cassette("bulk_transactions") do
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://api.localhost:3000/v1/budgets/f419ac25-6217-4175-88dc-c3136ff5f6fd/categories/574fac19-537d-46a8-be2b-d2f875691165
5
+ uri: http://api.localhost:3000/v1/budgets/f419ac25-6217-4175-88dc-c3136ff5f6fd/categories/acd2a771-0a56-4dba-97bd-3952b0879282
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.localhost:3000/v1/budgets/f419ac25-6217-4175-88dc-c3136ff5f6fd/transactions
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"transactions":[{"date":"2018-01-01","account_id":"c15e474a-fff6-459f-82de-8e7ea1a3819e","amount":10000},{"date":"2018-01-02","account_id":"c15e474a-fff6-459f-82de-8e7ea1a3819e","amount":20000},{"date":"2018-01-03","account_id":"c15e474a-fff6-459f-82de-8e7ea1a3819e","amount":30000,"import_id":"123456"}]}'
9
+ headers:
10
+ User-Agent:
11
+ - api_client/ruby/1.4.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
+ Vary:
28
+ - Accept-Encoding, Origin
29
+ ETag:
30
+ - W/"fd90fca6fa3aed56cada484393903b3f"
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Request-Id:
34
+ - 5e0ae946-ad77-4f25-8475-a2deed9758da
35
+ X-Runtime:
36
+ - '0.592970'
37
+ Transfer-Encoding:
38
+ - chunked
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"data":{"transaction_ids":["8006058e-880d-454a-b872-ac1f4e57fa83","f666fa17-f96d-4b53-ada1-0191d6fb4fa2","fb14edc0-5492-4c57-9acd-2f2795f02624"],"duplicate_import_ids":[],"transactions":[{"id":"8006058e-880d-454a-b872-ac1f4e57fa83","date":"2018-01-01","amount":10000,"memo":null,"cleared":"uncleared","approved":false,"flag_color":null,"account_id":"c15e474a-fff6-459f-82de-8e7ea1a3819e","account_name":"Checking","payee_id":null,"payee_name":null,"category_id":null,"category_name":null,"transfer_account_id":null,"transfer_transaction_id":null,"import_id":null,"deleted":false,"subtransactions":[]},{"id":"f666fa17-f96d-4b53-ada1-0191d6fb4fa2","date":"2018-01-02","amount":20000,"memo":null,"cleared":"uncleared","approved":false,"flag_color":null,"account_id":"c15e474a-fff6-459f-82de-8e7ea1a3819e","account_name":"Checking","payee_id":null,"payee_name":null,"category_id":null,"category_name":null,"transfer_account_id":null,"transfer_transaction_id":null,"import_id":null,"deleted":false,"subtransactions":[]},{"id":"fb14edc0-5492-4c57-9acd-2f2795f02624","date":"2018-01-03","amount":30000,"memo":null,"cleared":"uncleared","approved":false,"flag_color":null,"account_id":"c15e474a-fff6-459f-82de-8e7ea1a3819e","account_name":"Checking","payee_id":null,"payee_name":null,"category_id":null,"category_name":null,"transfer_account_id":null,"transfer_transaction_id":null,"import_id":"123456","deleted":false,"subtransactions":[]}]}}'
42
+ http_version: '1.1'
43
+ adapter_metadata:
44
+ effective_url: http://api.localhost:3000/v1/budgets/44656099-a8c8-4625-8fef-7c4549e696a7/transactions
45
+ recorded_at: Tue, 25 Sep 2018 21:32:45 GMT
46
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: http://api.localhost:3000/v1/budgets/f419ac25-6217-4175-88dc-c3136ff5f6fd/months/2018-02-01/categories/acd2a771-0a56-4dba-97bd-3952b0879282
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"month_category":{"budgeted":20382}}'
9
+ headers:
10
+ User-Agent:
11
+ - api_client/ruby/1.4.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: 200
23
+ message: OK
24
+ headers:
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Vary:
28
+ - Accept-Encoding, Origin
29
+ ETag:
30
+ - W/"bb47a0ec2db8e9a65487078a80518278"
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Request-Id:
34
+ - e9d2b5ad-bee5-4735-9a43-5f8b8bdca3ac
35
+ X-Runtime:
36
+ - '0.559140'
37
+ Transfer-Encoding:
38
+ - chunked
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"data":{"category":{"id":"acd2a771-0a56-4dba-97bd-3952b0879282","category_group_id":"ed6f4c0e-2c5a-45d9-b887-b68a60ea724a","name":"Groceries","hidden":false,"original_category_group_id":null,"note":null,"budgeted":20382,"activity":0,"balance":20382,"goal_type":null,"goal_creation_month":null,"goal_target":0,"goal_target_month":null,"goal_percentage_complete":0,"deleted":false}}}'
42
+ http_version: '1.1'
43
+ adapter_metadata:
44
+ effective_url: http://api.localhost:3000/v1/budgets/44656099-a8c8-4625-8fef-7c4549e696a7/months/2018-02-01/categories/acd2a771-0a56-4dba-97bd-3952b0879282
45
+ recorded_at: Tue, 25 Sep 2018 22:35:32 GMT
46
+ 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.0
4
+ version: 1.5.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: 2018-08-28 00:00:00.000000000 Z
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -159,8 +159,13 @@ files:
159
159
  - docs/PayeesApi.md
160
160
  - docs/PayeesResponse.md
161
161
  - docs/PayeesWrapper.md
162
+ - docs/SaveMonthCategory.md
163
+ - docs/SaveMonthCategoryWrapper.md
162
164
  - docs/SaveTransaction.md
163
165
  - docs/SaveTransactionWrapper.md
166
+ - docs/SaveTransactionsResponse.md
167
+ - docs/SaveTransactionsResponseData.md
168
+ - docs/SaveTransactionsWrapper.md
164
169
  - docs/ScheduledSubTransaction.md
165
170
  - docs/ScheduledTransactionDetail.md
166
171
  - docs/ScheduledTransactionResponse.md
@@ -184,7 +189,9 @@ files:
184
189
  - examples/budget-list.rb
185
190
  - examples/budget-month.rb
186
191
  - examples/category-balance.rb
192
+ - examples/create-multiple-transactions.rb
187
193
  - examples/create-transaction.rb
194
+ - examples/update-category-budgeted.rb
188
195
  - lib/ynab.rb
189
196
  - lib/ynab/api/accounts_api.rb
190
197
  - lib/ynab/api/budgets_api.rb
@@ -248,8 +255,13 @@ files:
248
255
  - lib/ynab/models/payee_wrapper.rb
249
256
  - lib/ynab/models/payees_response.rb
250
257
  - lib/ynab/models/payees_wrapper.rb
258
+ - lib/ynab/models/save_month_category.rb
259
+ - lib/ynab/models/save_month_category_wrapper.rb
251
260
  - lib/ynab/models/save_transaction.rb
252
261
  - lib/ynab/models/save_transaction_wrapper.rb
262
+ - lib/ynab/models/save_transactions_response.rb
263
+ - lib/ynab/models/save_transactions_response_data.rb
264
+ - lib/ynab/models/save_transactions_wrapper.rb
253
265
  - lib/ynab/models/scheduled_sub_transaction.rb
254
266
  - lib/ynab/models/scheduled_transaction_detail.rb
255
267
  - lib/ynab/models/scheduled_transaction_response.rb
@@ -271,6 +283,7 @@ files:
271
283
  - pkg/ynab-1.0.0.gem
272
284
  - pkg/ynab-1.1.0.gem
273
285
  - pkg/ynab-1.3.0.gem
286
+ - pkg/ynab-1.4.0.gem
274
287
  - spec-v1-swagger.json
275
288
  - spec/api/accounts_spec.rb
276
289
  - spec/api/budgets_spec.rb
@@ -297,6 +310,8 @@ files:
297
310
  - spec/fixtures/vcr_cassettes/month.yml
298
311
  - spec/fixtures/vcr_cassettes/months.yml
299
312
  - spec/fixtures/vcr_cassettes/months_unauthorized.yml
313
+ - spec/fixtures/vcr_cassettes/multiple_transactions.yml
314
+ - spec/fixtures/vcr_cassettes/patch_month_category.yml
300
315
  - spec/fixtures/vcr_cassettes/payee.yml
301
316
  - spec/fixtures/vcr_cassettes/payee_location.yml
302
317
  - spec/fixtures/vcr_cassettes/payee_locations.yml
@@ -337,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
337
352
  version: '0'
338
353
  requirements: []
339
354
  rubyforge_project:
340
- rubygems_version: 2.6.14.1
355
+ rubygems_version: 2.7.6
341
356
  signing_key:
342
357
  specification_version: 4
343
358
  summary: YNAB API Endpoints Ruby Gem
@@ -352,6 +367,7 @@ test_files:
352
367
  - spec/api/transactions_spec.rb
353
368
  - spec/api_error_spec.rb
354
369
  - spec/fixtures/.DS_Store
370
+ - spec/fixtures/vcr_cassettes/multiple_transactions.yml
355
371
  - spec/fixtures/vcr_cassettes/payee_transactions.yml
356
372
  - spec/fixtures/vcr_cassettes/categories.yml
357
373
  - spec/fixtures/vcr_cassettes/scheduled_transactions.yml
@@ -364,6 +380,7 @@ test_files:
364
380
  - spec/fixtures/vcr_cassettes/budgets.yml
365
381
  - spec/fixtures/vcr_cassettes/category_transactions.yml
366
382
  - spec/fixtures/vcr_cassettes/accounts.yml
383
+ - spec/fixtures/vcr_cassettes/patch_month_category.yml
367
384
  - spec/fixtures/vcr_cassettes/payee.yml
368
385
  - spec/fixtures/vcr_cassettes/payee_location.yml
369
386
  - spec/fixtures/vcr_cassettes/bulk_transactions.yml