ynab 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69ec9bd6f5c67e0bbb248e2334e3754e345a604e
4
- data.tar.gz: 76aa486bdad86177ec11d9043d0195d288cbdeb1
3
+ metadata.gz: 9bd84a797b63ba035bd3404cf239c4c81b241ac7
4
+ data.tar.gz: 9136bb84708e63f404ead2e3932535df971cee12
5
5
  SHA512:
6
- metadata.gz: 68679167f76ff3eefc8f80e3330ad4df2559a48576b8d1933c84eb81c777ae623138e007e4094e6fb2db3f7d7a0a8a82e3b045318365c3f443d1e3e751eee225
7
- data.tar.gz: eb0a9f8d73d96658f15f2d01f19da3edfd064ad800f06456eaecaf485235f1fe1b4e5d4fd4441d1f278c32331a32c955107b4a03f959e70858005313a477d279
6
+ metadata.gz: 9c5c7f98ef3cc5eed77c746c4bfc296ade067cf4f83014d4403b191bb62bc00a653c2fc4162ae63d81c0f3ad8cef273b932e6fe8f1592c737fea4689bd41c958
7
+ data.tar.gz: 981d0804f35ec9049d0c0a883a5907fc1e254a0bba80339f664773437fc3b63f62e7dc29555f0de86c00d4706435b9616452a705cb31c3a2193ee918b97ca22a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ynab (0.2.0)
4
+ ynab (0.4.0)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -11,7 +11,7 @@ GEM
11
11
  diff-lcs (1.3)
12
12
  ethon (0.11.0)
13
13
  ffi (>= 1.3.0)
14
- ffi (1.9.21)
14
+ ffi (1.9.23)
15
15
  json (2.1.0)
16
16
  rake (12.0.0)
17
17
  rspec (3.7.0)
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # YNAB API Ruby Library
2
2
 
