From 13993e5d1b1dac9409a1f8dae394591210f5feae Mon Sep 17 00:00:00 2001 From: Brady Holt Date: Wed, 15 Apr 2026 16:40:11 -0500 Subject: [PATCH 1/3] Generate against server v1.83.0 --- .openapi-generator/FILES | 24 + .openapi-generator/VERSION | 2 +- Gemfile.lock | 2 +- docs/Account.md | 6 + docs/AccountBase.md | 25 + docs/Category.md | 14 + docs/CategoryBase.md | 33 ++ docs/ExistingCategory.md | 3 +- docs/HybridTransaction.md | 2 + docs/MoneyMovement.md | 2 + docs/MoneyMovementBase.md | 16 + docs/MonthDetail.md | 8 + docs/MonthDetailBase.md | 16 + docs/MonthSummary.md | 8 + docs/MonthSummaryBase.md | 15 + docs/NewCategory.md | 3 +- docs/PayeesApi.md | 21 + docs/PlanDetail.md | 14 +- docs/PostPayee.md | 8 + docs/PostPayeeWrapper.md | 8 + docs/SaveAccount.md | 2 +- docs/SaveAccountType.md | 7 + docs/SaveCategory.md | 3 +- docs/SavePayee.md | 2 +- docs/ScheduledSubTransaction.md | 2 + docs/ScheduledSubTransactionBase.md | 17 + docs/ScheduledTransactionDetail.md | 2 + docs/ScheduledTransactionSummary.md | 2 + docs/ScheduledTransactionSummaryBase.md | 20 + docs/SubTransaction.md | 2 + docs/SubTransactionBase.md | 18 + docs/TransactionDetail.md | 2 + docs/TransactionSummary.md | 2 + docs/TransactionSummaryBase.md | 26 ++ lib/ynab.rb | 12 + lib/ynab/api/payees_api.rb | 74 +++ lib/ynab/models/account.rb | 80 +++- lib/ynab/models/account_base.rb | 340 ++++++++++++++ lib/ynab/models/category.rb | 179 ++++++- lib/ynab/models/category_base.rb | 436 ++++++++++++++++++ lib/ynab/models/existing_category.rb | 20 +- lib/ynab/models/hybrid_transaction.rb | 22 +- lib/ynab/models/money_movement.rb | 42 +- lib/ynab/models/money_movement_base.rb | 223 +++++++++ lib/ynab/models/month_detail.rb | 82 +++- lib/ynab/models/month_detail_base.rb | 230 +++++++++ lib/ynab/models/month_summary.rb | 97 +++- lib/ynab/models/month_summary_base.rb | 212 +++++++++ lib/ynab/models/new_category.rb | 20 +- lib/ynab/models/plan_detail.rb | 14 +- lib/ynab/models/post_payee.rb | 148 ++++++ lib/ynab/models/post_payee_wrapper.rb | 136 ++++++ lib/ynab/models/save_account.rb | 2 +- lib/ynab/models/save_account_type.rb | 45 ++ lib/ynab/models/save_category.rb | 23 +- lib/ynab/models/save_payee.rb | 2 +- lib/ynab/models/scheduled_sub_transaction.rb | 41 +- .../models/scheduled_sub_transaction_base.rb | 229 +++++++++ .../models/scheduled_transaction_detail.rb | 22 +- .../models/scheduled_transaction_summary.rb | 40 +- .../scheduled_transaction_summary_base.rb | 292 ++++++++++++ lib/ynab/models/sub_transaction.rb | 42 +- lib/ynab/models/sub_transaction_base.rb | 240 ++++++++++ lib/ynab/models/transaction_detail.rb | 22 +- lib/ynab/models/transaction_summary.rb | 45 +- lib/ynab/models/transaction_summary_base.rb | 358 ++++++++++++++ open_api_spec.yaml | 316 ++++++++++++- ynab.gemspec | 2 +- 68 files changed, 4271 insertions(+), 154 deletions(-) create mode 100644 docs/AccountBase.md create mode 100644 docs/CategoryBase.md create mode 100644 docs/MoneyMovementBase.md create mode 100644 docs/MonthDetailBase.md create mode 100644 docs/MonthSummaryBase.md create mode 100644 docs/PostPayee.md create mode 100644 docs/PostPayeeWrapper.md create mode 100644 docs/SaveAccountType.md create mode 100644 docs/ScheduledSubTransactionBase.md create mode 100644 docs/ScheduledTransactionSummaryBase.md create mode 100644 docs/SubTransactionBase.md create mode 100644 docs/TransactionSummaryBase.md create mode 100644 lib/ynab/models/account_base.rb create mode 100644 lib/ynab/models/category_base.rb create mode 100644 lib/ynab/models/money_movement_base.rb create mode 100644 lib/ynab/models/month_detail_base.rb create mode 100644 lib/ynab/models/month_summary_base.rb create mode 100644 lib/ynab/models/post_payee.rb create mode 100644 lib/ynab/models/post_payee_wrapper.rb create mode 100644 lib/ynab/models/save_account_type.rb create mode 100644 lib/ynab/models/scheduled_sub_transaction_base.rb create mode 100644 lib/ynab/models/scheduled_transaction_summary_base.rb create mode 100644 lib/ynab/models/sub_transaction_base.rb create mode 100644 lib/ynab/models/transaction_summary_base.rb diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 7a8a848..570cba7 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,6 +1,7 @@ .gitignore .rspec docs/Account.md +docs/AccountBase.md docs/AccountResponse.md docs/AccountResponseData.md docs/AccountType.md @@ -15,6 +16,7 @@ docs/CategoriesApi.md docs/CategoriesResponse.md docs/CategoriesResponseData.md docs/Category.md +docs/CategoryBase.md docs/CategoryGroup.md docs/CategoryGroupWithCategories.md docs/CategoryResponse.md @@ -29,6 +31,7 @@ docs/HybridTransaction.md docs/HybridTransactionsResponse.md docs/HybridTransactionsResponseData.md docs/MoneyMovement.md +docs/MoneyMovementBase.md docs/MoneyMovementGroup.md docs/MoneyMovementGroupsResponse.md docs/MoneyMovementGroupsResponseData.md @@ -36,11 +39,13 @@ docs/MoneyMovementsApi.md docs/MoneyMovementsResponse.md docs/MoneyMovementsResponseData.md docs/MonthDetail.md +docs/MonthDetailBase.md docs/MonthDetailResponse.md docs/MonthDetailResponseData.md docs/MonthSummariesResponse.md docs/MonthSummariesResponseData.md docs/MonthSummary.md +docs/MonthSummaryBase.md docs/MonthsApi.md docs/NewCategory.md docs/NewTransaction.md @@ -74,11 +79,14 @@ docs/PlansApi.md docs/PostAccountWrapper.md docs/PostCategoryGroupWrapper.md docs/PostCategoryWrapper.md +docs/PostPayee.md +docs/PostPayeeWrapper.md docs/PostScheduledTransactionWrapper.md docs/PostTransactionsWrapper.md docs/PutScheduledTransactionWrapper.md docs/PutTransactionWrapper.md docs/SaveAccount.md +docs/SaveAccountType.md docs/SaveCategory.md docs/SaveCategoryGroup.md docs/SaveCategoryGroupResponse.md @@ -96,21 +104,25 @@ docs/SaveTransactionWithOptionalFields.md docs/SaveTransactionsResponse.md docs/SaveTransactionsResponseData.md docs/ScheduledSubTransaction.md +docs/ScheduledSubTransactionBase.md docs/ScheduledTransactionDetail.md docs/ScheduledTransactionFrequency.md docs/ScheduledTransactionResponse.md docs/ScheduledTransactionResponseData.md docs/ScheduledTransactionSummary.md +docs/ScheduledTransactionSummaryBase.md docs/ScheduledTransactionsApi.md docs/ScheduledTransactionsResponse.md docs/ScheduledTransactionsResponseData.md docs/SubTransaction.md +docs/SubTransactionBase.md docs/TransactionClearedStatus.md docs/TransactionDetail.md docs/TransactionFlagColor.md docs/TransactionResponse.md docs/TransactionResponseData.md docs/TransactionSummary.md +docs/TransactionSummaryBase.md docs/TransactionsApi.md docs/TransactionsImportResponse.md docs/TransactionsImportResponseData.md @@ -135,6 +147,7 @@ lib/ynab/api_client.rb lib/ynab/api_model_base.rb lib/ynab/configuration.rb lib/ynab/models/account.rb +lib/ynab/models/account_base.rb lib/ynab/models/account_response.rb lib/ynab/models/account_response_data.rb lib/ynab/models/account_type.rb @@ -147,6 +160,7 @@ lib/ynab/models/bulk_transactions.rb lib/ynab/models/categories_response.rb lib/ynab/models/categories_response_data.rb lib/ynab/models/category.rb +lib/ynab/models/category_base.rb lib/ynab/models/category_group.rb lib/ynab/models/category_group_with_categories.rb lib/ynab/models/category_response.rb @@ -161,17 +175,20 @@ lib/ynab/models/hybrid_transaction.rb lib/ynab/models/hybrid_transactions_response.rb lib/ynab/models/hybrid_transactions_response_data.rb lib/ynab/models/money_movement.rb +lib/ynab/models/money_movement_base.rb lib/ynab/models/money_movement_group.rb lib/ynab/models/money_movement_groups_response.rb lib/ynab/models/money_movement_groups_response_data.rb lib/ynab/models/money_movements_response.rb lib/ynab/models/money_movements_response_data.rb lib/ynab/models/month_detail.rb +lib/ynab/models/month_detail_base.rb lib/ynab/models/month_detail_response.rb lib/ynab/models/month_detail_response_data.rb lib/ynab/models/month_summaries_response.rb lib/ynab/models/month_summaries_response_data.rb lib/ynab/models/month_summary.rb +lib/ynab/models/month_summary_base.rb lib/ynab/models/new_category.rb lib/ynab/models/new_transaction.rb lib/ynab/models/patch_category_group_wrapper.rb @@ -201,11 +218,14 @@ lib/ynab/models/plan_summary_response_data.rb lib/ynab/models/post_account_wrapper.rb lib/ynab/models/post_category_group_wrapper.rb lib/ynab/models/post_category_wrapper.rb +lib/ynab/models/post_payee.rb +lib/ynab/models/post_payee_wrapper.rb lib/ynab/models/post_scheduled_transaction_wrapper.rb lib/ynab/models/post_transactions_wrapper.rb lib/ynab/models/put_scheduled_transaction_wrapper.rb lib/ynab/models/put_transaction_wrapper.rb lib/ynab/models/save_account.rb +lib/ynab/models/save_account_type.rb lib/ynab/models/save_category.rb lib/ynab/models/save_category_group.rb lib/ynab/models/save_category_group_response.rb @@ -223,20 +243,24 @@ lib/ynab/models/save_transaction_with_optional_fields.rb lib/ynab/models/save_transactions_response.rb lib/ynab/models/save_transactions_response_data.rb lib/ynab/models/scheduled_sub_transaction.rb +lib/ynab/models/scheduled_sub_transaction_base.rb lib/ynab/models/scheduled_transaction_detail.rb lib/ynab/models/scheduled_transaction_frequency.rb lib/ynab/models/scheduled_transaction_response.rb lib/ynab/models/scheduled_transaction_response_data.rb lib/ynab/models/scheduled_transaction_summary.rb +lib/ynab/models/scheduled_transaction_summary_base.rb lib/ynab/models/scheduled_transactions_response.rb lib/ynab/models/scheduled_transactions_response_data.rb lib/ynab/models/sub_transaction.rb +lib/ynab/models/sub_transaction_base.rb lib/ynab/models/transaction_cleared_status.rb lib/ynab/models/transaction_detail.rb lib/ynab/models/transaction_flag_color.rb lib/ynab/models/transaction_response.rb lib/ynab/models/transaction_response_data.rb lib/ynab/models/transaction_summary.rb +lib/ynab/models/transaction_summary_base.rb lib/ynab/models/transactions_import_response.rb lib/ynab/models/transactions_import_response_data.rb lib/ynab/models/transactions_response.rb diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 2540a3a..a29ba3d 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.20.0 +7.21.0 diff --git a/Gemfile.lock b/Gemfile.lock index 58f7586..28d96d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - ynab (4.9.0) + ynab (5.0.0) typhoeus (~> 1.0, >= 1.0.1) GEM diff --git a/docs/Account.md b/docs/Account.md index 125d285..1fbb544 100644 --- a/docs/Account.md +++ b/docs/Account.md @@ -22,4 +22,10 @@ | **debt_minimum_payments** | **Hash<String, Integer>** | | [optional] | | **debt_escrow_amounts** | **Hash<String, Integer>** | | [optional] | | **deleted** | **Boolean** | Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. | | +| **balance_formatted** | **String** | The current available balance of the account formatted in the plan's currency format | [optional] | +| **balance_currency** | **Float** | The current available balance of the account as a decimal currency amount | [optional] | +| **cleared_balance_formatted** | **String** | The current cleared balance of the account formatted in the plan's currency format | [optional] | +| **cleared_balance_currency** | **Float** | The current cleared balance of the account as a decimal currency amount | [optional] | +| **uncleared_balance_formatted** | **String** | The current uncleared balance of the account formatted in the plan's currency format | [optional] | +| **uncleared_balance_currency** | **Float** | The current uncleared balance of the account as a decimal currency amount | [optional] | diff --git a/docs/AccountBase.md b/docs/AccountBase.md new file mode 100644 index 0000000..6f068c6 --- /dev/null +++ b/docs/AccountBase.md @@ -0,0 +1,25 @@ +# YNAB::AccountBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **name** | **String** | | | +| **type** | [**AccountType**](AccountType.md) | | | +| **on_budget** | **Boolean** | Whether this account is \"on budget\" or not | | +| **closed** | **Boolean** | Whether this account is closed or not | | +| **note** | **String** | | [optional] | +| **balance** | **Integer** | The current available balance of the account in milliunits format | | +| **cleared_balance** | **Integer** | The current cleared balance of the account in milliunits format | | +| **uncleared_balance** | **Integer** | The current uncleared balance of the account in milliunits format | | +| **transfer_payee_id** | **String** | The payee id which should be used when transferring to this account | | +| **direct_import_linked** | **Boolean** | Whether or not the account is linked to a financial institution for automatic transaction import. | [optional] | +| **direct_import_in_error** | **Boolean** | If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true. | [optional] | +| **last_reconciled_at** | **Time** | A date/time specifying when the account was last reconciled. | [optional] | +| **debt_original_balance** | **Integer** | This field is deprecated and will always be null. | [optional] | +| **debt_interest_rates** | **Hash<String, Integer>** | | [optional] | +| **debt_minimum_payments** | **Hash<String, Integer>** | | [optional] | +| **debt_escrow_amounts** | **Hash<String, Integer>** | | [optional] | +| **deleted** | **Boolean** | Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. | | + diff --git a/docs/Category.md b/docs/Category.md index 555efea..5e22964 100644 --- a/docs/Category.md +++ b/docs/Category.md @@ -30,4 +30,18 @@ | **goal_overall_left** | **Integer** | The amount of funding still needed to complete the goal within the current goal period. | [optional] | | **goal_snoozed_at** | **Time** | The date/time the goal was snoozed. If the goal is not snoozed, this will be null. | [optional] | | **deleted** | **Boolean** | Whether or not the category has been deleted. Deleted categories will only be included in delta requests. | | +| **balance_formatted** | **String** | Available balance of the category formatted in the plan's currency format | [optional] | +| **balance_currency** | **Float** | Available balance of the category as a decimal currency amount | [optional] | +| **activity_formatted** | **String** | Activity of the category formatted in the plan's currency format | [optional] | +| **activity_currency** | **Float** | Activity of the category as a decimal currency amount | [optional] | +| **budgeted_formatted** | **String** | Assigned (budgeted) amount of the category formatted in the plan's currency format | [optional] | +| **budgeted_currency** | **Float** | Assigned (budgeted) amount of the category as a decimal currency amount | [optional] | +| **goal_target_formatted** | **String** | The goal target amount formatted in the plan's currency format | [optional] | +| **goal_target_currency** | **Float** | The goal target amount as a decimal currency amount | [optional] | +| **goal_under_funded_formatted** | **String** | The goal underfunded amount formatted in the plan's currency format | [optional] | +| **goal_under_funded_currency** | **Float** | The goal underfunded amount as a decimal currency amount | [optional] | +| **goal_overall_funded_formatted** | **String** | The total amount funded towards the goal formatted in the plan's currency format | [optional] | +| **goal_overall_funded_currency** | **Float** | The total amount funded towards the goal as a decimal currency amount | [optional] | +| **goal_overall_left_formatted** | **String** | The amount of funding still needed to complete the goal formatted in the plan's currency format | [optional] | +| **goal_overall_left_currency** | **Float** | The amount of funding still needed to complete the goal as a decimal currency amount | [optional] | diff --git a/docs/CategoryBase.md b/docs/CategoryBase.md new file mode 100644 index 0000000..1de9e6d --- /dev/null +++ b/docs/CategoryBase.md @@ -0,0 +1,33 @@ +# YNAB::CategoryBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **category_group_id** | **String** | | | +| **category_group_name** | **String** | | [optional] | +| **name** | **String** | | | +| **hidden** | **Boolean** | Whether or not the category is hidden | | +| **original_category_group_id** | **String** | DEPRECATED: No longer used. Value will always be null. | [optional] | +| **note** | **String** | | [optional] | +| **budgeted** | **Integer** | Assigned (budgeted) amount in milliunits format | | +| **activity** | **Integer** | Activity amount in milliunits format | | +| **balance** | **Integer** | Available balance in milliunits format | | +| **goal_type** | **String** | The type of goal, if the category has a goal (TB='Target Category Balance', TBD='Target Category Balance by Date', MF='Monthly Funding', NEED='Plan Your Spending') | [optional] | +| **goal_needs_whole_amount** | **Boolean** | Indicates the monthly rollover behavior for \"NEED\"-type goals. When \"true\", the goal will always ask for the target amount in the new month (\"Set Aside\"). When \"false\", previous month category funding is used (\"Refill\"). For other goal types, this field will be null. | [optional] | +| **goal_day** | **Integer** | A day offset modifier for the goal's due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month). | [optional] | +| **goal_cadence** | **Integer** | The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal's due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal's due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years. | [optional] | +| **goal_cadence_frequency** | **Integer** | The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal's due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored. | [optional] | +| **goal_creation_month** | **Date** | The month a goal was created | [optional] | +| **goal_target** | **Integer** | The goal target amount in milliunits | [optional] | +| **goal_target_month** | **Date** | DEPRECATED: No longer used. Use `goal_target_date` instead. | [optional] | +| **goal_target_date** | **Date** | The target date for the goal to be completed. Only some goal types specify this date. | [optional] | +| **goal_percentage_complete** | **Integer** | The percentage completion of the goal | [optional] | +| **goal_months_to_budget** | **Integer** | The number of months, including the current month, left in the current goal period. | [optional] | +| **goal_under_funded** | **Integer** | The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month. | [optional] | +| **goal_overall_funded** | **Integer** | The total amount funded towards the goal within the current goal period. | [optional] | +| **goal_overall_left** | **Integer** | The amount of funding still needed to complete the goal within the current goal period. | [optional] | +| **goal_snoozed_at** | **Time** | The date/time the goal was snoozed. If the goal is not snoozed, this will be null. | [optional] | +| **deleted** | **Boolean** | Whether or not the category has been deleted. Deleted categories will only be included in delta requests. | | + diff --git a/docs/ExistingCategory.md b/docs/ExistingCategory.md index a459aa6..b36e2ae 100644 --- a/docs/ExistingCategory.md +++ b/docs/ExistingCategory.md @@ -7,6 +7,7 @@ | **name** | **String** | | [optional] | | **note** | **String** | | [optional] | | **category_group_id** | **String** | | [optional] | -| **goal_target** | **Integer** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. | [optional] | +| **goal_target** | **Integer** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. | [optional] | | **goal_target_date** | **Date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] | +| **goal_needs_whole_amount** | **Boolean** | Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. | [optional] | diff --git a/docs/HybridTransaction.md b/docs/HybridTransaction.md index 4520652..35cbb0d 100644 --- a/docs/HybridTransaction.md +++ b/docs/HybridTransaction.md @@ -23,6 +23,8 @@ | **import_payee_name_original** | **String** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] | | **debt_transaction_type** | **String** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] | | **deleted** | **Boolean** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | | +| **amount_formatted** | **String** | The transaction amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The transaction amount as a decimal currency amount | [optional] | | **type** | **String** | Whether the hybrid transaction represents a regular transaction or a subtransaction | | | **parent_transaction_id** | **String** | For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null. | [optional] | | **account_name** | **String** | | | diff --git a/docs/MoneyMovement.md b/docs/MoneyMovement.md index d24303d..a9905a2 100644 --- a/docs/MoneyMovement.md +++ b/docs/MoneyMovement.md @@ -13,4 +13,6 @@ | **from_category_id** | **String** | The id of the category the money was moved from | [optional] | | **to_category_id** | **String** | The id of the category the money was moved to | [optional] | | **amount** | **Integer** | The amount of the money movement in milliunits format | | +| **amount_formatted** | **String** | The money movement amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The money movement amount as a decimal currency amount | [optional] | diff --git a/docs/MoneyMovementBase.md b/docs/MoneyMovementBase.md new file mode 100644 index 0000000..72a5523 --- /dev/null +++ b/docs/MoneyMovementBase.md @@ -0,0 +1,16 @@ +# YNAB::MoneyMovementBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **month** | **Date** | The month of the money movement in ISO format (e.g. 2024-01-01) | [optional] | +| **moved_at** | **Time** | The date/time the money movement was processed on the server in ISO format (e.g. 2024-01-01T12:00:00Z) | [optional] | +| **note** | **String** | | [optional] | +| **money_movement_group_id** | **String** | The id of the money movement group this movement belongs to | [optional] | +| **performed_by_user_id** | **String** | The id of the user who performed the money movement | [optional] | +| **from_category_id** | **String** | The id of the category the money was moved from | [optional] | +| **to_category_id** | **String** | The id of the category the money was moved to | [optional] | +| **amount** | **Integer** | The amount of the money movement in milliunits format | | + diff --git a/docs/MonthDetail.md b/docs/MonthDetail.md index 684ecf2..c1c615f 100644 --- a/docs/MonthDetail.md +++ b/docs/MonthDetail.md @@ -12,5 +12,13 @@ | **to_be_budgeted** | **Integer** | The available amount for 'Ready to Assign' | | | **age_of_money** | **Integer** | The Age of Money as of the month | [optional] | | **deleted** | **Boolean** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | | +| **income_formatted** | **String** | The total income formatted in the plan's currency format | [optional] | +| **income_currency** | **Float** | The total income as a decimal currency amount | [optional] | +| **budgeted_formatted** | **String** | The total amount assigned formatted in the plan's currency format | [optional] | +| **budgeted_currency** | **Float** | The total amount assigned as a decimal currency amount | [optional] | +| **activity_formatted** | **String** | The total activity amount formatted in the plan's currency format | [optional] | +| **activity_currency** | **Float** | The total activity amount as a decimal currency amount | [optional] | +| **to_be_budgeted_formatted** | **String** | The available amount for 'Ready to Assign' formatted in the plan's currency format | [optional] | +| **to_be_budgeted_currency** | **Float** | The available amount for 'Ready to Assign' as a decimal currency amount | [optional] | | **categories** | [**Array<Category>**](Category.md) | The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. | | diff --git a/docs/MonthDetailBase.md b/docs/MonthDetailBase.md new file mode 100644 index 0000000..4d7cab2 --- /dev/null +++ b/docs/MonthDetailBase.md @@ -0,0 +1,16 @@ +# YNAB::MonthDetailBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **month** | **Date** | | | +| **note** | **String** | | [optional] | +| **income** | **Integer** | The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month | | +| **budgeted** | **Integer** | The total amount assigned (budgeted) in the month | | +| **activity** | **Integer** | The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign' | | +| **to_be_budgeted** | **Integer** | The available amount for 'Ready to Assign' | | +| **age_of_money** | **Integer** | The Age of Money as of the month | [optional] | +| **deleted** | **Boolean** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | | +| **categories** | [**Array<CategoryBase>**](CategoryBase.md) | The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. | | + diff --git a/docs/MonthSummary.md b/docs/MonthSummary.md index 84997b4..df1721f 100644 --- a/docs/MonthSummary.md +++ b/docs/MonthSummary.md @@ -12,4 +12,12 @@ | **to_be_budgeted** | **Integer** | The available amount for 'Ready to Assign' | | | **age_of_money** | **Integer** | The Age of Money as of the month | [optional] | | **deleted** | **Boolean** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | | +| **income_formatted** | **String** | The total income formatted in the plan's currency format | [optional] | +| **income_currency** | **Float** | The total income as a decimal currency amount | [optional] | +| **budgeted_formatted** | **String** | The total amount assigned formatted in the plan's currency format | [optional] | +| **budgeted_currency** | **Float** | The total amount assigned as a decimal currency amount | [optional] | +| **activity_formatted** | **String** | The total activity amount formatted in the plan's currency format | [optional] | +| **activity_currency** | **Float** | The total activity amount as a decimal currency amount | [optional] | +| **to_be_budgeted_formatted** | **String** | The available amount for 'Ready to Assign' formatted in the plan's currency format | [optional] | +| **to_be_budgeted_currency** | **Float** | The available amount for 'Ready to Assign' as a decimal currency amount | [optional] | diff --git a/docs/MonthSummaryBase.md b/docs/MonthSummaryBase.md new file mode 100644 index 0000000..a2810c1 --- /dev/null +++ b/docs/MonthSummaryBase.md @@ -0,0 +1,15 @@ +# YNAB::MonthSummaryBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **month** | **Date** | | | +| **note** | **String** | | [optional] | +| **income** | **Integer** | The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month | | +| **budgeted** | **Integer** | The total amount assigned (budgeted) in the month | | +| **activity** | **Integer** | The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign' | | +| **to_be_budgeted** | **Integer** | The available amount for 'Ready to Assign' | | +| **age_of_money** | **Integer** | The Age of Money as of the month | [optional] | +| **deleted** | **Boolean** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | | + diff --git a/docs/NewCategory.md b/docs/NewCategory.md index 9b4b872..d6ebed6 100644 --- a/docs/NewCategory.md +++ b/docs/NewCategory.md @@ -7,6 +7,7 @@ | **name** | **String** | | [optional] | | **note** | **String** | | [optional] | | **category_group_id** | **String** | | [optional] | -| **goal_target** | **Integer** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. | [optional] | +| **goal_target** | **Integer** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. | [optional] | | **goal_target_date** | **Date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] | +| **goal_needs_whole_amount** | **Boolean** | Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. | [optional] | diff --git a/docs/PayeesApi.md b/docs/PayeesApi.md index 0853b07..bb6cca1 100644 --- a/docs/PayeesApi.md +++ b/docs/PayeesApi.md @@ -4,11 +4,32 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**create_payee**](PayeesApi.md#create_payee) | **POST** /plans/{plan_id}/payees | Create a payee | | [**get_payee_by_id**](PayeesApi.md#get_payee_by_id) | **GET** /plans/{plan_id}/payees/{payee_id} | Get a payee | | [**get_payees**](PayeesApi.md#get_payees) | **GET** /plans/{plan_id}/payees | Get all payees | | [**update_payee**](PayeesApi.md#update_payee) | **PATCH** /plans/{plan_id}/payees/{payee_id} | Update a payee | +## create_payee + +> create_payee(plan_id, data) + +Create a payee + +Creates a new payee + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **plan_id** | **String** | The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). | | +| **data** | [**PostPayeeWrapper**](PostPayeeWrapper.md) | The payee to create | | + +### Return type + +[**SavePayeeResponse**](SavePayeeResponse.md) + + ## get_payee_by_id > get_payee_by_id(plan_id, payee_id) diff --git a/docs/PlanDetail.md b/docs/PlanDetail.md index 3acea04..e337f54 100644 --- a/docs/PlanDetail.md +++ b/docs/PlanDetail.md @@ -11,14 +11,14 @@ | **last_month** | **Date** | The latest plan month | [optional] | | **date_format** | [**DateFormat**](DateFormat.md) | | [optional] | | **currency_format** | [**CurrencyFormat**](CurrencyFormat.md) | | [optional] | -| **accounts** | [**Array<Account>**](Account.md) | | [optional] | +| **accounts** | [**Array<AccountBase>**](AccountBase.md) | | [optional] | | **payees** | [**Array<Payee>**](Payee.md) | | [optional] | | **payee_locations** | [**Array<PayeeLocation>**](PayeeLocation.md) | | [optional] | | **category_groups** | [**Array<CategoryGroup>**](CategoryGroup.md) | | [optional] | -| **categories** | [**Array<Category>**](Category.md) | | [optional] | -| **months** | [**Array<MonthDetail>**](MonthDetail.md) | | [optional] | -| **transactions** | [**Array<TransactionSummary>**](TransactionSummary.md) | | [optional] | -| **subtransactions** | [**Array<SubTransaction>**](SubTransaction.md) | | [optional] | -| **scheduled_transactions** | [**Array<ScheduledTransactionSummary>**](ScheduledTransactionSummary.md) | | [optional] | -| **scheduled_subtransactions** | [**Array<ScheduledSubTransaction>**](ScheduledSubTransaction.md) | | [optional] | +| **categories** | [**Array<CategoryBase>**](CategoryBase.md) | | [optional] | +| **months** | [**Array<MonthDetailBase>**](MonthDetailBase.md) | | [optional] | +| **transactions** | [**Array<TransactionSummaryBase>**](TransactionSummaryBase.md) | | [optional] | +| **subtransactions** | [**Array<SubTransactionBase>**](SubTransactionBase.md) | | [optional] | +| **scheduled_transactions** | [**Array<ScheduledTransactionSummaryBase>**](ScheduledTransactionSummaryBase.md) | | [optional] | +| **scheduled_subtransactions** | [**Array<ScheduledSubTransactionBase>**](ScheduledSubTransactionBase.md) | | [optional] | diff --git a/docs/PostPayee.md b/docs/PostPayee.md new file mode 100644 index 0000000..e9c45fd --- /dev/null +++ b/docs/PostPayee.md @@ -0,0 +1,8 @@ +# YNAB::PostPayee + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | The name of the payee. | | + diff --git a/docs/PostPayeeWrapper.md b/docs/PostPayeeWrapper.md new file mode 100644 index 0000000..2cf2f12 --- /dev/null +++ b/docs/PostPayeeWrapper.md @@ -0,0 +1,8 @@ +# YNAB::PostPayeeWrapper + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **payee** | [**PostPayee**](PostPayee.md) | | | + diff --git a/docs/SaveAccount.md b/docs/SaveAccount.md index a29ee8c..3f3bcea 100644 --- a/docs/SaveAccount.md +++ b/docs/SaveAccount.md @@ -5,6 +5,6 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **name** | **String** | The name of the account | | -| **type** | [**AccountType**](AccountType.md) | | | +| **type** | [**SaveAccountType**](SaveAccountType.md) | | | | **balance** | **Integer** | The current balance of the account in milliunits format | | diff --git a/docs/SaveAccountType.md b/docs/SaveAccountType.md new file mode 100644 index 0000000..eab7a05 --- /dev/null +++ b/docs/SaveAccountType.md @@ -0,0 +1,7 @@ +# YNAB::SaveAccountType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + diff --git a/docs/SaveCategory.md b/docs/SaveCategory.md index 1fe3737..8557881 100644 --- a/docs/SaveCategory.md +++ b/docs/SaveCategory.md @@ -7,6 +7,7 @@ | **name** | **String** | | [optional] | | **note** | **String** | | [optional] | | **category_group_id** | **String** | | [optional] | -| **goal_target** | **Integer** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. | [optional] | +| **goal_target** | **Integer** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. | [optional] | | **goal_target_date** | **Date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] | +| **goal_needs_whole_amount** | **Boolean** | Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. | [optional] | diff --git a/docs/SavePayee.md b/docs/SavePayee.md index 754486e..df09993 100644 --- a/docs/SavePayee.md +++ b/docs/SavePayee.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **name** | **String** | The name of the payee. The name must be a maximum of 500 characters. | [optional] | +| **name** | **String** | The name of the payee. | [optional] | diff --git a/docs/ScheduledSubTransaction.md b/docs/ScheduledSubTransaction.md index 48d4238..74edffd 100644 --- a/docs/ScheduledSubTransaction.md +++ b/docs/ScheduledSubTransaction.md @@ -14,4 +14,6 @@ | **category_name** | **String** | | [optional] | | **transfer_account_id** | **String** | If a transfer, the account_id which the scheduled subtransaction transfers to | [optional] | | **deleted** | **Boolean** | Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. | | +| **amount_formatted** | **String** | The scheduled subtransaction amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The scheduled subtransaction amount as a decimal currency amount | [optional] | diff --git a/docs/ScheduledSubTransactionBase.md b/docs/ScheduledSubTransactionBase.md new file mode 100644 index 0000000..6ed10b2 --- /dev/null +++ b/docs/ScheduledSubTransactionBase.md @@ -0,0 +1,17 @@ +# YNAB::ScheduledSubTransactionBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **scheduled_transaction_id** | **String** | | | +| **amount** | **Integer** | The scheduled subtransaction amount in milliunits format | | +| **memo** | **String** | | [optional] | +| **payee_id** | **String** | | [optional] | +| **payee_name** | **String** | | [optional] | +| **category_id** | **String** | | [optional] | +| **category_name** | **String** | | [optional] | +| **transfer_account_id** | **String** | If a transfer, the account_id which the scheduled subtransaction transfers to | [optional] | +| **deleted** | **Boolean** | Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. | | + diff --git a/docs/ScheduledTransactionDetail.md b/docs/ScheduledTransactionDetail.md index 4b5c875..b2ed384 100644 --- a/docs/ScheduledTransactionDetail.md +++ b/docs/ScheduledTransactionDetail.md @@ -17,6 +17,8 @@ | **category_id** | **String** | | [optional] | | **transfer_account_id** | **String** | If a transfer, the account_id which the scheduled transaction transfers to | [optional] | | **deleted** | **Boolean** | Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. | | +| **amount_formatted** | **String** | The scheduled transaction amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The scheduled transaction amount as a decimal currency amount | [optional] | | **account_name** | **String** | | | | **payee_name** | **String** | | [optional] | | **category_name** | **String** | The name of the category. If a split scheduled transaction, this will be 'Split'. | [optional] | diff --git a/docs/ScheduledTransactionSummary.md b/docs/ScheduledTransactionSummary.md index 6bc195a..48cca82 100644 --- a/docs/ScheduledTransactionSummary.md +++ b/docs/ScheduledTransactionSummary.md @@ -17,4 +17,6 @@ | **category_id** | **String** | | [optional] | | **transfer_account_id** | **String** | If a transfer, the account_id which the scheduled transaction transfers to | [optional] | | **deleted** | **Boolean** | Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. | | +| **amount_formatted** | **String** | The scheduled transaction amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The scheduled transaction amount as a decimal currency amount | [optional] | diff --git a/docs/ScheduledTransactionSummaryBase.md b/docs/ScheduledTransactionSummaryBase.md new file mode 100644 index 0000000..6182f4b --- /dev/null +++ b/docs/ScheduledTransactionSummaryBase.md @@ -0,0 +1,20 @@ +# YNAB::ScheduledTransactionSummaryBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **date_first** | **Date** | The first date for which the Scheduled Transaction was scheduled. | | +| **date_next** | **Date** | The next date for which the Scheduled Transaction is scheduled. | | +| **frequency** | **String** | | | +| **amount** | **Integer** | The scheduled transaction amount in milliunits format | | +| **memo** | **String** | | [optional] | +| **flag_color** | [**TransactionFlagColor**](TransactionFlagColor.md) | | [optional] | +| **flag_name** | **String** | The customized name of a transaction flag | [optional] | +| **account_id** | **String** | | | +| **payee_id** | **String** | | [optional] | +| **category_id** | **String** | | [optional] | +| **transfer_account_id** | **String** | If a transfer, the account_id which the scheduled transaction transfers to | [optional] | +| **deleted** | **Boolean** | Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. | | + diff --git a/docs/SubTransaction.md b/docs/SubTransaction.md index 1326f66..e6f7b71 100644 --- a/docs/SubTransaction.md +++ b/docs/SubTransaction.md @@ -15,4 +15,6 @@ | **transfer_account_id** | **String** | If a transfer, the account_id which the subtransaction transfers to | [optional] | | **transfer_transaction_id** | **String** | If a transfer, the id of transaction on the other side of the transfer | [optional] | | **deleted** | **Boolean** | Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. | | +| **amount_formatted** | **String** | The subtransaction amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The subtransaction amount as a decimal currency amount | [optional] | diff --git a/docs/SubTransactionBase.md b/docs/SubTransactionBase.md new file mode 100644 index 0000000..8ca2be7 --- /dev/null +++ b/docs/SubTransactionBase.md @@ -0,0 +1,18 @@ +# YNAB::SubTransactionBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **transaction_id** | **String** | | | +| **amount** | **Integer** | The subtransaction amount in milliunits format | | +| **memo** | **String** | | [optional] | +| **payee_id** | **String** | | [optional] | +| **payee_name** | **String** | | [optional] | +| **category_id** | **String** | | [optional] | +| **category_name** | **String** | | [optional] | +| **transfer_account_id** | **String** | If a transfer, the account_id which the subtransaction transfers to | [optional] | +| **transfer_transaction_id** | **String** | If a transfer, the id of transaction on the other side of the transfer | [optional] | +| **deleted** | **Boolean** | Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. | | + diff --git a/docs/TransactionDetail.md b/docs/TransactionDetail.md index 35aff4f..a4e95f5 100644 --- a/docs/TransactionDetail.md +++ b/docs/TransactionDetail.md @@ -23,6 +23,8 @@ | **import_payee_name_original** | **String** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] | | **debt_transaction_type** | **String** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] | | **deleted** | **Boolean** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | | +| **amount_formatted** | **String** | The transaction amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The transaction amount as a decimal currency amount | [optional] | | **account_name** | **String** | | | | **payee_name** | **String** | | [optional] | | **category_name** | **String** | The name of the category. If a split transaction, this will be 'Split'. | [optional] | diff --git a/docs/TransactionSummary.md b/docs/TransactionSummary.md index 97bbde5..b412451 100644 --- a/docs/TransactionSummary.md +++ b/docs/TransactionSummary.md @@ -23,4 +23,6 @@ | **import_payee_name_original** | **String** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] | | **debt_transaction_type** | **String** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] | | **deleted** | **Boolean** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | | +| **amount_formatted** | **String** | The transaction amount formatted in the plan's currency format | [optional] | +| **amount_currency** | **Float** | The transaction amount as a decimal currency amount | [optional] | diff --git a/docs/TransactionSummaryBase.md b/docs/TransactionSummaryBase.md new file mode 100644 index 0000000..f030414 --- /dev/null +++ b/docs/TransactionSummaryBase.md @@ -0,0 +1,26 @@ +# YNAB::TransactionSummaryBase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **date** | **Date** | The transaction date in ISO format (e.g. 2016-12-01) | | +| **amount** | **Integer** | The transaction amount in milliunits format | | +| **memo** | **String** | | [optional] | +| **cleared** | [**TransactionClearedStatus**](TransactionClearedStatus.md) | | | +| **approved** | **Boolean** | Whether or not the transaction is approved | | +| **flag_color** | [**TransactionFlagColor**](TransactionFlagColor.md) | | [optional] | +| **flag_name** | **String** | The customized name of a transaction flag | [optional] | +| **account_id** | **String** | | | +| **payee_id** | **String** | | [optional] | +| **category_id** | **String** | | [optional] | +| **transfer_account_id** | **String** | If a transfer transaction, the account to which it transfers | [optional] | +| **transfer_transaction_id** | **String** | If a transfer transaction, the id of transaction on the other side of the transfer | [optional] | +| **matched_transaction_id** | **String** | If transaction is matched, the id of the matched transaction | [optional] | +| **import_id** | **String** | If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. | [optional] | +| **import_payee_name** | **String** | If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules | [optional] | +| **import_payee_name_original** | **String** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] | +| **debt_transaction_type** | **String** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] | +| **deleted** | **Boolean** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | | + diff --git a/lib/ynab.rb b/lib/ynab.rb index 974fd19..9971750 100644 --- a/lib/ynab.rb +++ b/lib/ynab.rb @@ -15,6 +15,7 @@ # Models require 'ynab/api_model_base' require 'ynab/models/account' +require 'ynab/models/account_base' require 'ynab/models/account_response' require 'ynab/models/account_response_data' require 'ynab/models/account_type' @@ -27,6 +28,7 @@ require 'ynab/models/categories_response' require 'ynab/models/categories_response_data' require 'ynab/models/category' +require 'ynab/models/category_base' require 'ynab/models/category_group' require 'ynab/models/category_group_with_categories' require 'ynab/models/category_response' @@ -41,17 +43,20 @@ require 'ynab/models/hybrid_transactions_response' require 'ynab/models/hybrid_transactions_response_data' require 'ynab/models/money_movement' +require 'ynab/models/money_movement_base' require 'ynab/models/money_movement_group' require 'ynab/models/money_movement_groups_response' require 'ynab/models/money_movement_groups_response_data' require 'ynab/models/money_movements_response' require 'ynab/models/money_movements_response_data' require 'ynab/models/month_detail' +require 'ynab/models/month_detail_base' require 'ynab/models/month_detail_response' require 'ynab/models/month_detail_response_data' require 'ynab/models/month_summaries_response' require 'ynab/models/month_summaries_response_data' require 'ynab/models/month_summary' +require 'ynab/models/month_summary_base' require 'ynab/models/new_category' require 'ynab/models/new_transaction' require 'ynab/models/patch_category_group_wrapper' @@ -81,11 +86,14 @@ require 'ynab/models/post_account_wrapper' require 'ynab/models/post_category_group_wrapper' require 'ynab/models/post_category_wrapper' +require 'ynab/models/post_payee' +require 'ynab/models/post_payee_wrapper' require 'ynab/models/post_scheduled_transaction_wrapper' require 'ynab/models/post_transactions_wrapper' require 'ynab/models/put_scheduled_transaction_wrapper' require 'ynab/models/put_transaction_wrapper' require 'ynab/models/save_account' +require 'ynab/models/save_account_type' require 'ynab/models/save_category' require 'ynab/models/save_category_group' require 'ynab/models/save_category_group_response' @@ -103,20 +111,24 @@ require 'ynab/models/save_transactions_response' require 'ynab/models/save_transactions_response_data' require 'ynab/models/scheduled_sub_transaction' +require 'ynab/models/scheduled_sub_transaction_base' require 'ynab/models/scheduled_transaction_detail' require 'ynab/models/scheduled_transaction_frequency' require 'ynab/models/scheduled_transaction_response' require 'ynab/models/scheduled_transaction_response_data' require 'ynab/models/scheduled_transaction_summary' +require 'ynab/models/scheduled_transaction_summary_base' require 'ynab/models/scheduled_transactions_response' require 'ynab/models/scheduled_transactions_response_data' require 'ynab/models/sub_transaction' +require 'ynab/models/sub_transaction_base' require 'ynab/models/transaction_cleared_status' require 'ynab/models/transaction_detail' require 'ynab/models/transaction_flag_color' require 'ynab/models/transaction_response' require 'ynab/models/transaction_response_data' require 'ynab/models/transaction_summary' +require 'ynab/models/transaction_summary_base' require 'ynab/models/transactions_import_response' require 'ynab/models/transactions_import_response_data' require 'ynab/models/transactions_response' diff --git a/lib/ynab/api/payees_api.rb b/lib/ynab/api/payees_api.rb index 62ad890..bb9cbb0 100644 --- a/lib/ynab/api/payees_api.rb +++ b/lib/ynab/api/payees_api.rb @@ -15,6 +15,80 @@ class PayeesApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Create a payee + # Creates a new payee + # @param plan_id [String] The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). + # @param data [PostPayeeWrapper] The payee to create + # @param [Hash] opts the optional parameters + # @return [SavePayeeResponse] + def create_payee(plan_id, data, opts = {}) + data, _status_code, _headers = create_payee_with_http_info(plan_id, data, opts) + data + end + + # Create a payee + # Creates a new payee + # @param plan_id [String] The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). + # @param data [PostPayeeWrapper] The payee to create + # @param [Hash] opts the optional parameters + # @return [Array<(SavePayeeResponse, Integer, Hash)>] SavePayeeResponse data, response status code and response headers + def create_payee_with_http_info(plan_id, data, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PayeesApi.create_payee ...' + end + # verify the required parameter 'plan_id' is set + if @api_client.config.client_side_validation && plan_id.nil? + fail ArgumentError, "Missing the required parameter 'plan_id' when calling PayeesApi.create_payee" + end + # verify the required parameter 'data' is set + if @api_client.config.client_side_validation && data.nil? + fail ArgumentError, "Missing the required parameter 'data' when calling PayeesApi.create_payee" + end + # resource path + local_var_path = '/plans/{plan_id}/payees'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(data) + + # return_type + return_type = opts[:debug_return_type] || 'SavePayeeResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"PayeesApi.create_payee", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeesApi#create_payee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a payee # Returns a single payee # @param plan_id [String] The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). diff --git a/lib/ynab/models/account.rb b/lib/ynab/models/account.rb index 03beded..44e82e7 100644 --- a/lib/ynab/models/account.rb +++ b/lib/ynab/models/account.rb @@ -59,6 +59,24 @@ class Account < ApiModelBase # Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. attr_accessor :deleted + # The current available balance of the account formatted in the plan's currency format + attr_accessor :balance_formatted + + # The current available balance of the account as a decimal currency amount + attr_accessor :balance_currency + + # The current cleared balance of the account formatted in the plan's currency format + attr_accessor :cleared_balance_formatted + + # The current cleared balance of the account as a decimal currency amount + attr_accessor :cleared_balance_currency + + # The current uncleared balance of the account formatted in the plan's currency format + attr_accessor :uncleared_balance_formatted + + # The current uncleared balance of the account as a decimal currency amount + attr_accessor :uncleared_balance_currency + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -101,7 +119,13 @@ def self.attribute_map :'debt_interest_rates' => :'debt_interest_rates', :'debt_minimum_payments' => :'debt_minimum_payments', :'debt_escrow_amounts' => :'debt_escrow_amounts', - :'deleted' => :'deleted' + :'deleted' => :'deleted', + :'balance_formatted' => :'balance_formatted', + :'balance_currency' => :'balance_currency', + :'cleared_balance_formatted' => :'cleared_balance_formatted', + :'cleared_balance_currency' => :'cleared_balance_currency', + :'uncleared_balance_formatted' => :'uncleared_balance_formatted', + :'uncleared_balance_currency' => :'uncleared_balance_currency' } end @@ -130,20 +154,29 @@ def self.openapi_types :'debt_interest_rates' => :'Hash', :'debt_minimum_payments' => :'Hash', :'debt_escrow_amounts' => :'Hash', - :'deleted' => :'Boolean' + :'deleted' => :'Boolean', + :'balance_formatted' => :'String', + :'balance_currency' => :'Float', + :'cleared_balance_formatted' => :'String', + :'cleared_balance_currency' => :'Float', + :'uncleared_balance_formatted' => :'String', + :'uncleared_balance_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'note', - :'transfer_payee_id', - :'last_reconciled_at', - :'debt_original_balance', ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'AccountBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -236,6 +269,30 @@ def initialize(attributes = {}) if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end + + if attributes.key?(:'balance_formatted') + self.balance_formatted = attributes[:'balance_formatted'] + end + + if attributes.key?(:'balance_currency') + self.balance_currency = attributes[:'balance_currency'] + end + + if attributes.key?(:'cleared_balance_formatted') + self.cleared_balance_formatted = attributes[:'cleared_balance_formatted'] + end + + if attributes.key?(:'cleared_balance_currency') + self.cleared_balance_currency = attributes[:'cleared_balance_currency'] + end + + if attributes.key?(:'uncleared_balance_formatted') + self.uncleared_balance_formatted = attributes[:'uncleared_balance_formatted'] + end + + if attributes.key?(:'uncleared_balance_currency') + self.uncleared_balance_currency = attributes[:'uncleared_balance_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -256,6 +313,7 @@ def valid? return false if @balance.nil? return false if @cleared_balance.nil? return false if @uncleared_balance.nil? + return false if @transfer_payee_id.nil? return false if @deleted.nil? true end @@ -282,7 +340,13 @@ def ==(o) debt_interest_rates == o.debt_interest_rates && debt_minimum_payments == o.debt_minimum_payments && debt_escrow_amounts == o.debt_escrow_amounts && - deleted == o.deleted + deleted == o.deleted && + balance_formatted == o.balance_formatted && + balance_currency == o.balance_currency && + cleared_balance_formatted == o.cleared_balance_formatted && + cleared_balance_currency == o.cleared_balance_currency && + uncleared_balance_formatted == o.uncleared_balance_formatted && + uncleared_balance_currency == o.uncleared_balance_currency end # @see the `==` method @@ -294,7 +358,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, name, type, on_budget, closed, note, balance, cleared_balance, uncleared_balance, transfer_payee_id, direct_import_linked, direct_import_in_error, last_reconciled_at, debt_original_balance, debt_interest_rates, debt_minimum_payments, debt_escrow_amounts, deleted].hash + [id, name, type, on_budget, closed, note, balance, cleared_balance, uncleared_balance, transfer_payee_id, direct_import_linked, direct_import_in_error, last_reconciled_at, debt_original_balance, debt_interest_rates, debt_minimum_payments, debt_escrow_amounts, deleted, balance_formatted, balance_currency, cleared_balance_formatted, cleared_balance_currency, uncleared_balance_formatted, uncleared_balance_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/account_base.rb b/lib/ynab/models/account_base.rb new file mode 100644 index 0000000..78488a2 --- /dev/null +++ b/lib/ynab/models/account_base.rb @@ -0,0 +1,340 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class AccountBase < ApiModelBase + attr_accessor :id + + attr_accessor :name + + attr_accessor :type + + # Whether this account is \"on budget\" or not + attr_accessor :on_budget + + # Whether this account is closed or not + attr_accessor :closed + + attr_accessor :note + + # The current available balance of the account in milliunits format + attr_accessor :balance + + # The current cleared balance of the account in milliunits format + attr_accessor :cleared_balance + + # The current uncleared balance of the account in milliunits format + attr_accessor :uncleared_balance + + # The payee id which should be used when transferring to this account + attr_accessor :transfer_payee_id + + # Whether or not the account is linked to a financial institution for automatic transaction import. + attr_accessor :direct_import_linked + + # If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true. + attr_accessor :direct_import_in_error + + # A date/time specifying when the account was last reconciled. + attr_accessor :last_reconciled_at + + # This field is deprecated and will always be null. + attr_accessor :debt_original_balance + + attr_accessor :debt_interest_rates + + attr_accessor :debt_minimum_payments + + attr_accessor :debt_escrow_amounts + + # Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. + attr_accessor :deleted + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'type' => :'type', + :'on_budget' => :'on_budget', + :'closed' => :'closed', + :'note' => :'note', + :'balance' => :'balance', + :'cleared_balance' => :'cleared_balance', + :'uncleared_balance' => :'uncleared_balance', + :'transfer_payee_id' => :'transfer_payee_id', + :'direct_import_linked' => :'direct_import_linked', + :'direct_import_in_error' => :'direct_import_in_error', + :'last_reconciled_at' => :'last_reconciled_at', + :'debt_original_balance' => :'debt_original_balance', + :'debt_interest_rates' => :'debt_interest_rates', + :'debt_minimum_payments' => :'debt_minimum_payments', + :'debt_escrow_amounts' => :'debt_escrow_amounts', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'type' => :'AccountType', + :'on_budget' => :'Boolean', + :'closed' => :'Boolean', + :'note' => :'String', + :'balance' => :'Integer', + :'cleared_balance' => :'Integer', + :'uncleared_balance' => :'Integer', + :'transfer_payee_id' => :'String', + :'direct_import_linked' => :'Boolean', + :'direct_import_in_error' => :'Boolean', + :'last_reconciled_at' => :'Time', + :'debt_original_balance' => :'Integer', + :'debt_interest_rates' => :'Hash', + :'debt_minimum_payments' => :'Hash', + :'debt_escrow_amounts' => :'Hash', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'note', + :'transfer_payee_id', + :'last_reconciled_at', + :'debt_original_balance', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::AccountBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::AccountBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'on_budget') + self.on_budget = attributes[:'on_budget'] + end + + if attributes.key?(:'closed') + self.closed = attributes[:'closed'] + end + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'cleared_balance') + self.cleared_balance = attributes[:'cleared_balance'] + end + + if attributes.key?(:'uncleared_balance') + self.uncleared_balance = attributes[:'uncleared_balance'] + end + + if attributes.key?(:'transfer_payee_id') + self.transfer_payee_id = attributes[:'transfer_payee_id'] + end + + if attributes.key?(:'direct_import_linked') + self.direct_import_linked = attributes[:'direct_import_linked'] + end + + if attributes.key?(:'direct_import_in_error') + self.direct_import_in_error = attributes[:'direct_import_in_error'] + end + + if attributes.key?(:'last_reconciled_at') + self.last_reconciled_at = attributes[:'last_reconciled_at'] + end + + if attributes.key?(:'debt_original_balance') + self.debt_original_balance = attributes[:'debt_original_balance'] + end + + if attributes.key?(:'debt_interest_rates') + if (value = attributes[:'debt_interest_rates']).is_a?(Hash) + self.debt_interest_rates = value + end + end + + if attributes.key?(:'debt_minimum_payments') + if (value = attributes[:'debt_minimum_payments']).is_a?(Hash) + self.debt_minimum_payments = value + end + end + + if attributes.key?(:'debt_escrow_amounts') + if (value = attributes[:'debt_escrow_amounts']).is_a?(Hash) + self.debt_escrow_amounts = value + end + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @type.nil? + return false if @on_budget.nil? + return false if @closed.nil? + return false if @balance.nil? + return false if @cleared_balance.nil? + return false if @uncleared_balance.nil? + return false if @deleted.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + type == o.type && + on_budget == o.on_budget && + closed == o.closed && + note == o.note && + balance == o.balance && + cleared_balance == o.cleared_balance && + uncleared_balance == o.uncleared_balance && + transfer_payee_id == o.transfer_payee_id && + direct_import_linked == o.direct_import_linked && + direct_import_in_error == o.direct_import_in_error && + last_reconciled_at == o.last_reconciled_at && + debt_original_balance == o.debt_original_balance && + debt_interest_rates == o.debt_interest_rates && + debt_minimum_payments == o.debt_minimum_payments && + debt_escrow_amounts == o.debt_escrow_amounts && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, type, on_budget, closed, note, balance, cleared_balance, uncleared_balance, transfer_payee_id, direct_import_linked, direct_import_in_error, last_reconciled_at, debt_original_balance, debt_interest_rates, debt_minimum_payments, debt_escrow_amounts, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/category.rb b/lib/ynab/models/category.rb index f9912a8..9c57afb 100644 --- a/lib/ynab/models/category.rb +++ b/lib/ynab/models/category.rb @@ -85,6 +85,48 @@ class Category < ApiModelBase # Whether or not the category has been deleted. Deleted categories will only be included in delta requests. attr_accessor :deleted + # Available balance of the category formatted in the plan's currency format + attr_accessor :balance_formatted + + # Available balance of the category as a decimal currency amount + attr_accessor :balance_currency + + # Activity of the category formatted in the plan's currency format + attr_accessor :activity_formatted + + # Activity of the category as a decimal currency amount + attr_accessor :activity_currency + + # Assigned (budgeted) amount of the category formatted in the plan's currency format + attr_accessor :budgeted_formatted + + # Assigned (budgeted) amount of the category as a decimal currency amount + attr_accessor :budgeted_currency + + # The goal target amount formatted in the plan's currency format + attr_accessor :goal_target_formatted + + # The goal target amount as a decimal currency amount + attr_accessor :goal_target_currency + + # The goal underfunded amount formatted in the plan's currency format + attr_accessor :goal_under_funded_formatted + + # The goal underfunded amount as a decimal currency amount + attr_accessor :goal_under_funded_currency + + # The total amount funded towards the goal formatted in the plan's currency format + attr_accessor :goal_overall_funded_formatted + + # The total amount funded towards the goal as a decimal currency amount + attr_accessor :goal_overall_funded_currency + + # The amount of funding still needed to complete the goal formatted in the plan's currency format + attr_accessor :goal_overall_left_formatted + + # The amount of funding still needed to complete the goal as a decimal currency amount + attr_accessor :goal_overall_left_currency + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -135,7 +177,21 @@ def self.attribute_map :'goal_overall_funded' => :'goal_overall_funded', :'goal_overall_left' => :'goal_overall_left', :'goal_snoozed_at' => :'goal_snoozed_at', - :'deleted' => :'deleted' + :'deleted' => :'deleted', + :'balance_formatted' => :'balance_formatted', + :'balance_currency' => :'balance_currency', + :'activity_formatted' => :'activity_formatted', + :'activity_currency' => :'activity_currency', + :'budgeted_formatted' => :'budgeted_formatted', + :'budgeted_currency' => :'budgeted_currency', + :'goal_target_formatted' => :'goal_target_formatted', + :'goal_target_currency' => :'goal_target_currency', + :'goal_under_funded_formatted' => :'goal_under_funded_formatted', + :'goal_under_funded_currency' => :'goal_under_funded_currency', + :'goal_overall_funded_formatted' => :'goal_overall_funded_formatted', + :'goal_overall_funded_currency' => :'goal_overall_funded_currency', + :'goal_overall_left_formatted' => :'goal_overall_left_formatted', + :'goal_overall_left_currency' => :'goal_overall_left_currency' } end @@ -172,33 +228,46 @@ def self.openapi_types :'goal_overall_funded' => :'Integer', :'goal_overall_left' => :'Integer', :'goal_snoozed_at' => :'Time', - :'deleted' => :'Boolean' + :'deleted' => :'Boolean', + :'balance_formatted' => :'String', + :'balance_currency' => :'Float', + :'activity_formatted' => :'String', + :'activity_currency' => :'Float', + :'budgeted_formatted' => :'String', + :'budgeted_currency' => :'Float', + :'goal_target_formatted' => :'String', + :'goal_target_currency' => :'Float', + :'goal_under_funded_formatted' => :'String', + :'goal_under_funded_currency' => :'Float', + :'goal_overall_funded_formatted' => :'String', + :'goal_overall_funded_currency' => :'Float', + :'goal_overall_left_formatted' => :'String', + :'goal_overall_left_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'original_category_group_id', - :'note', :'goal_type', - :'goal_needs_whole_amount', - :'goal_day', - :'goal_cadence', - :'goal_cadence_frequency', - :'goal_creation_month', - :'goal_target', - :'goal_target_month', - :'goal_target_date', - :'goal_percentage_complete', - :'goal_months_to_budget', - :'goal_under_funded', - :'goal_overall_funded', - :'goal_overall_left', - :'goal_snoozed_at', + :'goal_target_formatted', + :'goal_target_currency', + :'goal_under_funded_formatted', + :'goal_under_funded_currency', + :'goal_overall_funded_formatted', + :'goal_overall_funded_currency', + :'goal_overall_left_formatted', + :'goal_overall_left_currency' ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CategoryBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -317,6 +386,62 @@ def initialize(attributes = {}) if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end + + if attributes.key?(:'balance_formatted') + self.balance_formatted = attributes[:'balance_formatted'] + end + + if attributes.key?(:'balance_currency') + self.balance_currency = attributes[:'balance_currency'] + end + + if attributes.key?(:'activity_formatted') + self.activity_formatted = attributes[:'activity_formatted'] + end + + if attributes.key?(:'activity_currency') + self.activity_currency = attributes[:'activity_currency'] + end + + if attributes.key?(:'budgeted_formatted') + self.budgeted_formatted = attributes[:'budgeted_formatted'] + end + + if attributes.key?(:'budgeted_currency') + self.budgeted_currency = attributes[:'budgeted_currency'] + end + + if attributes.key?(:'goal_target_formatted') + self.goal_target_formatted = attributes[:'goal_target_formatted'] + end + + if attributes.key?(:'goal_target_currency') + self.goal_target_currency = attributes[:'goal_target_currency'] + end + + if attributes.key?(:'goal_under_funded_formatted') + self.goal_under_funded_formatted = attributes[:'goal_under_funded_formatted'] + end + + if attributes.key?(:'goal_under_funded_currency') + self.goal_under_funded_currency = attributes[:'goal_under_funded_currency'] + end + + if attributes.key?(:'goal_overall_funded_formatted') + self.goal_overall_funded_formatted = attributes[:'goal_overall_funded_formatted'] + end + + if attributes.key?(:'goal_overall_funded_currency') + self.goal_overall_funded_currency = attributes[:'goal_overall_funded_currency'] + end + + if attributes.key?(:'goal_overall_left_formatted') + self.goal_overall_left_formatted = attributes[:'goal_overall_left_formatted'] + end + + if attributes.key?(:'goal_overall_left_currency') + self.goal_overall_left_currency = attributes[:'goal_overall_left_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -378,7 +503,21 @@ def ==(o) goal_overall_funded == o.goal_overall_funded && goal_overall_left == o.goal_overall_left && goal_snoozed_at == o.goal_snoozed_at && - deleted == o.deleted + deleted == o.deleted && + balance_formatted == o.balance_formatted && + balance_currency == o.balance_currency && + activity_formatted == o.activity_formatted && + activity_currency == o.activity_currency && + budgeted_formatted == o.budgeted_formatted && + budgeted_currency == o.budgeted_currency && + goal_target_formatted == o.goal_target_formatted && + goal_target_currency == o.goal_target_currency && + goal_under_funded_formatted == o.goal_under_funded_formatted && + goal_under_funded_currency == o.goal_under_funded_currency && + goal_overall_funded_formatted == o.goal_overall_funded_formatted && + goal_overall_funded_currency == o.goal_overall_funded_currency && + goal_overall_left_formatted == o.goal_overall_left_formatted && + goal_overall_left_currency == o.goal_overall_left_currency end # @see the `==` method @@ -390,7 +529,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_needs_whole_amount, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_target_date, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, goal_snoozed_at, deleted].hash + [id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_needs_whole_amount, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_target_date, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, goal_snoozed_at, deleted, balance_formatted, balance_currency, activity_formatted, activity_currency, budgeted_formatted, budgeted_currency, goal_target_formatted, goal_target_currency, goal_under_funded_formatted, goal_under_funded_currency, goal_overall_funded_formatted, goal_overall_funded_currency, goal_overall_left_formatted, goal_overall_left_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/category_base.rb b/lib/ynab/models/category_base.rb new file mode 100644 index 0000000..7062797 --- /dev/null +++ b/lib/ynab/models/category_base.rb @@ -0,0 +1,436 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class CategoryBase < ApiModelBase + attr_accessor :id + + attr_accessor :category_group_id + + attr_accessor :category_group_name + + attr_accessor :name + + # Whether or not the category is hidden + attr_accessor :hidden + + # DEPRECATED: No longer used. Value will always be null. + attr_accessor :original_category_group_id + + attr_accessor :note + + # Assigned (budgeted) amount in milliunits format + attr_accessor :budgeted + + # Activity amount in milliunits format + attr_accessor :activity + + # Available balance in milliunits format + attr_accessor :balance + + # The type of goal, if the category has a goal (TB='Target Category Balance', TBD='Target Category Balance by Date', MF='Monthly Funding', NEED='Plan Your Spending') + attr_accessor :goal_type + + # Indicates the monthly rollover behavior for \"NEED\"-type goals. When \"true\", the goal will always ask for the target amount in the new month (\"Set Aside\"). When \"false\", previous month category funding is used (\"Refill\"). For other goal types, this field will be null. + attr_accessor :goal_needs_whole_amount + + # A day offset modifier for the goal's due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month). + attr_accessor :goal_day + + # The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal's due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal's due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years. + attr_accessor :goal_cadence + + # The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal's due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored. + attr_accessor :goal_cadence_frequency + + # The month a goal was created + attr_accessor :goal_creation_month + + # The goal target amount in milliunits + attr_accessor :goal_target + + # DEPRECATED: No longer used. Use `goal_target_date` instead. + attr_accessor :goal_target_month + + # The target date for the goal to be completed. Only some goal types specify this date. + attr_accessor :goal_target_date + + # The percentage completion of the goal + attr_accessor :goal_percentage_complete + + # The number of months, including the current month, left in the current goal period. + attr_accessor :goal_months_to_budget + + # The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month. + attr_accessor :goal_under_funded + + # The total amount funded towards the goal within the current goal period. + attr_accessor :goal_overall_funded + + # The amount of funding still needed to complete the goal within the current goal period. + attr_accessor :goal_overall_left + + # The date/time the goal was snoozed. If the goal is not snoozed, this will be null. + attr_accessor :goal_snoozed_at + + # Whether or not the category has been deleted. Deleted categories will only be included in delta requests. + attr_accessor :deleted + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'category_group_id' => :'category_group_id', + :'category_group_name' => :'category_group_name', + :'name' => :'name', + :'hidden' => :'hidden', + :'original_category_group_id' => :'original_category_group_id', + :'note' => :'note', + :'budgeted' => :'budgeted', + :'activity' => :'activity', + :'balance' => :'balance', + :'goal_type' => :'goal_type', + :'goal_needs_whole_amount' => :'goal_needs_whole_amount', + :'goal_day' => :'goal_day', + :'goal_cadence' => :'goal_cadence', + :'goal_cadence_frequency' => :'goal_cadence_frequency', + :'goal_creation_month' => :'goal_creation_month', + :'goal_target' => :'goal_target', + :'goal_target_month' => :'goal_target_month', + :'goal_target_date' => :'goal_target_date', + :'goal_percentage_complete' => :'goal_percentage_complete', + :'goal_months_to_budget' => :'goal_months_to_budget', + :'goal_under_funded' => :'goal_under_funded', + :'goal_overall_funded' => :'goal_overall_funded', + :'goal_overall_left' => :'goal_overall_left', + :'goal_snoozed_at' => :'goal_snoozed_at', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'category_group_id' => :'String', + :'category_group_name' => :'String', + :'name' => :'String', + :'hidden' => :'Boolean', + :'original_category_group_id' => :'String', + :'note' => :'String', + :'budgeted' => :'Integer', + :'activity' => :'Integer', + :'balance' => :'Integer', + :'goal_type' => :'String', + :'goal_needs_whole_amount' => :'Boolean', + :'goal_day' => :'Integer', + :'goal_cadence' => :'Integer', + :'goal_cadence_frequency' => :'Integer', + :'goal_creation_month' => :'Date', + :'goal_target' => :'Integer', + :'goal_target_month' => :'Date', + :'goal_target_date' => :'Date', + :'goal_percentage_complete' => :'Integer', + :'goal_months_to_budget' => :'Integer', + :'goal_under_funded' => :'Integer', + :'goal_overall_funded' => :'Integer', + :'goal_overall_left' => :'Integer', + :'goal_snoozed_at' => :'Time', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'original_category_group_id', + :'note', + :'goal_type', + :'goal_needs_whole_amount', + :'goal_day', + :'goal_cadence', + :'goal_cadence_frequency', + :'goal_creation_month', + :'goal_target', + :'goal_target_month', + :'goal_target_date', + :'goal_percentage_complete', + :'goal_months_to_budget', + :'goal_under_funded', + :'goal_overall_funded', + :'goal_overall_left', + :'goal_snoozed_at', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::CategoryBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::CategoryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'category_group_id') + self.category_group_id = attributes[:'category_group_id'] + end + + if attributes.key?(:'category_group_name') + self.category_group_name = attributes[:'category_group_name'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + if attributes.key?(:'original_category_group_id') + self.original_category_group_id = attributes[:'original_category_group_id'] + end + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'budgeted') + self.budgeted = attributes[:'budgeted'] + end + + if attributes.key?(:'activity') + self.activity = attributes[:'activity'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'goal_type') + self.goal_type = attributes[:'goal_type'] + end + + if attributes.key?(:'goal_needs_whole_amount') + self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount'] + end + + if attributes.key?(:'goal_day') + self.goal_day = attributes[:'goal_day'] + end + + if attributes.key?(:'goal_cadence') + self.goal_cadence = attributes[:'goal_cadence'] + end + + if attributes.key?(:'goal_cadence_frequency') + self.goal_cadence_frequency = attributes[:'goal_cadence_frequency'] + end + + if attributes.key?(:'goal_creation_month') + self.goal_creation_month = attributes[:'goal_creation_month'] + end + + if attributes.key?(:'goal_target') + self.goal_target = attributes[:'goal_target'] + end + + if attributes.key?(:'goal_target_month') + self.goal_target_month = attributes[:'goal_target_month'] + end + + if attributes.key?(:'goal_target_date') + self.goal_target_date = attributes[:'goal_target_date'] + end + + if attributes.key?(:'goal_percentage_complete') + self.goal_percentage_complete = attributes[:'goal_percentage_complete'] + end + + if attributes.key?(:'goal_months_to_budget') + self.goal_months_to_budget = attributes[:'goal_months_to_budget'] + end + + if attributes.key?(:'goal_under_funded') + self.goal_under_funded = attributes[:'goal_under_funded'] + end + + if attributes.key?(:'goal_overall_funded') + self.goal_overall_funded = attributes[:'goal_overall_funded'] + end + + if attributes.key?(:'goal_overall_left') + self.goal_overall_left = attributes[:'goal_overall_left'] + end + + if attributes.key?(:'goal_snoozed_at') + self.goal_snoozed_at = attributes[:'goal_snoozed_at'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @category_group_id.nil? + return false if @name.nil? + return false if @hidden.nil? + return false if @budgeted.nil? + return false if @activity.nil? + return false if @balance.nil? + goal_type_validator = EnumAttributeValidator.new('String', ["TB", "TBD", "MF", "NEED", "DEBT"]) + return false unless goal_type_validator.valid?(@goal_type) + return false if @deleted.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] goal_type Object to be assigned + def goal_type=(goal_type) + @goal_type = goal_type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + category_group_id == o.category_group_id && + category_group_name == o.category_group_name && + name == o.name && + hidden == o.hidden && + original_category_group_id == o.original_category_group_id && + note == o.note && + budgeted == o.budgeted && + activity == o.activity && + balance == o.balance && + goal_type == o.goal_type && + goal_needs_whole_amount == o.goal_needs_whole_amount && + goal_day == o.goal_day && + goal_cadence == o.goal_cadence && + goal_cadence_frequency == o.goal_cadence_frequency && + goal_creation_month == o.goal_creation_month && + goal_target == o.goal_target && + goal_target_month == o.goal_target_month && + goal_target_date == o.goal_target_date && + goal_percentage_complete == o.goal_percentage_complete && + goal_months_to_budget == o.goal_months_to_budget && + goal_under_funded == o.goal_under_funded && + goal_overall_funded == o.goal_overall_funded && + goal_overall_left == o.goal_overall_left && + goal_snoozed_at == o.goal_snoozed_at && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, category_group_id, category_group_name, name, hidden, original_category_group_id, note, budgeted, activity, balance, goal_type, goal_needs_whole_amount, goal_day, goal_cadence, goal_cadence_frequency, goal_creation_month, goal_target, goal_target_month, goal_target_date, goal_percentage_complete, goal_months_to_budget, goal_under_funded, goal_overall_funded, goal_overall_left, goal_snoozed_at, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/existing_category.rb b/lib/ynab/models/existing_category.rb index e91cd73..1ded91a 100644 --- a/lib/ynab/models/existing_category.rb +++ b/lib/ynab/models/existing_category.rb @@ -18,12 +18,15 @@ class ExistingCategory < ApiModelBase attr_accessor :category_group_id - # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. + # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. attr_accessor :goal_target # The goal target date in ISO format (e.g. 2016-12-01). attr_accessor :goal_target_date + # Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. + attr_accessor :goal_needs_whole_amount + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -31,7 +34,8 @@ def self.attribute_map :'note' => :'note', :'category_group_id' => :'category_group_id', :'goal_target' => :'goal_target', - :'goal_target_date' => :'goal_target_date' + :'goal_target_date' => :'goal_target_date', + :'goal_needs_whole_amount' => :'goal_needs_whole_amount' } end @@ -47,7 +51,8 @@ def self.openapi_types :'note' => :'String', :'category_group_id' => :'String', :'goal_target' => :'Integer', - :'goal_target_date' => :'Date' + :'goal_target_date' => :'Date', + :'goal_needs_whole_amount' => :'Boolean' } end @@ -98,6 +103,10 @@ def initialize(attributes = {}) if attributes.key?(:'goal_target_date') self.goal_target_date = attributes[:'goal_target_date'] end + + if attributes.key?(:'goal_needs_whole_amount') + self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -122,7 +131,8 @@ def ==(o) note == o.note && category_group_id == o.category_group_id && goal_target == o.goal_target && - goal_target_date == o.goal_target_date + goal_target_date == o.goal_target_date && + goal_needs_whole_amount == o.goal_needs_whole_amount end # @see the `==` method @@ -134,7 +144,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, note, category_group_id, goal_target, goal_target_date].hash + [name, note, category_group_id, goal_target, goal_target_date, goal_needs_whole_amount].hash end # Builds the object from hash diff --git a/lib/ynab/models/hybrid_transaction.rb b/lib/ynab/models/hybrid_transaction.rb index 53b3a7c..cf3474c 100644 --- a/lib/ynab/models/hybrid_transaction.rb +++ b/lib/ynab/models/hybrid_transaction.rb @@ -62,6 +62,12 @@ class HybridTransaction < ApiModelBase # Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. attr_accessor :deleted + # The transaction amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The transaction amount as a decimal currency amount + attr_accessor :amount_currency + # Whether the hybrid transaction represents a regular transaction or a subtransaction attr_accessor :type @@ -119,6 +125,8 @@ def self.attribute_map :'import_payee_name_original' => :'import_payee_name_original', :'debt_transaction_type' => :'debt_transaction_type', :'deleted' => :'deleted', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency', :'type' => :'type', :'parent_transaction_id' => :'parent_transaction_id', :'account_name' => :'account_name', @@ -154,6 +162,8 @@ def self.openapi_types :'import_payee_name_original' => :'String', :'debt_transaction_type' => :'String', :'deleted' => :'Boolean', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float', :'type' => :'String', :'parent_transaction_id' => :'String', :'account_name' => :'String', @@ -270,6 +280,14 @@ def initialize(attributes = {}) self.deleted = attributes[:'deleted'] end + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -353,6 +371,8 @@ def ==(o) import_payee_name_original == o.import_payee_name_original && debt_transaction_type == o.debt_transaction_type && deleted == o.deleted && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency && type == o.type && parent_transaction_id == o.parent_transaction_id && account_name == o.account_name && @@ -369,7 +389,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, type, parent_transaction_id, account_name, payee_name, category_name].hash + [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, amount_formatted, amount_currency, type, parent_transaction_id, account_name, payee_name, category_name].hash end # Builds the object from hash diff --git a/lib/ynab/models/money_movement.rb b/lib/ynab/models/money_movement.rb index 629bd00..87313cb 100644 --- a/lib/ynab/models/money_movement.rb +++ b/lib/ynab/models/money_movement.rb @@ -37,6 +37,12 @@ class MoneyMovement < ApiModelBase # The amount of the money movement in milliunits format attr_accessor :amount + # The money movement amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The money movement amount as a decimal currency amount + attr_accessor :amount_currency + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -48,7 +54,9 @@ def self.attribute_map :'performed_by_user_id' => :'performed_by_user_id', :'from_category_id' => :'from_category_id', :'to_category_id' => :'to_category_id', - :'amount' => :'amount' + :'amount' => :'amount', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency' } end @@ -68,23 +76,25 @@ def self.openapi_types :'performed_by_user_id' => :'String', :'from_category_id' => :'String', :'to_category_id' => :'String', - :'amount' => :'Integer' + :'amount' => :'Integer', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'month', - :'moved_at', - :'note', - :'money_movement_group_id', - :'performed_by_user_id', - :'from_category_id', - :'to_category_id', ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MoneyMovementBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -135,6 +145,14 @@ def initialize(attributes = {}) if attributes.key?(:'amount') self.amount = attributes[:'amount'] end + + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -165,7 +183,9 @@ def ==(o) performed_by_user_id == o.performed_by_user_id && from_category_id == o.from_category_id && to_category_id == o.to_category_id && - amount == o.amount + amount == o.amount && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency end # @see the `==` method @@ -177,7 +197,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, month, moved_at, note, money_movement_group_id, performed_by_user_id, from_category_id, to_category_id, amount].hash + [id, month, moved_at, note, money_movement_group_id, performed_by_user_id, from_category_id, to_category_id, amount, amount_formatted, amount_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/money_movement_base.rb b/lib/ynab/models/money_movement_base.rb new file mode 100644 index 0000000..1459820 --- /dev/null +++ b/lib/ynab/models/money_movement_base.rb @@ -0,0 +1,223 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class MoneyMovementBase < ApiModelBase + attr_accessor :id + + # The month of the money movement in ISO format (e.g. 2024-01-01) + attr_accessor :month + + # The date/time the money movement was processed on the server in ISO format (e.g. 2024-01-01T12:00:00Z) + attr_accessor :moved_at + + attr_accessor :note + + # The id of the money movement group this movement belongs to + attr_accessor :money_movement_group_id + + # The id of the user who performed the money movement + attr_accessor :performed_by_user_id + + # The id of the category the money was moved from + attr_accessor :from_category_id + + # The id of the category the money was moved to + attr_accessor :to_category_id + + # The amount of the money movement in milliunits format + attr_accessor :amount + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'month' => :'month', + :'moved_at' => :'moved_at', + :'note' => :'note', + :'money_movement_group_id' => :'money_movement_group_id', + :'performed_by_user_id' => :'performed_by_user_id', + :'from_category_id' => :'from_category_id', + :'to_category_id' => :'to_category_id', + :'amount' => :'amount' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'month' => :'Date', + :'moved_at' => :'Time', + :'note' => :'String', + :'money_movement_group_id' => :'String', + :'performed_by_user_id' => :'String', + :'from_category_id' => :'String', + :'to_category_id' => :'String', + :'amount' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'month', + :'moved_at', + :'note', + :'money_movement_group_id', + :'performed_by_user_id', + :'from_category_id', + :'to_category_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovementBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MoneyMovementBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.key?(:'moved_at') + self.moved_at = attributes[:'moved_at'] + end + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'money_movement_group_id') + self.money_movement_group_id = attributes[:'money_movement_group_id'] + end + + if attributes.key?(:'performed_by_user_id') + self.performed_by_user_id = attributes[:'performed_by_user_id'] + end + + if attributes.key?(:'from_category_id') + self.from_category_id = attributes[:'from_category_id'] + end + + if attributes.key?(:'to_category_id') + self.to_category_id = attributes[:'to_category_id'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @amount.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + month == o.month && + moved_at == o.moved_at && + note == o.note && + money_movement_group_id == o.money_movement_group_id && + performed_by_user_id == o.performed_by_user_id && + from_category_id == o.from_category_id && + to_category_id == o.to_category_id && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, month, moved_at, note, money_movement_group_id, performed_by_user_id, from_category_id, to_category_id, amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/month_detail.rb b/lib/ynab/models/month_detail.rb index fb8832d..13b04d8 100644 --- a/lib/ynab/models/month_detail.rb +++ b/lib/ynab/models/month_detail.rb @@ -34,6 +34,30 @@ class MonthDetail < ApiModelBase # Whether or not the month has been deleted. Deleted months will only be included in delta requests. attr_accessor :deleted + # The total income formatted in the plan's currency format + attr_accessor :income_formatted + + # The total income as a decimal currency amount + attr_accessor :income_currency + + # The total amount assigned formatted in the plan's currency format + attr_accessor :budgeted_formatted + + # The total amount assigned as a decimal currency amount + attr_accessor :budgeted_currency + + # The total activity amount formatted in the plan's currency format + attr_accessor :activity_formatted + + # The total activity amount as a decimal currency amount + attr_accessor :activity_currency + + # The available amount for 'Ready to Assign' formatted in the plan's currency format + attr_accessor :to_be_budgeted_formatted + + # The available amount for 'Ready to Assign' as a decimal currency amount + attr_accessor :to_be_budgeted_currency + # The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. attr_accessor :categories @@ -48,6 +72,14 @@ def self.attribute_map :'to_be_budgeted' => :'to_be_budgeted', :'age_of_money' => :'age_of_money', :'deleted' => :'deleted', + :'income_formatted' => :'income_formatted', + :'income_currency' => :'income_currency', + :'budgeted_formatted' => :'budgeted_formatted', + :'budgeted_currency' => :'budgeted_currency', + :'activity_formatted' => :'activity_formatted', + :'activity_currency' => :'activity_currency', + :'to_be_budgeted_formatted' => :'to_be_budgeted_formatted', + :'to_be_budgeted_currency' => :'to_be_budgeted_currency', :'categories' => :'categories' } end @@ -68,6 +100,14 @@ def self.openapi_types :'to_be_budgeted' => :'Integer', :'age_of_money' => :'Integer', :'deleted' => :'Boolean', + :'income_formatted' => :'String', + :'income_currency' => :'Float', + :'budgeted_formatted' => :'String', + :'budgeted_currency' => :'Float', + :'activity_formatted' => :'String', + :'activity_currency' => :'Float', + :'to_be_budgeted_formatted' => :'String', + :'to_be_budgeted_currency' => :'Float', :'categories' => :'Array' } end @@ -132,6 +172,38 @@ def initialize(attributes = {}) self.deleted = attributes[:'deleted'] end + if attributes.key?(:'income_formatted') + self.income_formatted = attributes[:'income_formatted'] + end + + if attributes.key?(:'income_currency') + self.income_currency = attributes[:'income_currency'] + end + + if attributes.key?(:'budgeted_formatted') + self.budgeted_formatted = attributes[:'budgeted_formatted'] + end + + if attributes.key?(:'budgeted_currency') + self.budgeted_currency = attributes[:'budgeted_currency'] + end + + if attributes.key?(:'activity_formatted') + self.activity_formatted = attributes[:'activity_formatted'] + end + + if attributes.key?(:'activity_currency') + self.activity_currency = attributes[:'activity_currency'] + end + + if attributes.key?(:'to_be_budgeted_formatted') + self.to_be_budgeted_formatted = attributes[:'to_be_budgeted_formatted'] + end + + if attributes.key?(:'to_be_budgeted_currency') + self.to_be_budgeted_currency = attributes[:'to_be_budgeted_currency'] + end + if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value @@ -172,6 +244,14 @@ def ==(o) to_be_budgeted == o.to_be_budgeted && age_of_money == o.age_of_money && deleted == o.deleted && + income_formatted == o.income_formatted && + income_currency == o.income_currency && + budgeted_formatted == o.budgeted_formatted && + budgeted_currency == o.budgeted_currency && + activity_formatted == o.activity_formatted && + activity_currency == o.activity_currency && + to_be_budgeted_formatted == o.to_be_budgeted_formatted && + to_be_budgeted_currency == o.to_be_budgeted_currency && categories == o.categories end @@ -184,7 +264,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted, categories].hash + [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted, income_formatted, income_currency, budgeted_formatted, budgeted_currency, activity_formatted, activity_currency, to_be_budgeted_formatted, to_be_budgeted_currency, categories].hash end # Builds the object from hash diff --git a/lib/ynab/models/month_detail_base.rb b/lib/ynab/models/month_detail_base.rb new file mode 100644 index 0000000..2ab53b3 --- /dev/null +++ b/lib/ynab/models/month_detail_base.rb @@ -0,0 +1,230 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class MonthDetailBase < ApiModelBase + attr_accessor :month + + attr_accessor :note + + # The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month + attr_accessor :income + + # The total amount assigned (budgeted) in the month + attr_accessor :budgeted + + # The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign' + attr_accessor :activity + + # The available amount for 'Ready to Assign' + attr_accessor :to_be_budgeted + + # The Age of Money as of the month + attr_accessor :age_of_money + + # Whether or not the month has been deleted. Deleted months will only be included in delta requests. + attr_accessor :deleted + + # The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. + attr_accessor :categories + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month', + :'note' => :'note', + :'income' => :'income', + :'budgeted' => :'budgeted', + :'activity' => :'activity', + :'to_be_budgeted' => :'to_be_budgeted', + :'age_of_money' => :'age_of_money', + :'deleted' => :'deleted', + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'month' => :'Date', + :'note' => :'String', + :'income' => :'Integer', + :'budgeted' => :'Integer', + :'activity' => :'Integer', + :'to_be_budgeted' => :'Integer', + :'age_of_money' => :'Integer', + :'deleted' => :'Boolean', + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MonthSummaryBase' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MonthDetailBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MonthDetailBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'income') + self.income = attributes[:'income'] + end + + if attributes.key?(:'budgeted') + self.budgeted = attributes[:'budgeted'] + end + + if attributes.key?(:'activity') + self.activity = attributes[:'activity'] + end + + if attributes.key?(:'to_be_budgeted') + self.to_be_budgeted = attributes[:'to_be_budgeted'] + end + + if attributes.key?(:'age_of_money') + self.age_of_money = attributes[:'age_of_money'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return false if @income.nil? + return false if @budgeted.nil? + return false if @activity.nil? + return false if @to_be_budgeted.nil? + return false if @deleted.nil? + return false if @categories.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month && + note == o.note && + income == o.income && + budgeted == o.budgeted && + activity == o.activity && + to_be_budgeted == o.to_be_budgeted && + age_of_money == o.age_of_money && + deleted == o.deleted && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted, categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/month_summary.rb b/lib/ynab/models/month_summary.rb index 579e878..f202857 100644 --- a/lib/ynab/models/month_summary.rb +++ b/lib/ynab/models/month_summary.rb @@ -34,6 +34,30 @@ class MonthSummary < ApiModelBase # Whether or not the month has been deleted. Deleted months will only be included in delta requests. attr_accessor :deleted + # The total income formatted in the plan's currency format + attr_accessor :income_formatted + + # The total income as a decimal currency amount + attr_accessor :income_currency + + # The total amount assigned formatted in the plan's currency format + attr_accessor :budgeted_formatted + + # The total amount assigned as a decimal currency amount + attr_accessor :budgeted_currency + + # The total activity amount formatted in the plan's currency format + attr_accessor :activity_formatted + + # The total activity amount as a decimal currency amount + attr_accessor :activity_currency + + # The available amount for 'Ready to Assign' formatted in the plan's currency format + attr_accessor :to_be_budgeted_formatted + + # The available amount for 'Ready to Assign' as a decimal currency amount + attr_accessor :to_be_budgeted_currency + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -44,7 +68,15 @@ def self.attribute_map :'activity' => :'activity', :'to_be_budgeted' => :'to_be_budgeted', :'age_of_money' => :'age_of_money', - :'deleted' => :'deleted' + :'deleted' => :'deleted', + :'income_formatted' => :'income_formatted', + :'income_currency' => :'income_currency', + :'budgeted_formatted' => :'budgeted_formatted', + :'budgeted_currency' => :'budgeted_currency', + :'activity_formatted' => :'activity_formatted', + :'activity_currency' => :'activity_currency', + :'to_be_budgeted_formatted' => :'to_be_budgeted_formatted', + :'to_be_budgeted_currency' => :'to_be_budgeted_currency' } end @@ -63,18 +95,31 @@ def self.openapi_types :'activity' => :'Integer', :'to_be_budgeted' => :'Integer', :'age_of_money' => :'Integer', - :'deleted' => :'Boolean' + :'deleted' => :'Boolean', + :'income_formatted' => :'String', + :'income_currency' => :'Float', + :'budgeted_formatted' => :'String', + :'budgeted_currency' => :'Float', + :'activity_formatted' => :'String', + :'activity_currency' => :'Float', + :'to_be_budgeted_formatted' => :'String', + :'to_be_budgeted_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'note', - :'age_of_money', ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MonthSummaryBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -121,6 +166,38 @@ def initialize(attributes = {}) if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end + + if attributes.key?(:'income_formatted') + self.income_formatted = attributes[:'income_formatted'] + end + + if attributes.key?(:'income_currency') + self.income_currency = attributes[:'income_currency'] + end + + if attributes.key?(:'budgeted_formatted') + self.budgeted_formatted = attributes[:'budgeted_formatted'] + end + + if attributes.key?(:'budgeted_currency') + self.budgeted_currency = attributes[:'budgeted_currency'] + end + + if attributes.key?(:'activity_formatted') + self.activity_formatted = attributes[:'activity_formatted'] + end + + if attributes.key?(:'activity_currency') + self.activity_currency = attributes[:'activity_currency'] + end + + if attributes.key?(:'to_be_budgeted_formatted') + self.to_be_budgeted_formatted = attributes[:'to_be_budgeted_formatted'] + end + + if attributes.key?(:'to_be_budgeted_currency') + self.to_be_budgeted_currency = attributes[:'to_be_budgeted_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -154,7 +231,15 @@ def ==(o) activity == o.activity && to_be_budgeted == o.to_be_budgeted && age_of_money == o.age_of_money && - deleted == o.deleted + deleted == o.deleted && + income_formatted == o.income_formatted && + income_currency == o.income_currency && + budgeted_formatted == o.budgeted_formatted && + budgeted_currency == o.budgeted_currency && + activity_formatted == o.activity_formatted && + activity_currency == o.activity_currency && + to_be_budgeted_formatted == o.to_be_budgeted_formatted && + to_be_budgeted_currency == o.to_be_budgeted_currency end # @see the `==` method @@ -166,7 +251,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted].hash + [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted, income_formatted, income_currency, budgeted_formatted, budgeted_currency, activity_formatted, activity_currency, to_be_budgeted_formatted, to_be_budgeted_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/month_summary_base.rb b/lib/ynab/models/month_summary_base.rb new file mode 100644 index 0000000..69ffd79 --- /dev/null +++ b/lib/ynab/models/month_summary_base.rb @@ -0,0 +1,212 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class MonthSummaryBase < ApiModelBase + attr_accessor :month + + attr_accessor :note + + # The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month + attr_accessor :income + + # The total amount assigned (budgeted) in the month + attr_accessor :budgeted + + # The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign' + attr_accessor :activity + + # The available amount for 'Ready to Assign' + attr_accessor :to_be_budgeted + + # The Age of Money as of the month + attr_accessor :age_of_money + + # Whether or not the month has been deleted. Deleted months will only be included in delta requests. + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month', + :'note' => :'note', + :'income' => :'income', + :'budgeted' => :'budgeted', + :'activity' => :'activity', + :'to_be_budgeted' => :'to_be_budgeted', + :'age_of_money' => :'age_of_money', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'month' => :'Date', + :'note' => :'String', + :'income' => :'Integer', + :'budgeted' => :'Integer', + :'activity' => :'Integer', + :'to_be_budgeted' => :'Integer', + :'age_of_money' => :'Integer', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'note', + :'age_of_money', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MonthSummaryBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MonthSummaryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'income') + self.income = attributes[:'income'] + end + + if attributes.key?(:'budgeted') + self.budgeted = attributes[:'budgeted'] + end + + if attributes.key?(:'activity') + self.activity = attributes[:'activity'] + end + + if attributes.key?(:'to_be_budgeted') + self.to_be_budgeted = attributes[:'to_be_budgeted'] + end + + if attributes.key?(:'age_of_money') + self.age_of_money = attributes[:'age_of_money'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return false if @income.nil? + return false if @budgeted.nil? + return false if @activity.nil? + return false if @to_be_budgeted.nil? + return false if @deleted.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month && + note == o.note && + income == o.income && + budgeted == o.budgeted && + activity == o.activity && + to_be_budgeted == o.to_be_budgeted && + age_of_money == o.age_of_money && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [month, note, income, budgeted, activity, to_be_budgeted, age_of_money, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/new_category.rb b/lib/ynab/models/new_category.rb index a4e9cb8..b9b874b 100644 --- a/lib/ynab/models/new_category.rb +++ b/lib/ynab/models/new_category.rb @@ -18,12 +18,15 @@ class NewCategory < ApiModelBase attr_accessor :category_group_id - # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. + # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. attr_accessor :goal_target # The goal target date in ISO format (e.g. 2016-12-01). attr_accessor :goal_target_date + # Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. + attr_accessor :goal_needs_whole_amount + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -31,7 +34,8 @@ def self.attribute_map :'note' => :'note', :'category_group_id' => :'category_group_id', :'goal_target' => :'goal_target', - :'goal_target_date' => :'goal_target_date' + :'goal_target_date' => :'goal_target_date', + :'goal_needs_whole_amount' => :'goal_needs_whole_amount' } end @@ -47,7 +51,8 @@ def self.openapi_types :'note' => :'String', :'category_group_id' => :'String', :'goal_target' => :'Integer', - :'goal_target_date' => :'Date' + :'goal_target_date' => :'Date', + :'goal_needs_whole_amount' => :'Boolean' } end @@ -98,6 +103,10 @@ def initialize(attributes = {}) if attributes.key?(:'goal_target_date') self.goal_target_date = attributes[:'goal_target_date'] end + + if attributes.key?(:'goal_needs_whole_amount') + self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -122,7 +131,8 @@ def ==(o) note == o.note && category_group_id == o.category_group_id && goal_target == o.goal_target && - goal_target_date == o.goal_target_date + goal_target_date == o.goal_target_date && + goal_needs_whole_amount == o.goal_needs_whole_amount end # @see the `==` method @@ -134,7 +144,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, note, category_group_id, goal_target, goal_target_date].hash + [name, note, category_group_id, goal_target, goal_target_date, goal_needs_whole_amount].hash end # Builds the object from hash diff --git a/lib/ynab/models/plan_detail.rb b/lib/ynab/models/plan_detail.rb index d8d1b6c..0fd0189 100644 --- a/lib/ynab/models/plan_detail.rb +++ b/lib/ynab/models/plan_detail.rb @@ -87,16 +87,16 @@ def self.openapi_types :'last_month' => :'Date', :'date_format' => :'DateFormat', :'currency_format' => :'CurrencyFormat', - :'accounts' => :'Array', + :'accounts' => :'Array', :'payees' => :'Array', :'payee_locations' => :'Array', :'category_groups' => :'Array', - :'categories' => :'Array', - :'months' => :'Array', - :'transactions' => :'Array', - :'subtransactions' => :'Array', - :'scheduled_transactions' => :'Array', - :'scheduled_subtransactions' => :'Array' + :'categories' => :'Array', + :'months' => :'Array', + :'transactions' => :'Array', + :'subtransactions' => :'Array', + :'scheduled_transactions' => :'Array', + :'scheduled_subtransactions' => :'Array' } end diff --git a/lib/ynab/models/post_payee.rb b/lib/ynab/models/post_payee.rb new file mode 100644 index 0000000..8df9546 --- /dev/null +++ b/lib/ynab/models/post_payee.rb @@ -0,0 +1,148 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class PostPayee < ApiModelBase + # The name of the payee. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PostPayee` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PostPayee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @name.nil? + return false if @name.to_s.length > 500 + true + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + @name = name + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/post_payee_wrapper.rb b/lib/ynab/models/post_payee_wrapper.rb new file mode 100644 index 0000000..c8b3a28 --- /dev/null +++ b/lib/ynab/models/post_payee_wrapper.rb @@ -0,0 +1,136 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class PostPayeeWrapper < ApiModelBase + attr_accessor :payee + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee' => :'payee' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'payee' => :'PostPayee' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PostPayeeWrapper` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PostPayeeWrapper`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'payee') + self.payee = attributes[:'payee'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @payee.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee == o.payee + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [payee].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/save_account.rb b/lib/ynab/models/save_account.rb index 737a632..7aff576 100644 --- a/lib/ynab/models/save_account.rb +++ b/lib/ynab/models/save_account.rb @@ -60,7 +60,7 @@ def self.acceptable_attributes def self.openapi_types { :'name' => :'String', - :'type' => :'AccountType', + :'type' => :'SaveAccountType', :'balance' => :'Integer' } end diff --git a/lib/ynab/models/save_account_type.rb b/lib/ynab/models/save_account_type.rb new file mode 100644 index 0000000..4a75b46 --- /dev/null +++ b/lib/ynab/models/save_account_type.rb @@ -0,0 +1,45 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class SaveAccountType + CHECKING = "checking".freeze + SAVINGS = "savings".freeze + CASH = "cash".freeze + CREDIT_CARD = "creditCard".freeze + OTHER_ASSET = "otherAsset".freeze + OTHER_LIABILITY = "otherLiability".freeze + + def self.all_vars + @all_vars ||= [CHECKING, SAVINGS, CASH, CREDIT_CARD, OTHER_ASSET, OTHER_LIABILITY].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + if SaveAccountType.all_vars.include?(value) + return value + else + return nil + end + end + end + +end diff --git a/lib/ynab/models/save_category.rb b/lib/ynab/models/save_category.rb index 8494e57..e0d9d8e 100644 --- a/lib/ynab/models/save_category.rb +++ b/lib/ynab/models/save_category.rb @@ -18,12 +18,15 @@ class SaveCategory < ApiModelBase attr_accessor :category_group_id - # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. + # The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. attr_accessor :goal_target # The goal target date in ISO format (e.g. 2016-12-01). attr_accessor :goal_target_date + # Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. + attr_accessor :goal_needs_whole_amount + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -31,7 +34,8 @@ def self.attribute_map :'note' => :'note', :'category_group_id' => :'category_group_id', :'goal_target' => :'goal_target', - :'goal_target_date' => :'goal_target_date' + :'goal_target_date' => :'goal_target_date', + :'goal_needs_whole_amount' => :'goal_needs_whole_amount' } end @@ -47,7 +51,8 @@ def self.openapi_types :'note' => :'String', :'category_group_id' => :'String', :'goal_target' => :'Integer', - :'goal_target_date' => :'Date' + :'goal_target_date' => :'Date', + :'goal_needs_whole_amount' => :'Boolean' } end @@ -57,7 +62,8 @@ def self.openapi_nullable :'name', :'note', :'goal_target', - :'goal_target_date' + :'goal_target_date', + :'goal_needs_whole_amount' ]) end @@ -95,6 +101,10 @@ def initialize(attributes = {}) if attributes.key?(:'goal_target_date') self.goal_target_date = attributes[:'goal_target_date'] end + + if attributes.key?(:'goal_needs_whole_amount') + self.goal_needs_whole_amount = attributes[:'goal_needs_whole_amount'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -119,7 +129,8 @@ def ==(o) note == o.note && category_group_id == o.category_group_id && goal_target == o.goal_target && - goal_target_date == o.goal_target_date + goal_target_date == o.goal_target_date && + goal_needs_whole_amount == o.goal_needs_whole_amount end # @see the `==` method @@ -131,7 +142,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, note, category_group_id, goal_target, goal_target_date].hash + [name, note, category_group_id, goal_target, goal_target_date, goal_needs_whole_amount].hash end # Builds the object from hash diff --git a/lib/ynab/models/save_payee.rb b/lib/ynab/models/save_payee.rb index c689987..a016bb6 100644 --- a/lib/ynab/models/save_payee.rb +++ b/lib/ynab/models/save_payee.rb @@ -12,7 +12,7 @@ module YNAB class SavePayee < ApiModelBase - # The name of the payee. The name must be a maximum of 500 characters. + # The name of the payee. attr_accessor :name # Attribute mapping from ruby-style variable name to JSON key. diff --git a/lib/ynab/models/scheduled_sub_transaction.rb b/lib/ynab/models/scheduled_sub_transaction.rb index 4c96f49..705e624 100644 --- a/lib/ynab/models/scheduled_sub_transaction.rb +++ b/lib/ynab/models/scheduled_sub_transaction.rb @@ -35,6 +35,12 @@ class ScheduledSubTransaction < ApiModelBase # Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. attr_accessor :deleted + # The scheduled subtransaction amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The scheduled subtransaction amount as a decimal currency amount + attr_accessor :amount_currency + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -47,7 +53,9 @@ def self.attribute_map :'category_id' => :'category_id', :'category_name' => :'category_name', :'transfer_account_id' => :'transfer_account_id', - :'deleted' => :'deleted' + :'deleted' => :'deleted', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency' } end @@ -68,22 +76,25 @@ def self.openapi_types :'category_id' => :'String', :'category_name' => :'String', :'transfer_account_id' => :'String', - :'deleted' => :'Boolean' + :'deleted' => :'Boolean', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'memo', - :'payee_id', - :'payee_name', - :'category_id', - :'category_name', - :'transfer_account_id', ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ScheduledSubTransactionBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -138,6 +149,14 @@ def initialize(attributes = {}) if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end + + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -171,7 +190,9 @@ def ==(o) category_id == o.category_id && category_name == o.category_name && transfer_account_id == o.transfer_account_id && - deleted == o.deleted + deleted == o.deleted && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency end # @see the `==` method @@ -183,7 +204,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, scheduled_transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, deleted].hash + [id, scheduled_transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, deleted, amount_formatted, amount_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/scheduled_sub_transaction_base.rb b/lib/ynab/models/scheduled_sub_transaction_base.rb new file mode 100644 index 0000000..9281a6b --- /dev/null +++ b/lib/ynab/models/scheduled_sub_transaction_base.rb @@ -0,0 +1,229 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class ScheduledSubTransactionBase < ApiModelBase + attr_accessor :id + + attr_accessor :scheduled_transaction_id + + # The scheduled subtransaction amount in milliunits format + attr_accessor :amount + + attr_accessor :memo + + attr_accessor :payee_id + + attr_accessor :payee_name + + attr_accessor :category_id + + attr_accessor :category_name + + # If a transfer, the account_id which the scheduled subtransaction transfers to + attr_accessor :transfer_account_id + + # Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'scheduled_transaction_id' => :'scheduled_transaction_id', + :'amount' => :'amount', + :'memo' => :'memo', + :'payee_id' => :'payee_id', + :'payee_name' => :'payee_name', + :'category_id' => :'category_id', + :'category_name' => :'category_name', + :'transfer_account_id' => :'transfer_account_id', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'scheduled_transaction_id' => :'String', + :'amount' => :'Integer', + :'memo' => :'String', + :'payee_id' => :'String', + :'payee_name' => :'String', + :'category_id' => :'String', + :'category_name' => :'String', + :'transfer_account_id' => :'String', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'memo', + :'payee_id', + :'payee_name', + :'category_id', + :'category_name', + :'transfer_account_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ScheduledSubTransactionBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ScheduledSubTransactionBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'scheduled_transaction_id') + self.scheduled_transaction_id = attributes[:'scheduled_transaction_id'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + if attributes.key?(:'payee_name') + self.payee_name = attributes[:'payee_name'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'category_name') + self.category_name = attributes[:'category_name'] + end + + if attributes.key?(:'transfer_account_id') + self.transfer_account_id = attributes[:'transfer_account_id'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @scheduled_transaction_id.nil? + return false if @amount.nil? + return false if @deleted.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + scheduled_transaction_id == o.scheduled_transaction_id && + amount == o.amount && + memo == o.memo && + payee_id == o.payee_id && + payee_name == o.payee_name && + category_id == o.category_id && + category_name == o.category_name && + transfer_account_id == o.transfer_account_id && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, scheduled_transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/scheduled_transaction_detail.rb b/lib/ynab/models/scheduled_transaction_detail.rb index dd60ac6..d0cc55f 100644 --- a/lib/ynab/models/scheduled_transaction_detail.rb +++ b/lib/ynab/models/scheduled_transaction_detail.rb @@ -44,6 +44,12 @@ class ScheduledTransactionDetail < ApiModelBase # Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. attr_accessor :deleted + # The scheduled transaction amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The scheduled transaction amount as a decimal currency amount + attr_accessor :amount_currency + attr_accessor :account_name attr_accessor :payee_name @@ -92,6 +98,8 @@ def self.attribute_map :'category_id' => :'category_id', :'transfer_account_id' => :'transfer_account_id', :'deleted' => :'deleted', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency', :'account_name' => :'account_name', :'payee_name' => :'payee_name', :'category_name' => :'category_name', @@ -120,6 +128,8 @@ def self.openapi_types :'category_id' => :'String', :'transfer_account_id' => :'String', :'deleted' => :'Boolean', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float', :'account_name' => :'String', :'payee_name' => :'String', :'category_name' => :'String', @@ -210,6 +220,14 @@ def initialize(attributes = {}) self.deleted = attributes[:'deleted'] end + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end + if attributes.key?(:'account_name') self.account_name = attributes[:'account_name'] end @@ -277,6 +295,8 @@ def ==(o) category_id == o.category_id && transfer_account_id == o.transfer_account_id && deleted == o.deleted && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency && account_name == o.account_name && payee_name == o.payee_name && category_name == o.category_name && @@ -292,7 +312,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted, account_name, payee_name, category_name, subtransactions].hash + [id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted, amount_formatted, amount_currency, account_name, payee_name, category_name, subtransactions].hash end # Builds the object from hash diff --git a/lib/ynab/models/scheduled_transaction_summary.rb b/lib/ynab/models/scheduled_transaction_summary.rb index 9d523bb..64954b6 100644 --- a/lib/ynab/models/scheduled_transaction_summary.rb +++ b/lib/ynab/models/scheduled_transaction_summary.rb @@ -44,6 +44,12 @@ class ScheduledTransactionSummary < ApiModelBase # Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. attr_accessor :deleted + # The scheduled transaction amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The scheduled transaction amount as a decimal currency amount + attr_accessor :amount_currency + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -81,7 +87,9 @@ def self.attribute_map :'payee_id' => :'payee_id', :'category_id' => :'category_id', :'transfer_account_id' => :'transfer_account_id', - :'deleted' => :'deleted' + :'deleted' => :'deleted', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency' } end @@ -105,22 +113,26 @@ def self.openapi_types :'payee_id' => :'String', :'category_id' => :'String', :'transfer_account_id' => :'String', - :'deleted' => :'Boolean' + :'deleted' => :'Boolean', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'memo', :'flag_color', - :'flag_name', - :'payee_id', - :'category_id', - :'transfer_account_id', ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ScheduledTransactionSummaryBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -187,6 +199,14 @@ def initialize(attributes = {}) if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end + + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -234,7 +254,9 @@ def ==(o) payee_id == o.payee_id && category_id == o.category_id && transfer_account_id == o.transfer_account_id && - deleted == o.deleted + deleted == o.deleted && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency end # @see the `==` method @@ -246,7 +268,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted].hash + [id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted, amount_formatted, amount_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/scheduled_transaction_summary_base.rb b/lib/ynab/models/scheduled_transaction_summary_base.rb new file mode 100644 index 0000000..19533bf --- /dev/null +++ b/lib/ynab/models/scheduled_transaction_summary_base.rb @@ -0,0 +1,292 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class ScheduledTransactionSummaryBase < ApiModelBase + attr_accessor :id + + # The first date for which the Scheduled Transaction was scheduled. + attr_accessor :date_first + + # The next date for which the Scheduled Transaction is scheduled. + attr_accessor :date_next + + attr_accessor :frequency + + # The scheduled transaction amount in milliunits format + attr_accessor :amount + + attr_accessor :memo + + attr_accessor :flag_color + + # The customized name of a transaction flag + attr_accessor :flag_name + + attr_accessor :account_id + + attr_accessor :payee_id + + attr_accessor :category_id + + # If a transfer, the account_id which the scheduled transaction transfers to + attr_accessor :transfer_account_id + + # Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. + attr_accessor :deleted + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date_first' => :'date_first', + :'date_next' => :'date_next', + :'frequency' => :'frequency', + :'amount' => :'amount', + :'memo' => :'memo', + :'flag_color' => :'flag_color', + :'flag_name' => :'flag_name', + :'account_id' => :'account_id', + :'payee_id' => :'payee_id', + :'category_id' => :'category_id', + :'transfer_account_id' => :'transfer_account_id', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date_first' => :'Date', + :'date_next' => :'Date', + :'frequency' => :'String', + :'amount' => :'Integer', + :'memo' => :'String', + :'flag_color' => :'TransactionFlagColor', + :'flag_name' => :'String', + :'account_id' => :'String', + :'payee_id' => :'String', + :'category_id' => :'String', + :'transfer_account_id' => :'String', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'memo', + :'flag_color', + :'flag_name', + :'payee_id', + :'category_id', + :'transfer_account_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::ScheduledTransactionSummaryBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::ScheduledTransactionSummaryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date_first') + self.date_first = attributes[:'date_first'] + end + + if attributes.key?(:'date_next') + self.date_next = attributes[:'date_next'] + end + + if attributes.key?(:'frequency') + self.frequency = attributes[:'frequency'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'flag_color') + self.flag_color = attributes[:'flag_color'] + end + + if attributes.key?(:'flag_name') + self.flag_name = attributes[:'flag_name'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'transfer_account_id') + self.transfer_account_id = attributes[:'transfer_account_id'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date_first.nil? + return false if @date_next.nil? + return false if @frequency.nil? + frequency_validator = EnumAttributeValidator.new('String', ["never", "daily", "weekly", "everyOtherWeek", "twiceAMonth", "every4Weeks", "monthly", "everyOtherMonth", "every3Months", "every4Months", "twiceAYear", "yearly", "everyOtherYear"]) + return false unless frequency_validator.valid?(@frequency) + return false if @amount.nil? + return false if @account_id.nil? + return false if @deleted.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] frequency Object to be assigned + def frequency=(frequency) + @frequency = frequency + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date_first == o.date_first && + date_next == o.date_next && + frequency == o.frequency && + amount == o.amount && + memo == o.memo && + flag_color == o.flag_color && + flag_name == o.flag_name && + account_id == o.account_id && + payee_id == o.payee_id && + category_id == o.category_id && + transfer_account_id == o.transfer_account_id && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date_first, date_next, frequency, amount, memo, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/sub_transaction.rb b/lib/ynab/models/sub_transaction.rb index de9340a..9568073 100644 --- a/lib/ynab/models/sub_transaction.rb +++ b/lib/ynab/models/sub_transaction.rb @@ -38,6 +38,12 @@ class SubTransaction < ApiModelBase # Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. attr_accessor :deleted + # The subtransaction amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The subtransaction amount as a decimal currency amount + attr_accessor :amount_currency + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -51,7 +57,9 @@ def self.attribute_map :'category_name' => :'category_name', :'transfer_account_id' => :'transfer_account_id', :'transfer_transaction_id' => :'transfer_transaction_id', - :'deleted' => :'deleted' + :'deleted' => :'deleted', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency' } end @@ -73,23 +81,25 @@ def self.openapi_types :'category_name' => :'String', :'transfer_account_id' => :'String', :'transfer_transaction_id' => :'String', - :'deleted' => :'Boolean' + :'deleted' => :'Boolean', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'memo', - :'payee_id', - :'payee_name', - :'category_id', - :'category_name', - :'transfer_account_id', - :'transfer_transaction_id', ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'SubTransactionBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -148,6 +158,14 @@ def initialize(attributes = {}) if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end + + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -182,7 +200,9 @@ def ==(o) category_name == o.category_name && transfer_account_id == o.transfer_account_id && transfer_transaction_id == o.transfer_transaction_id && - deleted == o.deleted + deleted == o.deleted && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency end # @see the `==` method @@ -194,7 +214,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, transfer_transaction_id, deleted].hash + [id, transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, transfer_transaction_id, deleted, amount_formatted, amount_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/sub_transaction_base.rb b/lib/ynab/models/sub_transaction_base.rb new file mode 100644 index 0000000..b6a48e6 --- /dev/null +++ b/lib/ynab/models/sub_transaction_base.rb @@ -0,0 +1,240 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class SubTransactionBase < ApiModelBase + attr_accessor :id + + attr_accessor :transaction_id + + # The subtransaction amount in milliunits format + attr_accessor :amount + + attr_accessor :memo + + attr_accessor :payee_id + + attr_accessor :payee_name + + attr_accessor :category_id + + attr_accessor :category_name + + # If a transfer, the account_id which the subtransaction transfers to + attr_accessor :transfer_account_id + + # If a transfer, the id of transaction on the other side of the transfer + attr_accessor :transfer_transaction_id + + # Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. + attr_accessor :deleted + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'transaction_id' => :'transaction_id', + :'amount' => :'amount', + :'memo' => :'memo', + :'payee_id' => :'payee_id', + :'payee_name' => :'payee_name', + :'category_id' => :'category_id', + :'category_name' => :'category_name', + :'transfer_account_id' => :'transfer_account_id', + :'transfer_transaction_id' => :'transfer_transaction_id', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'transaction_id' => :'String', + :'amount' => :'Integer', + :'memo' => :'String', + :'payee_id' => :'String', + :'payee_name' => :'String', + :'category_id' => :'String', + :'category_name' => :'String', + :'transfer_account_id' => :'String', + :'transfer_transaction_id' => :'String', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'memo', + :'payee_id', + :'payee_name', + :'category_id', + :'category_name', + :'transfer_account_id', + :'transfer_transaction_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::SubTransactionBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::SubTransactionBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'transaction_id') + self.transaction_id = attributes[:'transaction_id'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + if attributes.key?(:'payee_name') + self.payee_name = attributes[:'payee_name'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'category_name') + self.category_name = attributes[:'category_name'] + end + + if attributes.key?(:'transfer_account_id') + self.transfer_account_id = attributes[:'transfer_account_id'] + end + + if attributes.key?(:'transfer_transaction_id') + self.transfer_transaction_id = attributes[:'transfer_transaction_id'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @transaction_id.nil? + return false if @amount.nil? + return false if @deleted.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + transaction_id == o.transaction_id && + amount == o.amount && + memo == o.memo && + payee_id == o.payee_id && + payee_name == o.payee_name && + category_id == o.category_id && + category_name == o.category_name && + transfer_account_id == o.transfer_account_id && + transfer_transaction_id == o.transfer_transaction_id && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, transaction_id, amount, memo, payee_id, payee_name, category_id, category_name, transfer_account_id, transfer_transaction_id, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/lib/ynab/models/transaction_detail.rb b/lib/ynab/models/transaction_detail.rb index 8ca9394..1664393 100644 --- a/lib/ynab/models/transaction_detail.rb +++ b/lib/ynab/models/transaction_detail.rb @@ -62,6 +62,12 @@ class TransactionDetail < ApiModelBase # Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. attr_accessor :deleted + # The transaction amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The transaction amount as a decimal currency amount + attr_accessor :amount_currency + attr_accessor :account_name attr_accessor :payee_name @@ -116,6 +122,8 @@ def self.attribute_map :'import_payee_name_original' => :'import_payee_name_original', :'debt_transaction_type' => :'debt_transaction_type', :'deleted' => :'deleted', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency', :'account_name' => :'account_name', :'payee_name' => :'payee_name', :'category_name' => :'category_name', @@ -150,6 +158,8 @@ def self.openapi_types :'import_payee_name_original' => :'String', :'debt_transaction_type' => :'String', :'deleted' => :'Boolean', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float', :'account_name' => :'String', :'payee_name' => :'String', :'category_name' => :'String', @@ -265,6 +275,14 @@ def initialize(attributes = {}) self.deleted = attributes[:'deleted'] end + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end + if attributes.key?(:'account_name') self.account_name = attributes[:'account_name'] end @@ -338,6 +356,8 @@ def ==(o) import_payee_name_original == o.import_payee_name_original && debt_transaction_type == o.debt_transaction_type && deleted == o.deleted && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency && account_name == o.account_name && payee_name == o.payee_name && category_name == o.category_name && @@ -353,7 +373,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, account_name, payee_name, category_name, subtransactions].hash + [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, amount_formatted, amount_currency, account_name, payee_name, category_name, subtransactions].hash end # Builds the object from hash diff --git a/lib/ynab/models/transaction_summary.rb b/lib/ynab/models/transaction_summary.rb index a9e5b5b..f14991c 100644 --- a/lib/ynab/models/transaction_summary.rb +++ b/lib/ynab/models/transaction_summary.rb @@ -62,6 +62,12 @@ class TransactionSummary < ApiModelBase # Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. attr_accessor :deleted + # The transaction amount formatted in the plan's currency format + attr_accessor :amount_formatted + + # The transaction amount as a decimal currency amount + attr_accessor :amount_currency + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -105,7 +111,9 @@ def self.attribute_map :'import_payee_name' => :'import_payee_name', :'import_payee_name_original' => :'import_payee_name_original', :'debt_transaction_type' => :'debt_transaction_type', - :'deleted' => :'deleted' + :'deleted' => :'deleted', + :'amount_formatted' => :'amount_formatted', + :'amount_currency' => :'amount_currency' } end @@ -135,28 +143,27 @@ def self.openapi_types :'import_payee_name' => :'String', :'import_payee_name_original' => :'String', :'debt_transaction_type' => :'String', - :'deleted' => :'Boolean' + :'deleted' => :'Boolean', + :'amount_formatted' => :'String', + :'amount_currency' => :'Float' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'memo', :'flag_color', - :'flag_name', - :'payee_id', - :'category_id', - :'transfer_account_id', - :'transfer_transaction_id', - :'matched_transaction_id', - :'import_id', - :'import_payee_name', - :'import_payee_name_original', :'debt_transaction_type', ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'TransactionSummaryBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -247,6 +254,14 @@ def initialize(attributes = {}) if attributes.key?(:'deleted') self.deleted = attributes[:'deleted'] end + + if attributes.key?(:'amount_formatted') + self.amount_formatted = attributes[:'amount_formatted'] + end + + if attributes.key?(:'amount_currency') + self.amount_currency = attributes[:'amount_currency'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -300,7 +315,9 @@ def ==(o) import_payee_name == o.import_payee_name && import_payee_name_original == o.import_payee_name_original && debt_transaction_type == o.debt_transaction_type && - deleted == o.deleted + deleted == o.deleted && + amount_formatted == o.amount_formatted && + amount_currency == o.amount_currency end # @see the `==` method @@ -312,7 +329,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted].hash + [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted, amount_formatted, amount_currency].hash end # Builds the object from hash diff --git a/lib/ynab/models/transaction_summary_base.rb b/lib/ynab/models/transaction_summary_base.rb new file mode 100644 index 0000000..d09793e --- /dev/null +++ b/lib/ynab/models/transaction_summary_base.rb @@ -0,0 +1,358 @@ +=begin +#YNAB API Endpoints + +#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.ynab.com + +Generated by: OpenAPI Generator (https://openapi-generator.tech) + +=end + +require 'date' +require 'time' + +module YNAB + class TransactionSummaryBase < ApiModelBase + attr_accessor :id + + # The transaction date in ISO format (e.g. 2016-12-01) + attr_accessor :date + + # The transaction amount in milliunits format + attr_accessor :amount + + attr_accessor :memo + + attr_accessor :cleared + + # Whether or not the transaction is approved + attr_accessor :approved + + attr_accessor :flag_color + + # The customized name of a transaction flag + attr_accessor :flag_name + + attr_accessor :account_id + + attr_accessor :payee_id + + attr_accessor :category_id + + # If a transfer transaction, the account to which it transfers + attr_accessor :transfer_account_id + + # If a transfer transaction, the id of transaction on the other side of the transfer + attr_accessor :transfer_transaction_id + + # If transaction is matched, the id of the matched transaction + attr_accessor :matched_transaction_id + + # If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. + attr_accessor :import_id + + # If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules + attr_accessor :import_payee_name + + # If the transaction was imported, the original payee name as it appeared on the statement + attr_accessor :import_payee_name_original + + # If the transaction is a debt/loan account transaction, the type of transaction + attr_accessor :debt_transaction_type + + # Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. + attr_accessor :deleted + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'amount' => :'amount', + :'memo' => :'memo', + :'cleared' => :'cleared', + :'approved' => :'approved', + :'flag_color' => :'flag_color', + :'flag_name' => :'flag_name', + :'account_id' => :'account_id', + :'payee_id' => :'payee_id', + :'category_id' => :'category_id', + :'transfer_account_id' => :'transfer_account_id', + :'transfer_transaction_id' => :'transfer_transaction_id', + :'matched_transaction_id' => :'matched_transaction_id', + :'import_id' => :'import_id', + :'import_payee_name' => :'import_payee_name', + :'import_payee_name_original' => :'import_payee_name_original', + :'debt_transaction_type' => :'debt_transaction_type', + :'deleted' => :'deleted' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'date' => :'Date', + :'amount' => :'Integer', + :'memo' => :'String', + :'cleared' => :'TransactionClearedStatus', + :'approved' => :'Boolean', + :'flag_color' => :'TransactionFlagColor', + :'flag_name' => :'String', + :'account_id' => :'String', + :'payee_id' => :'String', + :'category_id' => :'String', + :'transfer_account_id' => :'String', + :'transfer_transaction_id' => :'String', + :'matched_transaction_id' => :'String', + :'import_id' => :'String', + :'import_payee_name' => :'String', + :'import_payee_name_original' => :'String', + :'debt_transaction_type' => :'String', + :'deleted' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'memo', + :'flag_color', + :'flag_name', + :'payee_id', + :'category_id', + :'transfer_account_id', + :'transfer_transaction_id', + :'matched_transaction_id', + :'import_id', + :'import_payee_name', + :'import_payee_name_original', + :'debt_transaction_type', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::TransactionSummaryBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::TransactionSummaryBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'cleared') + self.cleared = attributes[:'cleared'] + end + + if attributes.key?(:'approved') + self.approved = attributes[:'approved'] + end + + if attributes.key?(:'flag_color') + self.flag_color = attributes[:'flag_color'] + end + + if attributes.key?(:'flag_name') + self.flag_name = attributes[:'flag_name'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + if attributes.key?(:'category_id') + self.category_id = attributes[:'category_id'] + end + + if attributes.key?(:'transfer_account_id') + self.transfer_account_id = attributes[:'transfer_account_id'] + end + + if attributes.key?(:'transfer_transaction_id') + self.transfer_transaction_id = attributes[:'transfer_transaction_id'] + end + + if attributes.key?(:'matched_transaction_id') + self.matched_transaction_id = attributes[:'matched_transaction_id'] + end + + if attributes.key?(:'import_id') + self.import_id = attributes[:'import_id'] + end + + if attributes.key?(:'import_payee_name') + self.import_payee_name = attributes[:'import_payee_name'] + end + + if attributes.key?(:'import_payee_name_original') + self.import_payee_name_original = attributes[:'import_payee_name_original'] + end + + if attributes.key?(:'debt_transaction_type') + self.debt_transaction_type = attributes[:'debt_transaction_type'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @amount.nil? + return false if @cleared.nil? + return false if @approved.nil? + return false if @account_id.nil? + debt_transaction_type_validator = EnumAttributeValidator.new('String', ["payment", "refund", "fee", "interest", "escrow", "balanceAdjustment", "credit", "charge"]) + return false unless debt_transaction_type_validator.valid?(@debt_transaction_type) + return false if @deleted.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] debt_transaction_type Object to be assigned + def debt_transaction_type=(debt_transaction_type) + @debt_transaction_type = debt_transaction_type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + date == o.date && + amount == o.amount && + memo == o.memo && + cleared == o.cleared && + approved == o.approved && + flag_color == o.flag_color && + flag_name == o.flag_name && + account_id == o.account_id && + payee_id == o.payee_id && + category_id == o.category_id && + transfer_account_id == o.transfer_account_id && + transfer_transaction_id == o.transfer_transaction_id && + matched_transaction_id == o.matched_transaction_id && + import_id == o.import_id && + import_payee_name == o.import_payee_name && + import_payee_name_original == o.import_payee_name_original && + debt_transaction_type == o.debt_transaction_type && + deleted == o.deleted + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, date, amount, memo, cleared, approved, flag_color, flag_name, account_id, payee_id, category_id, transfer_account_id, transfer_transaction_id, matched_transaction_id, import_id, import_payee_name, import_payee_name_original, debt_transaction_type, deleted].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + end + +end diff --git a/open_api_spec.yaml b/open_api_spec.yaml index 3da6a84..c054223 100644 --- a/open_api_spec.yaml +++ b/open_api_spec.yaml @@ -5,7 +5,7 @@ info: 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.ynab.com - version: 1.79.0 + version: 1.83.0 servers: - url: https://api.ynab.com/v1 security: @@ -622,6 +622,43 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" + post: + tags: + - Payees + summary: Create a payee + description: Creates a new payee + operationId: createPayee + parameters: + - name: plan_id + in: path + description: 'The id of the plan. "last-used" can be used to specify the last + used plan and "default" can be used if default plan selection is + enabled (see: https://api.ynab.com/#oauth-default-plan).' + required: true + schema: + type: string + requestBody: + description: The payee to create + content: + application/json: + schema: + $ref: "#/components/schemas/PostPayeeWrapper" + required: true + responses: + "201": + description: The payee was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/SavePayeeResponse" + "400": + description: The request could not be understood due to malformed syntax or + validation error(s) + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-codegen-request-body-name: data /plans/{plan_id}/payees/{payee_id}: get: tags: @@ -1897,7 +1934,7 @@ components: accounts: type: array items: - $ref: "#/components/schemas/Account" + $ref: "#/components/schemas/AccountBase" payees: type: array items: @@ -1913,27 +1950,27 @@ components: categories: type: array items: - $ref: "#/components/schemas/Category" + $ref: "#/components/schemas/CategoryBase" months: type: array items: - $ref: "#/components/schemas/MonthDetail" + $ref: "#/components/schemas/MonthDetailBase" transactions: type: array items: - $ref: "#/components/schemas/TransactionSummary" + $ref: "#/components/schemas/TransactionSummaryBase" subtransactions: type: array items: - $ref: "#/components/schemas/SubTransaction" + $ref: "#/components/schemas/SubTransactionBase" scheduled_transactions: type: array items: - $ref: "#/components/schemas/ScheduledTransactionSummary" + $ref: "#/components/schemas/ScheduledTransactionSummaryBase" scheduled_subtransactions: type: array items: - $ref: "#/components/schemas/ScheduledSubTransaction" + $ref: "#/components/schemas/ScheduledSubTransactionBase" PlanSettingsResponse: required: - data @@ -1987,7 +2024,7 @@ components: properties: account: $ref: "#/components/schemas/Account" - Account: + AccountBase: required: - balance - cleared_balance @@ -2067,6 +2104,32 @@ components: type: boolean description: Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. + Account: + allOf: + - $ref: "#/components/schemas/AccountBase" + - type: object + properties: + balance_formatted: + type: string + description: The current available balance of the account formatted in the plan's currency format + balance_currency: + type: number + format: double + description: The current available balance of the account as a decimal currency amount + cleared_balance_formatted: + type: string + description: The current cleared balance of the account formatted in the plan's currency format + cleared_balance_currency: + type: number + format: double + description: The current cleared balance of the account as a decimal currency amount + uncleared_balance_formatted: + type: string + description: The current uncleared balance of the account formatted in the plan's currency format + uncleared_balance_currency: + type: number + format: double + description: The current uncleared balance of the account as a decimal currency amount PostAccountWrapper: required: - account @@ -2085,7 +2148,7 @@ components: type: string description: The name of the account type: - $ref: "#/components/schemas/AccountType" + $ref: "#/components/schemas/SaveAccountType" balance: type: integer description: The current balance of the account in milliunits format @@ -2097,6 +2160,16 @@ components: additionalProperties: type: integer format: int64 + SaveAccountType: + type: string + description: The type of account to create or update + enum: + - checking + - savings + - cash + - creditCard + - otherAsset + - otherLiability AccountType: type: string description: The type of account @@ -2178,7 +2251,7 @@ components: type: boolean description: Whether or not the category group has been deleted. Deleted category groups will only be included in delta requests. - Category: + CategoryBase: required: - activity - balance @@ -2357,6 +2430,76 @@ components: type: boolean description: Whether or not the category has been deleted. Deleted categories will only be included in delta requests. + Category: + allOf: + - $ref: "#/components/schemas/CategoryBase" + - type: object + properties: + balance_formatted: + type: string + description: Available balance of the category formatted in the plan's currency format + balance_currency: + type: number + format: double + description: Available balance of the category as a decimal currency amount + activity_formatted: + type: string + description: Activity of the category formatted in the plan's currency format + activity_currency: + type: number + format: double + description: Activity of the category as a decimal currency amount + budgeted_formatted: + type: string + description: Assigned (budgeted) amount of the category formatted in the plan's currency format + budgeted_currency: + type: number + format: double + description: Assigned (budgeted) amount of the category as a decimal currency amount + goal_target_formatted: + type: + - string + - "null" + description: The goal target amount formatted in the plan's currency format + goal_target_currency: + type: + - number + - "null" + format: double + description: The goal target amount as a decimal currency amount + goal_under_funded_formatted: + type: + - string + - "null" + description: The goal underfunded amount formatted in the plan's currency format + goal_under_funded_currency: + type: + - number + - "null" + format: double + description: The goal underfunded amount as a decimal currency amount + goal_overall_funded_formatted: + type: + - string + - "null" + description: The total amount funded towards the goal formatted in the plan's currency format + goal_overall_funded_currency: + type: + - number + - "null" + format: double + description: The total amount funded towards the goal as a decimal currency amount + goal_overall_left_formatted: + type: + - string + - "null" + description: The amount of funding still needed to complete the goal formatted in the plan's currency format + goal_overall_left_currency: + type: + - number + - "null" + format: double + description: The amount of funding still needed to complete the goal as a decimal currency amount SaveCategoryResponse: required: - data @@ -2784,7 +2927,7 @@ components: type: integer description: The knowledge of the server format: int64 - TransactionSummary: + TransactionSummaryBase: required: - account_id - amount @@ -2894,6 +3037,19 @@ components: type: boolean description: Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. + TransactionSummary: + allOf: + - $ref: "#/components/schemas/TransactionSummaryBase" + - type: object + properties: + amount_formatted: + type: string + description: The transaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The transaction amount as a decimal currency amount + TransactionDetail: allOf: - $ref: "#/components/schemas/TransactionSummary" @@ -2951,6 +3107,23 @@ components: type: string description: The name of the category. If a split transaction, this will be 'Split'. + PostPayeeWrapper: + required: + - payee + type: object + properties: + payee: + $ref: "#/components/schemas/PostPayee" + PostPayee: + required: + - name + type: object + properties: + name: + type: string + nullable: false + maxLength: 500 + description: The name of the payee. PatchPayeeWrapper: required: - payee @@ -2965,7 +3138,7 @@ components: type: string nullable: false maxLength: 500 - description: The name of the payee. The name must be a maximum of 500 characters. + description: The name of the payee. PostCategoryGroupWrapper: required: - category_group @@ -3023,9 +3196,9 @@ components: - integer - "null" description: The goal target amount in milliunits format. If value is specified - and goal has not already been configured for category, a monthly - 'Needed for Spending' goal will be created for the category with - this target amount. + and goal has not already been configured for category, a monthly goal + will be created for the category with this target amount. If goal_type is + not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. format: int64 goal_target_date: type: @@ -3033,6 +3206,13 @@ components: - "null" description: The goal target date in ISO format (e.g. 2016-12-01). format: date + goal_needs_whole_amount: + type: + - boolean + - "null" + description: Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. + When true, the goal is configured as 'Set aside another...'. + When false, the goal is configured as 'Refill up to...'. ExistingCategory: allOf: - $ref: "#/components/schemas/SaveCategory" @@ -3112,7 +3292,7 @@ components: type: array items: $ref: "#/components/schemas/SaveTransactionWithOptionalFields" - SubTransaction: + SubTransactionBase: required: - amount - deleted @@ -3166,6 +3346,18 @@ components: type: boolean description: Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. + SubTransaction: + allOf: + - $ref: "#/components/schemas/SubTransactionBase" + - type: object + properties: + amount_formatted: + type: string + description: The subtransaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The subtransaction amount as a decimal currency amount ScheduledTransactionsResponse: required: - data @@ -3265,7 +3457,7 @@ components: $ref: "#/components/schemas/TransactionFlagColor" frequency: $ref: "#/components/schemas/ScheduledTransactionFrequency" - ScheduledTransactionSummary: + ScheduledTransactionSummaryBase: required: - account_id - amount @@ -3339,6 +3531,18 @@ components: type: boolean description: Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. + ScheduledTransactionSummary: + allOf: + - $ref: "#/components/schemas/ScheduledTransactionSummaryBase" + - type: object + properties: + amount_formatted: + type: string + description: The scheduled transaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The scheduled transaction amount as a decimal currency amount ScheduledTransactionDetail: allOf: - $ref: "#/components/schemas/ScheduledTransactionSummary" @@ -3364,7 +3568,7 @@ components: description: If a split scheduled transaction, the subtransactions. items: $ref: "#/components/schemas/ScheduledSubTransaction" - ScheduledSubTransaction: + ScheduledSubTransactionBase: required: - amount - deleted @@ -3416,6 +3620,18 @@ components: description: Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. + ScheduledSubTransaction: + allOf: + - $ref: "#/components/schemas/ScheduledSubTransactionBase" + - type: object + properties: + amount_formatted: + type: string + description: The scheduled subtransaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The scheduled subtransaction amount as a decimal currency amount MonthSummariesResponse: required: - data @@ -3447,7 +3663,7 @@ components: properties: month: $ref: "#/components/schemas/MonthDetail" - MonthSummary: + MonthSummaryBase: required: - activity - budgeted @@ -3492,6 +3708,52 @@ components: type: boolean description: Whether or not the month has been deleted. Deleted months will only be included in delta requests. + MonthSummary: + allOf: + - $ref: "#/components/schemas/MonthSummaryBase" + - type: object + properties: + income_formatted: + type: string + description: The total income formatted in the plan's currency format + income_currency: + type: number + format: double + description: The total income as a decimal currency amount + budgeted_formatted: + type: string + description: The total amount assigned formatted in the plan's currency format + budgeted_currency: + type: number + format: double + description: The total amount assigned as a decimal currency amount + activity_formatted: + type: string + description: The total activity amount formatted in the plan's currency format + activity_currency: + type: number + format: double + description: The total activity amount as a decimal currency amount + to_be_budgeted_formatted: + type: string + description: The available amount for 'Ready to Assign' formatted in the plan's currency format + to_be_budgeted_currency: + type: number + format: double + description: The available amount for 'Ready to Assign' as a decimal currency amount + MonthDetailBase: + allOf: + - $ref: "#/components/schemas/MonthSummaryBase" + - required: + - categories + type: object + properties: + categories: + type: array + description: The plan month categories. Amounts (budgeted, activity, balance, + etc.) are specific to the {month} parameter specified. + items: + $ref: "#/components/schemas/CategoryBase" MonthDetail: allOf: - $ref: "#/components/schemas/MonthSummary" @@ -3567,7 +3829,7 @@ components: type: integer description: The knowledge of the server format: int64 - MoneyMovement: + MoneyMovementBase: required: - id - amount @@ -3621,6 +3883,18 @@ components: type: integer description: The amount of the money movement in milliunits format format: int64 + MoneyMovement: + allOf: + - $ref: "#/components/schemas/MoneyMovementBase" + - type: object + properties: + amount_formatted: + type: string + description: The money movement amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The money movement amount as a decimal currency amount MoneyMovementGroupsResponse: required: - data diff --git a/ynab.gemspec b/ynab.gemspec index 854d372..625e736 100644 --- a/ynab.gemspec +++ b/ynab.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.email = ["api@ynab.com"] s.homepage = "https://github.com/ynab/ynab-sdk-ruby" s.summary = "Official Ruby client for the YNAB API" - s.description = "Official Ruby client for the YNAB API. API documentation available at https://api.ynab.com. Generated from server specification version 1.79.0." + s.description = "Official Ruby client for the YNAB API. API documentation available at https://api.ynab.com. Generated from server specification version 1.83.0." s.license = "Apache-2.0" s.required_ruby_version = ">= 3.3" s.metadata = {} From 5f0efdc9f007c9879d0b701e07019de088b2afe0 Mon Sep 17 00:00:00 2001 From: Brady Holt Date: Wed, 15 Apr 2026 16:42:24 -0500 Subject: [PATCH 2/3] Pin ruby/setup-ruby version --- .github/workflows/build-test.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 4e1d2e7..3615c11 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -7,7 +7,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0 with: ruby-version: 3.4.8 - name: Install gems diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 759275c..742201b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,7 +32,7 @@ jobs: git config user.name $GITHUB_ACTOR git config user.email gh-actions-${GITHUB_ACTOR}@github.com - name: Set up Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0 with: ruby-version: 3.4.8 - name: Upgrade RubyGems version From ec45f216ccc588c9403423d69336c682294e1ad1 Mon Sep 17 00:00:00 2001 From: Brady Holt Date: Wed, 15 Apr 2026 16:43:37 -0500 Subject: [PATCH 3/3] Pin actions/checkout --- .github/workflows/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 3615c11..35931ee 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -5,7 +5,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Ruby uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0 with: