Skip to content

Commit 0b24e62

Browse files
committed
Generate from spec version 1.72.0 - get txns by month
1 parent 86d9dd4 commit 0b24e62

File tree

8 files changed

+232
-3
lines changed

8 files changed

+232
-3
lines changed

Diff for: Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
ynab (3.1.0)
4+
ynab (3.2.0)
55
typhoeus (~> 1.0, >= 1.0.1)
66

77
GEM

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The following methods are available in this library.
6868
| **Transactions** | [transactions.get_transactions(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions) | Returns budget transactions |
6969
| | [transactions.get_transactions_by_account(budget_id, account_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_account) | Returns all transactions for a specified account |
7070
| | [transactions.get_transactions_by_category(budget_id, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_category) | Returns all transactions for a specified category |
71+
| | [transactions.get_transactions_by_month(budget_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_month) | Returns all transactions for a specified month |
7172
| | [transactions.get_transaction_by_id(budget_id, transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transaction_by_id) | Returns a single transaction |
7273
| | [transactions.create_transaction(budget_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#create_transaction) | Creates a single transaction |
7374
| | [transactions.create_transactions(budget_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#create_transaction) | Creates multiple transactions |

Diff for: docs/TransactionsApi.md

+24
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All URIs are relative to *https://api.ynab.com/v1*
1010
| [**get_transactions**](TransactionsApi.md#get_transactions) | **GET** /budgets/{budget_id}/transactions | List transactions |
1111
| [**get_transactions_by_account**](TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions |
1212
| [**get_transactions_by_category**](TransactionsApi.md#get_transactions_by_category) | **GET** /budgets/{budget_id}/categories/{category_id}/transactions | List category transactions, excluding any pending transactions |
13+
| [**get_transactions_by_month**](TransactionsApi.md#get_transactions_by_month) | **GET** /budgets/{budget_id}/months/{month}/transactions | List transactions in month, excluding any pending transactions |
1314
| [**get_transactions_by_payee**](TransactionsApi.md#get_transactions_by_payee) | **GET** /budgets/{budget_id}/payees/{payee_id}/transactions | List payee transactions, excluding any pending transactions |
1415
| [**import_transactions**](TransactionsApi.md#import_transactions) | **POST** /budgets/{budget_id}/transactions/import | Import transactions |
1516
| [**update_transaction**](TransactionsApi.md#update_transaction) | **PUT** /budgets/{budget_id}/transactions/{transaction_id} | Updates an existing transaction |
@@ -144,6 +145,29 @@ Returns all transactions for a specified category
144145
[**HybridTransactionsResponse**](HybridTransactionsResponse.md)
145146

146147

148+
## get_transactions_by_month
149+
150+
> <HybridTransactionsResponse> get_transactions_by_month(budget_id, month, opts)
151+
152+
List transactions in month, excluding any pending transactions
153+
154+
Returns all transactions for a specified month
155+
156+
### Parameters
157+
158+
| Name | Type | Description | Notes |
159+
| ---- | ---- | ----------- | ----- |
160+
| **budget_id** | **String** | The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | |
161+
| **month** | **String** | The budget month in ISO format (e.g. 2016-12-01) (\&quot;current\&quot; can also be used to specify the current calendar month (UTC)) | |
162+
| **since_date** | **Date** | If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). | [optional] |
163+
| **type** | **String** | If specified, only transactions of the specified type will be included. \&quot;uncategorized\&quot; and \&quot;unapproved\&quot; are currently supported. | [optional] |
164+
| **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included. | [optional] |
165+
166+
### Return type
167+
168+
[**HybridTransactionsResponse**](HybridTransactionsResponse.md)
169+
170+
147171
## get_transactions_by_payee
148172

149173
> <HybridTransactionsResponse> get_transactions_by_payee(budget_id, payee_id, opts)

Diff for: lib/ynab/api/transactions_api.rb

+78
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,84 @@ def get_transactions_by_category_with_http_info(budget_id, category_id, opts = {
456456
return data, status_code, headers
457457
end
458458

459+
# List transactions in month, excluding any pending transactions
460+
# Returns all transactions for a specified month
461+
# @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
462+
# @param month [String] The budget month in ISO format (e.g. 2016-12-01) (\&quot;current\&quot; can also be used to specify the current calendar month (UTC))
463+
# @param [Hash] opts the optional parameters
464+
# @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).
465+
# @option opts [String] :type If specified, only transactions of the specified type will be included. \&quot;uncategorized\&quot; and \&quot;unapproved\&quot; are currently supported.
466+
# @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.
467+
# @return [HybridTransactionsResponse]
468+
def get_transactions_by_month(budget_id, month, opts = {})
469+
data, _status_code, _headers = get_transactions_by_month_with_http_info(budget_id, month, opts)
470+
data
471+
end
472+
473+
# List transactions in month, excluding any pending transactions
474+
# Returns all transactions for a specified month
475+
# @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).
476+
# @param month [String] The budget month in ISO format (e.g. 2016-12-01) (\&quot;current\&quot; can also be used to specify the current calendar month (UTC))
477+
# @param [Hash] opts the optional parameters
478+
# @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).
479+
# @option opts [String] :type If specified, only transactions of the specified type will be included. \&quot;uncategorized\&quot; and \&quot;unapproved\&quot; are currently supported.
480+
# @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since &#x60;last_knowledge_of_server&#x60; will be included.
481+
# @return [Array<(HybridTransactionsResponse, Integer, Hash)>] HybridTransactionsResponse data, response status code and response headers
482+
def get_transactions_by_month_with_http_info(budget_id, month, opts = {})
483+
if @api_client.config.debugging
484+
@api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_month ...'
485+
end
486+
# verify the required parameter 'budget_id' is set
487+
if @api_client.config.client_side_validation && budget_id.nil?
488+
fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_month"
489+
end
490+
# verify the required parameter 'month' is set
491+
if @api_client.config.client_side_validation && month.nil?
492+
fail ArgumentError, "Missing the required parameter 'month' when calling TransactionsApi.get_transactions_by_month"
493+
end
494+
# resource path
495+
local_var_path = '/budgets/{budget_id}/months/{month}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s))
496+
497+
# query parameters
498+
query_params = opts[:query_params] || {}
499+
query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil?
500+
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
501+
query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil?
502+
503+
# header parameters
504+
header_params = opts[:header_params] || {}
505+
# HTTP header 'Accept' (if needed)
506+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
507+
508+
# form parameters
509+
form_params = opts[:form_params] || {}
510+
511+
# http body (model)
512+
post_body = opts[:debug_body]
513+
514+
# return_type
515+
return_type = opts[:debug_return_type] || 'HybridTransactionsResponse'
516+
517+
# auth_names
518+
auth_names = opts[:debug_auth_names] || ['bearer']
519+
520+
new_options = opts.merge(
521+
:operation => :"TransactionsApi.get_transactions_by_month",
522+
:header_params => header_params,
523+
:query_params => query_params,
524+
:form_params => form_params,
525+
:body => post_body,
526+
:auth_names => auth_names,
527+
:return_type => return_type
528+
)
529+
530+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
531+
if @api_client.config.debugging
532+
@api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
533+
end
534+
return data, status_code, headers
535+
end
536+
459537
# List payee transactions, excluding any pending transactions
460538
# Returns all transactions for a specified payee
461539
# @param budget_id [String] The id of the budget. \&quot;last-used\&quot; can be used to specify the last used budget and \&quot;default\&quot; can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget).

Diff for: open_api_spec.yaml

+71-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ info:
66
upon HTTPS for transport. We respond with meaningful HTTP response codes and
77
if an error occurs, we include error details in the response body. API
88
Documentation is at https://api.ynab.com
9-
version: 1.71.0
9+
version: 1.72.0
1010
servers:
1111
- url: https://api.ynab.com/v1
1212
security:
@@ -1425,6 +1425,76 @@ paths:
14251425
application/json:
14261426
schema:
14271427
$ref: "#/components/schemas/ErrorResponse"
1428+
/budgets/{budget_id}/months/{month}/transactions:
1429+
get:
1430+
tags:
1431+
- Transactions
1432+
summary: List transactions in month, excluding any pending transactions
1433+
description: Returns all transactions for a specified month
1434+
operationId: getTransactionsByMonth
1435+
parameters:
1436+
- name: budget_id
1437+
in: path
1438+
description: >-
1439+
The id of the budget. "last-used" can be used to specify the last
1440+
used budget and "default" can be used if default budget selection is
1441+
enabled (see: https://api.ynab.com/#oauth-default-budget).
1442+
required: true
1443+
schema:
1444+
type: string
1445+
- name: month
1446+
in: path
1447+
description: >-
1448+
The budget month in ISO format (e.g. 2016-12-01) ("current" can also
1449+
be used to specify the current calendar month (UTC))
1450+
required: true
1451+
schema:
1452+
type: string
1453+
- name: since_date
1454+
in: query
1455+
description: >-
1456+
If specified, only transactions on or after this date will be
1457+
included. The date should be ISO formatted (e.g. 2016-12-30).
1458+
schema:
1459+
type: string
1460+
format: date
1461+
- name: type
1462+
in: query
1463+
description: >-
1464+
If specified, only transactions of the specified type will be
1465+
included. "uncategorized" and "unapproved" are currently supported.
1466+
schema:
1467+
type: string
1468+
enum:
1469+
- uncategorized
1470+
- unapproved
1471+
- name: last_knowledge_of_server
1472+
in: query
1473+
description: >-
1474+
The starting server knowledge. If provided, only entities that have
1475+
changed since `last_knowledge_of_server` will be included.
1476+
schema:
1477+
type: integer
1478+
format: int64
1479+
responses:
1480+
"200":
1481+
description: The list of requested transactions
1482+
content:
1483+
application/json:
1484+
schema:
1485+
$ref: "#/components/schemas/HybridTransactionsResponse"
1486+
"404":
1487+
description: No transactions were found
1488+
content:
1489+
application/json:
1490+
schema:
1491+
$ref: "#/components/schemas/ErrorResponse"
1492+
default:
1493+
description: An error occurred
1494+
content:
1495+
application/json:
1496+
schema:
1497+
$ref: "#/components/schemas/ErrorResponse"
14281498
/budgets/{budget_id}/scheduled_transactions:
14291499
get:
14301500
tags:

Diff for: spec/api/transactions_spec.rb

+10
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@
6666
end
6767
end
6868

69+
describe 'GET /budgets/{budget_id}/months/{month}/transactions' do
70+
it 'returns a list of transactions for a month' do
71+
VCR.use_cassette("month_transactions") do
72+
response = instance.get_transactions_by_month(budget_id, "2024-07-01")
73+
expect(client.last_request.response.options[:code]).to be 200
74+
expect(response.data.transactions.length).to be 2
75+
end
76+
end
77+
end
78+
6979
describe 'GET /budgets/{budget_id}/transaction/{transaction_id}' do
7080
it 'returns a transaction' do
7181
VCR.use_cassette("transaction") do

Diff for: spec/fixtures/vcr_cassettes/month_transactions.yml

+46
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ynab.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
2020
s.email = ["[email protected]"]
2121
s.homepage = "https://github.com/ynab/ynab-sdk-ruby"
2222
s.summary = "YNAB API Client for Ruby"
23-
s.description = "Ruby gem wrapper for the YNAB API. Generated from server specification version 1.71.0 using OpenAPI Generator version 7.7.0."
23+
s.description = "Ruby gem wrapper for the YNAB API. Generated from server specification version 1.72.0 using OpenAPI Generator version 7.7.0."
2424
s.license = "Apache-2.0"
2525
s.required_ruby_version = ">= 3.3"
2626
s.metadata = {}

0 commit comments

Comments
 (0)