3
3
  [![Build Status](https://travis-ci.org/ynab/ynab-sdk-ruby.svg?branch=master)](https://travis-ci.org/ynab/ynab-sdk-ruby)
4
- [![NPM Package](https://img.shields.io/gem/v/ynab.svg)](https://rubygems.org/gems/ynab)
4
+ [![RubyGem](https://img.shields.io/gem/v/ynab.svg)](https://rubygems.org/gems/ynab)
5
5
 
6
6
  **NOTE: The YNAB API is currently only available to Early Access users. If you are interested in requesting access before the API is generally available, please fill out [this form](https://docs.google.com/forms/d/17plY-CE39Xl3pe2GqyVH1Unre8TjYKs-tkI6jVC4ko4/edit).**
7
7
 
@@ -21,7 +21,7 @@ gem install ynab
21
21
  ## Usage
22
22
 
23
23
  To use this client you must
24
- [obtain an access token](https://api.youneedabudget.com/#authentication) from
24
+ [obtain an access token](https://api.youneedabudget.com/#authentication-overview) from
25
25
  your [My Account](https://app.youneedabudget.com/settings) page of the YNAB web
26
26
  app.
27
27
 
@@ -42,14 +42,44 @@ end
42
42
 
43
43
  ## Examples
44
44
 
45
- See the [examples folder](https://github.com/ynab/ynab-sdk-ruby/tree/master/examples) for, well, example usage scenarios.
45
+ See the [examples folder](https://github.com/ynab/ynab-sdk-ruby/tree/master/examples) for example usage scenarios.
46
+
47
+ ## Methods
48
+
49
+ The following methods are available in this library.
50
+
51
+ | | Method | Description |
52
+ |------------------------|-------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
53
+ | **User** | `budgets.get_user()` | Returns authenticated user information
54
+ | **Budgets** | `budgets.get_budgets()` | Returns budgets list with summary information |
55
+ | | `budgets.get_budget_by_id(id)` | Returns a single budget with all related entities |
56
+ | **Accounts** | `accounts.get_accounts(budget_id)` | Returns all accounts |
57
+ | | `accounts.get_account_by_id(budget_id, id)` | Returns a single account |
58
+ | **Categories** | `categories.get_categories(budget_id)` | Returns all categories grouped by category group. |
59
+ | | `categories.get_category_by_id(budget_id, id)` | Returns a single category |
60
+ | **Payees** | `payees.get_payees(budget_id)` | Returns all payees |
61
+ | | `payees.get_payee_by_id(budget_id, id)` | Returns single payee |
62
+ | **Payee Locations** | `payee_locations.get_payee_locations(budget_id)` | Returns all payee locations |
63
+ | | `payee_locations.get_payee_location_by_id(budget_id, id)` | Returns a single payee location |
64
+ | | `payee_locations.get_payee_locations_by_payee(budget_id, id)` | Returns all payee locations for the specified payee |
65
+ | **Months** | `months.get_budget_months(budget_id)` | Returns all budget months |
66
+ | | `months.get_budget_month(budget_id, month)` | Returns a single budget month |
67
+ | **Transactions** | `transactions.get_transactions(budget_id)` | Returns budget transactions |
68
+ | | `transactions.get_transactions_by_account(budget_id, id)` | Returns all transactions for a specified account |
69
+ | | `transactions.get_transactions_by_category(budget_id, id)` | Returns all transactions for a specified category |
70
+ | | `transactions.get_transactions_by_id(budget_id, id)` | Returns a single transaction |
71
+ | | `transactions.update_transaction(budget_id, id, transaction)` | Updates a transaction |
72
+ | | `transactions.create_transaction(budget_id, transaction)` | Creates a new transaction |
73
+ | | `transactions.bulk_create_transactions(budget_id, transactions)` | Creates multiple transactions |
74
+ | **Scheduled Transactions** | `scheduled_transactions.get_scheduled_transactions(budget_id)` | Returns all scheduled transactions |
75
+ | | `scheduled_transactions.get_scheduled_transaction_by_id(budget_id, id)` | Returns a single scheduled transaction |
46
76
 
47
77
  ## Development
48
78
 
49
79
  - Install dependencies: `bundle`
50
80
  - Generate latest client based on swagger spec: `rake generate`
51
81
  - Run tests: `rake spec` or `rspec`
52
- - Publish: Update `gemVersion` in config.json and then `rake generate && rspec && gem build ynab && gem push ynab`
82
+ - Publish: Update `gemVersion` in config.json and then `rake generate && rspec && gem build ynab && gem push ynab-0.0.0.gem`
53
83
 
54
84
  ## License
55
85
 
data/config.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "gemName": "ynab",
3
3
  "moduleName": "YnabApi",
4
- "gemVersion": "0.3.0",
4
+ "gemVersion": "0.4.0",
5
5
  "gemDescription": "Ruby gem wrapper for the YNAB API. Read the documentation at https://api.youneedabudget.com",
6
6
  "gemHomepage": "https://github.com/ynab/ynab-sdk-ruby",
7
7
  "gemLicense": "Apache-2.0",
@@ -9,7 +9,7 @@ Name | Type | Description | Notes
9
9
  **frequency** | **String** | |
10
10
  **amount** | **Float** | The scheduled transaction amount in milliunits format |
11
11
  **memo** | **String** | |
12
- **flag_color** | **String** | |
12
+ **flag_color** | **String** | The scheduled transaction flag |
13
13
  **account_id** | **String** | |
14
14
  **payee_id** | **String** | |
15
15
  **category_id** | **String** | |
@@ -9,7 +9,7 @@ Name | Type | Description | Notes
9
9
  **frequency** | **String** | |
10
10
  **amount** | **Float** | The scheduled transaction amount in milliunits format |
11
11
  **memo** | **String** | |
12
- **flag_color** | **String** | |
12
+ **flag_color** | **String** | The scheduled transaction flag |
13
13
  **account_id** | **String** | |
14
14
  **payee_id** | **String** | |
15
15
  **category_id** | **String** | |
@@ -9,7 +9,7 @@ Name | Type | Description | Notes
9
9
  **memo** | **String** | |
10
10
  **cleared** | **String** | The cleared status of the transaction |
11
11
  **approved** | **BOOLEAN** | Whether or not the transaction is approved |
12
- **flag_color** | **String** | |
12
+ **flag_color** | **String** | The transaction flag |
13
13
  **account_id** | **String** | |
14
14
  **payee_id** | **String** | |
15
15
  **category_id** | **String** | |
@@ -9,7 +9,7 @@ Name | Type | Description | Notes
9
9
  **memo** | **String** | |
10
10
  **cleared** | **String** | The cleared status of the transaction |
11
11
  **approved** | **BOOLEAN** | Whether or not the transaction is approved |
12
- **flag_color** | **String** | |
12
+ **flag_color** | **String** | The transaction flag |
13
13
  **account_id** | **String** | |
14
14
  **payee_id** | **String** | |
15
15
  **category_id** | **String** | |
@@ -10,6 +10,7 @@ Method | HTTP request | Description
10
10
  [**get_transactions_by_account**](TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions
11
11
  [**get_transactions_by_category**](TransactionsApi.md#get_transactions_by_category) | **GET** /budgets/{budget_id}/categories/{category_id}/transactions | List category transactions
12
12
  [**get_transactions_by_id**](TransactionsApi.md#get_transactions_by_id) | **GET** /budgets/{budget_id}/transactions/{transaction_id} | Single transaction
13
+ [**get_transactions_by_payee**](TransactionsApi.md#get_transactions_by_payee) | **GET** /budgets/{budget_id}/payees/{payee_id}/transactions | List payee transactions
13
14
  [**update_transaction**](TransactionsApi.md#update_transaction) | **PUT** /budgets/{budget_id}/transactions/{transaction_id} | Updates an existing transaction
14
15
 
15
16
 
@@ -366,6 +367,67 @@ Name | Type | Description | Notes
366
367
 
367
368
 
368
369
 
370
+ # **get_transactions_by_payee**
371
+ > TransactionsResponse get_transactions_by_payee(budget_id, payee_id, opts)
372
+
373
+ List payee transactions
374
+
375
+ Returns all transactions for a specified payee
376
+
377
+ ### Example
378
+ ```ruby
379
+ # load the gem
380
+ require 'ynab'
381
+ # setup authorization
382
+ YnabApi.configure do |config|
383
+ # Configure API key authorization: bearer
384
+ config.api_key['Authorization'] = 'YOUR API KEY'
385
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
386
+ #config.api_key_prefix['Authorization'] = 'Bearer'
387
+ end
388
+
389
+ api_instance = YnabApi::TransactionsApi.new
390
+
391
+ budget_id = "budget_id_example" # String | The ID of the Budget.
392
+
393
+ payee_id = "payee_id_example" # String | The ID of the Payee.
394
+
395
+ opts = {
396
+ since_date: Date.parse("2013-10-20") # Date | Only return transactions on or after this date.
397
+ }
398
+
399
+ begin
400
+ #List payee transactions
401
+ result = api_instance.get_transactions_by_payee(budget_id, payee_id, opts)
402
+ p result
403
+ rescue YnabApi::ApiError => e
404
+ puts "Exception when calling TransactionsApi->get_transactions_by_payee: #{e}"
405
+ end
406
+ ```
407
+
408
+ ### Parameters
409
+
410
+ Name | Type | Description | Notes
411
+ ------------- | ------------- | ------------- | -------------
412
+ **budget_id** | [**String**](.md)| The ID of the Budget. |
413
+ **payee_id** | [**String**](.md)| The ID of the Payee. |
414
+ **since_date** | **Date**| Only return transactions on or after this date. | [optional]
415
+
416
+ ### Return type
417
+
418
+ [**TransactionsResponse**](TransactionsResponse.md)
419
+
420
+ ### Authorization
421
+
422
+ [bearer](../README.md#bearer)
423
+
424
+ ### HTTP request headers
425
+
426
+ - **Content-Type**: Not defined
427
+ - **Accept**: application/json
428
+
429
+
430
+
369
431
  # **update_transaction**
370
432
  > TransactionResponse update_transaction(budget_id, transaction_id, transaction)
371
433
 
data/docs/User.md ADDED
@@ -0,0 +1,8 @@
1
+ # YnabApi::User
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **String** | |
7
+
8
+
data/docs/UserApi.md ADDED
@@ -0,0 +1,57 @@
1
+ # YnabApi::UserApi
2
+
3
+ All URIs are relative to *https://api.youneedabudget.com/v1*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**get_user**](UserApi.md#get_user) | **GET** /user | User info
8
+
9
+
10
+ # **get_user**
11
+ > UserResponse get_user
12
+
13
+ User info
14
+
15
+ Returns authenticated user information.
16
+
17
+ ### Example
18
+ ```ruby
19
+ # load the gem
20
+ require 'ynab'
21
+ # setup authorization
22
+ YnabApi.configure do |config|
23
+ # Configure API key authorization: bearer
24
+ config.api_key['Authorization'] = 'YOUR API KEY'
25
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
26
+ #config.api_key_prefix['Authorization'] = 'Bearer'
27
+ end
28
+
29
+ api_instance = YnabApi::UserApi.new
30
+
31
+ begin
32
+ #User info
33
+ result = api_instance.get_user
34
+ p result
35
+ rescue YnabApi::ApiError => e
36
+ puts "Exception when calling UserApi->get_user: #{e}"
37
+ end
38
+ ```
39
+
40
+ ### Parameters
41
+ This endpoint does not need any parameter.
42
+
43
+ ### Return type
44
+
45
+ [**UserResponse**](UserResponse.md)
46
+
47
+ ### Authorization
48
+
49
+ [bearer](../README.md#bearer)
50
+
51
+ ### HTTP request headers
52
+
53
+ - **Content-Type**: Not defined
54
+ - **Accept**: application/json
55
+
56
+
57
+
@@ -0,0 +1,8 @@
1
+ # YnabApi::UserResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **data** | [**UserWrapper**](UserWrapper.md) | |
7
+
8
+
@@ -0,0 +1,8 @@
1
+ # YnabApi::UserWrapper
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **user** | [**User**](User.md) | |
7
+
8
+
data/lib/ynab.rb CHANGED
@@ -17,6 +17,7 @@ require 'ynab/version'
17
17
  require 'ynab/configuration'
18
18
 
19
19
  # Models
20
+ require 'ynab/models/user'
20
21
  require 'ynab/models/account'
21
22
  require 'ynab/models/account_response'
22
23
  require 'ynab/models/account_wrapper'
@@ -75,6 +76,7 @@ require 'ynab/models/bulk_ids'
75
76
  require 'ynab/models/bulk_response'
76
77
 
77
78
  # APIs
79
+ require 'ynab/api/user_api'
78
80
  require 'ynab/api/accounts_api'
79
81
  require 'ynab/api/budgets_api'
80
82
  require 'ynab/api/categories_api'
@@ -97,6 +99,10 @@ module YnabApi
97
99
  @client = ApiClient.new(config)
98
100
  end
99
101
 
102
+ def users
103
+ UserApi.new(@client)
104
+ end
105
+
100
106
  def budgets
101
107
  BudgetsApi.new(@client)
102
108
  end
@@ -383,6 +383,68 @@ module YnabApi
383
383
  return data, status_code, headers
384
384
  end
385
385
 
386
+ # List payee transactions
387
+ # Returns all transactions for a specified payee
388
+ # @param budget_id The ID of the Budget.
389
+ # @param payee_id The ID of the Payee.
390
+ # @param [Hash] opts the optional parameters
391
+ # @option opts [Date] :since_date Only return transactions on or after this date.
392
+ # @return [TransactionsResponse]
393
+ def get_transactions_by_payee(budget_id, payee_id, opts = {})
394
+ data, _status_code, _headers = get_transactions_by_payee_with_http_info(budget_id, payee_id, opts)
395
+ return data
396
+ end
397
+
398
+ # List payee transactions
399
+ # Returns all transactions for a specified payee
400
+ # @param budget_id The ID of the Budget.
401
+ # @param payee_id The ID of the Payee.
402
+ # @param [Hash] opts the optional parameters
403
+ # @option opts [Date] :since_date Only return transactions on or after this date.
404
+ # @return [Array<(TransactionsResponse, Fixnum, Hash)>] TransactionsResponse data, response status code and response headers
405
+ def get_transactions_by_payee_with_http_info(budget_id, payee_id, opts = {})
406
+ if @api_client.config.debugging
407
+ @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_payee ..."
408
+ end
409
+ # verify the required parameter 'budget_id' is set
410
+ if @api_client.config.client_side_validation && budget_id.nil?
411
+ fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_payee"
412
+ end
413
+ # verify the required parameter 'payee_id' is set
414
+ if @api_client.config.client_side_validation && payee_id.nil?
415
+ fail ArgumentError, "Missing the required parameter 'payee_id' when calling TransactionsApi.get_transactions_by_payee"
416
+ end
417
+ # resource path
418
+ local_var_path = "/budgets/{budget_id}/payees/{payee_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_id' + '}', payee_id.to_s)
419
+
420
+ # query parameters
421
+ query_params = {}
422
+ query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
423
+
424
+ # header parameters
425
+ header_params = {}
426
+ # HTTP header 'Accept' (if needed)
427
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
428
+
429
+ # form parameters
430
+ form_params = {}
431
+
432
+ # http body (model)
433
+ post_body = nil
434
+ auth_names = ['bearer']
435
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
436
+ :header_params => header_params,
437
+ :query_params => query_params,
438
+ :form_params => form_params,
439
+ :body => post_body,
440
+ :auth_names => auth_names,
441
+ :return_type => 'TransactionsResponse')
442
+ if @api_client.config.debugging
443
+ @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_payee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
444
+ end
445
+ return data, status_code, headers
446
+ end
447
+
386
448
  # Updates an existing transaction
387
449
  # Updates a transaction
388
450
  # @param budget_id The ID of the Budget.
@@ -0,0 +1,70 @@
1
+ =begin
2
+ #YNAB API Endpoints
3
+
4
+ #Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.3.1
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module YnabApi
16
+ class UserApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # User info
24
+ # Returns authenticated user information.
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [UserResponse]
27
+ def get_user(opts = {})
28
+ data, _status_code, _headers = get_user_with_http_info(opts)
29
+ return data
30
+ end
31
+
32
+ # User info
33
+ # Returns authenticated user information.
34
+ # @param [Hash] opts the optional parameters
35
+ # @return [Array<(UserResponse, Fixnum, Hash)>] UserResponse data, response status code and response headers
36
+ def get_user_with_http_info(opts = {})
37
+ if @api_client.config.debugging
38
+ @api_client.config.logger.debug "Calling API: UserApi.get_user ..."
39
+ end
40
+ # resource path
41
+ local_var_path = "/user"
42
+
43
+ # query parameters
44
+ query_params = {}
45
+
46
+ # header parameters
47
+ header_params = {}
48
+ # HTTP header 'Accept' (if needed)
49
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
50
+
51
+ # form parameters
52
+ form_params = {}
53
+
54
+ # http body (model)
55
+ post_body = nil
56
+ auth_names = ['bearer']
57
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
58
+ :header_params => header_params,
59
+ :query_params => query_params,
60
+ :form_params => form_params,
61
+ :body => post_body,
62
+ :auth_names => auth_names,
63
+ :return_type => 'UserResponse')
64
+ if @api_client.config.debugging
65
+ @api_client.config.logger.debug "API called: UserApi#get_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
66
+ end
67
+ return data, status_code, headers
68
+ end
69
+ end
70
+ end