diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 07dbc01..56c69d8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,10 +24,12 @@ jobs: uses: levibostian/action-hide-sensitive-inputs@v1 - uses: actions/checkout@v4 - name: Setup git repo + env: + GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }} run: | git config user.name $GITHUB_ACTOR git config user.email gh-actions-${GITHUB_ACTOR}@github.com - git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + git remote add gh-origin https://${GITHUB_ACTOR}:${GH_API_TOKEN}@github.com/${GITHUB_REPOSITORY}.git - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 6aafe0f..7a8a848 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -7,16 +7,6 @@ docs/AccountType.md docs/AccountsApi.md docs/AccountsResponse.md docs/AccountsResponseData.md -docs/BudgetDetail.md -docs/BudgetDetailResponse.md -docs/BudgetDetailResponseData.md -docs/BudgetSettings.md -docs/BudgetSettingsResponse.md -docs/BudgetSettingsResponseData.md -docs/BudgetSummary.md -docs/BudgetSummaryResponse.md -docs/BudgetSummaryResponseData.md -docs/BudgetsApi.md docs/BulkResponse.md docs/BulkResponseData.md docs/BulkResponseDataBulk.md @@ -33,10 +23,18 @@ docs/CurrencyFormat.md docs/DateFormat.md docs/ErrorDetail.md docs/ErrorResponse.md +docs/ExistingCategory.md docs/ExistingTransaction.md docs/HybridTransaction.md docs/HybridTransactionsResponse.md docs/HybridTransactionsResponseData.md +docs/MoneyMovement.md +docs/MoneyMovementGroup.md +docs/MoneyMovementGroupsResponse.md +docs/MoneyMovementGroupsResponseData.md +docs/MoneyMovementsApi.md +docs/MoneyMovementsResponse.md +docs/MoneyMovementsResponseData.md docs/MonthDetail.md docs/MonthDetailResponse.md docs/MonthDetailResponseData.md @@ -44,7 +42,9 @@ docs/MonthSummariesResponse.md docs/MonthSummariesResponseData.md docs/MonthSummary.md docs/MonthsApi.md +docs/NewCategory.md docs/NewTransaction.md +docs/PatchCategoryGroupWrapper.md docs/PatchCategoryWrapper.md docs/PatchMonthCategoryWrapper.md docs/PatchPayeeWrapper.md @@ -61,13 +61,28 @@ docs/PayeeResponseData.md docs/PayeesApi.md docs/PayeesResponse.md docs/PayeesResponseData.md +docs/PlanDetail.md +docs/PlanDetailResponse.md +docs/PlanDetailResponseData.md +docs/PlanSettings.md +docs/PlanSettingsResponse.md +docs/PlanSettingsResponseData.md +docs/PlanSummary.md +docs/PlanSummaryResponse.md +docs/PlanSummaryResponseData.md +docs/PlansApi.md docs/PostAccountWrapper.md +docs/PostCategoryGroupWrapper.md +docs/PostCategoryWrapper.md docs/PostScheduledTransactionWrapper.md docs/PostTransactionsWrapper.md docs/PutScheduledTransactionWrapper.md docs/PutTransactionWrapper.md docs/SaveAccount.md docs/SaveCategory.md +docs/SaveCategoryGroup.md +docs/SaveCategoryGroupResponse.md +docs/SaveCategoryGroupResponseData.md docs/SaveCategoryResponse.md docs/SaveCategoryResponseData.md docs/SaveMonthCategory.md @@ -107,15 +122,17 @@ docs/UserResponse.md docs/UserResponseData.md lib/ynab.rb lib/ynab/api/accounts_api.rb -lib/ynab/api/budgets_api.rb lib/ynab/api/categories_api.rb +lib/ynab/api/money_movements_api.rb lib/ynab/api/months_api.rb lib/ynab/api/payee_locations_api.rb lib/ynab/api/payees_api.rb +lib/ynab/api/plans_api.rb lib/ynab/api/scheduled_transactions_api.rb lib/ynab/api/transactions_api.rb lib/ynab/api/user_api.rb lib/ynab/api_client.rb +lib/ynab/api_model_base.rb lib/ynab/configuration.rb lib/ynab/models/account.rb lib/ynab/models/account_response.rb @@ -123,15 +140,6 @@ lib/ynab/models/account_response_data.rb lib/ynab/models/account_type.rb lib/ynab/models/accounts_response.rb lib/ynab/models/accounts_response_data.rb -lib/ynab/models/budget_detail.rb -lib/ynab/models/budget_detail_response.rb -lib/ynab/models/budget_detail_response_data.rb -lib/ynab/models/budget_settings.rb -lib/ynab/models/budget_settings_response.rb -lib/ynab/models/budget_settings_response_data.rb -lib/ynab/models/budget_summary.rb -lib/ynab/models/budget_summary_response.rb -lib/ynab/models/budget_summary_response_data.rb lib/ynab/models/bulk_response.rb lib/ynab/models/bulk_response_data.rb lib/ynab/models/bulk_response_data_bulk.rb @@ -147,17 +155,26 @@ lib/ynab/models/currency_format.rb lib/ynab/models/date_format.rb lib/ynab/models/error_detail.rb lib/ynab/models/error_response.rb +lib/ynab/models/existing_category.rb lib/ynab/models/existing_transaction.rb 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_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_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/new_category.rb lib/ynab/models/new_transaction.rb +lib/ynab/models/patch_category_group_wrapper.rb lib/ynab/models/patch_category_wrapper.rb lib/ynab/models/patch_month_category_wrapper.rb lib/ynab/models/patch_payee_wrapper.rb @@ -172,13 +189,27 @@ lib/ynab/models/payee_response.rb lib/ynab/models/payee_response_data.rb lib/ynab/models/payees_response.rb lib/ynab/models/payees_response_data.rb +lib/ynab/models/plan_detail.rb +lib/ynab/models/plan_detail_response.rb +lib/ynab/models/plan_detail_response_data.rb +lib/ynab/models/plan_settings.rb +lib/ynab/models/plan_settings_response.rb +lib/ynab/models/plan_settings_response_data.rb +lib/ynab/models/plan_summary.rb +lib/ynab/models/plan_summary_response.rb +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_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_category.rb +lib/ynab/models/save_category_group.rb +lib/ynab/models/save_category_group_response.rb +lib/ynab/models/save_category_group_response_data.rb lib/ynab/models/save_category_response.rb lib/ynab/models/save_category_response_data.rb lib/ynab/models/save_month_category.rb diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index e465da4..2540a3a 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.14.0 +7.20.0 diff --git a/Gemfile b/Gemfile index 5c0f85f..312bd6c 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source 'https://rubygems.org' gemspec group :development, :test do + gem "base64" gem "rake", ">= 12.3.3" gem "vcr", ">=3.0.3" end diff --git a/Gemfile.lock b/Gemfile.lock index 382851a..f122398 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,13 @@ PATH remote: . specs: - ynab (3.8.0) + ynab (3.9.0) typhoeus (~> 1.0, >= 1.0.1) GEM remote: https://rubygems.org/ specs: + base64 (0.3.0) diff-lcs (1.3) ethon (0.16.0) ffi (>= 1.15.0) @@ -33,6 +34,7 @@ PLATFORMS ruby DEPENDENCIES + base64 rake (>= 12.3.3) rspec (~> 3.6, >= 3.6.0) vcr (>= 3.0.3) diff --git a/README.md b/README.md index 74323cb..bb2dcf3 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,11 @@ require 'ynab' access_token = ENV['YNAB_ACCESS_TOKEN'] ynab_api = YNAB::API.new(access_token) -budget_response = ynab_api.budgets.get_budgets -budgets = budget_response.data.budgets +plan_response = ynab_api.plans.get_plans +plans = plan_response.data.budgets -budgets.each do |budget| - puts "Budget Name: #{budget.name}" +plans.each do |plan| + puts "Plan Name: #{plan.name}" end ``` @@ -48,40 +48,48 @@ The following methods are available in this library. | | Method | Description | |----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------| | **User** | [user.get_user()](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/UserApi.md#get_user) | Returns authenticated user information | -| **Budgets** | [budgets.get_budgets()](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/BudgetsApi.md#get_budgets) | Returns budgets list with summary information | -| | [budgets.get_budget_by_id(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/BudgetsApi.md#get_budget_by_id) | Returns a single budget with all related entities | -| | [budgets.get_budget_settings_by_id(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/BudgetsApi.md#get_budget_settings_by_id) | Returns settings for a budget | -| **Accounts** | [accounts.get_accounts(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#get_accounts) | Returns all accounts | -| | [accounts.get_account_by_id(budget_id, account_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#get_account_by_id) | Returns a single account | -| **Categories** | [categories.get_categories(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_categories) | Returns all categories grouped by category group. | -| | [categories.get_category_by_id(budget_id, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_category_by_id) | Returns a single category | -| | [categories.get_month_category_by_id(budget_id, month, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#get_month_category_by_id) | Returns a single category for a specific budget month -| | [categories.update_category(budget_id, category_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_category) | Update an existing category -| | [categories.update_month_category(budget_id, month, category_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_month_category) | Update an existing month category -| **Payees** | [payees.get_payees(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#get_payees) | Returns all payees | -| | [payees.get_payee_by_id(budget_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#get_payee_by_id) | Returns single payee | -| **Payee Locations** | [payee_locations.get_payee_locations(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_locations) | Returns all payee locations | -| | [payee_locations.get_payee_location_by_id(budget_id, payee_location_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_location_by_id) | Returns a single payee location | -| | [payee_locations.get_payee_locations_by_payee(budget_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_locations_by_payee) | Returns all payee locations for the specified payee | -| **Months** | [months.get_budget_months(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#get_budget_months) | Returns all budget months | -| | [months.get_budget_month(budget_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#get_budget_month) | Returns a single budget month | -| | [months.update_month_category(budget_id, month, category_id, month_category)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#update_month_category) | Update an existing month category | -| **Transactions** | [transactions.get_transactions(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions) | Returns budget transactions | -| | [transactions.get_transactions_by_account(budget_id, account_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_account) | Returns all transactions for a specified account | -| | [transactions.get_transactions_by_category(budget_id, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_category) | Returns all transactions for a specified category | -| | [transactions.get_transactions_by_month(budget_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_month) | Returns all transactions for a specified month | -| | [transactions.get_transaction_by_id(budget_id, transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transaction_by_id) | Returns a single transaction | -| | [transactions.create_transaction(budget_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#create_transaction) | Creates a single transaction | -| | [transactions.create_transactions(budget_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#create_transaction) | Creates multiple transactions | -| | [transactions.update_transaction(budget_id, id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#update_transaction) | Updates a single transaction | -| | [transactions.update_transactions(budget_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#update_transactions) | Updates multiple transactions | -| | [transactions.delete_transaction(budget_id, transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#delete_transaction) | Deletes a single transaction | -| | [transactions.import_transactions(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#import_transactions) | Imports transactions | -| **Scheduled Transactions** | [scheduled_transactions.get_scheduled_transactions(budget_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#get_scheduled_transactions) | Returns all scheduled transactions | -| | [scheduled_transactions.get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | Returns a single scheduled transaction | -| | [scheduled_transactions.create_scheduled_transaction(budget_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#create_scheduled_transaction) | Creates a single scheduled transaction | -| | [scheduled_transactions.update_scheduled_transaction(budget_id, scheduled_transaction_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#update_scheduled_transaction) | Updates a single scheduled transaction | -| | [scheduled_transactions.delete_scheduled_transaction(budget_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#delete_scheduled_transaction) | Deletes a single scheduled transaction | +| **Plans** | [plans.get_plans()](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PlansApi.md#get_plans) | Returns plans list with summary information | +| | [plans.get_plan_by_id(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PlansApi.md#get_plan_by_id) | Returns a single plan with all related entities | +| | [plans.get_plan_settings_by_id(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PlansApi.md#get_plan_settings_by_id) | Returns settings for a plan | +| **Accounts** | [accounts.get_accounts(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#get_accounts) | Returns all accounts | +| | [accounts.get_account_by_id(plan_id, account_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#get_account_by_id) | Returns a single account | +| | [accounts.create_account(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/AccountsApi.md#create_account) | Creates a new account | +| **Categories** | [categories.get_categories(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_categories) | Returns all categories grouped by category group | +| | [categories.get_category_by_id(plan_id, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_category_by_id) | Returns a single category | +| | [categories.get_month_category_by_id(plan_id, month, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#get_month_category_by_id) | Returns a single category for a specific plan month | +| | [categories.create_category(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#create_category) | Creates a new category | +| | [categories.create_category_group(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#create_category_group) | Creates a new category group | +| | [categories.update_category(plan_id, category_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_category) | Updates a category | +| | [categories.update_category_group(plan_id, category_group_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_category_group) | Updates a category group | +| | [categories.update_month_category(plan_id, month, category_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/CategoriesApi.md#update_month_category) | Updates a category for a specific month | +| **Payees** | [payees.get_payees(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#get_payees) | Returns all payees | +| | [payees.get_payee_by_id(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#get_payee_by_id) | Returns a single payee | +| | [payees.update_payee(plan_id, payee_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeesApi.md#update_payee) | Updates a payee | +| **Payee Locations** | [payee_locations.get_payee_locations(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_locations) | Returns all payee locations | +| | [payee_locations.get_payee_location_by_id(plan_id, payee_location_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_location_by_id) | Returns a single payee location | +| | [payee_locations.get_payee_locations_by_payee(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/PayeeLocationsApi.md#get_payee_locations_by_payee) | Returns all payee locations for the specified payee | +| **Months** | [months.get_plan_months(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#get_plan_months) | Returns all plan months | +| | [months.get_plan_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MonthsApi.md#get_plan_month) | Returns a single plan month | +| **Money Movements** | [money_movements.get_money_movements(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movements) | Returns all money movements | +| | [money_movements.get_money_movements_by_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movements_by_month) | Returns all money movements for a specific month | +| | [money_movements.get_money_movement_groups(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movement_groups) | Returns all money movement groups | +| | [money_movements.get_money_movement_groups_by_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/MoneyMovementsApi.md#get_money_movement_groups_by_month) | Returns all money movement groups for a specific month| +| **Transactions** | [transactions.get_transactions(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions) | Returns plan transactions | +| | [transactions.get_transactions_by_account(plan_id, account_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_account) | Returns all transactions for a specified account | +| | [transactions.get_transactions_by_category(plan_id, category_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_category) | Returns all transactions for a specified category | +| | [transactions.get_transactions_by_payee(plan_id, payee_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_payee) | Returns all transactions for a specified payee | +| | [transactions.get_transactions_by_month(plan_id, month)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transactions_by_month) | Returns all transactions for a specified month | +| | [transactions.get_transaction_by_id(plan_id, transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#get_transaction_by_id) | Returns a single transaction | +| | [transactions.create_transaction(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#create_transaction) | Creates a single transaction or multiple transactions | +| | [transactions.update_transaction(plan_id, transaction_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#update_transaction) | Updates a single transaction | +| | [transactions.update_transactions(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#update_transactions) | Updates multiple transactions | +| | [transactions.delete_transaction(plan_id, transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#delete_transaction) | Deletes a single transaction | +| | [transactions.import_transactions(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/TransactionsApi.md#import_transactions) | Imports transactions | +| **Scheduled Transactions** | [scheduled_transactions.get_scheduled_transactions(plan_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#get_scheduled_transactions) | Returns all scheduled transactions | +| | [scheduled_transactions.get_scheduled_transaction_by_id(plan_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | Returns a single scheduled transaction | +| | [scheduled_transactions.create_scheduled_transaction(plan_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#create_scheduled_transaction) | Creates a single scheduled transaction | +| | [scheduled_transactions.update_scheduled_transaction(plan_id, scheduled_transaction_id, data)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#update_scheduled_transaction) | Updates a single scheduled transaction | +| | [scheduled_transactions.delete_scheduled_transaction(plan_id, scheduled_transaction_id)](https://github.com/ynab/ynab-sdk-ruby/blob/master/docs/ScheduledTransactionsApi.md#delete_scheduled_transaction) | Deletes a single scheduled transaction | ## Versioning @@ -89,6 +97,6 @@ The version of this client is defined in the `ynab.gemspec` file and follows [se ## License -Copyright (c) 2024 You Need A Budget, LLC +Copyright (c) 2024 YNAB Licensed under the Apache-2.0 license diff --git a/Rakefile b/Rakefile index b9a3f67..25fe7f4 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ begin require 'rspec/core/rake_task' require 'bundler/gem_tasks' - require 'lib/ynab/version' + require_relative 'lib/ynab/version' RSpec::Core::RakeTask.new(:spec) do |t| t.rspec_opts = "-fd" diff --git a/docs/Account.md b/docs/Account.md index e9e1053..125d285 100644 --- a/docs/Account.md +++ b/docs/Account.md @@ -7,17 +7,17 @@ | **id** | **String** | | | | **name** | **String** | | | | **type** | [**AccountType**](AccountType.md) | | | -| **on_budget** | **Boolean** | Whether this account is on budget or not | | +| **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 balance of the account in milliunits format | | +| **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** | The original debt/loan account balance, specified in milliunits format. | [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] | diff --git a/docs/AccountsApi.md b/docs/AccountsApi.md index cd5ce99..713ff88 100644 --- a/docs/AccountsApi.md +++ b/docs/AccountsApi.md @@ -4,16 +4,16 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**create_account**](AccountsApi.md#create_account) | **POST** /budgets/{budget_id}/accounts | Create a new account | -| [**get_account_by_id**](AccountsApi.md#get_account_by_id) | **GET** /budgets/{budget_id}/accounts/{account_id} | Single account | -| [**get_accounts**](AccountsApi.md#get_accounts) | **GET** /budgets/{budget_id}/accounts | Account list | +| [**create_account**](AccountsApi.md#create_account) | **POST** /budgets/{plan_id}/accounts | Create an account | +| [**get_account_by_id**](AccountsApi.md#get_account_by_id) | **GET** /budgets/{plan_id}/accounts/{account_id} | Get an account | +| [**get_accounts**](AccountsApi.md#get_accounts) | **GET** /budgets/{plan_id}/accounts | Get all accounts | ## create_account -> create_account(budget_id, data) +> create_account(plan_id, data) -Create a new account +Create an account Creates a new account @@ -21,7 +21,7 @@ Creates a new account | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget) | | +| **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** | [**PostAccountWrapper**](PostAccountWrapper.md) | The account to create. | | ### Return type @@ -31,9 +31,9 @@ Creates a new account ## get_account_by_id -> get_account_by_id(budget_id, account_id) +> get_account_by_id(plan_id, account_id) -Single account +Get an account Returns a single account @@ -41,7 +41,7 @@ Returns a single account | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **account_id** | **String** | The id of the account | | ### Return type @@ -51,9 +51,9 @@ Returns a single account ## get_accounts -> get_accounts(budget_id, opts) +> get_accounts(plan_id, opts) -Account list +Get all accounts Returns all accounts @@ -61,7 +61,7 @@ Returns all accounts | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | ### Return type diff --git a/docs/BudgetSettingsResponseData.md b/docs/BudgetSettingsResponseData.md deleted file mode 100644 index 10eabf9..0000000 --- a/docs/BudgetSettingsResponseData.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::BudgetSettingsResponseData - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **settings** | [**BudgetSettings**](BudgetSettings.md) | | | - diff --git a/docs/BudgetSummary.md b/docs/BudgetSummary.md deleted file mode 100644 index 3043b36..0000000 --- a/docs/BudgetSummary.md +++ /dev/null @@ -1,15 +0,0 @@ -# YNAB::BudgetSummary - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | | | -| **name** | **String** | | | -| **last_modified_on** | **Time** | The last time any changes were made to the budget from either a web or mobile client | [optional] | -| **first_month** | **Date** | The earliest budget month | [optional] | -| **last_month** | **Date** | The latest budget month | [optional] | -| **date_format** | [**DateFormat**](DateFormat.md) | | [optional] | -| **currency_format** | [**CurrencyFormat**](CurrencyFormat.md) | | [optional] | -| **accounts** | [**Array<Account>**](Account.md) | The budget accounts (only included if `include_accounts=true` specified as query parameter) | [optional] | - diff --git a/docs/BudgetSummaryResponse.md b/docs/BudgetSummaryResponse.md deleted file mode 100644 index bddbd42..0000000 --- a/docs/BudgetSummaryResponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::BudgetSummaryResponse - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **data** | [**BudgetSummaryResponseData**](BudgetSummaryResponseData.md) | | | - diff --git a/docs/BudgetSummaryResponseData.md b/docs/BudgetSummaryResponseData.md deleted file mode 100644 index b5180a2..0000000 --- a/docs/BudgetSummaryResponseData.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::BudgetSummaryResponseData - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **budgets** | [**Array<BudgetSummary>**](BudgetSummary.md) | | | -| **default_budget** | [**BudgetSummary**](BudgetSummary.md) | | [optional] | - diff --git a/docs/BudgetsApi.md b/docs/BudgetsApi.md deleted file mode 100644 index 3591ea6..0000000 --- a/docs/BudgetsApi.md +++ /dev/null @@ -1,68 +0,0 @@ -# YNAB::BudgetsApi - -All URIs are relative to *https://api.ynab.com/v1* - -| Method | HTTP request | Description | -| ------ | ------------ | ----------- | -| [**get_budget_by_id**](BudgetsApi.md#get_budget_by_id) | **GET** /budgets/{budget_id} | Single budget | -| [**get_budget_settings_by_id**](BudgetsApi.md#get_budget_settings_by_id) | **GET** /budgets/{budget_id}/settings | Budget Settings | -| [**get_budgets**](BudgetsApi.md#get_budgets) | **GET** /budgets | List budgets | - - -## get_budget_by_id - -> get_budget_by_id(budget_id, opts) - -Single budget - -Returns a single budget with all related entities. This resource is effectively a full budget export. - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | -| **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | - -### Return type - -[**BudgetDetailResponse**](BudgetDetailResponse.md) - - -## get_budget_settings_by_id - -> get_budget_settings_by_id(budget_id) - -Budget Settings - -Returns settings for a budget - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | - -### Return type - -[**BudgetSettingsResponse**](BudgetSettingsResponse.md) - - -## get_budgets - -> get_budgets(opts) - -List budgets - -Returns budgets list with summary information - -### Parameters - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **include_accounts** | **Boolean** | Whether to include the list of budget accounts | [optional] | - -### Return type - -[**BudgetSummaryResponse**](BudgetSummaryResponse.md) - diff --git a/docs/CategoriesApi.md b/docs/CategoriesApi.md index d32fe65..3ccee49 100644 --- a/docs/CategoriesApi.md +++ b/docs/CategoriesApi.md @@ -4,26 +4,69 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**get_categories**](CategoriesApi.md#get_categories) | **GET** /budgets/{budget_id}/categories | List categories | -| [**get_category_by_id**](CategoriesApi.md#get_category_by_id) | **GET** /budgets/{budget_id}/categories/{category_id} | Single category | -| [**get_month_category_by_id**](CategoriesApi.md#get_month_category_by_id) | **GET** /budgets/{budget_id}/months/{month}/categories/{category_id} | Single category for a specific budget month | -| [**update_category**](CategoriesApi.md#update_category) | **PATCH** /budgets/{budget_id}/categories/{category_id} | Update a category | -| [**update_month_category**](CategoriesApi.md#update_month_category) | **PATCH** /budgets/{budget_id}/months/{month}/categories/{category_id} | Update a category for a specific month | +| [**create_category**](CategoriesApi.md#create_category) | **POST** /budgets/{plan_id}/categories | Create a category | +| [**create_category_group**](CategoriesApi.md#create_category_group) | **POST** /budgets/{plan_id}/category_groups | Create a category group | +| [**get_categories**](CategoriesApi.md#get_categories) | **GET** /budgets/{plan_id}/categories | Get all categories | +| [**get_category_by_id**](CategoriesApi.md#get_category_by_id) | **GET** /budgets/{plan_id}/categories/{category_id} | Get a category | +| [**get_month_category_by_id**](CategoriesApi.md#get_month_category_by_id) | **GET** /budgets/{plan_id}/months/{month}/categories/{category_id} | Get a category for a specific plan month | +| [**update_category**](CategoriesApi.md#update_category) | **PATCH** /budgets/{plan_id}/categories/{category_id} | Update a category | +| [**update_category_group**](CategoriesApi.md#update_category_group) | **PATCH** /budgets/{plan_id}/category_groups/{category_group_id} | Update a category group | +| [**update_month_category**](CategoriesApi.md#update_month_category) | **PATCH** /budgets/{plan_id}/months/{month}/categories/{category_id} | Update a category for a specific month | + + +## create_category + +> create_category(plan_id, data) + +Create a category + +Creates a new category + +### 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** | [**PostCategoryWrapper**](PostCategoryWrapper.md) | The category to create. | | + +### Return type + +[**SaveCategoryResponse**](SaveCategoryResponse.md) + + +## create_category_group + +> create_category_group(plan_id, data) + +Create a category group + +Creates a new category group + +### 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** | [**PostCategoryGroupWrapper**](PostCategoryGroupWrapper.md) | The category group to create. | | + +### Return type + +[**SaveCategoryGroupResponse**](SaveCategoryGroupResponse.md) ## get_categories -> get_categories(budget_id, opts) +> get_categories(plan_id, opts) -List categories +Get all categories -Returns all categories grouped by category group. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). +Returns all categories grouped by category group. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | ### Return type @@ -33,17 +76,17 @@ Returns all categories grouped by category group. Amounts (budgeted, activity, ## get_category_by_id -> get_category_by_id(budget_id, category_id) +> get_category_by_id(plan_id, category_id) -Single category +Get a category -Returns a single category. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). +Returns a single category. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **category_id** | **String** | The id of the category | | ### Return type @@ -53,18 +96,18 @@ Returns a single category. Amounts (budgeted, activity, balance, etc.) are spec ## get_month_category_by_id -> get_month_category_by_id(budget_id, month, category_id) +> get_month_category_by_id(plan_id, month, category_id) -Single category for a specific budget month +Get a category for a specific plan month -Returns a single category for a specific budget month. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). +Returns a single category for a specific plan month. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | -| **month** | **Date** | The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | +| **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). | | +| **month** | **Date** | The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | | **category_id** | **String** | The id of the category | | ### Return type @@ -74,7 +117,7 @@ Returns a single category for a specific budget month. Amounts (budgeted, activ ## update_category -> update_category(budget_id, category_id, data) +> update_category(plan_id, category_id, data) Update a category @@ -84,7 +127,7 @@ Update a category | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **category_id** | **String** | The id of the category | | | **data** | [**PatchCategoryWrapper**](PatchCategoryWrapper.md) | The category to update | | @@ -93,22 +136,43 @@ Update a category [**SaveCategoryResponse**](SaveCategoryResponse.md) +## update_category_group + +> update_category_group(plan_id, category_group_id, data) + +Update a category group + +Update a category group + +### 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). | | +| **category_group_id** | **String** | The id of the category group | | +| **data** | [**PatchCategoryGroupWrapper**](PatchCategoryGroupWrapper.md) | The category group to update | | + +### Return type + +[**SaveCategoryGroupResponse**](SaveCategoryGroupResponse.md) + + ## update_month_category -> update_month_category(budget_id, month, category_id, data) +> update_month_category(plan_id, month, category_id, data) Update a category for a specific month -Update a category for a specific month. Only `budgeted` amount can be updated. +Update a category for a specific month. Only `budgeted` (assigned) amount can be updated. ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | -| **month** | **Date** | The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | +| **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). | | +| **month** | **Date** | The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | | **category_id** | **String** | The id of the category | | -| **data** | [**PatchMonthCategoryWrapper**](PatchMonthCategoryWrapper.md) | The category to update. Only `budgeted` amount can be updated and any other fields specified will be ignored. | | +| **data** | [**PatchMonthCategoryWrapper**](PatchMonthCategoryWrapper.md) | The category to update. Only `budgeted` (assigned) amount can be updated and any other fields specified will be ignored. | | ### Return type diff --git a/docs/Category.md b/docs/Category.md index 481114e..555efea 100644 --- a/docs/Category.md +++ b/docs/Category.md @@ -11,9 +11,9 @@ | **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** | Budgeted amount in milliunits format | | +| **budgeted** | **Integer** | Assigned (budgeted) amount in milliunits format | | | **activity** | **Integer** | Activity amount in milliunits format | | -| **balance** | **Integer** | Balance 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] | @@ -21,7 +21,8 @@ | **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** | The original target month for the goal to be completed. Only some goal types specify this date. | [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] | diff --git a/docs/CategoryGroupWithCategories.md b/docs/CategoryGroupWithCategories.md index 2d99072..8e9b7d7 100644 --- a/docs/CategoryGroupWithCategories.md +++ b/docs/CategoryGroupWithCategories.md @@ -8,5 +8,5 @@ | **name** | **String** | | | | **hidden** | **Boolean** | Whether or not the category group is hidden | | | **deleted** | **Boolean** | Whether or not the category group has been deleted. Deleted category groups will only be included in delta requests. | | -| **categories** | [**Array<Category>**](Category.md) | Category group categories. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). | | +| **categories** | [**Array<Category>**](Category.md) | Category group categories. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). | | diff --git a/docs/ExistingCategory.md b/docs/ExistingCategory.md new file mode 100644 index 0000000..a459aa6 --- /dev/null +++ b/docs/ExistingCategory.md @@ -0,0 +1,12 @@ +# YNAB::ExistingCategory + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **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_date** | **Date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] | + diff --git a/docs/MoneyMovement.md b/docs/MoneyMovement.md new file mode 100644 index 0000000..d24303d --- /dev/null +++ b/docs/MoneyMovement.md @@ -0,0 +1,16 @@ +# YNAB::MoneyMovement + +## 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/MoneyMovementGroup.md b/docs/MoneyMovementGroup.md new file mode 100644 index 0000000..f2e132b --- /dev/null +++ b/docs/MoneyMovementGroup.md @@ -0,0 +1,12 @@ +# YNAB::MoneyMovementGroup + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **group_created_at** | **Time** | When the money movement group was created | | +| **month** | **Date** | The month of the money movement group in ISO format (e.g. 2024-01-01) | | +| **note** | **String** | | [optional] | +| **performed_by_user_id** | **String** | The id of the user who performed the money movement group | [optional] | + diff --git a/docs/MoneyMovementGroupsResponse.md b/docs/MoneyMovementGroupsResponse.md new file mode 100644 index 0000000..847c17a --- /dev/null +++ b/docs/MoneyMovementGroupsResponse.md @@ -0,0 +1,8 @@ +# YNAB::MoneyMovementGroupsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**MoneyMovementGroupsResponseData**](MoneyMovementGroupsResponseData.md) | | | + diff --git a/docs/MoneyMovementGroupsResponseData.md b/docs/MoneyMovementGroupsResponseData.md new file mode 100644 index 0000000..359eb0b --- /dev/null +++ b/docs/MoneyMovementGroupsResponseData.md @@ -0,0 +1,9 @@ +# YNAB::MoneyMovementGroupsResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **money_movement_groups** | [**Array<MoneyMovementGroup>**](MoneyMovementGroup.md) | | | +| **server_knowledge** | **Integer** | The knowledge of the server | | + diff --git a/docs/MoneyMovementsApi.md b/docs/MoneyMovementsApi.md new file mode 100644 index 0000000..e969264 --- /dev/null +++ b/docs/MoneyMovementsApi.md @@ -0,0 +1,89 @@ +# YNAB::MoneyMovementsApi + +All URIs are relative to *https://api.ynab.com/v1* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_money_movement_groups**](MoneyMovementsApi.md#get_money_movement_groups) | **GET** /budgets/{plan_id}/money_movement_groups | Get all money movement groups | +| [**get_money_movement_groups_by_month**](MoneyMovementsApi.md#get_money_movement_groups_by_month) | **GET** /budgets/{plan_id}/months/{month}/money_movement_groups | Get money movement groups for a plan month | +| [**get_money_movements**](MoneyMovementsApi.md#get_money_movements) | **GET** /budgets/{plan_id}/money_movements | Get all money movements | +| [**get_money_movements_by_month**](MoneyMovementsApi.md#get_money_movements_by_month) | **GET** /budgets/{plan_id}/months/{month}/money_movements | Get money movements for a plan month | + + +## get_money_movement_groups + +> get_money_movement_groups(plan_id) + +Get all money movement groups + +Returns all money movement groups + +### 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). | | + +### Return type + +[**MoneyMovementGroupsResponse**](MoneyMovementGroupsResponse.md) + + +## get_money_movement_groups_by_month + +> get_money_movement_groups_by_month(plan_id, month) + +Get money movement groups for a plan month + +Returns all money movement groups for a specific month + +### 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). | | +| **month** | **Date** | The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | + +### Return type + +[**MoneyMovementGroupsResponse**](MoneyMovementGroupsResponse.md) + + +## get_money_movements + +> get_money_movements(plan_id) + +Get all money movements + +Returns all money movements + +### 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). | | + +### Return type + +[**MoneyMovementsResponse**](MoneyMovementsResponse.md) + + +## get_money_movements_by_month + +> get_money_movements_by_month(plan_id, month) + +Get money movements for a plan month + +Returns all money movements for a specific month + +### 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). | | +| **month** | **Date** | The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | + +### Return type + +[**MoneyMovementsResponse**](MoneyMovementsResponse.md) + diff --git a/docs/BudgetSettingsResponse.md b/docs/MoneyMovementsResponse.md similarity index 54% rename from docs/BudgetSettingsResponse.md rename to docs/MoneyMovementsResponse.md index b583750..84ea80c 100644 --- a/docs/BudgetSettingsResponse.md +++ b/docs/MoneyMovementsResponse.md @@ -1,8 +1,8 @@ -# YNAB::BudgetSettingsResponse +# YNAB::MoneyMovementsResponse ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **data** | [**BudgetSettingsResponseData**](BudgetSettingsResponseData.md) | | | +| **data** | [**MoneyMovementsResponseData**](MoneyMovementsResponseData.md) | | | diff --git a/docs/MoneyMovementsResponseData.md b/docs/MoneyMovementsResponseData.md new file mode 100644 index 0000000..de24152 --- /dev/null +++ b/docs/MoneyMovementsResponseData.md @@ -0,0 +1,9 @@ +# YNAB::MoneyMovementsResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **money_movements** | [**Array<MoneyMovement>**](MoneyMovement.md) | | | +| **server_knowledge** | **Integer** | The knowledge of the server | | + diff --git a/docs/MonthDetail.md b/docs/MonthDetail.md index fb45eef..684ecf2 100644 --- a/docs/MonthDetail.md +++ b/docs/MonthDetail.md @@ -7,10 +7,10 @@ | **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 budgeted 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<Category>**](Category.md) | The budget month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. | | +| **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/MonthSummary.md b/docs/MonthSummary.md index 0522675..84997b4 100644 --- a/docs/MonthSummary.md +++ b/docs/MonthSummary.md @@ -7,7 +7,7 @@ | **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 budgeted 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] | diff --git a/docs/MonthsApi.md b/docs/MonthsApi.md index e1eb68b..3dbf386 100644 --- a/docs/MonthsApi.md +++ b/docs/MonthsApi.md @@ -4,43 +4,43 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**get_budget_month**](MonthsApi.md#get_budget_month) | **GET** /budgets/{budget_id}/months/{month} | Single budget month | -| [**get_budget_months**](MonthsApi.md#get_budget_months) | **GET** /budgets/{budget_id}/months | List budget months | +| [**get_plan_month**](MonthsApi.md#get_plan_month) | **GET** /budgets/{plan_id}/months/{month} | Get a plan month | +| [**get_plan_months**](MonthsApi.md#get_plan_months) | **GET** /budgets/{plan_id}/months | Get all plan months | -## get_budget_month +## get_plan_month -> get_budget_month(budget_id, month) +> get_plan_month(plan_id, month) -Single budget month +Get a plan month -Returns a single budget month +Returns a single plan month ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | -| **month** | **Date** | The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | +| **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). | | +| **month** | **Date** | The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | ### Return type [**MonthDetailResponse**](MonthDetailResponse.md) -## get_budget_months +## get_plan_months -> get_budget_months(budget_id, opts) +> get_plan_months(plan_id, opts) -List budget months +Get all plan months -Returns all budget months +Returns all plan months ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | ### Return type diff --git a/docs/NewCategory.md b/docs/NewCategory.md new file mode 100644 index 0000000..9b4b872 --- /dev/null +++ b/docs/NewCategory.md @@ -0,0 +1,12 @@ +# YNAB::NewCategory + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **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_date** | **Date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] | + diff --git a/docs/PatchCategoryGroupWrapper.md b/docs/PatchCategoryGroupWrapper.md new file mode 100644 index 0000000..2950f44 --- /dev/null +++ b/docs/PatchCategoryGroupWrapper.md @@ -0,0 +1,8 @@ +# YNAB::PatchCategoryGroupWrapper + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **category_group** | [**SaveCategoryGroup**](SaveCategoryGroup.md) | | | + diff --git a/docs/PatchCategoryWrapper.md b/docs/PatchCategoryWrapper.md index c7beb0b..35d457e 100644 --- a/docs/PatchCategoryWrapper.md +++ b/docs/PatchCategoryWrapper.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **category** | [**SaveCategory**](SaveCategory.md) | | | +| **category** | [**ExistingCategory**](ExistingCategory.md) | | | diff --git a/docs/PayeeLocationsApi.md b/docs/PayeeLocationsApi.md index 9343b4b..4da3d01 100644 --- a/docs/PayeeLocationsApi.md +++ b/docs/PayeeLocationsApi.md @@ -4,16 +4,16 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**get_payee_location_by_id**](PayeeLocationsApi.md#get_payee_location_by_id) | **GET** /budgets/{budget_id}/payee_locations/{payee_location_id} | Single payee location | -| [**get_payee_locations**](PayeeLocationsApi.md#get_payee_locations) | **GET** /budgets/{budget_id}/payee_locations | List payee locations | -| [**get_payee_locations_by_payee**](PayeeLocationsApi.md#get_payee_locations_by_payee) | **GET** /budgets/{budget_id}/payees/{payee_id}/payee_locations | List locations for a payee | +| [**get_payee_location_by_id**](PayeeLocationsApi.md#get_payee_location_by_id) | **GET** /budgets/{plan_id}/payee_locations/{payee_location_id} | Get a payee location | +| [**get_payee_locations**](PayeeLocationsApi.md#get_payee_locations) | **GET** /budgets/{plan_id}/payee_locations | Get all payee locations | +| [**get_payee_locations_by_payee**](PayeeLocationsApi.md#get_payee_locations_by_payee) | **GET** /budgets/{plan_id}/payees/{payee_id}/payee_locations | Get all locations for a payee | ## get_payee_location_by_id -> get_payee_location_by_id(budget_id, payee_location_id) +> get_payee_location_by_id(plan_id, payee_location_id) -Single payee location +Get a payee location Returns a single payee location @@ -21,7 +21,7 @@ Returns a single payee location | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **payee_location_id** | **String** | id of payee location | | ### Return type @@ -31,9 +31,9 @@ Returns a single payee location ## get_payee_locations -> get_payee_locations(budget_id) +> get_payee_locations(plan_id) -List payee locations +Get all payee locations Returns all payee locations @@ -41,7 +41,7 @@ Returns all payee locations | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | ### Return type @@ -50,9 +50,9 @@ Returns all payee locations ## get_payee_locations_by_payee -> get_payee_locations_by_payee(budget_id, payee_id) +> get_payee_locations_by_payee(plan_id, payee_id) -List locations for a payee +Get all locations for a payee Returns all payee locations for a specified payee @@ -60,7 +60,7 @@ Returns all payee locations for a specified payee | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **payee_id** | **String** | id of payee | | ### Return type diff --git a/docs/PayeesApi.md b/docs/PayeesApi.md index 2717d2e..5242709 100644 --- a/docs/PayeesApi.md +++ b/docs/PayeesApi.md @@ -4,16 +4,16 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**get_payee_by_id**](PayeesApi.md#get_payee_by_id) | **GET** /budgets/{budget_id}/payees/{payee_id} | Single payee | -| [**get_payees**](PayeesApi.md#get_payees) | **GET** /budgets/{budget_id}/payees | List payees | -| [**update_payee**](PayeesApi.md#update_payee) | **PATCH** /budgets/{budget_id}/payees/{payee_id} | Update a payee | +| [**get_payee_by_id**](PayeesApi.md#get_payee_by_id) | **GET** /budgets/{plan_id}/payees/{payee_id} | Get a payee | +| [**get_payees**](PayeesApi.md#get_payees) | **GET** /budgets/{plan_id}/payees | Get all payees | +| [**update_payee**](PayeesApi.md#update_payee) | **PATCH** /budgets/{plan_id}/payees/{payee_id} | Update a payee | ## get_payee_by_id -> get_payee_by_id(budget_id, payee_id) +> get_payee_by_id(plan_id, payee_id) -Single payee +Get a payee Returns a single payee @@ -21,7 +21,7 @@ Returns a single payee | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **payee_id** | **String** | The id of the payee | | ### Return type @@ -31,9 +31,9 @@ Returns a single payee ## get_payees -> get_payees(budget_id, opts) +> get_payees(plan_id, opts) -List payees +Get all payees Returns all payees @@ -41,7 +41,7 @@ Returns all payees | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | ### Return type @@ -51,7 +51,7 @@ Returns all payees ## update_payee -> update_payee(budget_id, payee_id, data) +> update_payee(plan_id, payee_id, data) Update a payee @@ -61,7 +61,7 @@ Update a payee | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **payee_id** | **String** | The id of the payee | | | **data** | [**PatchPayeeWrapper**](PatchPayeeWrapper.md) | The payee to update | | diff --git a/docs/BudgetDetail.md b/docs/PlanDetail.md similarity index 84% rename from docs/BudgetDetail.md rename to docs/PlanDetail.md index daa07f6..3acea04 100644 --- a/docs/BudgetDetail.md +++ b/docs/PlanDetail.md @@ -1,4 +1,4 @@ -# YNAB::BudgetDetail +# YNAB::PlanDetail ## Properties @@ -6,9 +6,9 @@ | ---- | ---- | ----------- | ----- | | **id** | **String** | | | | **name** | **String** | | | -| **last_modified_on** | **Time** | The last time any changes were made to the budget from either a web or mobile client | [optional] | -| **first_month** | **Date** | The earliest budget month | [optional] | -| **last_month** | **Date** | The latest budget month | [optional] | +| **last_modified_on** | **Time** | The last time any changes were made to the plan from either a web or mobile client | [optional] | +| **first_month** | **Date** | The earliest plan month | [optional] | +| **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] | diff --git a/docs/PlanDetailResponse.md b/docs/PlanDetailResponse.md new file mode 100644 index 0000000..e6497c1 --- /dev/null +++ b/docs/PlanDetailResponse.md @@ -0,0 +1,8 @@ +# YNAB::PlanDetailResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**PlanDetailResponseData**](PlanDetailResponseData.md) | | | + diff --git a/docs/BudgetDetailResponseData.md b/docs/PlanDetailResponseData.md similarity index 64% rename from docs/BudgetDetailResponseData.md rename to docs/PlanDetailResponseData.md index 99fc14e..62138d4 100644 --- a/docs/BudgetDetailResponseData.md +++ b/docs/PlanDetailResponseData.md @@ -1,9 +1,9 @@ -# YNAB::BudgetDetailResponseData +# YNAB::PlanDetailResponseData ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget** | [**BudgetDetail**](BudgetDetail.md) | | | +| **budget** | [**PlanDetail**](PlanDetail.md) | | | | **server_knowledge** | **Integer** | The knowledge of the server | | diff --git a/docs/BudgetSettings.md b/docs/PlanSettings.md similarity index 90% rename from docs/BudgetSettings.md rename to docs/PlanSettings.md index 0930fad..ce12e1a 100644 --- a/docs/BudgetSettings.md +++ b/docs/PlanSettings.md @@ -1,4 +1,4 @@ -# YNAB::BudgetSettings +# YNAB::PlanSettings ## Properties diff --git a/docs/BudgetDetailResponse.md b/docs/PlanSettingsResponse.md similarity index 54% rename from docs/BudgetDetailResponse.md rename to docs/PlanSettingsResponse.md index 554d59d..555f84d 100644 --- a/docs/BudgetDetailResponse.md +++ b/docs/PlanSettingsResponse.md @@ -1,8 +1,8 @@ -# YNAB::BudgetDetailResponse +# YNAB::PlanSettingsResponse ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **data** | [**BudgetDetailResponseData**](BudgetDetailResponseData.md) | | | +| **data** | [**PlanSettingsResponseData**](PlanSettingsResponseData.md) | | | diff --git a/docs/PlanSettingsResponseData.md b/docs/PlanSettingsResponseData.md new file mode 100644 index 0000000..6110873 --- /dev/null +++ b/docs/PlanSettingsResponseData.md @@ -0,0 +1,8 @@ +# YNAB::PlanSettingsResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **settings** | [**PlanSettings**](PlanSettings.md) | | | + diff --git a/docs/PlanSummary.md b/docs/PlanSummary.md new file mode 100644 index 0000000..02e826b --- /dev/null +++ b/docs/PlanSummary.md @@ -0,0 +1,15 @@ +# YNAB::PlanSummary + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **name** | **String** | | | +| **last_modified_on** | **Time** | The last time any changes were made to the plan from either a web or mobile client | [optional] | +| **first_month** | **Date** | The earliest plan month | [optional] | +| **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) | The plan accounts (only included if `include_accounts=true` specified as query parameter) | [optional] | + diff --git a/docs/PlanSummaryResponse.md b/docs/PlanSummaryResponse.md new file mode 100644 index 0000000..82bc979 --- /dev/null +++ b/docs/PlanSummaryResponse.md @@ -0,0 +1,8 @@ +# YNAB::PlanSummaryResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**PlanSummaryResponseData**](PlanSummaryResponseData.md) | | | + diff --git a/docs/PlanSummaryResponseData.md b/docs/PlanSummaryResponseData.md new file mode 100644 index 0000000..95f93b8 --- /dev/null +++ b/docs/PlanSummaryResponseData.md @@ -0,0 +1,9 @@ +# YNAB::PlanSummaryResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **budgets** | [**Array<PlanSummary>**](PlanSummary.md) | | | +| **default_budget** | [**PlanSummary**](PlanSummary.md) | | [optional] | + diff --git a/docs/PlansApi.md b/docs/PlansApi.md new file mode 100644 index 0000000..bb747ea --- /dev/null +++ b/docs/PlansApi.md @@ -0,0 +1,68 @@ +# YNAB::PlansApi + +All URIs are relative to *https://api.ynab.com/v1* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_plan_by_id**](PlansApi.md#get_plan_by_id) | **GET** /budgets/{plan_id} | Get a plan | +| [**get_plan_settings_by_id**](PlansApi.md#get_plan_settings_by_id) | **GET** /budgets/{plan_id}/settings | Get plan settings | +| [**get_plans**](PlansApi.md#get_plans) | **GET** /budgets | Get all plans | + + +## get_plan_by_id + +> get_plan_by_id(plan_id, opts) + +Get a plan + +Returns a single plan with all related entities. This resource is effectively a full plan export. + +### 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). | | +| **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | + +### Return type + +[**PlanDetailResponse**](PlanDetailResponse.md) + + +## get_plan_settings_by_id + +> get_plan_settings_by_id(plan_id) + +Get plan settings + +Returns settings for a plan + +### 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). | | + +### Return type + +[**PlanSettingsResponse**](PlanSettingsResponse.md) + + +## get_plans + +> get_plans(opts) + +Get all plans + +Returns plans list with summary information + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **include_accounts** | **Boolean** | Whether to include the list of plan accounts | [optional] | + +### Return type + +[**PlanSummaryResponse**](PlanSummaryResponse.md) + diff --git a/docs/PostCategoryGroupWrapper.md b/docs/PostCategoryGroupWrapper.md new file mode 100644 index 0000000..d817738 --- /dev/null +++ b/docs/PostCategoryGroupWrapper.md @@ -0,0 +1,8 @@ +# YNAB::PostCategoryGroupWrapper + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **category_group** | [**SaveCategoryGroup**](SaveCategoryGroup.md) | | | + diff --git a/docs/PostCategoryWrapper.md b/docs/PostCategoryWrapper.md new file mode 100644 index 0000000..63136e0 --- /dev/null +++ b/docs/PostCategoryWrapper.md @@ -0,0 +1,8 @@ +# YNAB::PostCategoryWrapper + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **category** | [**NewCategory**](NewCategory.md) | | | + diff --git a/docs/SaveCategory.md b/docs/SaveCategory.md index 55b215d..1fe3737 100644 --- a/docs/SaveCategory.md +++ b/docs/SaveCategory.md @@ -7,5 +7,6 @@ | **name** | **String** | | [optional] | | **note** | **String** | | [optional] | | **category_group_id** | **String** | | [optional] | -| **goal_target** | **Integer** | The goal target amount in milliunits format. This amount can only be changed if the category already has a configured goal (goal_type != null). | [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_date** | **Date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] | diff --git a/docs/SaveCategoryGroup.md b/docs/SaveCategoryGroup.md new file mode 100644 index 0000000..8be5451 --- /dev/null +++ b/docs/SaveCategoryGroup.md @@ -0,0 +1,8 @@ +# YNAB::SaveCategoryGroup + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | The name of the category group. The name must be a maximum of 50 characters. | | + diff --git a/docs/SaveCategoryGroupResponse.md b/docs/SaveCategoryGroupResponse.md new file mode 100644 index 0000000..85ef7fc --- /dev/null +++ b/docs/SaveCategoryGroupResponse.md @@ -0,0 +1,8 @@ +# YNAB::SaveCategoryGroupResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | [**SaveCategoryGroupResponseData**](SaveCategoryGroupResponseData.md) | | | + diff --git a/docs/SaveCategoryGroupResponseData.md b/docs/SaveCategoryGroupResponseData.md new file mode 100644 index 0000000..8e69c9c --- /dev/null +++ b/docs/SaveCategoryGroupResponseData.md @@ -0,0 +1,9 @@ +# YNAB::SaveCategoryGroupResponseData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **category_group** | [**CategoryGroup**](CategoryGroup.md) | | | +| **server_knowledge** | **Integer** | The knowledge of the server | | + diff --git a/docs/SaveMonthCategory.md b/docs/SaveMonthCategory.md index f6046ee..a8fad70 100644 --- a/docs/SaveMonthCategory.md +++ b/docs/SaveMonthCategory.md @@ -4,5 +4,5 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budgeted** | **Integer** | Budgeted amount in milliunits format | | +| **budgeted** | **Integer** | Assigned (budgeted) amount in milliunits format | | diff --git a/docs/ScheduledTransactionsApi.md b/docs/ScheduledTransactionsApi.md index 592afd1..6663510 100644 --- a/docs/ScheduledTransactionsApi.md +++ b/docs/ScheduledTransactionsApi.md @@ -4,18 +4,18 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**create_scheduled_transaction**](ScheduledTransactionsApi.md#create_scheduled_transaction) | **POST** /budgets/{budget_id}/scheduled_transactions | Create a single scheduled transaction | -| [**delete_scheduled_transaction**](ScheduledTransactionsApi.md#delete_scheduled_transaction) | **DELETE** /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | Deletes an existing scheduled transaction | -| [**get_scheduled_transaction_by_id**](ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | **GET** /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | Single scheduled transaction | -| [**get_scheduled_transactions**](ScheduledTransactionsApi.md#get_scheduled_transactions) | **GET** /budgets/{budget_id}/scheduled_transactions | List scheduled transactions | -| [**update_scheduled_transaction**](ScheduledTransactionsApi.md#update_scheduled_transaction) | **PUT** /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | Updates an existing scheduled transaction | +| [**create_scheduled_transaction**](ScheduledTransactionsApi.md#create_scheduled_transaction) | **POST** /budgets/{plan_id}/scheduled_transactions | Create a scheduled transaction | +| [**delete_scheduled_transaction**](ScheduledTransactionsApi.md#delete_scheduled_transaction) | **DELETE** /budgets/{plan_id}/scheduled_transactions/{scheduled_transaction_id} | Delete a scheduled transaction | +| [**get_scheduled_transaction_by_id**](ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | **GET** /budgets/{plan_id}/scheduled_transactions/{scheduled_transaction_id} | Get a scheduled transaction | +| [**get_scheduled_transactions**](ScheduledTransactionsApi.md#get_scheduled_transactions) | **GET** /budgets/{plan_id}/scheduled_transactions | Get all scheduled transactions | +| [**update_scheduled_transaction**](ScheduledTransactionsApi.md#update_scheduled_transaction) | **PUT** /budgets/{plan_id}/scheduled_transactions/{scheduled_transaction_id} | Update a scheduled transaction | ## create_scheduled_transaction -> create_scheduled_transaction(budget_id, data) +> create_scheduled_transaction(plan_id, data) -Create a single scheduled transaction +Create a scheduled transaction Creates a single scheduled transaction (a transaction with a future date). @@ -23,7 +23,7 @@ Creates a single scheduled transaction (a transaction with a future date). | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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** | [**PostScheduledTransactionWrapper**](PostScheduledTransactionWrapper.md) | The scheduled transaction to create | | ### Return type @@ -33,9 +33,9 @@ Creates a single scheduled transaction (a transaction with a future date). ## delete_scheduled_transaction -> delete_scheduled_transaction(budget_id, scheduled_transaction_id) +> delete_scheduled_transaction(plan_id, scheduled_transaction_id) -Deletes an existing scheduled transaction +Delete a scheduled transaction Deletes a scheduled transaction @@ -43,7 +43,7 @@ Deletes a scheduled transaction | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **scheduled_transaction_id** | **String** | The id of the scheduled transaction | | ### Return type @@ -53,9 +53,9 @@ Deletes a scheduled transaction ## get_scheduled_transaction_by_id -> get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id) +> get_scheduled_transaction_by_id(plan_id, scheduled_transaction_id) -Single scheduled transaction +Get a scheduled transaction Returns a single scheduled transaction @@ -63,7 +63,7 @@ Returns a single scheduled transaction | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **scheduled_transaction_id** | **String** | The id of the scheduled transaction | | ### Return type @@ -73,9 +73,9 @@ Returns a single scheduled transaction ## get_scheduled_transactions -> get_scheduled_transactions(budget_id, opts) +> get_scheduled_transactions(plan_id, opts) -List scheduled transactions +Get all scheduled transactions Returns all scheduled transactions @@ -83,7 +83,7 @@ Returns all scheduled transactions | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | ### Return type @@ -93,9 +93,9 @@ Returns all scheduled transactions ## update_scheduled_transaction -> update_scheduled_transaction(budget_id, scheduled_transaction_id, put_scheduled_transaction_wrapper) +> update_scheduled_transaction(plan_id, scheduled_transaction_id, put_scheduled_transaction_wrapper) -Updates an existing scheduled transaction +Update a scheduled transaction Updates a single scheduled transaction @@ -103,7 +103,7 @@ Updates a single scheduled transaction | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **scheduled_transaction_id** | **String** | The id of the scheduled transaction | | | **put_scheduled_transaction_wrapper** | [**PutScheduledTransactionWrapper**](PutScheduledTransactionWrapper.md) | The scheduled transaction to update | | diff --git a/docs/TransactionsApi.md b/docs/TransactionsApi.md index 7bfe7ae..e1db731 100644 --- a/docs/TransactionsApi.md +++ b/docs/TransactionsApi.md @@ -4,22 +4,22 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**create_transaction**](TransactionsApi.md#create_transaction) | **POST** /budgets/{budget_id}/transactions | Create a single transaction or multiple transactions | -| [**delete_transaction**](TransactionsApi.md#delete_transaction) | **DELETE** /budgets/{budget_id}/transactions/{transaction_id} | Deletes an existing transaction | -| [**get_transaction_by_id**](TransactionsApi.md#get_transaction_by_id) | **GET** /budgets/{budget_id}/transactions/{transaction_id} | Single transaction | -| [**get_transactions**](TransactionsApi.md#get_transactions) | **GET** /budgets/{budget_id}/transactions | List transactions | -| [**get_transactions_by_account**](TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions | -| [**get_transactions_by_category**](TransactionsApi.md#get_transactions_by_category) | **GET** /budgets/{budget_id}/categories/{category_id}/transactions | List category transactions, excluding any pending transactions | -| [**get_transactions_by_month**](TransactionsApi.md#get_transactions_by_month) | **GET** /budgets/{budget_id}/months/{month}/transactions | List transactions in month, excluding any pending transactions | -| [**get_transactions_by_payee**](TransactionsApi.md#get_transactions_by_payee) | **GET** /budgets/{budget_id}/payees/{payee_id}/transactions | List payee transactions, excluding any pending transactions | -| [**import_transactions**](TransactionsApi.md#import_transactions) | **POST** /budgets/{budget_id}/transactions/import | Import transactions | -| [**update_transaction**](TransactionsApi.md#update_transaction) | **PUT** /budgets/{budget_id}/transactions/{transaction_id} | Updates an existing transaction | -| [**update_transactions**](TransactionsApi.md#update_transactions) | **PATCH** /budgets/{budget_id}/transactions | Update multiple transactions | +| [**create_transaction**](TransactionsApi.md#create_transaction) | **POST** /budgets/{plan_id}/transactions | Create a single transaction or multiple transactions | +| [**delete_transaction**](TransactionsApi.md#delete_transaction) | **DELETE** /budgets/{plan_id}/transactions/{transaction_id} | Delete a transaction | +| [**get_transaction_by_id**](TransactionsApi.md#get_transaction_by_id) | **GET** /budgets/{plan_id}/transactions/{transaction_id} | Get a transaction | +| [**get_transactions**](TransactionsApi.md#get_transactions) | **GET** /budgets/{plan_id}/transactions | Get all transactions | +| [**get_transactions_by_account**](TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{plan_id}/accounts/{account_id}/transactions | Get all account transactions | +| [**get_transactions_by_category**](TransactionsApi.md#get_transactions_by_category) | **GET** /budgets/{plan_id}/categories/{category_id}/transactions | Get all category transactions | +| [**get_transactions_by_month**](TransactionsApi.md#get_transactions_by_month) | **GET** /budgets/{plan_id}/months/{month}/transactions | Get all plan month transactions | +| [**get_transactions_by_payee**](TransactionsApi.md#get_transactions_by_payee) | **GET** /budgets/{plan_id}/payees/{payee_id}/transactions | Get all payee transactions | +| [**import_transactions**](TransactionsApi.md#import_transactions) | **POST** /budgets/{plan_id}/transactions/import | Import transactions | +| [**update_transaction**](TransactionsApi.md#update_transaction) | **PUT** /budgets/{plan_id}/transactions/{transaction_id} | Update a transaction | +| [**update_transactions**](TransactionsApi.md#update_transactions) | **PATCH** /budgets/{plan_id}/transactions | Update multiple transactions | ## create_transaction -> create_transaction(budget_id, data) +> create_transaction(plan_id, data) Create a single transaction or multiple transactions @@ -29,7 +29,7 @@ Creates a single transaction or multiple transactions. If you provide a body co | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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** | [**PostTransactionsWrapper**](PostTransactionsWrapper.md) | The transaction or transactions to create. To create a single transaction you can specify a value for the `transaction` object and to create multiple transactions you can specify an array of `transactions`. It is expected that you will only provide a value for one of these objects. | | ### Return type @@ -39,9 +39,9 @@ Creates a single transaction or multiple transactions. If you provide a body co ## delete_transaction -> delete_transaction(budget_id, transaction_id) +> delete_transaction(plan_id, transaction_id) -Deletes an existing transaction +Delete a transaction Deletes a transaction @@ -49,7 +49,7 @@ Deletes a transaction | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **transaction_id** | **String** | The id of the transaction | | ### Return type @@ -59,9 +59,9 @@ Deletes a transaction ## get_transaction_by_id -> get_transaction_by_id(budget_id, transaction_id) +> get_transaction_by_id(plan_id, transaction_id) -Single transaction +Get a transaction Returns a single transaction @@ -69,7 +69,7 @@ Returns a single transaction | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **transaction_id** | **String** | The id of the transaction | | ### Return type @@ -79,17 +79,17 @@ Returns a single transaction ## get_transactions -> get_transactions(budget_id, opts) +> get_transactions(plan_id, opts) -List transactions +Get all transactions -Returns budget transactions, excluding any pending transactions +Returns plan transactions, excluding any pending transactions ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **since_date** | **Date** | If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). | [optional] | | **type** | **String** | If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. | [optional] | | **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | @@ -101,9 +101,9 @@ Returns budget transactions, excluding any pending transactions ## get_transactions_by_account -> get_transactions_by_account(budget_id, account_id, opts) +> get_transactions_by_account(plan_id, account_id, opts) -List account transactions +Get all account transactions Returns all transactions for a specified account, excluding any pending transactions @@ -111,7 +111,7 @@ Returns all transactions for a specified account, excluding any pending transact | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **account_id** | **String** | The id of the account | | | **since_date** | **Date** | If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). | [optional] | | **type** | **String** | If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. | [optional] | @@ -124,17 +124,17 @@ Returns all transactions for a specified account, excluding any pending transact ## get_transactions_by_category -> get_transactions_by_category(budget_id, category_id, opts) +> get_transactions_by_category(plan_id, category_id, opts) -List category transactions, excluding any pending transactions +Get all category transactions -Returns all transactions for a specified category +Returns all transactions for a specified category, excluding any pending transactions ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **category_id** | **String** | The id of the category | | | **since_date** | **Date** | If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). | [optional] | | **type** | **String** | If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. | [optional] | @@ -147,40 +147,40 @@ Returns all transactions for a specified category ## get_transactions_by_month -> get_transactions_by_month(budget_id, month, opts) +> get_transactions_by_month(plan_id, month, opts) -List transactions in month, excluding any pending transactions +Get all plan month transactions -Returns all transactions for a specified month +Returns all transactions for a specified month, excluding any pending transactions ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | -| **month** | **String** | The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | +| **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). | | +| **month** | **String** | The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) | | | **since_date** | **Date** | If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). | [optional] | | **type** | **String** | If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. | [optional] | | **last_knowledge_of_server** | **Integer** | The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. | [optional] | ### Return type -[**HybridTransactionsResponse**](HybridTransactionsResponse.md) +[**TransactionsResponse**](TransactionsResponse.md) ## get_transactions_by_payee -> get_transactions_by_payee(budget_id, payee_id, opts) +> get_transactions_by_payee(plan_id, payee_id, opts) -List payee transactions, excluding any pending transactions +Get all payee transactions -Returns all transactions for a specified payee +Returns all transactions for a specified payee, excluding any pending transactions ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **payee_id** | **String** | The id of the payee | | | **since_date** | **Date** | If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). | [optional] | | **type** | **String** | If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. | [optional] | @@ -193,17 +193,17 @@ Returns all transactions for a specified payee ## import_transactions -> import_transactions(budget_id) +> import_transactions(plan_id) Import transactions -Imports available transactions on all linked accounts for the given budget. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking \"Import\" on each account in the web application or tapping the \"New Transactions\" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported. +Imports available transactions on all linked accounts for the given plan. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking \"Import\" on each account in the web application or tapping the \"New Transactions\" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported. ### Parameters | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | ### Return type @@ -212,9 +212,9 @@ Imports available transactions on all linked accounts for the given budget. Lin ## update_transaction -> update_transaction(budget_id, transaction_id, data) +> update_transaction(plan_id, transaction_id, data) -Updates an existing transaction +Update a transaction Updates a single transaction @@ -222,7 +222,7 @@ Updates a single transaction | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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). | | | **transaction_id** | **String** | The id of the transaction | | | **data** | [**PutTransactionWrapper**](PutTransactionWrapper.md) | The transaction to update | | @@ -233,7 +233,7 @@ Updates a single transaction ## update_transactions -> update_transactions(budget_id, data) +> update_transactions(plan_id, data) Update multiple transactions @@ -243,7 +243,7 @@ Updates multiple transactions, by `id` or `import_id`. | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **budget_id** | **String** | The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). | | +| **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** | [**PatchTransactionsWrapper**](PatchTransactionsWrapper.md) | The transactions to update. Each transaction must have either an `id` or `import_id` specified. If `id` is specified as null an `import_id` value can be provided which will allow transaction(s) to be updated by its `import_id`. If an `id` is specified, it will always be used for lookup. You should not specify both `id` and `import_id`. Updating an `import_id` on an existing transaction is not allowed; if an `import_id` is specified, it will only be used to lookup the transaction. | | ### Return type diff --git a/docs/UserApi.md b/docs/UserApi.md index 0d360cc..1a3988b 100644 --- a/docs/UserApi.md +++ b/docs/UserApi.md @@ -4,14 +4,14 @@ All URIs are relative to *https://api.ynab.com/v1* | Method | HTTP request | Description | | ------ | ------------ | ----------- | -| [**get_user**](UserApi.md#get_user) | **GET** /user | User info | +| [**get_user**](UserApi.md#get_user) | **GET** /user | Get user | ## get_user > get_user -User info +Get user Returns authenticated user information diff --git a/examples/category-balance.rb b/examples/category-balance.rb index 46902f8..d59d847 100644 --- a/examples/category-balance.rb +++ b/examples/category-balance.rb @@ -3,13 +3,13 @@ access_token = ENV['YNAB_ACCESS_TOKEN'] ynab = YNAB::API.new(access_token) -budget_id = ENV['YNAB_BUDGET_ID'] +plan_id = ENV['YNAB_plan_id'] category_id = 'a191ac84-de09-not-real-6c5ed8cfdabe' begin puts 'Fetching category...' - category_response = ynab.categories.get_category_by_id(budget_id, category_id) + category_response = ynab.categories.get_category_by_id(plan_id, category_id) category = category_response.data.category puts "===========" diff --git a/examples/create-multiple-transactions.rb b/examples/create-multiple-transactions.rb index 2a93c60..c9a79ea 100644 --- a/examples/create-multiple-transactions.rb +++ b/examples/create-multiple-transactions.rb @@ -4,7 +4,7 @@ access_token = ENV['YNAB_ACCESS_TOKEN'] ynab = YNAB::API.new(access_token) -budget_id = ENV['YNAB_BUDGET_ID'] +plan_id = ENV['YNAB_plan_id'] account_id = 'f6fe07cb-c895-not-real-acfac0b7f026' category_id = 'a191ac84-de09-not-real-6c5ed8cfdabe' @@ -36,7 +36,7 @@ } begin - ynab.transactions.create_transaction(budget_id, data) + ynab.transactions.create_transaction(plan_id, data) rescue YNAB::ApiError => e puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}" end diff --git a/examples/create-transaction.rb b/examples/create-transaction.rb index e5867f8..3bdddd4 100644 --- a/examples/create-transaction.rb +++ b/examples/create-transaction.rb @@ -4,7 +4,7 @@ access_token = ENV['YNAB_ACCESS_TOKEN'] ynab = YNAB::API.new(access_token) -budget_id = ENV['YNAB_BUDGET_ID'] +plan_id = ENV['YNAB_plan_id'] account_id = 'f6fe07cb-c895-not-real-acfac0b7f026' category_id = 'a191ac84-de09-not-real-6c5ed8cfdabe' @@ -23,7 +23,7 @@ } begin - ynab.transactions.create_transaction(budget_id, data) + ynab.transactions.create_transaction(plan_id, data) rescue YNAB::ApiError => e puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}" end diff --git a/examples/budget-list.rb b/examples/plan-list.rb similarity index 53% rename from examples/budget-list.rb rename to examples/plan-list.rb index ce88cbe..6eeddca 100644 --- a/examples/budget-list.rb +++ b/examples/plan-list.rb @@ -4,17 +4,17 @@ ynab = YNAB::API.new(access_token) begin - puts 'Fetching budgets...' + puts 'Fetching plans...' - budget_response = ynab.budgets.get_budgets - budgets = budget_response.data.budgets + plan_response = ynab.plans.get_plans + plans = plan_response.data.budgets puts '===========' - puts 'BUDGET LIST' + puts 'PLAN LIST' puts '===========' - budgets.each do |budget| - puts "[id: #{budget.id}, name: #{budget.name}]" + plans.each do |plan| + puts "[id: #{plan.id}, name: #{plan.name}]" end rescue YNAB::ApiError => e puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}" diff --git a/examples/budget-month.rb b/examples/plan-month.rb similarity index 51% rename from examples/budget-month.rb rename to examples/plan-month.rb index 08cf255..c57c23e 100644 --- a/examples/budget-month.rb +++ b/examples/plan-month.rb @@ -4,24 +4,23 @@ access_token = ENV['YNAB_ACCESS_TOKEN'] ynab = YNAB::API.new(access_token) -budget_id = ENV['YNAB_BUDGET_ID'] +plan_id = ENV['YNAB_plan_id'] begin puts 'Fetching month...' first_day_of_month_iso = Date.new(Date.today.year, Date.today.month, 1).iso8601 - current_date = Date.today - first_day_of_month = Date.new(current_date.year, current_date.month, 1) - month_response = ynab.months.get_budget_month(budget_id, first_day_of_month_iso) - budget_month = month_response.data.month + + month_response = ynab.months.get_plan_month(plan_id, first_day_of_month_iso) + plan_month = month_response.data.month puts "============" - puts "BUDGET MONTH" + puts "PLAN MONTH" puts "============" - puts " Month: #{budget_month.month}" - puts " Note: #{budget_month.note}" - puts "To Be Budgeted: #{budget_month.to_be_budgeted}" - puts " Age of Money: #{budget_month.age_of_money}" + puts " Month: #{plan_month.month}" + puts " Note: #{plan_month.note}" + puts "To Be Budgeted: #{plan_month.to_be_budgeted}" + puts " Age of Money: #{plan_month.age_of_money}" puts " Categories: " budget_month.categories.each do |category| diff --git a/examples/update-category-budgeted.rb b/examples/update-category-budgeted.rb index 232d436..bc4dad6 100644 --- a/examples/update-category-budgeted.rb +++ b/examples/update-category-budgeted.rb @@ -4,7 +4,7 @@ access_token = ENV['YNAB_ACCESS_TOKEN'] ynab = YNAB::API.new(access_token) -budget_id = ENV['YNAB_BUDGET_ID'] +plan_id = ENV['YNAB_plan_id'] category_id = 'a191ac84-de09-not-real-6c5ed8cfdabe' month = '2019-01-01' @@ -16,7 +16,7 @@ begin # Update budgeted amount to 203.82 in 2018-09-01 for category_id - response = ynab.categories.update_month_category(budget_id, month, category_id, data) + response = ynab.categories.update_month_category(plan_id, month, category_id, data) month_category_response = response.data.category puts "[budgeted: #{month_category_response.budgeted}, balance: #{month_category_response.balance}]" rescue YNAB::ApiError => e diff --git a/examples/update-multiple-transactions.rb b/examples/update-multiple-transactions.rb index 5cbc567..c15952e 100644 --- a/examples/update-multiple-transactions.rb +++ b/examples/update-multiple-transactions.rb @@ -3,18 +3,18 @@ access_token = ENV['YNAB_ACCESS_TOKEN'] ynab = YNAB::API.new(access_token) -budget_id = ENV['YNAB_BUDGET_ID'] +plan_id = ENV['YNAB_plan_id'] begin # Fetch all unapproved transactions and update them all as approved - unapproved_transaction_data = ynab.transactions.get_transactions(budget_id, { type: 'unapproved' }).data + unapproved_transaction_data = ynab.transactions.get_transactions(plan_id, { type: 'unapproved' }).data data = unapproved_transaction_data.clone data.transactions.each do |t| t.approved = true end - ynab.transactions.update_transactions(budget_id, update_data) + ynab.transactions.update_transactions(plan_id, update_data) rescue YNAB::ApiError => e puts "ERROR: id=#{e.id}; name=#{e.name}; detail: #{e.detail}" end diff --git a/lib/ynab.rb b/lib/ynab.rb index c65dce5..974fd19 100644 --- a/lib/ynab.rb +++ b/lib/ynab.rb @@ -4,7 +4,6 @@ #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 # Common files @@ -14,21 +13,13 @@ require 'ynab/configuration' # Models +require 'ynab/api_model_base' require 'ynab/models/account' require 'ynab/models/account_response' require 'ynab/models/account_response_data' require 'ynab/models/account_type' require 'ynab/models/accounts_response' require 'ynab/models/accounts_response_data' -require 'ynab/models/budget_detail' -require 'ynab/models/budget_detail_response' -require 'ynab/models/budget_detail_response_data' -require 'ynab/models/budget_settings' -require 'ynab/models/budget_settings_response' -require 'ynab/models/budget_settings_response_data' -require 'ynab/models/budget_summary' -require 'ynab/models/budget_summary_response' -require 'ynab/models/budget_summary_response_data' require 'ynab/models/bulk_response' require 'ynab/models/bulk_response_data' require 'ynab/models/bulk_response_data_bulk' @@ -44,17 +35,26 @@ require 'ynab/models/date_format' require 'ynab/models/error_detail' require 'ynab/models/error_response' +require 'ynab/models/existing_category' require 'ynab/models/existing_transaction' require 'ynab/models/hybrid_transaction' require 'ynab/models/hybrid_transactions_response' require 'ynab/models/hybrid_transactions_response_data' +require 'ynab/models/money_movement' +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_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/new_category' require 'ynab/models/new_transaction' +require 'ynab/models/patch_category_group_wrapper' require 'ynab/models/patch_category_wrapper' require 'ynab/models/patch_month_category_wrapper' require 'ynab/models/patch_payee_wrapper' @@ -69,13 +69,27 @@ require 'ynab/models/payee_response_data' require 'ynab/models/payees_response' require 'ynab/models/payees_response_data' +require 'ynab/models/plan_detail' +require 'ynab/models/plan_detail_response' +require 'ynab/models/plan_detail_response_data' +require 'ynab/models/plan_settings' +require 'ynab/models/plan_settings_response' +require 'ynab/models/plan_settings_response_data' +require 'ynab/models/plan_summary' +require 'ynab/models/plan_summary_response' +require 'ynab/models/plan_summary_response_data' require 'ynab/models/post_account_wrapper' +require 'ynab/models/post_category_group_wrapper' +require 'ynab/models/post_category_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_category' +require 'ynab/models/save_category_group' +require 'ynab/models/save_category_group_response' +require 'ynab/models/save_category_group_response_data' require 'ynab/models/save_category_response' require 'ynab/models/save_category_response_data' require 'ynab/models/save_month_category' @@ -113,11 +127,12 @@ # APIs require 'ynab/api/accounts_api' -require 'ynab/api/budgets_api' require 'ynab/api/categories_api' +require 'ynab/api/money_movements_api' require 'ynab/api/months_api' require 'ynab/api/payee_locations_api' require 'ynab/api/payees_api' +require 'ynab/api/plans_api' require 'ynab/api/scheduled_transactions_api' require 'ynab/api/transactions_api' require 'ynab/api/user_api' @@ -140,8 +155,8 @@ def user UserApi.new(@client) end - def budgets - BudgetsApi.new(@client) + def plans + PlansApi.new(@client) end def accounts diff --git a/lib/ynab/api/accounts_api.rb b/lib/ynab/api/accounts_api.rb index efe029f..128ef4d 100644 --- a/lib/ynab/api/accounts_api.rb +++ b/lib/ynab/api/accounts_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -16,37 +15,37 @@ class AccountsApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # Create a new account + # Create an account # Creates a new account - # @param budget_id [String] The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget) + # @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 [PostAccountWrapper] The account to create. # @param [Hash] opts the optional parameters # @return [AccountResponse] - def create_account(budget_id, data, opts = {}) - data, _status_code, _headers = create_account_with_http_info(budget_id, data, opts) + def create_account(plan_id, data, opts = {}) + data, _status_code, _headers = create_account_with_http_info(plan_id, data, opts) data end - # Create a new account + # Create an account # Creates a new account - # @param budget_id [String] The id of the budget (\"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget) + # @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 [PostAccountWrapper] The account to create. # @param [Hash] opts the optional parameters # @return [Array<(AccountResponse, Integer, Hash)>] AccountResponse data, response status code and response headers - def create_account_with_http_info(budget_id, data, opts = {}) + def create_account_with_http_info(plan_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccountsApi.create_account ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.create_account" + # 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 AccountsApi.create_account" 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 AccountsApi.create_account" end # resource path - local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/accounts'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -90,37 +89,37 @@ def create_account_with_http_info(budget_id, data, opts = {}) return data, status_code, headers end - # Single account + # Get an account # Returns a single account - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 account_id [String] The id of the account # @param [Hash] opts the optional parameters # @return [AccountResponse] - def get_account_by_id(budget_id, account_id, opts = {}) - data, _status_code, _headers = get_account_by_id_with_http_info(budget_id, account_id, opts) + def get_account_by_id(plan_id, account_id, opts = {}) + data, _status_code, _headers = get_account_by_id_with_http_info(plan_id, account_id, opts) data end - # Single account + # Get an account # Returns a single account - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 account_id [String] The id of the account # @param [Hash] opts the optional parameters # @return [Array<(AccountResponse, Integer, Hash)>] AccountResponse data, response status code and response headers - def get_account_by_id_with_http_info(budget_id, account_id, opts = {}) + def get_account_by_id_with_http_info(plan_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccountsApi.get_account_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_account_by_id" + # 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 AccountsApi.get_account_by_id" end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/accounts/{account_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + local_var_path = '/budgets/{plan_id}/accounts/{account_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -159,33 +158,33 @@ def get_account_by_id_with_http_info(budget_id, account_id, opts = {}) return data, status_code, headers end - # Account list + # Get all accounts # Returns all accounts - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [AccountsResponse] - def get_accounts(budget_id, opts = {}) - data, _status_code, _headers = get_accounts_with_http_info(budget_id, opts) + def get_accounts(plan_id, opts = {}) + data, _status_code, _headers = get_accounts_with_http_info(plan_id, opts) data end - # Account list + # Get all accounts # Returns all accounts - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(AccountsResponse, Integer, Hash)>] AccountsResponse data, response status code and response headers - def get_accounts_with_http_info(budget_id, opts = {}) + def get_accounts_with_http_info(plan_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_accounts" + # 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 AccountsApi.get_accounts" end # resource path - local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/accounts'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/lib/ynab/api/categories_api.rb b/lib/ynab/api/categories_api.rb index 805f200..062ddc5 100644 --- a/lib/ynab/api/categories_api.rb +++ b/lib/ynab/api/categories_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -16,33 +15,181 @@ class CategoriesApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # List categories - # Returns all categories grouped by category group. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Create a category + # Creates a new category + # @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 [PostCategoryWrapper] The category to create. + # @param [Hash] opts the optional parameters + # @return [SaveCategoryResponse] + def create_category(plan_id, data, opts = {}) + data, _status_code, _headers = create_category_with_http_info(plan_id, data, opts) + data + end + + # Create a category + # Creates a new category + # @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 [PostCategoryWrapper] The category to create. + # @param [Hash] opts the optional parameters + # @return [Array<(SaveCategoryResponse, Integer, Hash)>] SaveCategoryResponse data, response status code and response headers + def create_category_with_http_info(plan_id, data, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CategoriesApi.create_category ...' + 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 CategoriesApi.create_category" + 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 CategoriesApi.create_category" + end + # resource path + local_var_path = '/budgets/{plan_id}/categories'.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] || 'SaveCategoryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"CategoriesApi.create_category", + :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: CategoriesApi#create_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a category group + # Creates a new category group + # @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 [PostCategoryGroupWrapper] The category group to create. + # @param [Hash] opts the optional parameters + # @return [SaveCategoryGroupResponse] + def create_category_group(plan_id, data, opts = {}) + data, _status_code, _headers = create_category_group_with_http_info(plan_id, data, opts) + data + end + + # Create a category group + # Creates a new category group + # @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 [PostCategoryGroupWrapper] The category group to create. + # @param [Hash] opts the optional parameters + # @return [Array<(SaveCategoryGroupResponse, Integer, Hash)>] SaveCategoryGroupResponse data, response status code and response headers + def create_category_group_with_http_info(plan_id, data, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CategoriesApi.create_category_group ...' + 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 CategoriesApi.create_category_group" + 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 CategoriesApi.create_category_group" + end + # resource path + local_var_path = '/budgets/{plan_id}/category_groups'.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] || 'SaveCategoryGroupResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"CategoriesApi.create_category_group", + :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: CategoriesApi#create_category_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all categories + # Returns all categories grouped by category group. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [CategoriesResponse] - def get_categories(budget_id, opts = {}) - data, _status_code, _headers = get_categories_with_http_info(budget_id, opts) + def get_categories(plan_id, opts = {}) + data, _status_code, _headers = get_categories_with_http_info(plan_id, opts) data end - # List categories - # Returns all categories grouped by category group. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all categories + # Returns all categories grouped by category group. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(CategoriesResponse, Integer, Hash)>] CategoriesResponse data, response status code and response headers - def get_categories_with_http_info(budget_id, opts = {}) + def get_categories_with_http_info(plan_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_categories" + # 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 CategoriesApi.get_categories" end # resource path - local_var_path = '/budgets/{budget_id}/categories'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/categories'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -82,37 +229,37 @@ def get_categories_with_http_info(budget_id, opts = {}) return data, status_code, headers end - # Single category - # Returns a single category. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get a category + # Returns a single category. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). + # @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 category_id [String] The id of the category # @param [Hash] opts the optional parameters # @return [CategoryResponse] - def get_category_by_id(budget_id, category_id, opts = {}) - data, _status_code, _headers = get_category_by_id_with_http_info(budget_id, category_id, opts) + def get_category_by_id(plan_id, category_id, opts = {}) + data, _status_code, _headers = get_category_by_id_with_http_info(plan_id, category_id, opts) data end - # Single category - # Returns a single category. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get a category + # Returns a single category. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). + # @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 category_id [String] The id of the category # @param [Hash] opts the optional parameters # @return [Array<(CategoryResponse, Integer, Hash)>] CategoryResponse data, response status code and response headers - def get_category_by_id_with_http_info(budget_id, category_id, opts = {}) + def get_category_by_id_with_http_info(plan_id, category_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.get_category_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_category_by_id" + # 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 CategoriesApi.get_category_by_id" end # verify the required parameter 'category_id' is set if @api_client.config.client_side_validation && category_id.nil? fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.get_category_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/categories/{category_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) + local_var_path = '/budgets/{plan_id}/categories/{category_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -151,32 +298,32 @@ def get_category_by_id_with_http_info(budget_id, category_id, opts = {}) return data, status_code, headers end - # Single category for a specific budget month - # Returns a single category for a specific budget month. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [Date] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Get a category for a specific plan month + # Returns a single category for a specific plan month. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param category_id [String] The id of the category # @param [Hash] opts the optional parameters # @return [CategoryResponse] - def get_month_category_by_id(budget_id, month, category_id, opts = {}) - data, _status_code, _headers = get_month_category_by_id_with_http_info(budget_id, month, category_id, opts) + def get_month_category_by_id(plan_id, month, category_id, opts = {}) + data, _status_code, _headers = get_month_category_by_id_with_http_info(plan_id, month, category_id, opts) data end - # Single category for a specific budget month - # Returns a single category for a specific budget month. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [Date] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Get a category for a specific plan month + # Returns a single category for a specific plan month. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param category_id [String] The id of the category # @param [Hash] opts the optional parameters # @return [Array<(CategoryResponse, Integer, Hash)>] CategoryResponse data, response status code and response headers - def get_month_category_by_id_with_http_info(budget_id, month, category_id, opts = {}) + def get_month_category_by_id_with_http_info(plan_id, month, category_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.get_month_category_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_month_category_by_id" + # 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 CategoriesApi.get_month_category_by_id" end # verify the required parameter 'month' is set if @api_client.config.client_side_validation && month.nil? @@ -187,7 +334,7 @@ def get_month_category_by_id_with_http_info(budget_id, month, category_id, opts fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.get_month_category_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/months/{month}/categories/{category_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) + local_var_path = '/budgets/{plan_id}/months/{month}/categories/{category_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -228,30 +375,30 @@ def get_month_category_by_id_with_http_info(budget_id, month, category_id, opts # Update a category # Update a category - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 category_id [String] The id of the category # @param data [PatchCategoryWrapper] The category to update # @param [Hash] opts the optional parameters # @return [SaveCategoryResponse] - def update_category(budget_id, category_id, data, opts = {}) - data, _status_code, _headers = update_category_with_http_info(budget_id, category_id, data, opts) + def update_category(plan_id, category_id, data, opts = {}) + data, _status_code, _headers = update_category_with_http_info(plan_id, category_id, data, opts) data end # Update a category # Update a category - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 category_id [String] The id of the category # @param data [PatchCategoryWrapper] The category to update # @param [Hash] opts the optional parameters # @return [Array<(SaveCategoryResponse, Integer, Hash)>] SaveCategoryResponse data, response status code and response headers - def update_category_with_http_info(budget_id, category_id, data, opts = {}) + def update_category_with_http_info(plan_id, category_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.update_category ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.update_category" + # 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 CategoriesApi.update_category" end # verify the required parameter 'category_id' is set if @api_client.config.client_side_validation && category_id.nil? @@ -262,7 +409,7 @@ def update_category_with_http_info(budget_id, category_id, data, opts = {}) fail ArgumentError, "Missing the required parameter 'data' when calling CategoriesApi.update_category" end # resource path - local_var_path = '/budgets/{budget_id}/categories/{category_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) + local_var_path = '/budgets/{plan_id}/categories/{category_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -306,34 +453,114 @@ def update_category_with_http_info(budget_id, category_id, data, opts = {}) return data, status_code, headers end + # Update a category group + # Update a category group + # @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 category_group_id [String] The id of the category group + # @param data [PatchCategoryGroupWrapper] The category group to update + # @param [Hash] opts the optional parameters + # @return [SaveCategoryGroupResponse] + def update_category_group(plan_id, category_group_id, data, opts = {}) + data, _status_code, _headers = update_category_group_with_http_info(plan_id, category_group_id, data, opts) + data + end + + # Update a category group + # Update a category group + # @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 category_group_id [String] The id of the category group + # @param data [PatchCategoryGroupWrapper] The category group to update + # @param [Hash] opts the optional parameters + # @return [Array<(SaveCategoryGroupResponse, Integer, Hash)>] SaveCategoryGroupResponse data, response status code and response headers + def update_category_group_with_http_info(plan_id, category_group_id, data, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CategoriesApi.update_category_group ...' + 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 CategoriesApi.update_category_group" + end + # verify the required parameter 'category_group_id' is set + if @api_client.config.client_side_validation && category_group_id.nil? + fail ArgumentError, "Missing the required parameter 'category_group_id' when calling CategoriesApi.update_category_group" + 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 CategoriesApi.update_category_group" + end + # resource path + local_var_path = '/budgets/{plan_id}/category_groups/{category_group_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'category_group_id' + '}', CGI.escape(category_group_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] || 'SaveCategoryGroupResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"CategoriesApi.update_category_group", + :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(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CategoriesApi#update_category_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a category for a specific month - # Update a category for a specific month. Only `budgeted` amount can be updated. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [Date] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Update a category for a specific month. Only `budgeted` (assigned) amount can be updated. + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param category_id [String] The id of the category - # @param data [PatchMonthCategoryWrapper] The category to update. Only `budgeted` amount can be updated and any other fields specified will be ignored. + # @param data [PatchMonthCategoryWrapper] The category to update. Only `budgeted` (assigned) amount can be updated and any other fields specified will be ignored. # @param [Hash] opts the optional parameters # @return [SaveCategoryResponse] - def update_month_category(budget_id, month, category_id, data, opts = {}) - data, _status_code, _headers = update_month_category_with_http_info(budget_id, month, category_id, data, opts) + def update_month_category(plan_id, month, category_id, data, opts = {}) + data, _status_code, _headers = update_month_category_with_http_info(plan_id, month, category_id, data, opts) data end # Update a category for a specific month - # Update a category for a specific month. Only `budgeted` amount can be updated. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [Date] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Update a category for a specific month. Only `budgeted` (assigned) amount can be updated. + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param category_id [String] The id of the category - # @param data [PatchMonthCategoryWrapper] The category to update. Only `budgeted` amount can be updated and any other fields specified will be ignored. + # @param data [PatchMonthCategoryWrapper] The category to update. Only `budgeted` (assigned) amount can be updated and any other fields specified will be ignored. # @param [Hash] opts the optional parameters # @return [Array<(SaveCategoryResponse, Integer, Hash)>] SaveCategoryResponse data, response status code and response headers - def update_month_category_with_http_info(budget_id, month, category_id, data, opts = {}) + def update_month_category_with_http_info(plan_id, month, category_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoriesApi.update_month_category ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.update_month_category" + # 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 CategoriesApi.update_month_category" end # verify the required parameter 'month' is set if @api_client.config.client_side_validation && month.nil? @@ -348,7 +575,7 @@ def update_month_category_with_http_info(budget_id, month, category_id, data, op fail ArgumentError, "Missing the required parameter 'data' when calling CategoriesApi.update_month_category" end # resource path - local_var_path = '/budgets/{budget_id}/months/{month}/categories/{category_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) + local_var_path = '/budgets/{plan_id}/months/{month}/categories/{category_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/lib/ynab/api/deprecated_api.rb b/lib/ynab/api/deprecated_api.rb index 0927bd8..1b50401 100644 --- a/lib/ynab/api/deprecated_api.rb +++ b/lib/ynab/api/deprecated_api.rb @@ -20,36 +20,36 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Bulk create transactions - # Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{plan_id}/transactions' to create multiple transactions. + # @param plan_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). # @param transactions [BulkTransactions] The list of transactions to create # @param [Hash] opts the optional parameters # @return [BulkResponse] - def bulk_create_transactions(budget_id, transactions, opts = {}) - data, _status_code, _headers = bulk_create_transactions_with_http_info(budget_id, transactions, opts) + def bulk_create_transactions(plan_id, transactions, opts = {}) + data, _status_code, _headers = bulk_create_transactions_with_http_info(plan_id, transactions, opts) data end # Bulk create transactions - # Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{budget_id}/transactions' to create multiple transactions. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Creates multiple transactions. Although this endpoint is still supported, it is recommended to use 'POST /budgets/{plan_id}/transactions' to create multiple transactions. + # @param plan_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). # @param transactions [BulkTransactions] The list of transactions to create # @param [Hash] opts the optional parameters # @return [Array<(BulkResponse, Integer, Hash)>] BulkResponse data, response status code and response headers - def bulk_create_transactions_with_http_info(budget_id, transactions, opts = {}) + def bulk_create_transactions_with_http_info(plan_id, transactions, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DeprecatedApi.bulk_create_transactions ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling DeprecatedApi.bulk_create_transactions" + # 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 DeprecatedApi.bulk_create_transactions" end # verify the required parameter 'transactions' is set if @api_client.config.client_side_validation && transactions.nil? fail ArgumentError, "Missing the required parameter 'transactions' when calling DeprecatedApi.bulk_create_transactions" end # resource path - local_var_path = '/budgets/{budget_id}/transactions/bulk'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions/bulk'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/lib/ynab/api/money_movements_api.rb b/lib/ynab/api/money_movements_api.rb new file mode 100644 index 0000000..c09a6ae --- /dev/null +++ b/lib/ynab/api/money_movements_api.rb @@ -0,0 +1,282 @@ +=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 'cgi' + +module YNAB + class MoneyMovementsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Get all money movement groups + # Returns all money movement groups + # @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 [Hash] opts the optional parameters + # @return [MoneyMovementGroupsResponse] + def get_money_movement_groups(plan_id, opts = {}) + data, _status_code, _headers = get_money_movement_groups_with_http_info(plan_id, opts) + data + end + + # Get all money movement groups + # Returns all money movement groups + # @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 [Hash] opts the optional parameters + # @return [Array<(MoneyMovementGroupsResponse, Integer, Hash)>] MoneyMovementGroupsResponse data, response status code and response headers + def get_money_movement_groups_with_http_info(plan_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MoneyMovementsApi.get_money_movement_groups ...' + 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 MoneyMovementsApi.get_money_movement_groups" + end + # resource path + local_var_path = '/budgets/{plan_id}/money_movement_groups'.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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MoneyMovementGroupsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"MoneyMovementsApi.get_money_movement_groups", + :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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MoneyMovementsApi#get_money_movement_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get money movement groups for a plan month + # Returns all money movement groups for a specific month + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # @param [Hash] opts the optional parameters + # @return [MoneyMovementGroupsResponse] + def get_money_movement_groups_by_month(plan_id, month, opts = {}) + data, _status_code, _headers = get_money_movement_groups_by_month_with_http_info(plan_id, month, opts) + data + end + + # Get money movement groups for a plan month + # Returns all money movement groups for a specific month + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # @param [Hash] opts the optional parameters + # @return [Array<(MoneyMovementGroupsResponse, Integer, Hash)>] MoneyMovementGroupsResponse data, response status code and response headers + def get_money_movement_groups_by_month_with_http_info(plan_id, month, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MoneyMovementsApi.get_money_movement_groups_by_month ...' + 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 MoneyMovementsApi.get_money_movement_groups_by_month" + end + # verify the required parameter 'month' is set + if @api_client.config.client_side_validation && month.nil? + fail ArgumentError, "Missing the required parameter 'month' when calling MoneyMovementsApi.get_money_movement_groups_by_month" + end + # resource path + local_var_path = '/budgets/{plan_id}/months/{month}/money_movement_groups'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MoneyMovementGroupsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"MoneyMovementsApi.get_money_movement_groups_by_month", + :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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MoneyMovementsApi#get_money_movement_groups_by_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all money movements + # Returns all money movements + # @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 [Hash] opts the optional parameters + # @return [MoneyMovementsResponse] + def get_money_movements(plan_id, opts = {}) + data, _status_code, _headers = get_money_movements_with_http_info(plan_id, opts) + data + end + + # Get all money movements + # Returns all money movements + # @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 [Hash] opts the optional parameters + # @return [Array<(MoneyMovementsResponse, Integer, Hash)>] MoneyMovementsResponse data, response status code and response headers + def get_money_movements_with_http_info(plan_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MoneyMovementsApi.get_money_movements ...' + 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 MoneyMovementsApi.get_money_movements" + end + # resource path + local_var_path = '/budgets/{plan_id}/money_movements'.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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MoneyMovementsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"MoneyMovementsApi.get_money_movements", + :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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MoneyMovementsApi#get_money_movements\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get money movements for a plan month + # Returns all money movements for a specific month + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # @param [Hash] opts the optional parameters + # @return [MoneyMovementsResponse] + def get_money_movements_by_month(plan_id, month, opts = {}) + data, _status_code, _headers = get_money_movements_by_month_with_http_info(plan_id, month, opts) + data + end + + # Get money movements for a plan month + # Returns all money movements for a specific month + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # @param [Hash] opts the optional parameters + # @return [Array<(MoneyMovementsResponse, Integer, Hash)>] MoneyMovementsResponse data, response status code and response headers + def get_money_movements_by_month_with_http_info(plan_id, month, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MoneyMovementsApi.get_money_movements_by_month ...' + 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 MoneyMovementsApi.get_money_movements_by_month" + end + # verify the required parameter 'month' is set + if @api_client.config.client_side_validation && month.nil? + fail ArgumentError, "Missing the required parameter 'month' when calling MoneyMovementsApi.get_money_movements_by_month" + end + # resource path + local_var_path = '/budgets/{plan_id}/months/{month}/money_movements'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.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']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MoneyMovementsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearer'] + + new_options = opts.merge( + :operation => :"MoneyMovementsApi.get_money_movements_by_month", + :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(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MoneyMovementsApi#get_money_movements_by_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/months_api.rb b/lib/ynab/api/months_api.rb index d809ef5..a773bf0 100644 --- a/lib/ynab/api/months_api.rb +++ b/lib/ynab/api/months_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -16,37 +15,37 @@ class MonthsApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # Single budget month - # Returns a single budget month - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [Date] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Get a plan month + # Returns a single plan month + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param [Hash] opts the optional parameters # @return [MonthDetailResponse] - def get_budget_month(budget_id, month, opts = {}) - data, _status_code, _headers = get_budget_month_with_http_info(budget_id, month, opts) + def get_plan_month(plan_id, month, opts = {}) + data, _status_code, _headers = get_plan_month_with_http_info(plan_id, month, opts) data end - # Single budget month - # Returns a single budget month - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [Date] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Get a plan month + # Returns a single plan month + # @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 month [Date] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param [Hash] opts the optional parameters # @return [Array<(MonthDetailResponse, Integer, Hash)>] MonthDetailResponse data, response status code and response headers - def get_budget_month_with_http_info(budget_id, month, opts = {}) + def get_plan_month_with_http_info(plan_id, month, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: MonthsApi.get_budget_month ...' + @api_client.config.logger.debug 'Calling API: MonthsApi.get_plan_month ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling MonthsApi.get_budget_month" + # 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 MonthsApi.get_plan_month" end # verify the required parameter 'month' is set if @api_client.config.client_side_validation && month.nil? - fail ArgumentError, "Missing the required parameter 'month' when calling MonthsApi.get_budget_month" + fail ArgumentError, "Missing the required parameter 'month' when calling MonthsApi.get_plan_month" end # resource path - local_var_path = '/budgets/{budget_id}/months/{month}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)) + local_var_path = '/budgets/{plan_id}/months/{month}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -69,7 +68,7 @@ def get_budget_month_with_http_info(budget_id, month, opts = {}) auth_names = opts[:debug_auth_names] || ['bearer'] new_options = opts.merge( - :operation => :"MonthsApi.get_budget_month", + :operation => :"MonthsApi.get_plan_month", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -80,38 +79,38 @@ def get_budget_month_with_http_info(budget_id, month, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: MonthsApi#get_budget_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MonthsApi#get_plan_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # List budget months - # Returns all budget months - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all plan months + # Returns all plan months + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [MonthSummariesResponse] - def get_budget_months(budget_id, opts = {}) - data, _status_code, _headers = get_budget_months_with_http_info(budget_id, opts) + def get_plan_months(plan_id, opts = {}) + data, _status_code, _headers = get_plan_months_with_http_info(plan_id, opts) data end - # List budget months - # Returns all budget months - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all plan months + # Returns all plan months + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(MonthSummariesResponse, Integer, Hash)>] MonthSummariesResponse data, response status code and response headers - def get_budget_months_with_http_info(budget_id, opts = {}) + def get_plan_months_with_http_info(plan_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: MonthsApi.get_budget_months ...' + @api_client.config.logger.debug 'Calling API: MonthsApi.get_plan_months ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling MonthsApi.get_budget_months" + # 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 MonthsApi.get_plan_months" end # resource path - local_var_path = '/budgets/{budget_id}/months'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/months'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -135,7 +134,7 @@ def get_budget_months_with_http_info(budget_id, opts = {}) auth_names = opts[:debug_auth_names] || ['bearer'] new_options = opts.merge( - :operation => :"MonthsApi.get_budget_months", + :operation => :"MonthsApi.get_plan_months", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -146,7 +145,7 @@ def get_budget_months_with_http_info(budget_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: MonthsApi#get_budget_months\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: MonthsApi#get_plan_months\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/ynab/api/payee_locations_api.rb b/lib/ynab/api/payee_locations_api.rb index 908e624..42f44d4 100644 --- a/lib/ynab/api/payee_locations_api.rb +++ b/lib/ynab/api/payee_locations_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -16,37 +15,37 @@ class PayeeLocationsApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # Single payee location + # Get a payee location # Returns a single payee location - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_location_id [String] id of payee location # @param [Hash] opts the optional parameters # @return [PayeeLocationResponse] - def get_payee_location_by_id(budget_id, payee_location_id, opts = {}) - data, _status_code, _headers = get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts) + def get_payee_location_by_id(plan_id, payee_location_id, opts = {}) + data, _status_code, _headers = get_payee_location_by_id_with_http_info(plan_id, payee_location_id, opts) data end - # Single payee location + # Get a payee location # Returns a single payee location - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_location_id [String] id of payee location # @param [Hash] opts the optional parameters # @return [Array<(PayeeLocationResponse, Integer, Hash)>] PayeeLocationResponse data, response status code and response headers - def get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts = {}) + def get_payee_location_by_id_with_http_info(plan_id, payee_location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PayeeLocationsApi.get_payee_location_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_location_by_id" + # 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 PayeeLocationsApi.get_payee_location_by_id" end # verify the required parameter 'payee_location_id' is set if @api_client.config.client_side_validation && payee_location_id.nil? fail ArgumentError, "Missing the required parameter 'payee_location_id' when calling PayeeLocationsApi.get_payee_location_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/payee_locations/{payee_location_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'payee_location_id' + '}', CGI.escape(payee_location_id.to_s)) + local_var_path = '/budgets/{plan_id}/payee_locations/{payee_location_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'payee_location_id' + '}', CGI.escape(payee_location_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -85,31 +84,31 @@ def get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts = return data, status_code, headers end - # List payee locations + # Get all payee locations # Returns all payee locations - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @return [PayeeLocationsResponse] - def get_payee_locations(budget_id, opts = {}) - data, _status_code, _headers = get_payee_locations_with_http_info(budget_id, opts) + def get_payee_locations(plan_id, opts = {}) + data, _status_code, _headers = get_payee_locations_with_http_info(plan_id, opts) data end - # List payee locations + # Get all payee locations # Returns all payee locations - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @return [Array<(PayeeLocationsResponse, Integer, Hash)>] PayeeLocationsResponse data, response status code and response headers - def get_payee_locations_with_http_info(budget_id, opts = {}) + def get_payee_locations_with_http_info(plan_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PayeeLocationsApi.get_payee_locations ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_locations" + # 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 PayeeLocationsApi.get_payee_locations" end # resource path - local_var_path = '/budgets/{budget_id}/payee_locations'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/payee_locations'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -148,37 +147,37 @@ def get_payee_locations_with_http_info(budget_id, opts = {}) return data, status_code, headers end - # List locations for a payee + # Get all locations for a payee # Returns all payee locations for a specified payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_id [String] id of payee # @param [Hash] opts the optional parameters # @return [PayeeLocationsResponse] - def get_payee_locations_by_payee(budget_id, payee_id, opts = {}) - data, _status_code, _headers = get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts) + def get_payee_locations_by_payee(plan_id, payee_id, opts = {}) + data, _status_code, _headers = get_payee_locations_by_payee_with_http_info(plan_id, payee_id, opts) data end - # List locations for a payee + # Get all locations for a payee # Returns all payee locations for a specified payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_id [String] id of payee # @param [Hash] opts the optional parameters # @return [Array<(PayeeLocationsResponse, Integer, Hash)>] PayeeLocationsResponse data, response status code and response headers - def get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts = {}) + def get_payee_locations_by_payee_with_http_info(plan_id, payee_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PayeeLocationsApi.get_payee_locations_by_payee ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_locations_by_payee" + # 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 PayeeLocationsApi.get_payee_locations_by_payee" end # verify the required parameter 'payee_id' is set if @api_client.config.client_side_validation && payee_id.nil? fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeeLocationsApi.get_payee_locations_by_payee" end # resource path - local_var_path = '/budgets/{budget_id}/payees/{payee_id}/payee_locations'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) + local_var_path = '/budgets/{plan_id}/payees/{payee_id}/payee_locations'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/lib/ynab/api/payees_api.rb b/lib/ynab/api/payees_api.rb index 8e30fcc..84139f4 100644 --- a/lib/ynab/api/payees_api.rb +++ b/lib/ynab/api/payees_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -16,37 +15,37 @@ class PayeesApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # Single payee + # Get a payee # Returns a single payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_id [String] The id of the payee # @param [Hash] opts the optional parameters # @return [PayeeResponse] - def get_payee_by_id(budget_id, payee_id, opts = {}) - data, _status_code, _headers = get_payee_by_id_with_http_info(budget_id, payee_id, opts) + def get_payee_by_id(plan_id, payee_id, opts = {}) + data, _status_code, _headers = get_payee_by_id_with_http_info(plan_id, payee_id, opts) data end - # Single payee + # Get a payee # Returns a single payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_id [String] The id of the payee # @param [Hash] opts the optional parameters # @return [Array<(PayeeResponse, Integer, Hash)>] PayeeResponse data, response status code and response headers - def get_payee_by_id_with_http_info(budget_id, payee_id, opts = {}) + def get_payee_by_id_with_http_info(plan_id, payee_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PayeesApi.get_payee_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payee_by_id" + # 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.get_payee_by_id" end # verify the required parameter 'payee_id' is set if @api_client.config.client_side_validation && payee_id.nil? fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeesApi.get_payee_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/payees/{payee_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) + local_var_path = '/budgets/{plan_id}/payees/{payee_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -85,33 +84,33 @@ def get_payee_by_id_with_http_info(budget_id, payee_id, opts = {}) return data, status_code, headers end - # List payees + # Get all payees # Returns all payees - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [PayeesResponse] - def get_payees(budget_id, opts = {}) - data, _status_code, _headers = get_payees_with_http_info(budget_id, opts) + def get_payees(plan_id, opts = {}) + data, _status_code, _headers = get_payees_with_http_info(plan_id, opts) data end - # List payees + # Get all payees # Returns all payees - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(PayeesResponse, Integer, Hash)>] PayeesResponse data, response status code and response headers - def get_payees_with_http_info(budget_id, opts = {}) + def get_payees_with_http_info(plan_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PayeesApi.get_payees ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payees" + # 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.get_payees" end # resource path - local_var_path = '/budgets/{budget_id}/payees'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/payees'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -153,30 +152,30 @@ def get_payees_with_http_info(budget_id, opts = {}) # Update a payee # Update a payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_id [String] The id of the payee # @param data [PatchPayeeWrapper] The payee to update # @param [Hash] opts the optional parameters # @return [SavePayeeResponse] - def update_payee(budget_id, payee_id, data, opts = {}) - data, _status_code, _headers = update_payee_with_http_info(budget_id, payee_id, data, opts) + def update_payee(plan_id, payee_id, data, opts = {}) + data, _status_code, _headers = update_payee_with_http_info(plan_id, payee_id, data, opts) data end # Update a payee # Update a payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 payee_id [String] The id of the payee # @param data [PatchPayeeWrapper] The payee to update # @param [Hash] opts the optional parameters # @return [Array<(SavePayeeResponse, Integer, Hash)>] SavePayeeResponse data, response status code and response headers - def update_payee_with_http_info(budget_id, payee_id, data, opts = {}) + def update_payee_with_http_info(plan_id, payee_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PayeesApi.update_payee ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.update_payee" + # 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.update_payee" end # verify the required parameter 'payee_id' is set if @api_client.config.client_side_validation && payee_id.nil? @@ -187,7 +186,7 @@ def update_payee_with_http_info(budget_id, payee_id, data, opts = {}) fail ArgumentError, "Missing the required parameter 'data' when calling PayeesApi.update_payee" end # resource path - local_var_path = '/budgets/{budget_id}/payees/{payee_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) + local_var_path = '/budgets/{plan_id}/payees/{payee_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/lib/ynab/api/budgets_api.rb b/lib/ynab/api/plans_api.rb similarity index 51% rename from lib/ynab/api/budgets_api.rb rename to lib/ynab/api/plans_api.rb index ff2f72d..4f6b0d4 100644 --- a/lib/ynab/api/budgets_api.rb +++ b/lib/ynab/api/plans_api.rb @@ -4,45 +4,44 @@ #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 'cgi' module YNAB - class BudgetsApi + class PlansApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end - # Single budget - # Returns a single budget with all related entities. This resource is effectively a full budget export. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get a plan + # Returns a single plan with all related entities. This resource is effectively a full plan export. + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. - # @return [BudgetDetailResponse] - def get_budget_by_id(budget_id, opts = {}) - data, _status_code, _headers = get_budget_by_id_with_http_info(budget_id, opts) + # @return [PlanDetailResponse] + def get_plan_by_id(plan_id, opts = {}) + data, _status_code, _headers = get_plan_by_id_with_http_info(plan_id, opts) data end - # Single budget - # Returns a single budget with all related entities. This resource is effectively a full budget export. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get a plan + # Returns a single plan with all related entities. This resource is effectively a full plan export. + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. - # @return [Array<(BudgetDetailResponse, Integer, Hash)>] BudgetDetailResponse data, response status code and response headers - def get_budget_by_id_with_http_info(budget_id, opts = {}) + # @return [Array<(PlanDetailResponse, Integer, Hash)>] PlanDetailResponse data, response status code and response headers + def get_plan_by_id_with_http_info(plan_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_by_id ...' + @api_client.config.logger.debug 'Calling API: PlansApi.get_plan_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_by_id" + # 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 PlansApi.get_plan_by_id" end # resource path - local_var_path = '/budgets/{budget_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -60,13 +59,13 @@ def get_budget_by_id_with_http_info(budget_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'BudgetDetailResponse' + return_type = opts[:debug_return_type] || 'PlanDetailResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer'] new_options = opts.merge( - :operation => :"BudgetsApi.get_budget_by_id", + :operation => :"PlansApi.get_plan_by_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -77,36 +76,36 @@ def get_budget_by_id_with_http_info(budget_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: BudgetsApi#get_budget_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PlansApi#get_plan_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Budget Settings - # Returns settings for a budget - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get plan settings + # Returns settings for a plan + # @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 [Hash] opts the optional parameters - # @return [BudgetSettingsResponse] - def get_budget_settings_by_id(budget_id, opts = {}) - data, _status_code, _headers = get_budget_settings_by_id_with_http_info(budget_id, opts) + # @return [PlanSettingsResponse] + def get_plan_settings_by_id(plan_id, opts = {}) + data, _status_code, _headers = get_plan_settings_by_id_with_http_info(plan_id, opts) data end - # Budget Settings - # Returns settings for a budget - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get plan settings + # Returns settings for a plan + # @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 [Hash] opts the optional parameters - # @return [Array<(BudgetSettingsResponse, Integer, Hash)>] BudgetSettingsResponse data, response status code and response headers - def get_budget_settings_by_id_with_http_info(budget_id, opts = {}) + # @return [Array<(PlanSettingsResponse, Integer, Hash)>] PlanSettingsResponse data, response status code and response headers + def get_plan_settings_by_id_with_http_info(plan_id, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_settings_by_id ...' + @api_client.config.logger.debug 'Calling API: PlansApi.get_plan_settings_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_settings_by_id" + # 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 PlansApi.get_plan_settings_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/settings'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/settings'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -123,13 +122,13 @@ def get_budget_settings_by_id_with_http_info(budget_id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'BudgetSettingsResponse' + return_type = opts[:debug_return_type] || 'PlanSettingsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer'] new_options = opts.merge( - :operation => :"BudgetsApi.get_budget_settings_by_id", + :operation => :"PlansApi.get_plan_settings_by_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -140,29 +139,29 @@ def get_budget_settings_by_id_with_http_info(budget_id, opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: BudgetsApi#get_budget_settings_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PlansApi#get_plan_settings_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # List budgets - # Returns budgets list with summary information + # Get all plans + # Returns plans list with summary information # @param [Hash] opts the optional parameters - # @option opts [Boolean] :include_accounts Whether to include the list of budget accounts - # @return [BudgetSummaryResponse] - def get_budgets(opts = {}) - data, _status_code, _headers = get_budgets_with_http_info(opts) + # @option opts [Boolean] :include_accounts Whether to include the list of plan accounts + # @return [PlanSummaryResponse] + def get_plans(opts = {}) + data, _status_code, _headers = get_plans_with_http_info(opts) data end - # List budgets - # Returns budgets list with summary information + # Get all plans + # Returns plans list with summary information # @param [Hash] opts the optional parameters - # @option opts [Boolean] :include_accounts Whether to include the list of budget accounts - # @return [Array<(BudgetSummaryResponse, Integer, Hash)>] BudgetSummaryResponse data, response status code and response headers - def get_budgets_with_http_info(opts = {}) + # @option opts [Boolean] :include_accounts Whether to include the list of plan accounts + # @return [Array<(PlanSummaryResponse, Integer, Hash)>] PlanSummaryResponse data, response status code and response headers + def get_plans_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budgets ...' + @api_client.config.logger.debug 'Calling API: PlansApi.get_plans ...' end # resource path local_var_path = '/budgets' @@ -183,13 +182,13 @@ def get_budgets_with_http_info(opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'BudgetSummaryResponse' + return_type = opts[:debug_return_type] || 'PlanSummaryResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer'] new_options = opts.merge( - :operation => :"BudgetsApi.get_budgets", + :operation => :"PlansApi.get_plans", :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -200,7 +199,7 @@ def get_budgets_with_http_info(opts = {}) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: BudgetsApi#get_budgets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: PlansApi#get_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/ynab/api/scheduled_transactions_api.rb b/lib/ynab/api/scheduled_transactions_api.rb index d3b850a..183f59b 100644 --- a/lib/ynab/api/scheduled_transactions_api.rb +++ b/lib/ynab/api/scheduled_transactions_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -16,37 +15,37 @@ class ScheduledTransactionsApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # Create a single scheduled transaction + # Create a scheduled transaction # Creates a single scheduled transaction (a transaction with a future date). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [PostScheduledTransactionWrapper] The scheduled transaction to create # @param [Hash] opts the optional parameters # @return [ScheduledTransactionResponse] - def create_scheduled_transaction(budget_id, data, opts = {}) - data, _status_code, _headers = create_scheduled_transaction_with_http_info(budget_id, data, opts) + def create_scheduled_transaction(plan_id, data, opts = {}) + data, _status_code, _headers = create_scheduled_transaction_with_http_info(plan_id, data, opts) data end - # Create a single scheduled transaction + # Create a scheduled transaction # Creates a single scheduled transaction (a transaction with a future date). - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [PostScheduledTransactionWrapper] The scheduled transaction to create # @param [Hash] opts the optional parameters # @return [Array<(ScheduledTransactionResponse, Integer, Hash)>] ScheduledTransactionResponse data, response status code and response headers - def create_scheduled_transaction_with_http_info(budget_id, data, opts = {}) + def create_scheduled_transaction_with_http_info(plan_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduledTransactionsApi.create_scheduled_transaction ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.create_scheduled_transaction" + # 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 ScheduledTransactionsApi.create_scheduled_transaction" 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 ScheduledTransactionsApi.create_scheduled_transaction" end # resource path - local_var_path = '/budgets/{budget_id}/scheduled_transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/scheduled_transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -90,37 +89,37 @@ def create_scheduled_transaction_with_http_info(budget_id, data, opts = {}) return data, status_code, headers end - # Deletes an existing scheduled transaction + # Delete a scheduled transaction # Deletes a scheduled transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 scheduled_transaction_id [String] The id of the scheduled transaction # @param [Hash] opts the optional parameters # @return [ScheduledTransactionResponse] - def delete_scheduled_transaction(budget_id, scheduled_transaction_id, opts = {}) - data, _status_code, _headers = delete_scheduled_transaction_with_http_info(budget_id, scheduled_transaction_id, opts) + def delete_scheduled_transaction(plan_id, scheduled_transaction_id, opts = {}) + data, _status_code, _headers = delete_scheduled_transaction_with_http_info(plan_id, scheduled_transaction_id, opts) data end - # Deletes an existing scheduled transaction + # Delete a scheduled transaction # Deletes a scheduled transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 scheduled_transaction_id [String] The id of the scheduled transaction # @param [Hash] opts the optional parameters # @return [Array<(ScheduledTransactionResponse, Integer, Hash)>] ScheduledTransactionResponse data, response status code and response headers - def delete_scheduled_transaction_with_http_info(budget_id, scheduled_transaction_id, opts = {}) + def delete_scheduled_transaction_with_http_info(plan_id, scheduled_transaction_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduledTransactionsApi.delete_scheduled_transaction ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.delete_scheduled_transaction" + # 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 ScheduledTransactionsApi.delete_scheduled_transaction" end # verify the required parameter 'scheduled_transaction_id' is set if @api_client.config.client_side_validation && scheduled_transaction_id.nil? fail ArgumentError, "Missing the required parameter 'scheduled_transaction_id' when calling ScheduledTransactionsApi.delete_scheduled_transaction" end # resource path - local_var_path = '/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'scheduled_transaction_id' + '}', CGI.escape(scheduled_transaction_id.to_s)) + local_var_path = '/budgets/{plan_id}/scheduled_transactions/{scheduled_transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'scheduled_transaction_id' + '}', CGI.escape(scheduled_transaction_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -159,37 +158,37 @@ def delete_scheduled_transaction_with_http_info(budget_id, scheduled_transaction return data, status_code, headers end - # Single scheduled transaction + # Get a scheduled transaction # Returns a single scheduled transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 scheduled_transaction_id [String] The id of the scheduled transaction # @param [Hash] opts the optional parameters # @return [ScheduledTransactionResponse] - def get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id, opts = {}) - data, _status_code, _headers = get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts) + def get_scheduled_transaction_by_id(plan_id, scheduled_transaction_id, opts = {}) + data, _status_code, _headers = get_scheduled_transaction_by_id_with_http_info(plan_id, scheduled_transaction_id, opts) data end - # Single scheduled transaction + # Get a scheduled transaction # Returns a single scheduled transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 scheduled_transaction_id [String] The id of the scheduled transaction # @param [Hash] opts the optional parameters # @return [Array<(ScheduledTransactionResponse, Integer, Hash)>] ScheduledTransactionResponse data, response status code and response headers - def get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts = {}) + def get_scheduled_transaction_by_id_with_http_info(plan_id, scheduled_transaction_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduledTransactionsApi.get_scheduled_transaction_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id" + # 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 ScheduledTransactionsApi.get_scheduled_transaction_by_id" end # verify the required parameter 'scheduled_transaction_id' is set if @api_client.config.client_side_validation && scheduled_transaction_id.nil? fail ArgumentError, "Missing the required parameter 'scheduled_transaction_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'scheduled_transaction_id' + '}', CGI.escape(scheduled_transaction_id.to_s)) + local_var_path = '/budgets/{plan_id}/scheduled_transactions/{scheduled_transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'scheduled_transaction_id' + '}', CGI.escape(scheduled_transaction_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -228,33 +227,33 @@ def get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transact return data, status_code, headers end - # List scheduled transactions + # Get all scheduled transactions # Returns all scheduled transactions - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [ScheduledTransactionsResponse] - def get_scheduled_transactions(budget_id, opts = {}) - data, _status_code, _headers = get_scheduled_transactions_with_http_info(budget_id, opts) + def get_scheduled_transactions(plan_id, opts = {}) + data, _status_code, _headers = get_scheduled_transactions_with_http_info(plan_id, opts) data end - # List scheduled transactions + # Get all scheduled transactions # Returns all scheduled transactions - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [Hash] opts the optional parameters # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(ScheduledTransactionsResponse, Integer, Hash)>] ScheduledTransactionsResponse data, response status code and response headers - def get_scheduled_transactions_with_http_info(budget_id, opts = {}) + def get_scheduled_transactions_with_http_info(plan_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduledTransactionsApi.get_scheduled_transactions ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transactions" + # 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 ScheduledTransactionsApi.get_scheduled_transactions" end # resource path - local_var_path = '/budgets/{budget_id}/scheduled_transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/scheduled_transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -294,32 +293,32 @@ def get_scheduled_transactions_with_http_info(budget_id, opts = {}) return data, status_code, headers end - # Updates an existing scheduled transaction + # Update a scheduled transaction # Updates a single scheduled transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 scheduled_transaction_id [String] The id of the scheduled transaction # @param put_scheduled_transaction_wrapper [PutScheduledTransactionWrapper] The scheduled transaction to update # @param [Hash] opts the optional parameters # @return [ScheduledTransactionResponse] - def update_scheduled_transaction(budget_id, scheduled_transaction_id, put_scheduled_transaction_wrapper, opts = {}) - data, _status_code, _headers = update_scheduled_transaction_with_http_info(budget_id, scheduled_transaction_id, put_scheduled_transaction_wrapper, opts) + def update_scheduled_transaction(plan_id, scheduled_transaction_id, put_scheduled_transaction_wrapper, opts = {}) + data, _status_code, _headers = update_scheduled_transaction_with_http_info(plan_id, scheduled_transaction_id, put_scheduled_transaction_wrapper, opts) data end - # Updates an existing scheduled transaction + # Update a scheduled transaction # Updates a single scheduled transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 scheduled_transaction_id [String] The id of the scheduled transaction # @param put_scheduled_transaction_wrapper [PutScheduledTransactionWrapper] The scheduled transaction to update # @param [Hash] opts the optional parameters # @return [Array<(ScheduledTransactionResponse, Integer, Hash)>] ScheduledTransactionResponse data, response status code and response headers - def update_scheduled_transaction_with_http_info(budget_id, scheduled_transaction_id, put_scheduled_transaction_wrapper, opts = {}) + def update_scheduled_transaction_with_http_info(plan_id, scheduled_transaction_id, put_scheduled_transaction_wrapper, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ScheduledTransactionsApi.update_scheduled_transaction ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.update_scheduled_transaction" + # 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 ScheduledTransactionsApi.update_scheduled_transaction" end # verify the required parameter 'scheduled_transaction_id' is set if @api_client.config.client_side_validation && scheduled_transaction_id.nil? @@ -330,7 +329,7 @@ def update_scheduled_transaction_with_http_info(budget_id, scheduled_transaction fail ArgumentError, "Missing the required parameter 'put_scheduled_transaction_wrapper' when calling ScheduledTransactionsApi.update_scheduled_transaction" end # resource path - local_var_path = '/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'scheduled_transaction_id' + '}', CGI.escape(scheduled_transaction_id.to_s)) + local_var_path = '/budgets/{plan_id}/scheduled_transactions/{scheduled_transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'scheduled_transaction_id' + '}', CGI.escape(scheduled_transaction_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/lib/ynab/api/transactions_api.rb b/lib/ynab/api/transactions_api.rb index a5dfa77..b49e680 100644 --- a/lib/ynab/api/transactions_api.rb +++ b/lib/ynab/api/transactions_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -18,35 +17,35 @@ def initialize(api_client = ApiClient.default) end # Create a single transaction or multiple transactions # Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions (transactions with a future date) cannot be created on this endpoint. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [PostTransactionsWrapper] The transaction or transactions to create. To create a single transaction you can specify a value for the `transaction` object and to create multiple transactions you can specify an array of `transactions`. It is expected that you will only provide a value for one of these objects. # @param [Hash] opts the optional parameters # @return [SaveTransactionsResponse] - def create_transaction(budget_id, data, opts = {}) - data, _status_code, _headers = create_transaction_with_http_info(budget_id, data, opts) + def create_transaction(plan_id, data, opts = {}) + data, _status_code, _headers = create_transaction_with_http_info(plan_id, data, opts) data end # Create a single transaction or multiple transactions # Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions (transactions with a future date) cannot be created on this endpoint. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [PostTransactionsWrapper] The transaction or transactions to create. To create a single transaction you can specify a value for the `transaction` object and to create multiple transactions you can specify an array of `transactions`. It is expected that you will only provide a value for one of these objects. # @param [Hash] opts the optional parameters # @return [Array<(SaveTransactionsResponse, Integer, Hash)>] SaveTransactionsResponse data, response status code and response headers - def create_transaction_with_http_info(budget_id, data, opts = {}) + def create_transaction_with_http_info(plan_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.create_transaction ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.create_transaction" + # 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 TransactionsApi.create_transaction" 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 TransactionsApi.create_transaction" end # resource path - local_var_path = '/budgets/{budget_id}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -90,37 +89,37 @@ def create_transaction_with_http_info(budget_id, data, opts = {}) return data, status_code, headers end - # Deletes an existing transaction + # Delete a transaction # Deletes a transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 transaction_id [String] The id of the transaction # @param [Hash] opts the optional parameters # @return [TransactionResponse] - def delete_transaction(budget_id, transaction_id, opts = {}) - data, _status_code, _headers = delete_transaction_with_http_info(budget_id, transaction_id, opts) + def delete_transaction(plan_id, transaction_id, opts = {}) + data, _status_code, _headers = delete_transaction_with_http_info(plan_id, transaction_id, opts) data end - # Deletes an existing transaction + # Delete a transaction # Deletes a transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 transaction_id [String] The id of the transaction # @param [Hash] opts the optional parameters # @return [Array<(TransactionResponse, Integer, Hash)>] TransactionResponse data, response status code and response headers - def delete_transaction_with_http_info(budget_id, transaction_id, opts = {}) + def delete_transaction_with_http_info(plan_id, transaction_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.delete_transaction ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.delete_transaction" + # 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 TransactionsApi.delete_transaction" end # verify the required parameter 'transaction_id' is set if @api_client.config.client_side_validation && transaction_id.nil? fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.delete_transaction" end # resource path - local_var_path = '/budgets/{budget_id}/transactions/{transaction_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions/{transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -159,37 +158,37 @@ def delete_transaction_with_http_info(budget_id, transaction_id, opts = {}) return data, status_code, headers end - # Single transaction + # Get a transaction # Returns a single transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 transaction_id [String] The id of the transaction # @param [Hash] opts the optional parameters # @return [TransactionResponse] - def get_transaction_by_id(budget_id, transaction_id, opts = {}) - data, _status_code, _headers = get_transaction_by_id_with_http_info(budget_id, transaction_id, opts) + def get_transaction_by_id(plan_id, transaction_id, opts = {}) + data, _status_code, _headers = get_transaction_by_id_with_http_info(plan_id, transaction_id, opts) data end - # Single transaction + # Get a transaction # Returns a single transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 transaction_id [String] The id of the transaction # @param [Hash] opts the optional parameters # @return [Array<(TransactionResponse, Integer, Hash)>] TransactionResponse data, response status code and response headers - def get_transaction_by_id_with_http_info(budget_id, transaction_id, opts = {}) + def get_transaction_by_id_with_http_info(plan_id, transaction_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transaction_by_id ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transaction_by_id" + # 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 TransactionsApi.get_transaction_by_id" end # verify the required parameter 'transaction_id' is set if @api_client.config.client_side_validation && transaction_id.nil? fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.get_transaction_by_id" end # resource path - local_var_path = '/budgets/{budget_id}/transactions/{transaction_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions/{transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -228,37 +227,37 @@ def get_transaction_by_id_with_http_info(budget_id, transaction_id, opts = {}) return data, status_code, headers end - # List transactions - # Returns budget transactions, excluding any pending transactions - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all transactions + # Returns plan transactions, excluding any pending transactions + # @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 [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [TransactionsResponse] - def get_transactions(budget_id, opts = {}) - data, _status_code, _headers = get_transactions_with_http_info(budget_id, opts) + def get_transactions(plan_id, opts = {}) + data, _status_code, _headers = get_transactions_with_http_info(plan_id, opts) data end - # List transactions - # Returns budget transactions, excluding any pending transactions - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all transactions + # Returns plan transactions, excluding any pending transactions + # @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 [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(TransactionsResponse, Integer, Hash)>] TransactionsResponse data, response status code and response headers - def get_transactions_with_http_info(budget_id, opts = {}) + def get_transactions_with_http_info(plan_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions" + # 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 TransactionsApi.get_transactions" end # resource path - local_var_path = '/budgets/{budget_id}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -300,43 +299,43 @@ def get_transactions_with_http_info(budget_id, opts = {}) return data, status_code, headers end - # List account transactions + # Get all account transactions # Returns all transactions for a specified account, excluding any pending transactions - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 account_id [String] The id of the account # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [TransactionsResponse] - def get_transactions_by_account(budget_id, account_id, opts = {}) - data, _status_code, _headers = get_transactions_by_account_with_http_info(budget_id, account_id, opts) + def get_transactions_by_account(plan_id, account_id, opts = {}) + data, _status_code, _headers = get_transactions_by_account_with_http_info(plan_id, account_id, opts) data end - # List account transactions + # Get all account transactions # Returns all transactions for a specified account, excluding any pending transactions - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 account_id [String] The id of the account # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(TransactionsResponse, Integer, Hash)>] TransactionsResponse data, response status code and response headers - def get_transactions_by_account_with_http_info(budget_id, account_id, opts = {}) + def get_transactions_by_account_with_http_info(plan_id, account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_account ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_account" + # 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 TransactionsApi.get_transactions_by_account" end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation && account_id.nil? fail ArgumentError, "Missing the required parameter 'account_id' when calling TransactionsApi.get_transactions_by_account" end # resource path - local_var_path = '/budgets/{budget_id}/accounts/{account_id}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) + local_var_path = '/budgets/{plan_id}/accounts/{account_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'account_id' + '}', CGI.escape(account_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -378,43 +377,43 @@ def get_transactions_by_account_with_http_info(budget_id, account_id, opts = {}) return data, status_code, headers end - # List category transactions, excluding any pending transactions - # Returns all transactions for a specified category - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all category transactions + # Returns all transactions for a specified category, excluding any pending transactions + # @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 category_id [String] The id of the category # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [HybridTransactionsResponse] - def get_transactions_by_category(budget_id, category_id, opts = {}) - data, _status_code, _headers = get_transactions_by_category_with_http_info(budget_id, category_id, opts) + def get_transactions_by_category(plan_id, category_id, opts = {}) + data, _status_code, _headers = get_transactions_by_category_with_http_info(plan_id, category_id, opts) data end - # List category transactions, excluding any pending transactions - # Returns all transactions for a specified category - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all category transactions + # Returns all transactions for a specified category, excluding any pending transactions + # @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 category_id [String] The id of the category # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(HybridTransactionsResponse, Integer, Hash)>] HybridTransactionsResponse data, response status code and response headers - def get_transactions_by_category_with_http_info(budget_id, category_id, opts = {}) + def get_transactions_by_category_with_http_info(plan_id, category_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_category ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_category" + # 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 TransactionsApi.get_transactions_by_category" end # verify the required parameter 'category_id' is set if @api_client.config.client_side_validation && category_id.nil? fail ArgumentError, "Missing the required parameter 'category_id' when calling TransactionsApi.get_transactions_by_category" end # resource path - local_var_path = '/budgets/{budget_id}/categories/{category_id}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) + local_var_path = '/budgets/{plan_id}/categories/{category_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'category_id' + '}', CGI.escape(category_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -456,43 +455,43 @@ def get_transactions_by_category_with_http_info(budget_id, category_id, opts = { return data, status_code, headers end - # List transactions in month, excluding any pending transactions - # Returns all transactions for a specified month - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [String] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Get all plan month transactions + # Returns all transactions for a specified month, excluding any pending transactions + # @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 month [String] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. - # @return [HybridTransactionsResponse] - def get_transactions_by_month(budget_id, month, opts = {}) - data, _status_code, _headers = get_transactions_by_month_with_http_info(budget_id, month, opts) + # @return [TransactionsResponse] + def get_transactions_by_month(plan_id, month, opts = {}) + data, _status_code, _headers = get_transactions_by_month_with_http_info(plan_id, month, opts) data end - # List transactions in month, excluding any pending transactions - # Returns all transactions for a specified month - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). - # @param month [String] The budget month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) + # Get all plan month transactions + # Returns all transactions for a specified month, excluding any pending transactions + # @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 month [String] The plan month in ISO format (e.g. 2016-12-01) (\"current\" can also be used to specify the current calendar month (UTC)) # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. - # @return [Array<(HybridTransactionsResponse, Integer, Hash)>] HybridTransactionsResponse data, response status code and response headers - def get_transactions_by_month_with_http_info(budget_id, month, opts = {}) + # @return [Array<(TransactionsResponse, Integer, Hash)>] TransactionsResponse data, response status code and response headers + def get_transactions_by_month_with_http_info(plan_id, month, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_month ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_month" + # 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 TransactionsApi.get_transactions_by_month" end # verify the required parameter 'month' is set if @api_client.config.client_side_validation && month.nil? fail ArgumentError, "Missing the required parameter 'month' when calling TransactionsApi.get_transactions_by_month" end # resource path - local_var_path = '/budgets/{budget_id}/months/{month}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)) + local_var_path = '/budgets/{plan_id}/months/{month}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'month' + '}', CGI.escape(month.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -512,7 +511,7 @@ def get_transactions_by_month_with_http_info(budget_id, month, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'HybridTransactionsResponse' + return_type = opts[:debug_return_type] || 'TransactionsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['bearer'] @@ -534,43 +533,43 @@ def get_transactions_by_month_with_http_info(budget_id, month, opts = {}) return data, status_code, headers end - # List payee transactions, excluding any pending transactions - # Returns all transactions for a specified payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all payee transactions + # Returns all transactions for a specified payee, excluding any pending transactions + # @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 payee_id [String] The id of the payee # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [HybridTransactionsResponse] - def get_transactions_by_payee(budget_id, payee_id, opts = {}) - data, _status_code, _headers = get_transactions_by_payee_with_http_info(budget_id, payee_id, opts) + def get_transactions_by_payee(plan_id, payee_id, opts = {}) + data, _status_code, _headers = get_transactions_by_payee_with_http_info(plan_id, payee_id, opts) data end - # List payee transactions, excluding any pending transactions - # Returns all transactions for a specified payee - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Get all payee transactions + # Returns all transactions for a specified payee, excluding any pending transactions + # @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 payee_id [String] The id of the payee # @param [Hash] opts the optional parameters # @option opts [Date] :since_date If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). # @option opts [String] :type If specified, only transactions of the specified type will be included. \"uncategorized\" and \"unapproved\" are currently supported. # @option opts [Integer] :last_knowledge_of_server The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included. # @return [Array<(HybridTransactionsResponse, Integer, Hash)>] HybridTransactionsResponse data, response status code and response headers - def get_transactions_by_payee_with_http_info(budget_id, payee_id, opts = {}) + def get_transactions_by_payee_with_http_info(plan_id, payee_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions_by_payee ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_payee" + # 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 TransactionsApi.get_transactions_by_payee" end # verify the required parameter 'payee_id' is set if @api_client.config.client_side_validation && payee_id.nil? fail ArgumentError, "Missing the required parameter 'payee_id' when calling TransactionsApi.get_transactions_by_payee" end # resource path - local_var_path = '/budgets/{budget_id}/payees/{payee_id}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) + local_var_path = '/budgets/{plan_id}/payees/{payee_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'payee_id' + '}', CGI.escape(payee_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -613,30 +612,30 @@ def get_transactions_by_payee_with_http_info(budget_id, payee_id, opts = {}) end # Import transactions - # Imports available transactions on all linked accounts for the given budget. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking \"Import\" on each account in the web application or tapping the \"New Transactions\" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Imports available transactions on all linked accounts for the given plan. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking \"Import\" on each account in the web application or tapping the \"New Transactions\" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported. + # @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 [Hash] opts the optional parameters # @return [TransactionsImportResponse] - def import_transactions(budget_id, opts = {}) - data, _status_code, _headers = import_transactions_with_http_info(budget_id, opts) + def import_transactions(plan_id, opts = {}) + data, _status_code, _headers = import_transactions_with_http_info(plan_id, opts) data end # Import transactions - # Imports available transactions on all linked accounts for the given budget. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking \"Import\" on each account in the web application or tapping the \"New Transactions\" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # Imports available transactions on all linked accounts for the given plan. Linked accounts allow transactions to be imported directly from a specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking \"Import\" on each account in the web application or tapping the \"New Transactions\" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported. + # @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 [Hash] opts the optional parameters # @return [Array<(TransactionsImportResponse, Integer, Hash)>] TransactionsImportResponse data, response status code and response headers - def import_transactions_with_http_info(budget_id, opts = {}) + def import_transactions_with_http_info(plan_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.import_transactions ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.import_transactions" + # 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 TransactionsApi.import_transactions" end # resource path - local_var_path = '/budgets/{budget_id}/transactions/import'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions/import'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -675,32 +674,32 @@ def import_transactions_with_http_info(budget_id, opts = {}) return data, status_code, headers end - # Updates an existing transaction + # Update a transaction # Updates a single transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 transaction_id [String] The id of the transaction # @param data [PutTransactionWrapper] The transaction to update # @param [Hash] opts the optional parameters # @return [TransactionResponse] - def update_transaction(budget_id, transaction_id, data, opts = {}) - data, _status_code, _headers = update_transaction_with_http_info(budget_id, transaction_id, data, opts) + def update_transaction(plan_id, transaction_id, data, opts = {}) + data, _status_code, _headers = update_transaction_with_http_info(plan_id, transaction_id, data, opts) data end - # Updates an existing transaction + # Update a transaction # Updates a single transaction - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 transaction_id [String] The id of the transaction # @param data [PutTransactionWrapper] The transaction to update # @param [Hash] opts the optional parameters # @return [Array<(TransactionResponse, Integer, Hash)>] TransactionResponse data, response status code and response headers - def update_transaction_with_http_info(budget_id, transaction_id, data, opts = {}) + def update_transaction_with_http_info(plan_id, transaction_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.update_transaction ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.update_transaction" + # 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 TransactionsApi.update_transaction" end # verify the required parameter 'transaction_id' is set if @api_client.config.client_side_validation && transaction_id.nil? @@ -711,7 +710,7 @@ def update_transaction_with_http_info(budget_id, transaction_id, data, opts = {} fail ArgumentError, "Missing the required parameter 'data' when calling TransactionsApi.update_transaction" end # resource path - local_var_path = '/budgets/{budget_id}/transactions/{transaction_id}'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions/{transaction_id}'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)).sub('{' + 'transaction_id' + '}', CGI.escape(transaction_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -757,35 +756,35 @@ def update_transaction_with_http_info(budget_id, transaction_id, data, opts = {} # Update multiple transactions # Updates multiple transactions, by `id` or `import_id`. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [PatchTransactionsWrapper] The transactions to update. Each transaction must have either an `id` or `import_id` specified. If `id` is specified as null an `import_id` value can be provided which will allow transaction(s) to be updated by its `import_id`. If an `id` is specified, it will always be used for lookup. You should not specify both `id` and `import_id`. Updating an `import_id` on an existing transaction is not allowed; if an `import_id` is specified, it will only be used to lookup the transaction. # @param [Hash] opts the optional parameters # @return [SaveTransactionsResponse] - def update_transactions(budget_id, data, opts = {}) - data, _status_code, _headers = update_transactions_with_http_info(budget_id, data, opts) + def update_transactions(plan_id, data, opts = {}) + data, _status_code, _headers = update_transactions_with_http_info(plan_id, data, opts) data end # Update multiple transactions # Updates multiple transactions, by `id` or `import_id`. - # @param budget_id [String] The id of the budget. \"last-used\" can be used to specify the last used budget and \"default\" can be used if default budget selection is enabled (see: https://api.ynab.com/#oauth-default-budget). + # @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 [PatchTransactionsWrapper] The transactions to update. Each transaction must have either an `id` or `import_id` specified. If `id` is specified as null an `import_id` value can be provided which will allow transaction(s) to be updated by its `import_id`. If an `id` is specified, it will always be used for lookup. You should not specify both `id` and `import_id`. Updating an `import_id` on an existing transaction is not allowed; if an `import_id` is specified, it will only be used to lookup the transaction. # @param [Hash] opts the optional parameters # @return [Array<(SaveTransactionsResponse, Integer, Hash)>] SaveTransactionsResponse data, response status code and response headers - def update_transactions_with_http_info(budget_id, data, opts = {}) + def update_transactions_with_http_info(plan_id, data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TransactionsApi.update_transactions ...' end - # verify the required parameter 'budget_id' is set - if @api_client.config.client_side_validation && budget_id.nil? - fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.update_transactions" + # 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 TransactionsApi.update_transactions" 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 TransactionsApi.update_transactions" end # resource path - local_var_path = '/budgets/{budget_id}/transactions'.sub('{' + 'budget_id' + '}', CGI.escape(budget_id.to_s)) + local_var_path = '/budgets/{plan_id}/transactions'.sub('{' + 'plan_id' + '}', CGI.escape(plan_id.to_s)) # query parameters query_params = opts[:query_params] || {} diff --git a/lib/ynab/api/user_api.rb b/lib/ynab/api/user_api.rb index 71f4ffc..29f1da3 100644 --- a/lib/ynab/api/user_api.rb +++ b/lib/ynab/api/user_api.rb @@ -4,7 +4,6 @@ #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 'cgi' @@ -16,7 +15,7 @@ class UserApi def initialize(api_client = ApiClient.default) @api_client = api_client end - # User info + # Get user # Returns authenticated user information # @param [Hash] opts the optional parameters # @return [UserResponse] @@ -25,7 +24,7 @@ def get_user(opts = {}) data end - # User info + # Get user # Returns authenticated user information # @param [Hash] opts the optional parameters # @return [Array<(UserResponse, Integer, Hash)>] UserResponse data, response status code and response headers diff --git a/lib/ynab/api_client.rb b/lib/ynab/api_client.rb index a49b748..99d0267 100644 --- a/lib/ynab/api_client.rb +++ b/lib/ynab/api_client.rb @@ -4,7 +4,6 @@ #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' @@ -195,7 +194,6 @@ def download_file(request) end end end - # Check if the given MIME is a JSON MIME. # JSON MIME examples: # application/json diff --git a/lib/ynab/api_model_base.rb b/lib/ynab/api_model_base.rb new file mode 100644 index 0000000..dc8c9e1 --- /dev/null +++ b/lib/ynab/api_model_base.rb @@ -0,0 +1,85 @@ +=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 + +module YNAB + class ApiModelBase + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = YNAB.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/lib/ynab/models/account.rb b/lib/ynab/models/account.rb index d3a3a42..03beded 100644 --- a/lib/ynab/models/account.rb +++ b/lib/ynab/models/account.rb @@ -11,14 +11,14 @@ require 'time' module YNAB - class Account + class Account < ApiModelBase attr_accessor :id attr_accessor :name attr_accessor :type - # Whether this account is on budget or not + # Whether this account is \"on budget\" or not attr_accessor :on_budget # Whether this account is closed or not @@ -26,7 +26,7 @@ class Account attr_accessor :note - # The current balance of the account in milliunits format + # The current available balance of the account in milliunits format attr_accessor :balance # The current cleared balance of the account in milliunits format @@ -47,7 +47,7 @@ class Account # A date/time specifying when the account was last reconciled. attr_accessor :last_reconciled_at - # The original debt/loan account balance, specified in milliunits format. + # This field is deprecated and will always be null. attr_accessor :debt_original_balance attr_accessor :debt_interest_rates @@ -141,9 +141,6 @@ def self.openapi_nullable :'transfer_payee_id', :'last_reconciled_at', :'debt_original_balance', - :'debt_interest_rates', - :'debt_minimum_payments', - :'debt_escrow_amounts', ]) end @@ -323,61 +320,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -393,25 +335,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/account_response.rb b/lib/ynab/models/account_response.rb index 93fbf27..a3a8a75 100644 --- a/lib/ynab/models/account_response.rb +++ b/lib/ynab/models/account_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class AccountResponse + class AccountResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/account_response_data.rb b/lib/ynab/models/account_response_data.rb index 573e6b7..9b809a1 100644 --- a/lib/ynab/models/account_response_data.rb +++ b/lib/ynab/models/account_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class AccountResponseData + class AccountResponseData < ApiModelBase attr_accessor :account # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/accounts_response.rb b/lib/ynab/models/accounts_response.rb index ee31195..80df6a7 100644 --- a/lib/ynab/models/accounts_response.rb +++ b/lib/ynab/models/accounts_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class AccountsResponse + class AccountsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/accounts_response_data.rb b/lib/ynab/models/accounts_response_data.rb index 4403646..e28b452 100644 --- a/lib/ynab/models/accounts_response_data.rb +++ b/lib/ynab/models/accounts_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class AccountsResponseData + class AccountsResponseData < ApiModelBase attr_accessor :accounts # The knowledge of the server @@ -129,61 +129,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -199,25 +144,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/bulk_response.rb b/lib/ynab/models/bulk_response.rb index deaa4b0..2d52db7 100644 --- a/lib/ynab/models/bulk_response.rb +++ b/lib/ynab/models/bulk_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BulkResponse + class BulkResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/bulk_response_data.rb b/lib/ynab/models/bulk_response_data.rb index 563d437..6a84ca6 100644 --- a/lib/ynab/models/bulk_response_data.rb +++ b/lib/ynab/models/bulk_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BulkResponseData + class BulkResponseData < ApiModelBase attr_accessor :bulk # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/bulk_response_data_bulk.rb b/lib/ynab/models/bulk_response_data_bulk.rb index 7e122de..e84a50d 100644 --- a/lib/ynab/models/bulk_response_data_bulk.rb +++ b/lib/ynab/models/bulk_response_data_bulk.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BulkResponseDataBulk + class BulkResponseDataBulk < ApiModelBase # The list of Transaction ids that were created. attr_accessor :transaction_ids @@ -132,61 +132,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -202,25 +147,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/bulk_transactions.rb b/lib/ynab/models/bulk_transactions.rb index 2dc893c..2825085 100644 --- a/lib/ynab/models/bulk_transactions.rb +++ b/lib/ynab/models/bulk_transactions.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BulkTransactions + class BulkTransactions < ApiModelBase attr_accessor :transactions # Attribute mapping from ruby-style variable name to JSON key. @@ -118,61 +118,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -188,25 +133,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/categories_response.rb b/lib/ynab/models/categories_response.rb index 23dc432..3504787 100644 --- a/lib/ynab/models/categories_response.rb +++ b/lib/ynab/models/categories_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class CategoriesResponse + class CategoriesResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/categories_response_data.rb b/lib/ynab/models/categories_response_data.rb index 7532396..f9c5eff 100644 --- a/lib/ynab/models/categories_response_data.rb +++ b/lib/ynab/models/categories_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class CategoriesResponseData + class CategoriesResponseData < ApiModelBase attr_accessor :category_groups # The knowledge of the server @@ -129,61 +129,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -199,25 +144,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/category.rb b/lib/ynab/models/category.rb index 4461e9b..f9912a8 100644 --- a/lib/ynab/models/category.rb +++ b/lib/ynab/models/category.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class Category + class Category < ApiModelBase attr_accessor :id attr_accessor :category_group_id @@ -28,13 +28,13 @@ class Category attr_accessor :note - # Budgeted amount in milliunits format + # Assigned (budgeted) amount in milliunits format attr_accessor :budgeted # Activity amount in milliunits format attr_accessor :activity - # Balance in milliunits format + # 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') @@ -58,9 +58,12 @@ class Category # The goal target amount in milliunits attr_accessor :goal_target - # The original target month for the goal to be completed. Only some goal types specify this date. + # 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 @@ -125,6 +128,7 @@ def self.attribute_map :'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', @@ -161,6 +165,7 @@ def self.openapi_types :'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', @@ -184,6 +189,7 @@ def self.openapi_nullable :'goal_creation_month', :'goal_target', :'goal_target_month', + :'goal_target_date', :'goal_percentage_complete', :'goal_months_to_budget', :'goal_under_funded', @@ -280,6 +286,10 @@ def initialize(attributes = {}) 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 @@ -361,6 +371,7 @@ def ==(o) 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 && @@ -379,7 +390,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_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].hash end # Builds the object from hash @@ -405,61 +416,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -475,25 +431,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/category_group.rb b/lib/ynab/models/category_group.rb index f5a122a..862b994 100644 --- a/lib/ynab/models/category_group.rb +++ b/lib/ynab/models/category_group.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class CategoryGroup + class CategoryGroup < ApiModelBase attr_accessor :id attr_accessor :name @@ -148,61 +148,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -218,25 +163,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/category_group_with_categories.rb b/lib/ynab/models/category_group_with_categories.rb index 0458b5f..e14d79e 100644 --- a/lib/ynab/models/category_group_with_categories.rb +++ b/lib/ynab/models/category_group_with_categories.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class CategoryGroupWithCategories + class CategoryGroupWithCategories < ApiModelBase attr_accessor :id attr_accessor :name @@ -22,7 +22,7 @@ class CategoryGroupWithCategories # Whether or not the category group has been deleted. Deleted category groups will only be included in delta requests. attr_accessor :deleted - # Category group categories. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). + # Category group categories. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC). attr_accessor :categories # Attribute mapping from ruby-style variable name to JSON key. @@ -168,61 +168,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -238,25 +183,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/category_response.rb b/lib/ynab/models/category_response.rb index 47aa27f..c9ef45e 100644 --- a/lib/ynab/models/category_response.rb +++ b/lib/ynab/models/category_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class CategoryResponse + class CategoryResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/category_response_data.rb b/lib/ynab/models/category_response_data.rb index 583af75..d2d1ae9 100644 --- a/lib/ynab/models/category_response_data.rb +++ b/lib/ynab/models/category_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class CategoryResponseData + class CategoryResponseData < ApiModelBase attr_accessor :category # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/currency_format.rb b/lib/ynab/models/currency_format.rb index 7f60483..23ceaa6 100644 --- a/lib/ynab/models/currency_format.rb +++ b/lib/ynab/models/currency_format.rb @@ -11,8 +11,8 @@ require 'time' module YNAB - # The currency format setting for the budget. In some cases the format will not be available and will be specified as null. - class CurrencyFormat + # The currency format setting for the plan. In some cases the format will not be available and will be specified as null. + class CurrencyFormat < ApiModelBase attr_accessor :iso_code attr_accessor :example_format @@ -187,61 +187,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -257,25 +202,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/date_format.rb b/lib/ynab/models/date_format.rb index 40f8d27..a9f4056 100644 --- a/lib/ynab/models/date_format.rb +++ b/lib/ynab/models/date_format.rb @@ -11,8 +11,8 @@ require 'time' module YNAB - # The date format setting for the budget. In some cases the format will not be available and will be specified as null. - class DateFormat + # The date format setting for the plan. In some cases the format will not be available and will be specified as null. + class DateFormat < ApiModelBase attr_accessor :format # Attribute mapping from ruby-style variable name to JSON key. @@ -117,61 +117,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -187,25 +132,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/error_detail.rb b/lib/ynab/models/error_detail.rb index 23b00e6..52c6f34 100644 --- a/lib/ynab/models/error_detail.rb +++ b/lib/ynab/models/error_detail.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ErrorDetail + class ErrorDetail < ApiModelBase attr_accessor :id attr_accessor :name @@ -136,61 +136,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -206,25 +151,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/error_response.rb b/lib/ynab/models/error_response.rb index a135dbd..2941de5 100644 --- a/lib/ynab/models/error_response.rb +++ b/lib/ynab/models/error_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ErrorResponse + class ErrorResponse < ApiModelBase attr_accessor :error # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/existing_category.rb b/lib/ynab/models/existing_category.rb new file mode 100644 index 0000000..e91cd73 --- /dev/null +++ b/lib/ynab/models/existing_category.rb @@ -0,0 +1,180 @@ +=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 ExistingCategory < ApiModelBase + attr_accessor :name + + attr_accessor :note + + 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. + attr_accessor :goal_target + + # The goal target date in ISO format (e.g. 2016-12-01). + attr_accessor :goal_target_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'note' => :'note', + :'category_group_id' => :'category_group_id', + :'goal_target' => :'goal_target', + :'goal_target_date' => :'goal_target_date' + } + 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', + :'note' => :'String', + :'category_group_id' => :'String', + :'goal_target' => :'Integer', + :'goal_target_date' => :'Date' + } + 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 + [ + :'SaveCategory' + ] + 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::ExistingCategory` 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::ExistingCategory`. 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 + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'category_group_id') + self.category_group_id = attributes[:'category_group_id'] + end + + if attributes.key?(:'goal_target') + self.goal_target = attributes[:'goal_target'] + end + + if attributes.key?(:'goal_target_date') + self.goal_target_date = attributes[:'goal_target_date'] + 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? + 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 && + name == o.name && + note == o.note && + category_group_id == o.category_group_id && + goal_target == o.goal_target && + goal_target_date == o.goal_target_date + 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, note, category_group_id, goal_target, goal_target_date].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_transaction.rb b/lib/ynab/models/existing_transaction.rb index b1026fb..6aba429 100644 --- a/lib/ynab/models/existing_transaction.rb +++ b/lib/ynab/models/existing_transaction.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ExistingTransaction + class ExistingTransaction < ApiModelBase attr_accessor :account_id # The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored. @@ -105,10 +105,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'payee_id', - :'payee_name', - :'category_id', - :'memo', :'flag_color', ]) end @@ -262,61 +258,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -332,25 +273,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/hybrid_transaction.rb b/lib/ynab/models/hybrid_transaction.rb index dc6d0db..53b3a7c 100644 --- a/lib/ynab/models/hybrid_transaction.rb +++ b/lib/ynab/models/hybrid_transaction.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class HybridTransaction + class HybridTransaction < ApiModelBase attr_accessor :id # The transaction date in ISO format (e.g. 2016-12-01) @@ -165,17 +165,7 @@ def self.openapi_types # 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', :'parent_transaction_id', :'payee_name', @@ -405,61 +395,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -475,25 +410,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/hybrid_transactions_response.rb b/lib/ynab/models/hybrid_transactions_response.rb index a27585d..f940363 100644 --- a/lib/ynab/models/hybrid_transactions_response.rb +++ b/lib/ynab/models/hybrid_transactions_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class HybridTransactionsResponse + class HybridTransactionsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/hybrid_transactions_response_data.rb b/lib/ynab/models/hybrid_transactions_response_data.rb index 10c49fc..98093ce 100644 --- a/lib/ynab/models/hybrid_transactions_response_data.rb +++ b/lib/ynab/models/hybrid_transactions_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class HybridTransactionsResponseData + class HybridTransactionsResponseData < ApiModelBase attr_accessor :transactions # The knowledge of the server @@ -128,61 +128,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -198,25 +143,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/money_movement.rb b/lib/ynab/models/money_movement.rb new file mode 100644 index 0000000..629bd00 --- /dev/null +++ b/lib/ynab/models/money_movement.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 MoneyMovement < 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::MoneyMovement` 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::MoneyMovement`. 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/money_movement_group.rb b/lib/ynab/models/money_movement_group.rb new file mode 100644 index 0000000..a90e879 --- /dev/null +++ b/lib/ynab/models/money_movement_group.rb @@ -0,0 +1,179 @@ +=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 MoneyMovementGroup < ApiModelBase + attr_accessor :id + + # When the money movement group was created + attr_accessor :group_created_at + + # The month of the money movement group in ISO format (e.g. 2024-01-01) + attr_accessor :month + + attr_accessor :note + + # The id of the user who performed the money movement group + attr_accessor :performed_by_user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'group_created_at' => :'group_created_at', + :'month' => :'month', + :'note' => :'note', + :'performed_by_user_id' => :'performed_by_user_id' + } + 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', + :'group_created_at' => :'Time', + :'month' => :'Date', + :'note' => :'String', + :'performed_by_user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'note', + :'performed_by_user_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::MoneyMovementGroup` 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::MoneyMovementGroup`. 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?(:'group_created_at') + self.group_created_at = attributes[:'group_created_at'] + end + + if attributes.key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'performed_by_user_id') + self.performed_by_user_id = attributes[:'performed_by_user_id'] + 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 @group_created_at.nil? + return false if @month.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 && + group_created_at == o.group_created_at && + month == o.month && + note == o.note && + performed_by_user_id == o.performed_by_user_id + 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, group_created_at, month, note, performed_by_user_id].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/budget_summary_response.rb b/lib/ynab/models/money_movement_groups_response.rb similarity index 61% rename from lib/ynab/models/budget_summary_response.rb rename to lib/ynab/models/money_movement_groups_response.rb index e0b6109..8d74717 100644 --- a/lib/ynab/models/budget_summary_response.rb +++ b/lib/ynab/models/money_movement_groups_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BudgetSummaryResponse + class MoneyMovementGroupsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -29,7 +29,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'data' => :'BudgetSummaryResponseData' + :'data' => :'MoneyMovementGroupsResponseData' } end @@ -43,13 +43,13 @@ def self.openapi_nullable # @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::BudgetSummaryResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovementGroupsResponse` 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::BudgetSummaryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MoneyMovementGroupsResponse`. 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 } @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/money_movement_groups_response_data.rb b/lib/ynab/models/money_movement_groups_response_data.rb new file mode 100644 index 0000000..c007ef6 --- /dev/null +++ b/lib/ynab/models/money_movement_groups_response_data.rb @@ -0,0 +1,149 @@ +=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 MoneyMovementGroupsResponseData < ApiModelBase + attr_accessor :money_movement_groups + + # The knowledge of the server + attr_accessor :server_knowledge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'money_movement_groups' => :'money_movement_groups', + :'server_knowledge' => :'server_knowledge' + } + 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 + { + :'money_movement_groups' => :'Array', + :'server_knowledge' => :'Integer' + } + 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::MoneyMovementGroupsResponseData` 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::MoneyMovementGroupsResponseData`. 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?(:'money_movement_groups') + if (value = attributes[:'money_movement_groups']).is_a?(Array) + self.money_movement_groups = value + end + end + + if attributes.key?(:'server_knowledge') + self.server_knowledge = attributes[:'server_knowledge'] + 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 @money_movement_groups.nil? + return false if @server_knowledge.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 && + money_movement_groups == o.money_movement_groups && + server_knowledge == o.server_knowledge + 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 + [money_movement_groups, server_knowledge].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/budget_settings_response.rb b/lib/ynab/models/money_movements_response.rb similarity index 62% rename from lib/ynab/models/budget_settings_response.rb rename to lib/ynab/models/money_movements_response.rb index e7c5ae8..3b583dc 100644 --- a/lib/ynab/models/budget_settings_response.rb +++ b/lib/ynab/models/money_movements_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BudgetSettingsResponse + class MoneyMovementsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -29,7 +29,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'data' => :'BudgetSettingsResponseData' + :'data' => :'MoneyMovementsResponseData' } end @@ -43,13 +43,13 @@ def self.openapi_nullable # @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::BudgetSettingsResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovementsResponse` 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::BudgetSettingsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::MoneyMovementsResponse`. 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 } @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/money_movements_response_data.rb b/lib/ynab/models/money_movements_response_data.rb new file mode 100644 index 0000000..341bc95 --- /dev/null +++ b/lib/ynab/models/money_movements_response_data.rb @@ -0,0 +1,149 @@ +=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 MoneyMovementsResponseData < ApiModelBase + attr_accessor :money_movements + + # The knowledge of the server + attr_accessor :server_knowledge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'money_movements' => :'money_movements', + :'server_knowledge' => :'server_knowledge' + } + 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 + { + :'money_movements' => :'Array', + :'server_knowledge' => :'Integer' + } + 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::MoneyMovementsResponseData` 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::MoneyMovementsResponseData`. 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?(:'money_movements') + if (value = attributes[:'money_movements']).is_a?(Array) + self.money_movements = value + end + end + + if attributes.key?(:'server_knowledge') + self.server_knowledge = attributes[:'server_knowledge'] + 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 @money_movements.nil? + return false if @server_knowledge.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 && + money_movements == o.money_movements && + server_knowledge == o.server_knowledge + 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 + [money_movements, server_knowledge].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 04fe871..fb8832d 100644 --- a/lib/ynab/models/month_detail.rb +++ b/lib/ynab/models/month_detail.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class MonthDetail + class MonthDetail < ApiModelBase attr_accessor :month attr_accessor :note @@ -19,7 +19,7 @@ class MonthDetail # The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month attr_accessor :income - # The total amount budgeted in the month + # 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' @@ -34,7 +34,7 @@ class MonthDetail # Whether or not the month has been deleted. Deleted months will only be included in delta requests. attr_accessor :deleted - # The budget month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. + # 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. @@ -75,8 +75,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'note', - :'age_of_money', ]) end @@ -212,61 +210,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -282,25 +225,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/month_detail_response.rb b/lib/ynab/models/month_detail_response.rb index dc35b0b..2753403 100644 --- a/lib/ynab/models/month_detail_response.rb +++ b/lib/ynab/models/month_detail_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class MonthDetailResponse + class MonthDetailResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/month_detail_response_data.rb b/lib/ynab/models/month_detail_response_data.rb index 8e69afd..ab2b404 100644 --- a/lib/ynab/models/month_detail_response_data.rb +++ b/lib/ynab/models/month_detail_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class MonthDetailResponseData + class MonthDetailResponseData < ApiModelBase attr_accessor :month # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/month_summaries_response.rb b/lib/ynab/models/month_summaries_response.rb index 8c9bce2..36b6d73 100644 --- a/lib/ynab/models/month_summaries_response.rb +++ b/lib/ynab/models/month_summaries_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class MonthSummariesResponse + class MonthSummariesResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/month_summaries_response_data.rb b/lib/ynab/models/month_summaries_response_data.rb index 5516de1..52cf04b 100644 --- a/lib/ynab/models/month_summaries_response_data.rb +++ b/lib/ynab/models/month_summaries_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class MonthSummariesResponseData + class MonthSummariesResponseData < ApiModelBase attr_accessor :months # The knowledge of the server @@ -129,61 +129,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -199,25 +144,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/month_summary.rb b/lib/ynab/models/month_summary.rb index 6b66e95..579e878 100644 --- a/lib/ynab/models/month_summary.rb +++ b/lib/ynab/models/month_summary.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class MonthSummary + class MonthSummary < ApiModelBase attr_accessor :month attr_accessor :note @@ -19,7 +19,7 @@ class MonthSummary # The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month attr_accessor :income - # The total amount budgeted in the month + # 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' @@ -192,61 +192,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -262,25 +207,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/new_category.rb b/lib/ynab/models/new_category.rb new file mode 100644 index 0000000..a4e9cb8 --- /dev/null +++ b/lib/ynab/models/new_category.rb @@ -0,0 +1,180 @@ +=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 NewCategory < ApiModelBase + attr_accessor :name + + attr_accessor :note + + 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. + attr_accessor :goal_target + + # The goal target date in ISO format (e.g. 2016-12-01). + attr_accessor :goal_target_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'note' => :'note', + :'category_group_id' => :'category_group_id', + :'goal_target' => :'goal_target', + :'goal_target_date' => :'goal_target_date' + } + 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', + :'note' => :'String', + :'category_group_id' => :'String', + :'goal_target' => :'Integer', + :'goal_target_date' => :'Date' + } + 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 + [ + :'SaveCategory' + ] + 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::NewCategory` 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::NewCategory`. 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 + + if attributes.key?(:'note') + self.note = attributes[:'note'] + end + + if attributes.key?(:'category_group_id') + self.category_group_id = attributes[:'category_group_id'] + end + + if attributes.key?(:'goal_target') + self.goal_target = attributes[:'goal_target'] + end + + if attributes.key?(:'goal_target_date') + self.goal_target_date = attributes[:'goal_target_date'] + 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? + 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 && + name == o.name && + note == o.note && + category_group_id == o.category_group_id && + goal_target == o.goal_target && + goal_target_date == o.goal_target_date + 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, note, category_group_id, goal_target, goal_target_date].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_transaction.rb b/lib/ynab/models/new_transaction.rb index 2197adc..74bd9e4 100644 --- a/lib/ynab/models/new_transaction.rb +++ b/lib/ynab/models/new_transaction.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class NewTransaction + class NewTransaction < ApiModelBase attr_accessor :account_id # The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored. @@ -110,10 +110,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'payee_id', - :'payee_name', - :'category_id', - :'memo', :'flag_color', :'import_id' ]) @@ -280,61 +276,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -350,25 +291,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/patch_category_group_wrapper.rb b/lib/ynab/models/patch_category_group_wrapper.rb new file mode 100644 index 0000000..8d06d74 --- /dev/null +++ b/lib/ynab/models/patch_category_group_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 PatchCategoryGroupWrapper < ApiModelBase + attr_accessor :category_group + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category_group' => :'category_group' + } + 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 + { + :'category_group' => :'SaveCategoryGroup' + } + 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::PatchCategoryGroupWrapper` 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::PatchCategoryGroupWrapper`. 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?(:'category_group') + self.category_group = attributes[:'category_group'] + 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 @category_group.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 && + category_group == o.category_group + 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 + [category_group].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/patch_category_wrapper.rb b/lib/ynab/models/patch_category_wrapper.rb index 40a741f..126687c 100644 --- a/lib/ynab/models/patch_category_wrapper.rb +++ b/lib/ynab/models/patch_category_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PatchCategoryWrapper + class PatchCategoryWrapper < ApiModelBase attr_accessor :category # Attribute mapping from ruby-style variable name to JSON key. @@ -29,7 +29,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'category' => :'SaveCategory' + :'category' => :'ExistingCategory' } end @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/patch_month_category_wrapper.rb b/lib/ynab/models/patch_month_category_wrapper.rb index 8074243..26de85d 100644 --- a/lib/ynab/models/patch_month_category_wrapper.rb +++ b/lib/ynab/models/patch_month_category_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PatchMonthCategoryWrapper + class PatchMonthCategoryWrapper < ApiModelBase attr_accessor :category # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/patch_payee_wrapper.rb b/lib/ynab/models/patch_payee_wrapper.rb index 3138377..2cfee85 100644 --- a/lib/ynab/models/patch_payee_wrapper.rb +++ b/lib/ynab/models/patch_payee_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PatchPayeeWrapper + class PatchPayeeWrapper < ApiModelBase attr_accessor :payee # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/patch_transactions_wrapper.rb b/lib/ynab/models/patch_transactions_wrapper.rb index 081deb1..172e5e0 100644 --- a/lib/ynab/models/patch_transactions_wrapper.rb +++ b/lib/ynab/models/patch_transactions_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PatchTransactionsWrapper + class PatchTransactionsWrapper < ApiModelBase attr_accessor :transactions # Attribute mapping from ruby-style variable name to JSON key. @@ -118,61 +118,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -188,25 +133,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee.rb b/lib/ynab/models/payee.rb index 2c9081c..9b1672d 100644 --- a/lib/ynab/models/payee.rb +++ b/lib/ynab/models/payee.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class Payee + class Payee < ApiModelBase attr_accessor :id attr_accessor :name @@ -148,61 +148,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -218,25 +163,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee_location.rb b/lib/ynab/models/payee_location.rb index 473d88b..2fae4a4 100644 --- a/lib/ynab/models/payee_location.rb +++ b/lib/ynab/models/payee_location.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeeLocation + class PayeeLocation < ApiModelBase attr_accessor :id attr_accessor :payee_id @@ -157,61 +157,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -227,25 +172,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee_location_response.rb b/lib/ynab/models/payee_location_response.rb index b985719..5347012 100644 --- a/lib/ynab/models/payee_location_response.rb +++ b/lib/ynab/models/payee_location_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeeLocationResponse + class PayeeLocationResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee_location_response_data.rb b/lib/ynab/models/payee_location_response_data.rb index 480379d..ff6d9cf 100644 --- a/lib/ynab/models/payee_location_response_data.rb +++ b/lib/ynab/models/payee_location_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeeLocationResponseData + class PayeeLocationResponseData < ApiModelBase attr_accessor :payee_location # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee_locations_response.rb b/lib/ynab/models/payee_locations_response.rb index d5619f1..2589689 100644 --- a/lib/ynab/models/payee_locations_response.rb +++ b/lib/ynab/models/payee_locations_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeeLocationsResponse + class PayeeLocationsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee_locations_response_data.rb b/lib/ynab/models/payee_locations_response_data.rb index dd0fac7..0700fe5 100644 --- a/lib/ynab/models/payee_locations_response_data.rb +++ b/lib/ynab/models/payee_locations_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeeLocationsResponseData + class PayeeLocationsResponseData < ApiModelBase attr_accessor :payee_locations # Attribute mapping from ruby-style variable name to JSON key. @@ -118,61 +118,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -188,25 +133,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee_response.rb b/lib/ynab/models/payee_response.rb index 48edc0b..4f67c05 100644 --- a/lib/ynab/models/payee_response.rb +++ b/lib/ynab/models/payee_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeeResponse + class PayeeResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payee_response_data.rb b/lib/ynab/models/payee_response_data.rb index 318b480..b85e23f 100644 --- a/lib/ynab/models/payee_response_data.rb +++ b/lib/ynab/models/payee_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeeResponseData + class PayeeResponseData < ApiModelBase attr_accessor :payee # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payees_response.rb b/lib/ynab/models/payees_response.rb index c904d2f..b59e26f 100644 --- a/lib/ynab/models/payees_response.rb +++ b/lib/ynab/models/payees_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeesResponse + class PayeesResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/payees_response_data.rb b/lib/ynab/models/payees_response_data.rb index de25fb9..36a8fd1 100644 --- a/lib/ynab/models/payees_response_data.rb +++ b/lib/ynab/models/payees_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PayeesResponseData + class PayeesResponseData < ApiModelBase attr_accessor :payees # The knowledge of the server @@ -129,61 +129,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -199,25 +144,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/budget_detail.rb b/lib/ynab/models/plan_detail.rb similarity index 78% rename from lib/ynab/models/budget_detail.rb rename to lib/ynab/models/plan_detail.rb index d63c4b1..d8d1b6c 100644 --- a/lib/ynab/models/budget_detail.rb +++ b/lib/ynab/models/plan_detail.rb @@ -11,18 +11,18 @@ require 'time' module YNAB - class BudgetDetail + class PlanDetail < ApiModelBase attr_accessor :id attr_accessor :name - # The last time any changes were made to the budget from either a web or mobile client + # The last time any changes were made to the plan from either a web or mobile client attr_accessor :last_modified_on - # The earliest budget month + # The earliest plan month attr_accessor :first_month - # The latest budget month + # The latest plan month attr_accessor :last_month attr_accessor :date_format @@ -103,15 +103,13 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'date_format', - :'currency_format', ]) end # List of class defined in allOf (OpenAPI v3) def self.openapi_all_of [ - :'BudgetSummary' + :'PlanSummary' ] end @@ -119,13 +117,13 @@ def self.openapi_all_of # @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::BudgetDetail` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PlanDetail` 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::BudgetDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PlanDetail`. 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 } @@ -293,61 +291,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -363,25 +306,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/plan_detail_response.rb b/lib/ynab/models/plan_detail_response.rb new file mode 100644 index 0000000..5b1e2a4 --- /dev/null +++ b/lib/ynab/models/plan_detail_response.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 PlanDetailResponse < ApiModelBase + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + 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 + { + :'data' => :'PlanDetailResponseData' + } + 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::PlanDetailResponse` 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::PlanDetailResponse`. 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?(:'data') + self.data = attributes[:'data'] + 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 @data.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 && + data == o.data + 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 + [data].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/budget_detail_response_data.rb b/lib/ynab/models/plan_detail_response_data.rb similarity index 63% rename from lib/ynab/models/budget_detail_response_data.rb rename to lib/ynab/models/plan_detail_response_data.rb index 300bbea..fb3986a 100644 --- a/lib/ynab/models/budget_detail_response_data.rb +++ b/lib/ynab/models/plan_detail_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BudgetDetailResponseData + class PlanDetailResponseData < ApiModelBase attr_accessor :budget # The knowledge of the server @@ -33,7 +33,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'budget' => :'BudgetDetail', + :'budget' => :'PlanDetail', :'server_knowledge' => :'Integer' } end @@ -48,13 +48,13 @@ def self.openapi_nullable # @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::BudgetDetailResponseData` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PlanDetailResponseData` 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::BudgetDetailResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PlanDetailResponseData`. 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 } @@ -127,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -197,25 +142,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/budget_settings.rb b/lib/ynab/models/plan_settings.rb similarity index 63% rename from lib/ynab/models/budget_settings.rb rename to lib/ynab/models/plan_settings.rb index 3c141df..0f1ddaa 100644 --- a/lib/ynab/models/budget_settings.rb +++ b/lib/ynab/models/plan_settings.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BudgetSettings + class PlanSettings < ApiModelBase attr_accessor :date_format attr_accessor :currency_format @@ -40,8 +40,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'date_format', - :'currency_format' ]) end @@ -49,13 +47,13 @@ def self.openapi_nullable # @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::BudgetSettings` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PlanSettings` 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::BudgetSettings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PlanSettings`. 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 } @@ -79,6 +77,8 @@ def list_invalid_properties # 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 @date_format.nil? + return false if @currency_format.nil? true end @@ -126,61 +126,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -196,25 +141,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/budget_detail_response.rb b/lib/ynab/models/plan_settings_response.rb similarity index 62% rename from lib/ynab/models/budget_detail_response.rb rename to lib/ynab/models/plan_settings_response.rb index ee210a0..ed31232 100644 --- a/lib/ynab/models/budget_detail_response.rb +++ b/lib/ynab/models/plan_settings_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BudgetDetailResponse + class PlanSettingsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -29,7 +29,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'data' => :'BudgetDetailResponseData' + :'data' => :'PlanSettingsResponseData' } end @@ -43,13 +43,13 @@ def self.openapi_nullable # @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::BudgetDetailResponse` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PlanSettingsResponse` 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::BudgetDetailResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PlanSettingsResponse`. 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 } @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/budget_settings_response_data.rb b/lib/ynab/models/plan_settings_response_data.rb similarity index 61% rename from lib/ynab/models/budget_settings_response_data.rb rename to lib/ynab/models/plan_settings_response_data.rb index aef2ec3..d5e425d 100644 --- a/lib/ynab/models/budget_settings_response_data.rb +++ b/lib/ynab/models/plan_settings_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BudgetSettingsResponseData + class PlanSettingsResponseData < ApiModelBase attr_accessor :settings # Attribute mapping from ruby-style variable name to JSON key. @@ -29,7 +29,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'settings' => :'BudgetSettings' + :'settings' => :'PlanSettings' } end @@ -43,13 +43,13 @@ def self.openapi_nullable # @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::BudgetSettingsResponseData` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PlanSettingsResponseData` 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::BudgetSettingsResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PlanSettingsResponseData`. 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 } @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/budget_summary.rb b/lib/ynab/models/plan_summary.rb similarity index 68% rename from lib/ynab/models/budget_summary.rb rename to lib/ynab/models/plan_summary.rb index cd9e3d2..d747841 100644 --- a/lib/ynab/models/budget_summary.rb +++ b/lib/ynab/models/plan_summary.rb @@ -11,25 +11,25 @@ require 'time' module YNAB - class BudgetSummary + class PlanSummary < ApiModelBase attr_accessor :id attr_accessor :name - # The last time any changes were made to the budget from either a web or mobile client + # The last time any changes were made to the plan from either a web or mobile client attr_accessor :last_modified_on - # The earliest budget month + # The earliest plan month attr_accessor :first_month - # The latest budget month + # The latest plan month attr_accessor :last_month attr_accessor :date_format attr_accessor :currency_format - # The budget accounts (only included if `include_accounts=true` specified as query parameter) + # The plan accounts (only included if `include_accounts=true` specified as query parameter) attr_accessor :accounts # Attribute mapping from ruby-style variable name to JSON key. @@ -68,8 +68,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'date_format', - :'currency_format', ]) end @@ -77,13 +75,13 @@ def self.openapi_nullable # @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::BudgetSummary` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PlanSummary` 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::BudgetSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PlanSummary`. 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 } @@ -188,61 +186,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -258,25 +201,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/plan_summary_response.rb b/lib/ynab/models/plan_summary_response.rb new file mode 100644 index 0000000..198bcba --- /dev/null +++ b/lib/ynab/models/plan_summary_response.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 PlanSummaryResponse < ApiModelBase + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + 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 + { + :'data' => :'PlanSummaryResponseData' + } + 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::PlanSummaryResponse` 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::PlanSummaryResponse`. 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?(:'data') + self.data = attributes[:'data'] + 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 @data.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 && + data == o.data + 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 + [data].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/budget_summary_response_data.rb b/lib/ynab/models/plan_summary_response_data.rb similarity index 63% rename from lib/ynab/models/budget_summary_response_data.rb rename to lib/ynab/models/plan_summary_response_data.rb index 255097e..523eed4 100644 --- a/lib/ynab/models/budget_summary_response_data.rb +++ b/lib/ynab/models/plan_summary_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class BudgetSummaryResponseData + class PlanSummaryResponseData < ApiModelBase attr_accessor :budgets attr_accessor :default_budget @@ -32,8 +32,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'budgets' => :'Array', - :'default_budget' => :'BudgetSummary' + :'budgets' => :'Array', + :'default_budget' => :'PlanSummary' } end @@ -47,13 +47,13 @@ def self.openapi_nullable # @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::BudgetSummaryResponseData` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::PlanSummaryResponseData` 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::BudgetSummaryResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `YNAB::PlanSummaryResponseData`. 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 } @@ -127,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -197,25 +142,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/post_account_wrapper.rb b/lib/ynab/models/post_account_wrapper.rb index 61b3e8c..3d58d14 100644 --- a/lib/ynab/models/post_account_wrapper.rb +++ b/lib/ynab/models/post_account_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PostAccountWrapper + class PostAccountWrapper < ApiModelBase attr_accessor :account # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/post_category_group_wrapper.rb b/lib/ynab/models/post_category_group_wrapper.rb new file mode 100644 index 0000000..7a31d11 --- /dev/null +++ b/lib/ynab/models/post_category_group_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 PostCategoryGroupWrapper < ApiModelBase + attr_accessor :category_group + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category_group' => :'category_group' + } + 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 + { + :'category_group' => :'SaveCategoryGroup' + } + 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::PostCategoryGroupWrapper` 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::PostCategoryGroupWrapper`. 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?(:'category_group') + self.category_group = attributes[:'category_group'] + 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 @category_group.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 && + category_group == o.category_group + 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 + [category_group].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_category_wrapper.rb b/lib/ynab/models/post_category_wrapper.rb new file mode 100644 index 0000000..8d0758f --- /dev/null +++ b/lib/ynab/models/post_category_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 PostCategoryWrapper < ApiModelBase + attr_accessor :category + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category' + } + 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 + { + :'category' => :'NewCategory' + } + 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::PostCategoryWrapper` 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::PostCategoryWrapper`. 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?(:'category') + self.category = attributes[:'category'] + 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 @category.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 && + category == o.category + 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 + [category].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_scheduled_transaction_wrapper.rb b/lib/ynab/models/post_scheduled_transaction_wrapper.rb index 047758d..e927b1a 100644 --- a/lib/ynab/models/post_scheduled_transaction_wrapper.rb +++ b/lib/ynab/models/post_scheduled_transaction_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PostScheduledTransactionWrapper + class PostScheduledTransactionWrapper < ApiModelBase attr_accessor :scheduled_transaction # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/post_transactions_wrapper.rb b/lib/ynab/models/post_transactions_wrapper.rb index 31856b3..a658b40 100644 --- a/lib/ynab/models/post_transactions_wrapper.rb +++ b/lib/ynab/models/post_transactions_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PostTransactionsWrapper + class PostTransactionsWrapper < ApiModelBase attr_accessor :transaction attr_accessor :transactions @@ -126,61 +126,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -196,25 +141,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/put_scheduled_transaction_wrapper.rb b/lib/ynab/models/put_scheduled_transaction_wrapper.rb index 5c5f080..a0605b2 100644 --- a/lib/ynab/models/put_scheduled_transaction_wrapper.rb +++ b/lib/ynab/models/put_scheduled_transaction_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PutScheduledTransactionWrapper + class PutScheduledTransactionWrapper < ApiModelBase attr_accessor :scheduled_transaction # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/put_transaction_wrapper.rb b/lib/ynab/models/put_transaction_wrapper.rb index ba7f485..7078037 100644 --- a/lib/ynab/models/put_transaction_wrapper.rb +++ b/lib/ynab/models/put_transaction_wrapper.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class PutTransactionWrapper + class PutTransactionWrapper < ApiModelBase attr_accessor :transaction # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_account.rb b/lib/ynab/models/save_account.rb index c0e22c4..737a632 100644 --- a/lib/ynab/models/save_account.rb +++ b/lib/ynab/models/save_account.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveAccount + class SaveAccount < ApiModelBase # The name of the account attr_accessor :name @@ -160,61 +160,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -230,25 +175,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_category.rb b/lib/ynab/models/save_category.rb index bfc96f9..8494e57 100644 --- a/lib/ynab/models/save_category.rb +++ b/lib/ynab/models/save_category.rb @@ -11,23 +11,27 @@ require 'time' module YNAB - class SaveCategory + class SaveCategory < ApiModelBase attr_accessor :name attr_accessor :note attr_accessor :category_group_id - # The goal target amount in milliunits format. This amount can only be changed if the category already has a configured goal (goal_type != null). + # 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. attr_accessor :goal_target + # The goal target date in ISO format (e.g. 2016-12-01). + attr_accessor :goal_target_date + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'name' => :'name', :'note' => :'note', :'category_group_id' => :'category_group_id', - :'goal_target' => :'goal_target' + :'goal_target' => :'goal_target', + :'goal_target_date' => :'goal_target_date' } end @@ -42,7 +46,8 @@ def self.openapi_types :'name' => :'String', :'note' => :'String', :'category_group_id' => :'String', - :'goal_target' => :'Integer' + :'goal_target' => :'Integer', + :'goal_target_date' => :'Date' } end @@ -51,7 +56,8 @@ def self.openapi_nullable Set.new([ :'name', :'note', - :'goal_target' + :'goal_target', + :'goal_target_date' ]) end @@ -85,6 +91,10 @@ def initialize(attributes = {}) if attributes.key?(:'goal_target') self.goal_target = attributes[:'goal_target'] end + + if attributes.key?(:'goal_target_date') + self.goal_target_date = attributes[:'goal_target_date'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -108,7 +118,8 @@ def ==(o) name == o.name && note == o.note && category_group_id == o.category_group_id && - goal_target == o.goal_target + goal_target == o.goal_target && + goal_target_date == o.goal_target_date end # @see the `==` method @@ -120,7 +131,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [name, note, category_group_id, goal_target].hash + [name, note, category_group_id, goal_target, goal_target_date].hash end # Builds the object from hash @@ -146,61 +157,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -216,25 +172,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_category_group.rb b/lib/ynab/models/save_category_group.rb new file mode 100644 index 0000000..3956df4 --- /dev/null +++ b/lib/ynab/models/save_category_group.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 SaveCategoryGroup < ApiModelBase + # The name of the category group. The name must be a maximum of 50 characters. + 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::SaveCategoryGroup` 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::SaveCategoryGroup`. 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 > 50 + 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/save_category_group_response.rb b/lib/ynab/models/save_category_group_response.rb new file mode 100644 index 0000000..e6e7ce0 --- /dev/null +++ b/lib/ynab/models/save_category_group_response.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 SaveCategoryGroupResponse < ApiModelBase + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + 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 + { + :'data' => :'SaveCategoryGroupResponseData' + } + 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::SaveCategoryGroupResponse` 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::SaveCategoryGroupResponse`. 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?(:'data') + self.data = attributes[:'data'] + 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 @data.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 && + data == o.data + 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 + [data].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_category_group_response_data.rb b/lib/ynab/models/save_category_group_response_data.rb new file mode 100644 index 0000000..b262ba3 --- /dev/null +++ b/lib/ynab/models/save_category_group_response_data.rb @@ -0,0 +1,147 @@ +=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 SaveCategoryGroupResponseData < ApiModelBase + attr_accessor :category_group + + # The knowledge of the server + attr_accessor :server_knowledge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category_group' => :'category_group', + :'server_knowledge' => :'server_knowledge' + } + 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 + { + :'category_group' => :'CategoryGroup', + :'server_knowledge' => :'Integer' + } + 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::SaveCategoryGroupResponseData` 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::SaveCategoryGroupResponseData`. 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?(:'category_group') + self.category_group = attributes[:'category_group'] + end + + if attributes.key?(:'server_knowledge') + self.server_knowledge = attributes[:'server_knowledge'] + 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 @category_group.nil? + return false if @server_knowledge.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 && + category_group == o.category_group && + server_knowledge == o.server_knowledge + 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 + [category_group, server_knowledge].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_category_response.rb b/lib/ynab/models/save_category_response.rb index d009a87..379b02a 100644 --- a/lib/ynab/models/save_category_response.rb +++ b/lib/ynab/models/save_category_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveCategoryResponse + class SaveCategoryResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_category_response_data.rb b/lib/ynab/models/save_category_response_data.rb index bd96505..84428a4 100644 --- a/lib/ynab/models/save_category_response_data.rb +++ b/lib/ynab/models/save_category_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveCategoryResponseData + class SaveCategoryResponseData < ApiModelBase attr_accessor :category # The knowledge of the server @@ -127,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -197,25 +142,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_month_category.rb b/lib/ynab/models/save_month_category.rb index 75b39cd..69c38df 100644 --- a/lib/ynab/models/save_month_category.rb +++ b/lib/ynab/models/save_month_category.rb @@ -11,8 +11,8 @@ require 'time' module YNAB - class SaveMonthCategory - # Budgeted amount in milliunits format + class SaveMonthCategory < ApiModelBase + # Assigned (budgeted) amount in milliunits format attr_accessor :budgeted # Attribute mapping from ruby-style variable name to JSON key. @@ -117,61 +117,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -187,25 +132,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_payee.rb b/lib/ynab/models/save_payee.rb index 589fe6f..c689987 100644 --- a/lib/ynab/models/save_payee.rb +++ b/lib/ynab/models/save_payee.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SavePayee + class SavePayee < ApiModelBase # The name of the payee. The name must be a maximum of 500 characters. attr_accessor :name @@ -123,61 +123,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -193,25 +138,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_payee_response.rb b/lib/ynab/models/save_payee_response.rb index f6d23e2..0ce2a28 100644 --- a/lib/ynab/models/save_payee_response.rb +++ b/lib/ynab/models/save_payee_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SavePayeeResponse + class SavePayeeResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_payee_response_data.rb b/lib/ynab/models/save_payee_response_data.rb index ee0c220..61a5ab9 100644 --- a/lib/ynab/models/save_payee_response_data.rb +++ b/lib/ynab/models/save_payee_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SavePayeeResponseData + class SavePayeeResponseData < ApiModelBase attr_accessor :payee # The knowledge of the server @@ -127,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -197,25 +142,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_scheduled_transaction.rb b/lib/ynab/models/save_scheduled_transaction.rb index b9377a0..80f25c0 100644 --- a/lib/ynab/models/save_scheduled_transaction.rb +++ b/lib/ynab/models/save_scheduled_transaction.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveScheduledTransaction + class SaveScheduledTransaction < ApiModelBase attr_accessor :account_id # The scheduled transaction date in ISO format (e.g. 2016-12-01). This should be a future date no more than 5 years into the future. @@ -235,61 +235,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -305,25 +250,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_sub_transaction.rb b/lib/ynab/models/save_sub_transaction.rb index 54004e5..3d71d6e 100644 --- a/lib/ynab/models/save_sub_transaction.rb +++ b/lib/ynab/models/save_sub_transaction.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveSubTransaction + class SaveSubTransaction < ApiModelBase # The subtransaction amount in milliunits format. attr_accessor :amount @@ -174,61 +174,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -244,25 +189,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_transaction_with_id_or_import_id.rb b/lib/ynab/models/save_transaction_with_id_or_import_id.rb index 92ca38d..25b937b 100644 --- a/lib/ynab/models/save_transaction_with_id_or_import_id.rb +++ b/lib/ynab/models/save_transaction_with_id_or_import_id.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveTransactionWithIdOrImportId + class SaveTransactionWithIdOrImportId < ApiModelBase attr_accessor :account_id # The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored. @@ -115,10 +115,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'payee_id', - :'payee_name', - :'category_id', - :'memo', :'flag_color', :'id', :'import_id' @@ -291,61 +287,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -361,25 +302,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_transaction_with_optional_fields.rb b/lib/ynab/models/save_transaction_with_optional_fields.rb index f5e2453..090465c 100644 --- a/lib/ynab/models/save_transaction_with_optional_fields.rb +++ b/lib/ynab/models/save_transaction_with_optional_fields.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveTransactionWithOptionalFields + class SaveTransactionWithOptionalFields < ApiModelBase attr_accessor :account_id # The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored. @@ -255,61 +255,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -325,25 +270,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_transactions_response.rb b/lib/ynab/models/save_transactions_response.rb index c18acb6..71d4208 100644 --- a/lib/ynab/models/save_transactions_response.rb +++ b/lib/ynab/models/save_transactions_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveTransactionsResponse + class SaveTransactionsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/save_transactions_response_data.rb b/lib/ynab/models/save_transactions_response_data.rb index dfaeca9..ababdfd 100644 --- a/lib/ynab/models/save_transactions_response_data.rb +++ b/lib/ynab/models/save_transactions_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SaveTransactionsResponseData + class SaveTransactionsResponseData < ApiModelBase # The transaction ids that were saved attr_accessor :transaction_ids @@ -163,61 +163,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -233,25 +178,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/scheduled_sub_transaction.rb b/lib/ynab/models/scheduled_sub_transaction.rb index b4823a3..4c96f49 100644 --- a/lib/ynab/models/scheduled_sub_transaction.rb +++ b/lib/ynab/models/scheduled_sub_transaction.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ScheduledSubTransaction + class ScheduledSubTransaction < ApiModelBase attr_accessor :id attr_accessor :scheduled_transaction_id @@ -209,61 +209,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -279,25 +224,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/scheduled_transaction_detail.rb b/lib/ynab/models/scheduled_transaction_detail.rb index ecad913..dd60ac6 100644 --- a/lib/ynab/models/scheduled_transaction_detail.rb +++ b/lib/ynab/models/scheduled_transaction_detail.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ScheduledTransactionDetail + class ScheduledTransactionDetail < ApiModelBase attr_accessor :id # The first date for which the Scheduled Transaction was scheduled. @@ -130,12 +130,7 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'memo', :'flag_color', - :'flag_name', - :'payee_id', - :'category_id', - :'transfer_account_id', :'payee_name', :'category_name', ]) @@ -323,61 +318,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -393,25 +333,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/scheduled_transaction_response.rb b/lib/ynab/models/scheduled_transaction_response.rb index f9de010..faf4f76 100644 --- a/lib/ynab/models/scheduled_transaction_response.rb +++ b/lib/ynab/models/scheduled_transaction_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ScheduledTransactionResponse + class ScheduledTransactionResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/scheduled_transaction_response_data.rb b/lib/ynab/models/scheduled_transaction_response_data.rb index fa40673..bd30392 100644 --- a/lib/ynab/models/scheduled_transaction_response_data.rb +++ b/lib/ynab/models/scheduled_transaction_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ScheduledTransactionResponseData + class ScheduledTransactionResponseData < ApiModelBase attr_accessor :scheduled_transaction # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/scheduled_transaction_summary.rb b/lib/ynab/models/scheduled_transaction_summary.rb index c8c2839..9d523bb 100644 --- a/lib/ynab/models/scheduled_transaction_summary.rb +++ b/lib/ynab/models/scheduled_transaction_summary.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ScheduledTransactionSummary + class ScheduledTransactionSummary < ApiModelBase attr_accessor :id # The first date for which the Scheduled Transaction was scheduled. @@ -272,61 +272,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -342,25 +287,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/scheduled_transactions_response.rb b/lib/ynab/models/scheduled_transactions_response.rb index 835abfe..c9c261c 100644 --- a/lib/ynab/models/scheduled_transactions_response.rb +++ b/lib/ynab/models/scheduled_transactions_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ScheduledTransactionsResponse + class ScheduledTransactionsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/scheduled_transactions_response_data.rb b/lib/ynab/models/scheduled_transactions_response_data.rb index a56e58c..c5bf908 100644 --- a/lib/ynab/models/scheduled_transactions_response_data.rb +++ b/lib/ynab/models/scheduled_transactions_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class ScheduledTransactionsResponseData + class ScheduledTransactionsResponseData < ApiModelBase attr_accessor :scheduled_transactions # The knowledge of the server @@ -129,61 +129,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -199,25 +144,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/sub_transaction.rb b/lib/ynab/models/sub_transaction.rb index 0f07221..de9340a 100644 --- a/lib/ynab/models/sub_transaction.rb +++ b/lib/ynab/models/sub_transaction.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class SubTransaction + class SubTransaction < ApiModelBase attr_accessor :id attr_accessor :transaction_id @@ -220,61 +220,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -290,25 +235,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transaction_detail.rb b/lib/ynab/models/transaction_detail.rb index dd8b675..8ca9394 100644 --- a/lib/ynab/models/transaction_detail.rb +++ b/lib/ynab/models/transaction_detail.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionDetail + class TransactionDetail < ApiModelBase attr_accessor :id # The transaction date in ISO format (e.g. 2016-12-01) @@ -160,17 +160,7 @@ def self.openapi_types # 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', :'payee_name', :'category_name', @@ -389,61 +379,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -459,25 +394,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transaction_response.rb b/lib/ynab/models/transaction_response.rb index 9ffbacf..615be4d 100644 --- a/lib/ynab/models/transaction_response.rb +++ b/lib/ynab/models/transaction_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionResponse + class TransactionResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transaction_response_data.rb b/lib/ynab/models/transaction_response_data.rb index 7208370..d20672e 100644 --- a/lib/ynab/models/transaction_response_data.rb +++ b/lib/ynab/models/transaction_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionResponseData + class TransactionResponseData < ApiModelBase attr_accessor :transaction # The knowledge of the server @@ -127,61 +127,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -197,25 +142,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transaction_summary.rb b/lib/ynab/models/transaction_summary.rb index 836f8e7..a9e5b5b 100644 --- a/lib/ynab/models/transaction_summary.rb +++ b/lib/ynab/models/transaction_summary.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionSummary + class TransactionSummary < ApiModelBase attr_accessor :id # The transaction date in ISO format (e.g. 2016-12-01) @@ -338,61 +338,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -408,25 +353,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transactions_import_response.rb b/lib/ynab/models/transactions_import_response.rb index e126cb3..9d49383 100644 --- a/lib/ynab/models/transactions_import_response.rb +++ b/lib/ynab/models/transactions_import_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionsImportResponse + class TransactionsImportResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transactions_import_response_data.rb b/lib/ynab/models/transactions_import_response_data.rb index d0f48d2..00f6080 100644 --- a/lib/ynab/models/transactions_import_response_data.rb +++ b/lib/ynab/models/transactions_import_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionsImportResponseData + class TransactionsImportResponseData < ApiModelBase # The list of transaction ids that were imported. attr_accessor :transaction_ids @@ -119,61 +119,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -189,25 +134,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transactions_response.rb b/lib/ynab/models/transactions_response.rb index 1486b5b..c2d8451 100644 --- a/lib/ynab/models/transactions_response.rb +++ b/lib/ynab/models/transactions_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionsResponse + class TransactionsResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/transactions_response_data.rb b/lib/ynab/models/transactions_response_data.rb index 852d314..0f9f96c 100644 --- a/lib/ynab/models/transactions_response_data.rb +++ b/lib/ynab/models/transactions_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class TransactionsResponseData + class TransactionsResponseData < ApiModelBase attr_accessor :transactions # The knowledge of the server @@ -129,61 +129,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -199,25 +144,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/user.rb b/lib/ynab/models/user.rb index 5eaedfa..9d65378 100644 --- a/lib/ynab/models/user.rb +++ b/lib/ynab/models/user.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class User + class User < ApiModelBase attr_accessor :id # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/user_response.rb b/lib/ynab/models/user_response.rb index e859dff..5bd74af 100644 --- a/lib/ynab/models/user_response.rb +++ b/lib/ynab/models/user_response.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class UserResponse + class UserResponse < ApiModelBase attr_accessor :data # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/models/user_response_data.rb b/lib/ynab/models/user_response_data.rb index c14341b..3323f39 100644 --- a/lib/ynab/models/user_response_data.rb +++ b/lib/ynab/models/user_response_data.rb @@ -11,7 +11,7 @@ require 'time' module YNAB - class UserResponseData + class UserResponseData < ApiModelBase attr_accessor :user # Attribute mapping from ruby-style variable name to JSON key. @@ -116,61 +116,6 @@ def self.build_from_hash(attributes) new(transformed_hash) end - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def self._deserialize(type, value) - case type.to_sym - when :Time - Time.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :Boolean - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - # models (e.g. Pet) or oneOf - klass = YNAB.const_get(type) - klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash @@ -186,25 +131,6 @@ def to_hash end hash end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end end diff --git a/lib/ynab/overrides/transactions_api.rb b/lib/ynab/overrides/transactions_api.rb index 7404343..f33ffb1 100644 --- a/lib/ynab/overrides/transactions_api.rb +++ b/lib/ynab/overrides/transactions_api.rb @@ -9,23 +9,23 @@ def initialize(api_client = ApiClient.default) end # Create a single transaction or multiple transactions # Creates a single transaction or multiple transactions. If you provide a body containing a 'transaction' object, a single transaction will be created and if you provide a body containing a 'transactions' array, multiple transactions will be created. - # @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget) + # @param plan_id The id of the budget (\"last-used\" can also be used to specify the last used budget) # @param data The transaction or transactions to create # @param [Hash] opts the optional parameters # @return [SaveTransactionsResponse] - def create_transactions(budget_id, data, opts = {}) - data, _status_code, _headers = create_transaction_with_http_info(budget_id, data, opts) + def create_transactions(plan_id, data, opts = {}) + data, _status_code, _headers = create_transaction_with_http_info(plan_id, data, opts) data end # Bulk create transactions # Creates multiple transactions - # @param budget_id The id of the budget (\"last-used\" can also be used to specify the last used budget) + # @param plan_id The id of the budget (\"last-used\" can also be used to specify the last used budget) # @param transactions The list of transactions to create # @param [Hash] opts the optional parameters # @return [BulkResponse] - def bulk_create_transactions(budget_id, transactions, opts = {}) - DeprecatedApi.new(@api_client).bulk_create_transactions(budget_id, transactions, opts) + def bulk_create_transactions(plan_id, transactions, opts = {}) + DeprecatedApi.new(@api_client).bulk_create_transactions(plan_id, transactions, opts) end end end diff --git a/open_api_spec.yaml b/open_api_spec.yaml index 6173be3..4089a24 100644 --- a/open_api_spec.yaml +++ b/open_api_spec.yaml @@ -1,48 +1,47 @@ -openapi: 3.0.0 +openapi: 3.1.1 info: title: YNAB API Endpoints - description: >- - 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 - version: 1.76.0 + description: 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 + version: 1.78.0 servers: - url: https://api.ynab.com/v1 security: - bearer: [] tags: - name: User - - name: Budgets + - name: Plans - name: Accounts - description: The accounts for a budget + description: The accounts for a plan - name: Categories - description: The categories for a budget + description: The categories for a plan - name: Payees - description: The payees for a budget + description: The payees for a plan - name: Payee Locations - description: >- - When you enter a transaction and specify a payee on the YNAB mobile apps, - the GPS coordinates for that location are stored, with your permission, so - that the next time you are in the same place (like the Grocery store) we - can pre-populate nearby payees for you! It’s handy and saves you time. - This resource makes these locations available. Locations will not be - available for all payees. + description: When you enter a transaction and specify a payee on the YNAB mobile + apps, the GPS coordinates for that location are stored, with your + permission, so that the next time you are in the same place (like the + Grocery store) we can pre-populate nearby payees for you! It’s handy and + saves you time. This resource makes these locations available. Locations + will not be available for all payees. - name: Months - description: >- - Each budget contains one or more months, which is where Ready to Assign, - Age of Money and category (budgeted / activity / balances) amounts are - available. + description: Each plan contains one or more months, which is where Ready to + Assign, Age of Money and category (assigned / activity / available) + amounts are available. + - name: Money Movements + description: The money movements for a plan - name: Transactions - description: The transactions for a budget + description: The transactions for a plan - name: Scheduled Transactions - description: The scheduled transactions for a budget + description: The scheduled transactions for a plan paths: /user: get: tags: - User - summary: User info + summary: Get user description: Returns authenticated user information operationId: getUser responses: @@ -52,148 +51,118 @@ paths: application/json: schema: $ref: "#/components/schemas/UserResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" /budgets: get: tags: - - Budgets - summary: List budgets - description: Returns budgets list with summary information - operationId: getBudgets + - Plans + summary: Get all plans + description: Returns plans list with summary information + operationId: getPlans parameters: - name: include_accounts in: query - description: Whether to include the list of budget accounts + description: Whether to include the list of plan accounts schema: type: boolean responses: "200": - description: The list of budgets + description: The list of plans content: application/json: schema: - $ref: "#/components/schemas/BudgetSummaryResponse" + $ref: "#/components/schemas/PlanSummaryResponse" "404": - description: No budgets were found + description: No plans were found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}: + /budgets/{plan_id}: get: tags: - - Budgets - summary: Single budget - description: >- - Returns a single budget with all related entities. This resource is - effectively a full budget export. - operationId: getBudgetById + - Plans + summary: Get a plan + description: Returns a single plan with all related entities. This resource is + effectively a full plan export. + operationId: getPlanById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 responses: "200": - description: The requested budget + description: The requested plan content: application/json: schema: - $ref: "#/components/schemas/BudgetDetailResponse" + $ref: "#/components/schemas/PlanDetailResponse" "404": - description: The specified budget was not found - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred + description: The specified plan was not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/settings: + /budgets/{plan_id}/settings: get: tags: - - Budgets - summary: Budget Settings - description: Returns settings for a budget - operationId: getBudgetSettingsById + - Plans + summary: Get plan settings + description: Returns settings for a plan + operationId: getPlanSettingsById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 responses: "200": - description: The requested budget settings + description: The requested plan settings content: application/json: schema: - $ref: "#/components/schemas/BudgetSettingsResponse" + $ref: "#/components/schemas/PlanSettingsResponse" "404": - description: The specified Budget was not found + description: The specified plan was not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/accounts: + /budgets/{plan_id}/accounts: get: tags: - Accounts - summary: Account list + summary: Get all accounts description: Returns all accounts operationId: getAccounts parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -210,32 +179,25 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" post: tags: - Accounts - summary: Create a new account + summary: Create an account description: Creates a new account operationId: createAccount parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget ("last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget) + 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 account to create. content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PostAccountWrapper" required: true @@ -247,28 +209,26 @@ paths: schema: $ref: "#/components/schemas/AccountResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + 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 - /budgets/{budget_id}/accounts/{account_id}: + /budgets/{plan_id}/accounts/{account_id}: get: tags: - Accounts - summary: Single account + summary: Get an account description: Returns a single account operationId: getAccountById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -292,36 +252,28 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/categories: + /budgets/{plan_id}/categories: get: tags: - Categories - summary: List categories - description: >- - Returns all categories grouped by category group. Amounts (budgeted, - activity, balance, etc.) are specific to the current budget month (UTC). + summary: Get all categories + description: Returns all categories grouped by category group. Amounts + (assigned, activity, available, etc.) are specific to the current plan + month (UTC). operationId: getCategories parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -338,28 +290,57 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred + post: + tags: + - Categories + summary: Create a category + description: Creates a new category + operationId: createCategory + 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 category to create. + content: + application/json: + schema: + $ref: "#/components/schemas/PostCategoryWrapper" + required: true + responses: + "201": + description: The category was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/SaveCategoryResponse" + "400": + description: The request could not be understood due to malformed syntax or + validation error(s). content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/categories/{category_id}: + x-codegen-request-body-name: data + /budgets/{plan_id}/categories/{category_id}: get: tags: - Categories - summary: Single category - description: >- - Returns a single category. Amounts (budgeted, activity, balance, etc.) - are specific to the current budget month (UTC). + summary: Get a category + description: Returns a single category. Amounts (assigned, activity, available, + etc.) are specific to the current plan month (UTC). operationId: getCategoryById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -377,13 +358,7 @@ paths: schema: $ref: "#/components/schemas/CategoryResponse" "404": - description: The category not was found - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred + description: The category was not found content: application/json: schema: @@ -392,16 +367,14 @@ paths: tags: - Categories summary: Update a category - description: >- - Update a category + description: Update a category operationId: updateCategory parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -412,10 +385,9 @@ paths: schema: type: string requestBody: - description: >- - The category to update + description: The category to update content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PatchCategoryWrapper" required: true @@ -427,38 +399,34 @@ paths: schema: $ref: "#/components/schemas/SaveCategoryResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + 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 - /budgets/{budget_id}/months/{month}/categories/{category_id}: + /budgets/{plan_id}/months/{month}/categories/{category_id}: get: tags: - Categories - summary: Single category for a specific budget month - description: >- - Returns a single category for a specific budget month. Amounts - (budgeted, activity, balance, etc.) are specific to the current budget + summary: Get a category for a specific plan month + description: Returns a single category for a specific plan month. Amounts + (assigned, activity, available, etc.) are specific to the current plan month (UTC). operationId: getMonthCategoryById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: month in: path - description: >- - The budget month in ISO format (e.g. 2016-12-01) ("current" can also + description: The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC)) required: true schema: @@ -483,34 +451,25 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" patch: tags: - Categories summary: Update a category for a specific month - description: >- - Update a category for a specific month. Only `budgeted` amount can be - updated. + description: Update a category for a specific month. Only `budgeted` (assigned) + amount can be updated. operationId: updateMonthCategory parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: month in: path - description: >- - The budget month in ISO format (e.g. 2016-12-01) ("current" can also + description: The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC)) required: true schema: @@ -523,11 +482,10 @@ paths: schema: type: string requestBody: - description: >- - The category to update. Only `budgeted` amount can be updated and any - other fields specified will be ignored. + description: The category to update. Only `budgeted` (assigned) amount can be + updated and any other fields specified will be ignored. content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PatchMonthCategoryWrapper" required: true @@ -539,36 +497,115 @@ paths: schema: $ref: "#/components/schemas/SaveCategoryResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + 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 - /budgets/{budget_id}/payees: + /budgets/{plan_id}/category_groups: + post: + tags: + - Categories + summary: Create a category group + description: Creates a new category group + operationId: createCategoryGroup + 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 category group to create. + content: + application/json: + schema: + $ref: "#/components/schemas/PostCategoryGroupWrapper" + required: true + responses: + "201": + description: The category group was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/SaveCategoryGroupResponse" + "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 + /budgets/{plan_id}/category_groups/{category_group_id}: + patch: + tags: + - Categories + summary: Update a category group + description: Update a category group + operationId: updateCategoryGroup + 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 + - name: category_group_id + in: path + description: The id of the category group + required: true + schema: + type: string + requestBody: + description: The category group to update + content: + application/json: + schema: + $ref: "#/components/schemas/PatchCategoryGroupWrapper" + required: true + responses: + "200": + description: The category group was successfully updated + content: + application/json: + schema: + $ref: "#/components/schemas/SaveCategoryGroupResponse" + "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 + /budgets/{plan_id}/payees: get: tags: - Payees - summary: List payees + summary: Get all payees description: Returns all payees operationId: getPayees parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -585,26 +622,19 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/payees/{payee_id}: + /budgets/{plan_id}/payees/{payee_id}: get: tags: - Payees - summary: Single payee + summary: Get a payee description: Returns a single payee operationId: getPayeeById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -627,26 +657,18 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" patch: tags: - Payees summary: Update a payee - description: >- - Update a payee + description: Update a payee operationId: updatePayee parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -657,10 +679,9 @@ paths: schema: type: string requestBody: - description: >- - The payee to update + description: The payee to update content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PatchPayeeWrapper" required: true @@ -672,28 +693,26 @@ paths: schema: $ref: "#/components/schemas/SavePayeeResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + 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 - /budgets/{budget_id}/payee_locations: + /budgets/{plan_id}/payee_locations: get: tags: - Payee Locations - summary: List payee locations + summary: Get all payee locations description: Returns all payee locations operationId: getPayeeLocations parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -710,26 +729,19 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/payee_locations/{payee_location_id}: + /budgets/{plan_id}/payee_locations/{payee_location_id}: get: tags: - Payee Locations - summary: Single payee location + summary: Get a payee location description: Returns a single payee location operationId: getPayeeLocationById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -752,26 +764,19 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/payees/{payee_id}/payee_locations: + /budgets/{plan_id}/payees/{payee_id}/payee_locations: get: tags: - Payee Locations - summary: List locations for a payee + summary: Get all locations for a payee description: Returns all payee locations for a specified payee operationId: getPayeeLocationsByPayee parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -794,77 +799,127 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/months: + /budgets/{plan_id}/months: get: tags: - Months - summary: List budget months - description: Returns all budget months - operationId: getBudgetMonths + summary: Get all plan months + description: Returns all plan months + operationId: getPlanMonths parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 responses: "200": - description: The list of budget months + description: The list of plan months content: application/json: schema: $ref: "#/components/schemas/MonthSummariesResponse" "404": - description: No budget months were found + description: No plan months were found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred + /budgets/{plan_id}/months/{month}: + get: + tags: + - Months + summary: Get a plan month + description: Returns a single plan month + operationId: getPlanMonth + 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 + - name: month + in: path + description: The plan month in ISO format (e.g. 2016-12-01) ("current" can also + be used to specify the current calendar month (UTC)) + required: true + schema: + type: string + format: date + responses: + "200": + description: The plan month detail + content: + application/json: + schema: + $ref: "#/components/schemas/MonthDetailResponse" + "404": + description: The plan month was not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/months/{month}: + /budgets/{plan_id}/money_movements: get: tags: - - Months - summary: Single budget month - description: Returns a single budget month - operationId: getBudgetMonth + - Money Movements + summary: Get all money movements + description: Returns all money movements + operationId: getMoneyMovements parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 + responses: + "200": + description: The list of requested money movements + content: + application/json: + schema: + $ref: "#/components/schemas/MoneyMovementsResponse" + "404": + description: No money movements were found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + /budgets/{plan_id}/months/{month}/money_movements: + get: + tags: + - Money Movements + summary: Get money movements for a plan month + description: Returns all money movements for a specific month + operationId: getMoneyMovementsByMonth + 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 - name: month in: path - description: >- - The budget month in ISO format (e.g. 2016-12-01) ("current" can also + description: The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC)) required: true schema: @@ -872,52 +927,109 @@ paths: format: date responses: "200": - description: The budget month detail + description: The list of requested money movements content: application/json: schema: - $ref: "#/components/schemas/MonthDetailResponse" + $ref: "#/components/schemas/MoneyMovementsResponse" "404": - description: The budget month was not found + description: No money movements were found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred + /budgets/{plan_id}/money_movement_groups: + get: + tags: + - Money Movements + summary: Get all money movement groups + description: Returns all money movement groups + operationId: getMoneyMovementGroups + 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 + responses: + "200": + description: The list of requested money movement groups + content: + application/json: + schema: + $ref: "#/components/schemas/MoneyMovementGroupsResponse" + "404": + description: No money movement groups were found + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + /budgets/{plan_id}/months/{month}/money_movement_groups: + get: + tags: + - Money Movements + summary: Get money movement groups for a plan month + description: Returns all money movement groups for a specific month + operationId: getMoneyMovementGroupsByMonth + 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 + - name: month + in: path + description: The plan month in ISO format (e.g. 2016-12-01) ("current" can also + be used to specify the current calendar month (UTC)) + required: true + schema: + type: string + format: date + responses: + "200": + description: The list of requested money movement groups + content: + application/json: + schema: + $ref: "#/components/schemas/MoneyMovementGroupsResponse" + "404": + description: No money movement groups were found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/transactions: + /budgets/{plan_id}/transactions: get: tags: - Transactions - summary: List transactions - description: Returns budget transactions, excluding any pending transactions + summary: Get all transactions + description: Returns plan transactions, excluding any pending transactions operationId: getTransactions parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: since_date in: query - description: >- - If specified, only transactions on or after this date will be + description: If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). schema: type: string format: date - name: type in: query - description: >- - If specified, only transactions of the specified type will be + description: If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported. schema: type: string @@ -926,9 +1038,8 @@ paths: - unapproved - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -955,32 +1066,29 @@ paths: tags: - Transactions summary: Create a single transaction or multiple transactions - description: >- - Creates a single transaction or multiple transactions. If you provide a - body containing a `transaction` object, a single transaction will be - created and if you provide a body containing a `transactions` array, - multiple transactions will be created. Scheduled transactions (transactions with a future date) - cannot be created on this endpoint. + description: Creates a single transaction or multiple transactions. If you + provide a body containing a `transaction` object, a single transaction + will be created and if you provide a body containing a `transactions` + array, multiple transactions will be created. Scheduled transactions + (transactions with a future date) cannot be created on this endpoint. operationId: createTransaction parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 transaction or transactions to create. To create a single + description: The transaction or transactions to create. To create a single transaction you can specify a value for the `transaction` object and to create multiple transactions you can specify an array of `transactions`. It is expected that you will only provide a value for one of these objects. content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PostTransactionsWrapper" required: true @@ -992,16 +1100,14 @@ paths: schema: $ref: "#/components/schemas/SaveTransactionsResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + description: The request could not be understood due to malformed syntax or validation error(s). content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "409": - description: >- - A transaction on the same account with the same `import_id` already + description: A transaction on the same account with the same `import_id` already exists. content: application/json: @@ -1015,26 +1121,25 @@ paths: description: Updates multiple transactions, by `id` or `import_id`. operationId: updateTransactions parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 transactions to update. Each transaction must have either an `id` - or `import_id` specified. If `id` is specified as null an `import_id` - value can be provided which will allow transaction(s) to be updated by - its `import_id`. If an `id` is specified, it will always be used for - lookup. You should not specify both `id` and `import_id`. Updating - an `import_id` on an existing transaction is not allowed; if an `import_id` - is specified, it will only be used to lookup the transaction. + description: The transactions to update. Each transaction must have either an + `id` or `import_id` specified. If `id` is specified as null an + `import_id` value can be provided which will allow transaction(s) to + be updated by its `import_id`. If an `id` is specified, it will always + be used for lookup. You should not specify both `id` and + `import_id`. Updating an `import_id` on an existing transaction is + not allowed; if an `import_id` is specified, it will only be used to + lookup the transaction. content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PatchTransactionsWrapper" required: true @@ -1046,35 +1151,32 @@ paths: schema: $ref: "#/components/schemas/SaveTransactionsResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + 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 - /budgets/{budget_id}/transactions/import: + /budgets/{plan_id}/transactions/import: post: tags: - Transactions summary: Import transactions - description: >- - Imports available transactions on all linked accounts for the given - budget. Linked accounts allow transactions to be imported directly from - a specified financial institution and this endpoint initiates that + description: Imports available transactions on all linked accounts for the given + plan. Linked accounts allow transactions to be imported directly from a + specified financial institution and this endpoint initiates that import. Sending a request to this endpoint is the equivalent of clicking "Import" on each account in the web application or tapping the "New Transactions" banner in the mobile applications. The response for this endpoint contains the transaction ids that have been imported. operationId: importTransactions parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1092,27 +1194,25 @@ paths: schema: $ref: "#/components/schemas/TransactionsImportResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + description: The request could not be understood due to malformed syntax or validation error(s) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/transactions/{transaction_id}: + /budgets/{plan_id}/transactions/{transaction_id}: get: tags: - Transactions - summary: Single transaction + summary: Get a transaction description: Returns a single transaction operationId: getTransactionById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1135,25 +1235,18 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" put: tags: - Transactions - summary: Updates an existing transaction + summary: Update a transaction description: Updates a single transaction operationId: updateTransaction parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1166,7 +1259,7 @@ paths: requestBody: description: The transaction to update content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PutTransactionWrapper" required: true @@ -1178,8 +1271,7 @@ paths: schema: $ref: "#/components/schemas/TransactionResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + description: The request could not be understood due to malformed syntax or validation error(s) content: application/json: @@ -1189,16 +1281,15 @@ paths: delete: tags: - Transactions - summary: Deletes an existing transaction + summary: Delete a transaction description: Deletes a transaction operationId: deleteTransaction parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1221,20 +1312,20 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/accounts/{account_id}/transactions: + /budgets/{plan_id}/accounts/{account_id}/transactions: get: tags: - Transactions - summary: List account transactions - description: Returns all transactions for a specified account, excluding any pending transactions + summary: Get all account transactions + description: Returns all transactions for a specified account, excluding any + pending transactions operationId: getTransactionsByAccount parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1246,16 +1337,14 @@ paths: type: string - name: since_date in: query - description: >- - If specified, only transactions on or after this date will be + description: If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). schema: type: string format: date - name: type in: query - description: >- - If specified, only transactions of the specified type will be + description: If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported. schema: type: string @@ -1264,9 +1353,8 @@ paths: - unapproved - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -1283,26 +1371,20 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/categories/{category_id}/transactions: + /budgets/{plan_id}/categories/{category_id}/transactions: get: tags: - Transactions - summary: List category transactions, excluding any pending transactions - description: Returns all transactions for a specified category + summary: Get all category transactions + description: Returns all transactions for a specified category, excluding any + pending transactions operationId: getTransactionsByCategory parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1314,16 +1396,14 @@ paths: type: string - name: since_date in: query - description: >- - If specified, only transactions on or after this date will be + description: If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). schema: type: string format: date - name: type in: query - description: >- - If specified, only transactions of the specified type will be + description: If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported. schema: type: string @@ -1332,9 +1412,8 @@ paths: - unapproved - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -1351,26 +1430,20 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/payees/{payee_id}/transactions: + /budgets/{plan_id}/payees/{payee_id}/transactions: get: tags: - Transactions - summary: List payee transactions, excluding any pending transactions - description: Returns all transactions for a specified payee + summary: Get all payee transactions + description: Returns all transactions for a specified payee, excluding any + pending transactions operationId: getTransactionsByPayee parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1382,16 +1455,14 @@ paths: type: string - name: since_date in: query - description: >- - If specified, only transactions on or after this date will be + description: If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). schema: type: string format: date - name: type in: query - description: >- - If specified, only transactions of the specified type will be + description: If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported. schema: type: string @@ -1400,9 +1471,8 @@ paths: - unapproved - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -1419,49 +1489,40 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/months/{month}/transactions: + /budgets/{plan_id}/months/{month}/transactions: get: tags: - Transactions - summary: List transactions in month, excluding any pending transactions - description: Returns all transactions for a specified month + summary: Get all plan month transactions + description: Returns all transactions for a specified month, excluding any + pending transactions operationId: getTransactionsByMonth parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: month in: path - description: >- - The budget month in ISO format (e.g. 2016-12-01) ("current" can also + description: The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC)) required: true schema: type: string - name: since_date in: query - description: >- - If specified, only transactions on or after this date will be + description: If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). schema: type: string format: date - name: type in: query - description: >- - If specified, only transactions of the specified type will be + description: If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported. schema: type: string @@ -1470,9 +1531,8 @@ paths: - unapproved - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -1482,41 +1542,33 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/HybridTransactionsResponse" + $ref: "#/components/schemas/TransactionsResponse" "404": description: No transactions were found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - /budgets/{budget_id}/scheduled_transactions: + /budgets/{plan_id}/scheduled_transactions: get: tags: - Scheduled Transactions - summary: List scheduled transactions + summary: Get all scheduled transactions description: Returns all scheduled transactions operationId: getScheduledTransactions parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 - name: last_knowledge_of_server in: query - description: >- - The starting server knowledge. If provided, only entities that have - changed since `last_knowledge_of_server` will be included. + description: The starting server knowledge. If provided, only entities that + have changed since `last_knowledge_of_server` will be included. schema: type: integer format: int64 @@ -1533,34 +1585,26 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" post: tags: - Scheduled Transactions - summary: Create a single scheduled transaction - description: >- - Creates a single scheduled transaction (a transaction with a future date). + summary: Create a scheduled transaction + description: Creates a single scheduled transaction (a transaction with a future + date). operationId: createScheduledTransaction parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 scheduled transaction to create + description: The scheduled transaction to create content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PostScheduledTransactionWrapper" required: true @@ -1572,28 +1616,26 @@ paths: schema: $ref: "#/components/schemas/ScheduledTransactionResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + 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 - /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}: + /budgets/{plan_id}/scheduled_transactions/{scheduled_transaction_id}: get: tags: - Scheduled Transactions - summary: Single scheduled transaction + summary: Get a scheduled transaction description: Returns a single scheduled transaction operationId: getScheduledTransactionById parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1616,25 +1658,18 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" - default: - description: An error occurred - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" put: tags: - Scheduled Transactions - summary: Updates an existing scheduled transaction + summary: Update a scheduled transaction description: Updates a single scheduled transaction operationId: updateScheduledTransaction parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1647,7 +1682,7 @@ paths: requestBody: description: The scheduled transaction to update content: - "application/json": + application/json: schema: $ref: "#/components/schemas/PutScheduledTransactionWrapper" required: true @@ -1659,8 +1694,7 @@ paths: schema: $ref: "#/components/schemas/ScheduledTransactionResponse" "400": - description: >- - The request could not be understood due to malformed syntax or + description: The request could not be understood due to malformed syntax or validation error(s) content: application/json: @@ -1669,16 +1703,15 @@ paths: delete: tags: - Scheduled Transactions - summary: Deletes an existing scheduled transaction + summary: Delete a scheduled transaction description: Deletes a scheduled transaction operationId: deleteScheduledTransaction parameters: - - name: budget_id + - name: plan_id in: path - description: >- - The id of the budget. "last-used" can be used to specify the last - used budget and "default" can be used if default budget selection is - enabled (see: https://api.ynab.com/#oauth-default-budget). + 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 @@ -1746,14 +1779,14 @@ components: DateFormat: required: - format - type: object + type: + - object + - "null" properties: format: type: string - nullable: true - description: >- - The date format setting for the budget. In some cases the format will - not be available and will be specified as null. + description: The date format setting for the plan. In some cases the format + will not be available and will be specified as null. CurrencyFormat: required: - currency_symbol @@ -1764,7 +1797,9 @@ components: - group_separator - iso_code - symbol_first - type: object + type: + - object + - "null" properties: iso_code: type: string @@ -1783,11 +1818,9 @@ components: type: string display_symbol: type: boolean - nullable: true - description: >- - The currency format setting for the budget. In some cases the format + description: The currency format setting for the plan. In some cases the format will not be available and will be specified as null. - BudgetSummaryResponse: + PlanSummaryResponse: required: - data type: object @@ -1800,10 +1833,12 @@ components: budgets: type: array items: - $ref: "#/components/schemas/BudgetSummary" + $ref: "#/components/schemas/PlanSummary" default_budget: - $ref: "#/components/schemas/BudgetSummary" - BudgetSummary: + allOf: + - $ref: "#/components/schemas/PlanSummary" + nullable: true + PlanSummary: required: - id - name @@ -1816,17 +1851,16 @@ components: type: string last_modified_on: type: string - description: >- - The last time any changes were made to the budget from either a web + description: The last time any changes were made to the plan from either a web or mobile client format: date-time first_month: type: string - description: The earliest budget month + description: The earliest plan month format: date last_month: type: string - description: The latest budget month + description: The latest plan month format: date date_format: $ref: "#/components/schemas/DateFormat" @@ -1834,12 +1868,11 @@ components: $ref: "#/components/schemas/CurrencyFormat" accounts: type: array - description: >- - The budget accounts (only included if `include_accounts=true` + description: The plan accounts (only included if `include_accounts=true` specified as query parameter) items: $ref: "#/components/schemas/Account" - BudgetDetailResponse: + PlanDetailResponse: required: - data type: object @@ -1851,14 +1884,14 @@ components: type: object properties: budget: - $ref: "#/components/schemas/BudgetDetail" + $ref: "#/components/schemas/PlanDetail" server_knowledge: type: integer description: The knowledge of the server format: int64 - BudgetDetail: + PlanDetail: allOf: - - $ref: "#/components/schemas/BudgetSummary" + - $ref: "#/components/schemas/PlanSummary" - type: object properties: accounts: @@ -1901,7 +1934,7 @@ components: type: array items: $ref: "#/components/schemas/ScheduledSubTransaction" - BudgetSettingsResponse: + PlanSettingsResponse: required: - data type: object @@ -1912,8 +1945,8 @@ components: type: object properties: settings: - $ref: "#/components/schemas/BudgetSettings" - BudgetSettings: + $ref: "#/components/schemas/PlanSettings" + PlanSettings: required: - currency_format - date_format @@ -1977,16 +2010,17 @@ components: $ref: "#/components/schemas/AccountType" on_budget: type: boolean - description: Whether this account is on budget or not + description: Whether this account is "on budget" or not closed: type: boolean description: Whether this account is closed or not note: - type: string - nullable: true + type: + - string + - "null" balance: type: integer - description: The current balance of the account in milliunits format + description: The current available balance of the account in milliunits format format: int64 cleared_balance: type: integer @@ -1997,32 +2031,31 @@ components: description: The current uncleared balance of the account in milliunits format format: int64 transfer_payee_id: - type: string - nullable: true + type: + - string + - "null" description: The payee id which should be used when transferring to this account format: uuid direct_import_linked: type: boolean - description: >- - Whether or not the account is linked to a financial institution for + description: Whether or not the account is linked to a financial institution for automatic transaction import. direct_import_in_error: type: boolean - description: >- - If an account linked to a financial institution + description: 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. last_reconciled_at: - type: string - nullable: true + type: + - string + - "null" description: A date/time specifying when the account was last reconciled. format: date-time debt_original_balance: - type: integer - nullable: true - description: >- - The original debt/loan account balance, specified in milliunits - format. + type: + - integer + - "null" + description: This field is deprecated and will always be null. format: int64 debt_interest_rates: $ref: "#/components/schemas/LoanAccountPeriodicValue" @@ -2032,8 +2065,7 @@ components: $ref: "#/components/schemas/LoanAccountPeriodicValue" deleted: type: boolean - description: >- - Whether or not the account has been deleted. Deleted accounts will + description: Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. PostAccountWrapper: required: @@ -2059,8 +2091,9 @@ components: description: The current balance of the account in milliunits format format: int64 LoanAccountPeriodicValue: - type: object - nullable: true + type: + - object + - "null" additionalProperties: type: integer format: int64 @@ -2121,9 +2154,8 @@ components: properties: categories: type: array - description: >- - Category group categories. Amounts (budgeted, activity, - balance, etc.) are specific to the current budget month (UTC). + description: Category group categories. Amounts (assigned, activity, available, + etc.) are specific to the current plan month (UTC). items: $ref: "#/components/schemas/Category" CategoryGroup: @@ -2144,8 +2176,7 @@ components: description: Whether or not the category group is hidden deleted: type: boolean - description: >- - Whether or not the category group has been deleted. Deleted + description: Whether or not the category group has been deleted. Deleted category groups will only be included in delta requests. Category: required: @@ -2173,16 +2204,18 @@ components: type: boolean description: Whether or not the category is hidden original_category_group_id: - type: string + type: + - string + - "null" description: "DEPRECATED: No longer used. Value will always be null." format: uuid - nullable: true note: - type: string - nullable: true + type: + - string + - "null" budgeted: type: integer - description: Budgeted amount in milliunits format + description: Assigned (budgeted) amount in milliunits format format: int64 activity: type: integer @@ -2190,12 +2223,13 @@ components: format: int64 balance: type: integer - description: Balance in milliunits format + description: Available balance in milliunits format format: int64 goal_type: - type: string - description: >- - The type of goal, if the category has a goal (TB='Target Category + type: + - string + - "null" + description: 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') enum: @@ -2205,30 +2239,30 @@ components: - NEED - DEBT - null - nullable: true goal_needs_whole_amount: - type: boolean - description: >- - Indicates the monthly rollover behavior for "NEED"-type goals. When + type: + - boolean + - "null" + description: 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. - nullable: true + month ("Set Aside"). When "false", previous month category funding + is used ("Refill"). For other goal types, this field will be null. default: null goal_day: - type: integer - description: >- - A day offset modifier for the goal's due date. When goal_cadence is + type: + - integer + - "null" + description: 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). format: int32 - nullable: true goal_cadence: - type: integer - description: >- - The goal cadence. Value in range 0-14. There are two subsets of + type: + - integer + - "null" + description: 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 @@ -2238,50 +2272,59 @@ components: every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years. format: int32 - nullable: true goal_cadence_frequency: - type: integer - description: >- - The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a + type: + - integer + - "null" + description: 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. format: int32 - nullable: true goal_creation_month: - type: string + type: + - string + - "null" description: The month a goal was created format: date - nullable: true goal_target: - type: integer + type: + - integer + - "null" description: The goal target amount in milliunits format: int64 - nullable: true goal_target_month: - type: string - description: >- - The original target month for the goal to be completed. Only some - goal types specify this date. + type: + - string + - "null" + description: "DEPRECATED: No longer used. Use `goal_target_date` instead." + format: date + goal_target_date: + type: + - string + - "null" + description: The target date for the goal to be completed. Only some goal types + specify this date. format: date - nullable: true goal_percentage_complete: - type: integer + type: + - integer + - "null" description: The percentage completion of the goal format: int32 - nullable: true goal_months_to_budget: - type: integer - description: >- - The number of months, including the current month, left in the + type: + - integer + - "null" + description: The number of months, including the current month, left in the current goal period. format: int32 - nullable: true goal_under_funded: - type: integer - description: >- - The amount of funding still needed in the current month to stay on + type: + - integer + - "null" + description: 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 @@ -2289,32 +2332,30 @@ components: clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month. format: int64 - nullable: true goal_overall_funded: - type: integer - description: >- - The total amount funded towards the goal within the current goal + type: + - integer + - "null" + description: The total amount funded towards the goal within the current goal period. format: int64 - nullable: true goal_overall_left: - type: integer - description: >- - The amount of funding still needed to complete the goal within the + type: + - integer + - "null" + description: The amount of funding still needed to complete the goal within the current goal period. format: int64 - nullable: true goal_snoozed_at: - type: string - description: >- - The date/time the goal was snoozed. If the goal is not snoozed, this - will be null. + type: + - string + - "null" + description: The date/time the goal was snoozed. If the goal is not snoozed, + this will be null. format: date-time - nullable: true deleted: type: boolean - description: >- - Whether or not the category has been deleted. Deleted categories + description: Whether or not the category has been deleted. Deleted categories will only be included in delta requests. SaveCategoryResponse: required: @@ -2333,6 +2374,23 @@ components: type: integer description: The knowledge of the server format: int64 + SaveCategoryGroupResponse: + required: + - data + type: object + properties: + data: + required: + - category_group + - server_knowledge + type: object + properties: + category_group: + $ref: "#/components/schemas/CategoryGroup" + server_knowledge: + type: integer + description: The knowledge of the server + format: int64 PayeesResponse: required: - data @@ -2394,16 +2452,15 @@ components: name: type: string transfer_account_id: - type: string - nullable: true - description: >- - If a transfer payee, the `account_id` to which this payee transfers + type: + - string + - "null" + description: If a transfer payee, the `account_id` to which this payee transfers to deleted: type: boolean - description: >- - Whether or not the payee has been deleted. Deleted payees will only - be included in delta requests. + description: Whether or not the payee has been deleted. Deleted payees will + only be included in delta requests. PayeeLocationsResponse: required: - data @@ -2451,8 +2508,7 @@ components: type: string deleted: type: boolean - description: >- - Whether or not the payee location has been deleted. Deleted payee + description: Whether or not the payee location has been deleted. Deleted payee locations will only be included in delta requests. TransactionsResponse: required: @@ -2527,48 +2583,48 @@ components: properties: import_id: maxLength: 36 - type: string - nullable: true - description: >- - If specified, a new transaction will be assigned this `import_id` + type: + - string + - "null" + description: 'If specified, a new transaction will be assigned this `import_id` and considered "imported". We will also attempt to match this - imported transaction to an existing "user-entered" transaction on the - same account, with the same amount, and with a date +/-10 days from - the imported transaction date.

Transactions imported through - File Based Import or Direct Import (not through the API) are - assigned an import_id in 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'. Using a consistent format will prevent - duplicates through Direct Import and File Based Import.

If - import_id is omitted or specified as null, the transaction will be - treated as a "user-entered" transaction. As such, it will be - eligible to be matched against transactions later being imported - (via DI, FBI, or API). + imported transaction to an existing "user-entered" transaction + on the same account, with the same amount, and with a date +/-10 + days from the imported transaction date.

Transactions + imported through File Based Import or Direct Import (not through + the API) are assigned an import_id in 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''. Using a consistent format will + prevent duplicates through Direct Import and File Based + Import.

If import_id is omitted or specified as null, the + transaction will be treated as a "user-entered" transaction. + As such, it will be eligible to be matched against transactions + later being imported (via DI, FBI, or API).' SaveTransactionWithIdOrImportId: allOf: - type: object properties: id: - type: string - nullable: true - description: >- - If specified, this id will be used to lookup a transaction by - its `id` for the purpose of updating the transaction itself. - If not specified, an `import_id` should be supplied. + type: + - string + - "null" + description: If specified, this id will be used to lookup a transaction by its + `id` for the purpose of updating the transaction itself. If not + specified, an `import_id` should be supplied. import_id: maxLength: 36 - type: string - nullable: true - description: >- - If specified, this id will be used to lookup a transaction by - its `import_id` for the purpose of updating the transaction itself. + type: + - string + - "null" + description: If specified, this id will be used to lookup a transaction by its + `import_id` for the purpose of updating the transaction itself. If not specified, an `id` should be supplied. You may not - provide both an `id` and an `import_id` and updating an `import_id` - on an existing transaction is not allowed. + provide both an `id` and an `import_id` and updating an + `import_id` on an existing transaction is not allowed. - $ref: "#/components/schemas/SaveTransactionWithOptionalFields" SaveTransactionWithOptionalFields: type: object @@ -2578,44 +2634,42 @@ components: format: uuid date: type: string - description: >- - The transaction date in ISO format (e.g. 2016-12-01). Future dates + description: The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored. format: date amount: type: integer - description: >- - The transaction amount in milliunits format. Split transaction + description: The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored. format: int64 payee_id: - type: string - nullable: true - description: >- - The payee for the transaction. To create a transfer between two + type: + - string + - "null" + description: The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource. format: uuid payee_name: maxLength: 200 - type: string - nullable: true - description: >- - The payee name. If a `payee_name` value is provided and `payee_id` + type: + - string + - "null" + description: The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee. category_id: - type: string - nullable: true - description: >- - The category for the transaction. To configure a split transaction, - you can specify null for `category_id` and provide a + type: + - string + - "null" + description: The category for the transaction. To configure a split + transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will @@ -2623,21 +2677,20 @@ components: format: uuid memo: maxLength: 500 - type: string - nullable: true + type: + - string + - "null" cleared: $ref: "#/components/schemas/TransactionClearedStatus" approved: type: boolean - description: >- - Whether or not the transaction is approved. If not supplied, + description: Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. flag_color: $ref: "#/components/schemas/TransactionFlagColor" subtransactions: type: array - description: >- - An array of subtransactions to configure a transaction as a split. + description: An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. items: @@ -2652,31 +2705,33 @@ components: description: The subtransaction amount in milliunits format. format: int64 payee_id: - type: string - nullable: true + type: + - string + - "null" description: The payee for the subtransaction. format: uuid payee_name: maxLength: 200 - type: string - nullable: true - description: >- - The payee name. If a `payee_name` value is provided and `payee_id` + type: + - string + - "null" + description: The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if import_id is also specified on parent transaction) or (2) a payee with the same name or (3) creation of a new payee. category_id: - type: string - nullable: true - description: >- - The category for the subtransaction. Credit Card Payment categories - are not permitted and will be ignored if supplied. + type: + - string + - "null" + description: The category for the subtransaction. Credit Card Payment + categories are not permitted and will be ignored if supplied. format: uuid memo: maxLength: 500 - type: string - nullable: true + type: + - string + - "null" SaveTransactionsResponse: required: - data @@ -2697,17 +2752,15 @@ components: $ref: "#/components/schemas/TransactionDetail" transactions: type: array - description: >- - If multiple transactions were specified, the transactions that - were saved + description: If multiple transactions were specified, the transactions that were + saved items: $ref: "#/components/schemas/TransactionDetail" duplicate_import_ids: type: array - description: >- - If multiple transactions were specified, a list of import_ids - that were not created because of an existing `import_id` found - on the same account + description: If multiple transactions were specified, a list of import_ids that + were not created because of an existing `import_id` found on the + same account items: type: string server_knowledge: @@ -2753,8 +2806,9 @@ components: description: The transaction amount in milliunits format format: int64 memo: - type: string - nullable: true + type: + - string + - "null" cleared: $ref: "#/components/schemas/TransactionClearedStatus" approved: @@ -2768,57 +2822,63 @@ components: type: string format: uuid payee_id: - type: string - nullable: true + type: + - string + - "null" format: uuid category_id: - type: string - nullable: true + type: + - string + - "null" format: uuid transfer_account_id: - type: string - nullable: true + type: + - string + - "null" description: If a transfer transaction, the account to which it transfers format: uuid transfer_transaction_id: - type: string - nullable: true - description: >- - If a transfer transaction, the id of transaction on the other side + type: + - string + - "null" + description: If a transfer transaction, the id of transaction on the other side of the transfer matched_transaction_id: - type: string - nullable: true + type: + - string + - "null" description: If transaction is matched, the id of the matched transaction import_id: - type: string - nullable: true - description: >- - 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: + type: + - string + - "null" + description: "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'. + and same amount, its import_id would be + 'YNAB:-294230:2015-12-30:2'." import_payee_name: - type: string - nullable: true - description: >- - If the transaction was imported, the payee name that was used when + type: + - string + - "null" + description: If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules import_payee_name_original: - type: string - nullable: true - description: >- - If the transaction was imported, the original payee name as it + type: + - string + - "null" + description: If the transaction was imported, the original payee name as it appeared on the statement debt_transaction_type: - type: string - description: >- - If the transaction is a debt/loan account transaction, the type of + type: + - string + - "null" + description: If the transaction is a debt/loan account transaction, the type of transaction enum: - payment @@ -2830,11 +2890,9 @@ components: - credit - charge - null - nullable: true deleted: type: boolean - description: >- - Whether or not the transaction has been deleted. Deleted + description: Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. TransactionDetail: allOf: @@ -2847,13 +2905,14 @@ components: account_name: type: string payee_name: - type: string - nullable: true + type: + - string + - "null" category_name: - type: string - nullable: true - description: >- - The name of the category. If a split transaction, this will be + type: + - string + - "null" + description: The name of the category. If a split transaction, this will be 'Split'. subtransactions: type: array @@ -2870,28 +2929,27 @@ components: properties: type: type: string - description: >- - Whether the hybrid transaction represents a regular transaction - or a subtransaction + description: Whether the hybrid transaction represents a regular transaction or + a subtransaction enum: - transaction - subtransaction parent_transaction_id: - type: string - nullable: true - description: >- - For subtransaction types, this is the id of the parent + type: + - string + - "null" + description: For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null. account_name: type: string payee_name: - type: string - nullable: true + type: + - string + - "null" category_name: type: string - description: >- - The name of the category. If a split transaction, this will be + description: The name of the category. If a split transaction, this will be 'Split'. PatchPayeeWrapper: required: @@ -2908,30 +2966,83 @@ components: nullable: false maxLength: 500 description: The name of the payee. The name must be a maximum of 500 characters. + PostCategoryGroupWrapper: + required: + - category_group + type: object + properties: + category_group: + $ref: "#/components/schemas/SaveCategoryGroup" + PatchCategoryGroupWrapper: + required: + - category_group + type: object + properties: + category_group: + $ref: "#/components/schemas/SaveCategoryGroup" + SaveCategoryGroup: + required: + - name + type: object + properties: + name: + type: string + description: The name of the category group. The name must be a maximum of 50 + characters. + maxLength: 50 + PostCategoryWrapper: + required: + - category + type: object + properties: + category: + $ref: "#/components/schemas/NewCategory" PatchCategoryWrapper: required: - category type: object properties: category: - $ref: "#/components/schemas/SaveCategory" + $ref: "#/components/schemas/ExistingCategory" SaveCategory: type: object properties: name: - type: string - nullable: true + type: + - string + - "null" note: - type: string - nullable: true + type: + - string + - "null" category_group_id: type: string format: uuid goal_target: - type: integer - description: The goal target amount in milliunits format. This amount can only be changed if the category already has a configured goal (goal_type != null). + type: + - 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. format: int64 - nullable: true + goal_target_date: + type: + - string + - "null" + description: The goal target date in ISO format (e.g. 2016-12-01). + format: date + ExistingCategory: + allOf: + - $ref: "#/components/schemas/SaveCategory" + - type: object + NewCategory: + allOf: + - $ref: "#/components/schemas/SaveCategory" + - required: + - name + - category_group_id PatchMonthCategoryWrapper: required: - category @@ -2946,7 +3057,7 @@ components: properties: budgeted: type: integer - description: Budgeted amount in milliunits format + description: Assigned (budgeted) amount in milliunits format format: int64 TransactionsImportResponse: required: @@ -2986,8 +3097,7 @@ components: type: string duplicate_import_ids: type: array - description: >- - If any Transactions were not created because they had an + description: If any Transactions were not created because they had an `import_id` matching a transaction already on the same account, the specified import_id(s) will be included in this list. @@ -3019,37 +3129,42 @@ components: description: The subtransaction amount in milliunits format format: int64 memo: - type: string - nullable: true + type: + - string + - "null" payee_id: - type: string + type: + - string + - "null" format: uuid - nullable: true payee_name: - type: string - nullable: true + type: + - string + - "null" category_id: - type: string - nullable: true + type: + - string + - "null" format: uuid category_name: - type: string - nullable: true + type: + - string + - "null" transfer_account_id: - type: string - nullable: true + type: + - string + - "null" description: If a transfer, the account_id which the subtransaction transfers to format: uuid transfer_transaction_id: - type: string - nullable: true - description: >- - If a transfer, the id of transaction on the other side of the + type: + - string + - "null" + description: If a transfer, the id of transaction on the other side of the transfer deleted: type: boolean - description: >- - Whether or not the subtransaction has been deleted. Deleted + description: Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. ScheduledTransactionsResponse: required: @@ -3107,42 +3222,45 @@ components: format: uuid date: type: string - description: >- - The scheduled transaction date in ISO format (e.g. 2016-12-01). This should be a future date no more than 5 years into the future. + description: The scheduled transaction date in ISO format (e.g. + 2016-12-01). This should be a future date no more than 5 years into + the future. format: date amount: type: integer - description: >- - The scheduled transaction amount in milliunits format. + description: The scheduled transaction amount in milliunits format. format: int64 payee_id: - type: string - nullable: true - description: >- - The payee for the scheduled transaction. To create a transfer between two - accounts, use the account transfer payee pointing to the target - account. Account transfer payees are specified as + type: + - string + - "null" + description: The payee for the scheduled transaction. To create a transfer + between two accounts, use the account transfer payee pointing to the + target account. Account transfer payees are specified as `transfer_payee_id` on the account resource. format: uuid payee_name: maxLength: 200 - type: string - nullable: true - description: >- - The payee name for the the scheduled transaction. If a `payee_name` value is provided and `payee_id` - has a null value, the `payee_name` value will be used to resolve the - payee by either (1) a payee with the same name or (2) creation of a new payee. + type: + - string + - "null" + description: The payee name for the the scheduled transaction. If a + `payee_name` value is provided and `payee_id` has a null value, the + `payee_name` value will be used to resolve the payee by either (1) a + payee with the same name or (2) creation of a new payee. category_id: - type: string - nullable: true - description: >- - The category for the scheduled transaction. Credit Card Payment categories are not permitted. - Creating a split scheduled transaction is not currently supported. + type: + - string + - "null" + description: The category for the scheduled transaction. Credit Card Payment + categories are not permitted. Creating a split scheduled transaction + is not currently supported. format: uuid memo: maxLength: 500 - type: string - nullable: true + type: + - string + - "null" flag_color: $ref: "#/components/schemas/TransactionFlagColor" frequency: @@ -3190,8 +3308,9 @@ components: description: The scheduled transaction amount in milliunits format format: int64 memo: - type: string - nullable: true + type: + - string + - "null" flag_color: $ref: "#/components/schemas/TransactionFlagColor" flag_name: @@ -3200,24 +3319,25 @@ components: type: string format: uuid payee_id: - type: string - nullable: true + type: + - string + - "null" format: uuid category_id: - type: string - nullable: true + type: + - string + - "null" format: uuid transfer_account_id: - type: string - nullable: true - description: >- - If a transfer, the account_id which the scheduled transaction + type: + - string + - "null" + description: If a transfer, the account_id which the scheduled transaction transfers to format: uuid deleted: type: boolean - description: >- - Whether or not the scheduled transaction has been deleted. Deleted + description: Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. ScheduledTransactionDetail: allOf: @@ -3230,14 +3350,15 @@ components: account_name: type: string payee_name: - type: string - nullable: true + type: + - string + - "null" category_name: - type: string - nullable: true - description: >- - The name of the category. If a split scheduled transaction, - this will be 'Split'. + type: + - string + - "null" + description: The name of the category. If a split scheduled transaction, this + will be 'Split'. subtransactions: type: array description: If a split scheduled transaction, the subtransactions. @@ -3262,33 +3383,37 @@ components: description: The scheduled subtransaction amount in milliunits format format: int64 memo: - type: string - nullable: true + type: + - string + - "null" payee_id: - type: string - nullable: true + type: + - string + - "null" format: uuid payee_name: - type: string - nullable: true + type: + - string + - "null" category_id: - type: string - nullable: true + type: + - string + - "null" format: uuid category_name: - type: string - nullable: true + type: + - string + - "null" transfer_account_id: - type: string - nullable: true - description: >- - If a transfer, the account_id which the scheduled subtransaction + type: + - string + - "null" + description: If a transfer, the account_id which the scheduled subtransaction transfers to format: uuid deleted: type: boolean - description: >- - Whether or not the scheduled subtransaction has been deleted. + description: Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. MonthSummariesResponse: @@ -3336,38 +3461,37 @@ components: type: string format: date note: - type: string - nullable: true + type: + - string + - "null" income: type: integer - description: >- - The total amount of transactions categorized to 'Inflow: Ready to - Assign' in the month + description: "The total amount of transactions categorized to 'Inflow: Ready to + Assign' in the month" format: int64 budgeted: type: integer - description: The total amount budgeted in the month + description: The total amount assigned (budgeted) in the month format: int64 activity: type: integer - description: >- - The total amount of transactions in the month, excluding those - categorized to 'Inflow: Ready to Assign' + description: "The total amount of transactions in the month, excluding those + categorized to 'Inflow: Ready to Assign'" format: int64 to_be_budgeted: type: integer description: The available amount for 'Ready to Assign' format: int64 age_of_money: - type: integer + type: + - integer + - "null" description: The Age of Money as of the month format: int32 - nullable: true deleted: type: boolean - description: >- - Whether or not the month has been deleted. Deleted months will only - be included in delta requests. + description: Whether or not the month has been deleted. Deleted months will + only be included in delta requests. MonthDetail: allOf: - $ref: "#/components/schemas/MonthSummary" @@ -3377,13 +3501,14 @@ components: properties: categories: type: array - description: >- - The budget month categories. Amounts (budgeted, activity, - balance, etc.) are specific to the {month} parameter specified. + description: The plan month categories. Amounts (budgeted, activity, balance, + etc.) are specific to the {month} parameter specified. items: $ref: "#/components/schemas/Category" TransactionFlagColor: - type: string + type: + - string + - "null" description: The transaction flag enum: - red @@ -3394,11 +3519,11 @@ components: - purple - "" - null - nullable: true TransactionFlagName: - type: string + type: + - string + - "null" description: The customized name of a transaction flag - nullable: true TransactionClearedStatus: type: string description: The cleared status of the transaction @@ -3423,6 +3548,126 @@ components: - twiceAYear - yearly - everyOtherYear + MoneyMovementsResponse: + required: + - data + type: object + properties: + data: + required: + - money_movements + - server_knowledge + type: object + properties: + money_movements: + type: array + items: + $ref: "#/components/schemas/MoneyMovement" + server_knowledge: + type: integer + description: The knowledge of the server + format: int64 + MoneyMovement: + required: + - id + - amount + type: object + properties: + id: + type: string + format: uuid + month: + type: + - string + - "null" + description: The month of the money movement in ISO format (e.g. 2024-01-01) + format: date + moved_at: + type: + - string + - "null" + description: The date/time the money movement was processed on the server in ISO + format (e.g. 2024-01-01T12:00:00Z) + format: date-time + note: + type: + - string + - "null" + money_movement_group_id: + type: + - string + - "null" + description: The id of the money movement group this movement belongs to + format: uuid + performed_by_user_id: + type: + - string + - "null" + description: The id of the user who performed the money movement + format: uuid + from_category_id: + type: + - string + - "null" + description: The id of the category the money was moved from + format: uuid + to_category_id: + type: + - string + - "null" + description: The id of the category the money was moved to + format: uuid + amount: + type: integer + description: The amount of the money movement in milliunits format + format: int64 + MoneyMovementGroupsResponse: + required: + - data + type: object + properties: + data: + required: + - money_movement_groups + - server_knowledge + type: object + properties: + money_movement_groups: + type: array + items: + $ref: "#/components/schemas/MoneyMovementGroup" + server_knowledge: + type: integer + description: The knowledge of the server + format: int64 + MoneyMovementGroup: + required: + - id + - group_created_at + - month + type: object + properties: + id: + type: string + format: uuid + group_created_at: + type: string + description: When the money movement group was created + format: date-time + month: + type: string + description: The month of the money movement group in ISO format (e.g. 2024-01-01) + format: date + note: + type: + - string + - "null" + performed_by_user_id: + type: + - string + - "null" + description: The id of the user who performed the money movement group + format: uuid securitySchemes: bearer: type: http diff --git a/spec/api/accounts_spec.rb b/spec/api/accounts_spec.rb index 465cb75..f4256bb 100644 --- a/spec/api/accounts_spec.rb +++ b/spec/api/accounts_spec.rb @@ -2,7 +2,7 @@ describe 'accounts' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } - let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } + let(:plan_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } let (:instance) { client.accounts } @@ -15,7 +15,7 @@ describe 'authorization' do it 'sets the Bearer Auth header correctly' do VCR.use_cassette("accounts") do - response = instance.get_accounts(budget_id) + response = instance.get_accounts(plan_id) expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end @@ -25,7 +25,7 @@ VCR.use_cassette("accounts_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.accounts.get_accounts(budget_id) + response = client.accounts.get_accounts(plan_id) rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -34,30 +34,30 @@ end end - describe 'GET /budgets/{budget_id}/accounts' do + describe 'GET /budgets/{plan_id}/accounts' do it 'returns a list of accounts' do VCR.use_cassette("accounts") do - response = instance.get_accounts(budget_id) + response = instance.get_accounts(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.accounts.length).to be 1 end end end - describe 'GET /budgets/{budget_id}/accounts/{account_id}' do + describe 'GET /budgets/{plan_id}/accounts/{account_id}' do it 'returns an account' do VCR.use_cassette("account") do - response = instance.get_account_by_id(budget_id, '5982e895-98e5-41ca-9681-0b6de1036a1c') + response = instance.get_account_by_id(plan_id, '5982e895-98e5-41ca-9681-0b6de1036a1c') expect(response.data.account).to be expect(response.data.account.name).to eq "Checking" end end end - describe 'POST /budgets/{budget_id}/accounts' do + describe 'POST /budgets/{plan_id}/accounts' do it 'creates an account' do VCR.use_cassette("create_account") do - response = instance.create_account(budget_id, { + response = instance.create_account(plan_id, { account: { name: 'New Checking Account', type: 'checking', diff --git a/spec/api/categories_spec.rb b/spec/api/categories_spec.rb index 0983c47..907ff02 100644 --- a/spec/api/categories_spec.rb +++ b/spec/api/categories_spec.rb @@ -2,7 +2,7 @@ describe 'categories' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } - let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } + let(:plan_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } let(:category_id) { 'acd2a771-0a56-4dba-97bd-3952b0879282' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } let (:instance) { client.categories } @@ -16,7 +16,7 @@ describe 'authorization' do it 'sets the Bearer Auth header correctly' do VCR.use_cassette("categories") do - response = instance.get_categories(budget_id) + response = instance.get_categories(plan_id) expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end @@ -26,7 +26,7 @@ VCR.use_cassette("categories_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.categories.get_categories(budget_id) + response = client.categories.get_categories(plan_id) rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -35,10 +35,10 @@ end end - describe 'GET /budgets/{budget_id}/categories' do + describe 'GET /budgets/{plan_id}/categories' do it 'returns a list of categories' do VCR.use_cassette("categories") do - response = instance.get_categories(budget_id) + response = instance.get_categories(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.category_groups.length).to be 8 expect(response.data.category_groups[0].categories.length).to be 3 @@ -46,20 +46,20 @@ end end - describe 'GET /budgets/{budget_id}/categories/{category_id}' do + describe 'GET /budgets/{plan_id}/categories/{category_id}' do it 'returns a category' do VCR.use_cassette("category") do - response = instance.get_category_by_id(budget_id, category_id) + response = instance.get_category_by_id(plan_id, category_id) expect(response.data.category).to be expect(response.data.category.name).to eq 'Groceries' end end end - describe 'PATCH /budgets/{budget_id}/months/{month}/categories/{category_id}' do + describe 'PATCH /budgets/{plan_id}/months/{month}/categories/{category_id}' do it 'returns a category' do VCR.use_cassette("patch_month_category") do - response = instance.update_month_category(budget_id, '2018-02-01', category_id, month_category: { budgeted: 20382 }) + response = instance.update_month_category(plan_id, '2018-02-01', category_id, month_category: { budgeted: 20382 }) expect(response.data.category).to be expect(response.data.category.name).to eq 'Groceries' expect(response.data.category.budgeted).to eq 20382 diff --git a/spec/api/months_spec.rb b/spec/api/months_spec.rb index 8886c90..d0aace6 100644 --- a/spec/api/months_spec.rb +++ b/spec/api/months_spec.rb @@ -2,7 +2,7 @@ describe 'months' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } - let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } + let(:plan_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } let (:instance) { client.months } @@ -15,7 +15,7 @@ describe 'authorization' do it 'sets the Bearer Auth header correctly' do VCR.use_cassette("months") do - response = instance.get_budget_months(budget_id) + response = instance.get_plan_months(plan_id) expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end @@ -25,7 +25,7 @@ VCR.use_cassette("months_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.months.get_budget_months(budget_id) + response = client.months.get_plan_months(plan_id) rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -34,20 +34,20 @@ end end - describe 'GET /budgets/{budget_id}/months' do + describe 'GET /budgets/{plan_id}/months' do it 'returns a list of months' do VCR.use_cassette("months") do - response = instance.get_budget_months(budget_id) + response = instance.get_plan_months(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.months.length).to be 3 end end end - describe 'GET /budgets/{budget_id}/months/{month}' do + describe 'GET /budgets/{plan_id}/months/{month}' do it 'returns a month' do VCR.use_cassette("month") do - response = instance.get_budget_month(budget_id, '2018-02-01') + response = instance.get_plan_month(plan_id, '2018-02-01') expect(response.data.month).to be expect(response.data.month.to_be_budgeted).to eq 1000000 expect(response.data.month.note).to eq "Test Note" diff --git a/spec/api/payee_locations_spec.rb b/spec/api/payee_locations_spec.rb index cae7798..9f016c8 100644 --- a/spec/api/payee_locations_spec.rb +++ b/spec/api/payee_locations_spec.rb @@ -2,7 +2,7 @@ describe 'payee locations' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } - let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } + let(:plan_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } let (:instance) { client.payee_locations } @@ -15,7 +15,7 @@ describe 'authorization' do it 'sets the Bearer Auth header correctly' do VCR.use_cassette("payee_locations") do - response = instance.get_payee_locations(budget_id) + response = instance.get_payee_locations(plan_id) expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end @@ -25,7 +25,7 @@ VCR.use_cassette("payee_locations_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.payee_locations.get_payee_locations(budget_id) + response = client.payee_locations.get_payee_locations(plan_id) rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -34,20 +34,20 @@ end end - describe 'GET /budgets/{budget_id}/payee_location' do + describe 'GET /budgets/{plan_id}/payee_location' do it 'returns a list of payee locations' do VCR.use_cassette("payee_locations") do - response = instance.get_payee_locations(budget_id) + response = instance.get_payee_locations(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.payee_locations.length).to be 1 end end end - describe 'GET /budgets/{budget_id}/payee_locations/{payee_id}' do + describe 'GET /budgets/{plan_id}/payee_locations/{payee_id}' do it 'returns a payee location' do VCR.use_cassette("payee_location") do - response = instance.get_payee_location_by_id(budget_id, '052c7814-1797-44ce-9519-020e864e4928') + response = instance.get_payee_location_by_id(plan_id, '052c7814-1797-44ce-9519-020e864e4928') expect(response.data.payee_location).to be expect(response.data.payee_location.latitude).to eq "40.7128" expect(response.data.payee_location.longitude).to eq "74.006" diff --git a/spec/api/payees_spec.rb b/spec/api/payees_spec.rb index 33cfc40..b29ac07 100644 --- a/spec/api/payees_spec.rb +++ b/spec/api/payees_spec.rb @@ -2,7 +2,7 @@ describe 'payees' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } - let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } + let(:plan_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } let (:instance) { client.payees } @@ -15,7 +15,7 @@ describe 'authorization' do it 'sets the Bearer Auth header correctly' do VCR.use_cassette("payees") do - response = instance.get_payees(budget_id) + response = instance.get_payees(plan_id) expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end @@ -25,7 +25,7 @@ VCR.use_cassette("payees_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.payees.get_payees(budget_id) + response = client.payees.get_payees(plan_id) rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -34,20 +34,20 @@ end end - describe 'GET /budgets/{budget_id}/payees' do + describe 'GET /budgets/{plan_id}/payees' do it 'returns a list of payees' do VCR.use_cassette("payees") do - response = instance.get_payees(budget_id) + response = instance.get_payees(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.payees.length).to be 5 end end end - describe 'GET /budgets/{budget_id}/payees/{payee_id}' do + describe 'GET /budgets/{plan_id}/payees/{payee_id}' do it 'returns a payee' do VCR.use_cassette("payee") do - response = instance.get_payee_by_id(budget_id, '200e6eb1-02fc-4af6-be26-27c5740bb949') + response = instance.get_payee_by_id(plan_id, '200e6eb1-02fc-4af6-be26-27c5740bb949') expect(response.data.payee).to be expect(response.data.payee.name).to eq 'Test Payee' end diff --git a/spec/api/budgets_spec.rb b/spec/api/plans_spec.rb similarity index 67% rename from spec/api/budgets_spec.rb rename to spec/api/plans_spec.rb index a943832..6dd50d4 100644 --- a/spec/api/budgets_spec.rb +++ b/spec/api/plans_spec.rb @@ -1,30 +1,30 @@ require 'spec_helper' -describe 'budgets' do +describe 'plans' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } - let (:instance) { client.budgets } + let (:instance) { client.plans } - describe 'test an instance of BudgetsApi' do - it 'should create an instance of BudgetsApi' do - expect(instance).to be_instance_of(YNAB::BudgetsApi) + describe 'test an instance of PlansApi' do + it 'should create an instance of PlansApi' do + expect(instance).to be_instance_of(YNAB::PlansApi) end end describe 'authorization' do it 'sets the Bearer Auth header correctly' do - VCR.use_cassette("budgets") do - response = instance.get_budgets + VCR.use_cassette("plans") do + response = instance.get_plans expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end end it 'throws when unauthorized' do - VCR.use_cassette("budgets_unauthorized") do + VCR.use_cassette("plans_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.budgets.get_budgets + response = client.plans.get_plans rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -36,17 +36,17 @@ describe 'GET /budgets' do it 'returns a list of budgets' do VCR.use_cassette("budgets") do - response = instance.get_budgets + response = instance.get_plans expect(client.last_request.response.options[:code]).to be 200 expect(response.data.budgets.length).to be 4 end end end - describe 'GET /budgets/{budget_id}' do + describe 'GET /budgets/{plan_id}' do it 'returns a budget' do VCR.use_cassette("budget") do - response = instance.get_budget_by_id('f419ac25-6217-4175-88dc-c3136ff5f6fd') + response = instance.get_plan_by_id('f419ac25-6217-4175-88dc-c3136ff5f6fd') expect(response.data.budget).to be expect(response.data.budget.name).to eq "ABC" end diff --git a/spec/api/scheduled_transactions_spec.rb b/spec/api/scheduled_transactions_spec.rb index 255f30f..e70aee4 100644 --- a/spec/api/scheduled_transactions_spec.rb +++ b/spec/api/scheduled_transactions_spec.rb @@ -2,7 +2,7 @@ describe 'scheduled transactions' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } - let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } + let(:plan_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } let (:instance) { client.scheduled_transactions } @@ -15,7 +15,7 @@ describe 'authorization' do it 'sets the Bearer Auth header correctly' do VCR.use_cassette("scheduled_transactions") do - response = instance.get_scheduled_transactions(budget_id) + response = instance.get_scheduled_transactions(plan_id) expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end @@ -25,7 +25,7 @@ VCR.use_cassette("scheduled_transactions_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.scheduled_transactions.get_scheduled_transactions(budget_id) + response = client.scheduled_transactions.get_scheduled_transactions(plan_id) rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -34,30 +34,30 @@ end end - describe 'GET /budgets/{budget_id}/scheduled_transactions' do + describe 'GET /budgets/{plan_id}/scheduled_transactions' do it 'returns a list of transactions' do VCR.use_cassette("scheduled_transactions") do - response = instance.get_scheduled_transactions(budget_id) + response = instance.get_scheduled_transactions(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.scheduled_transactions.length).to be 1 end end end - describe 'GET /budgets/{budget_id}/scheduled_transactions/{payee_id}' do + describe 'GET /budgets/{plan_id}/scheduled_transactions/{payee_id}' do it 'returns a payee' do VCR.use_cassette("scheduled_transaction") do - response = instance.get_scheduled_transaction_by_id(budget_id, '1a8e4929-3ad1-4859-8443-2aeeab0684ab') + response = instance.get_scheduled_transaction_by_id(plan_id, '1a8e4929-3ad1-4859-8443-2aeeab0684ab') expect(response.data.scheduled_transaction).to be expect(response.data.scheduled_transaction.amount).to eq -10000 end end end - describe 'POST /budgets/{budget_id}/scheduled_transactions' do + describe 'POST /budgets/{plan_id}/scheduled_transactions' do it 'creates a scheduled transaction' do VCR.use_cassette("create_scheduled_transaction") do - response = instance.create_scheduled_transaction(budget_id, { + response = instance.create_scheduled_transaction(plan_id, { scheduled_transaction: { date: "#{Time.now.year + 1}-01-01", account_id: '49b0c987-7d2b-46ec-ba14-f8a7e79fb830', diff --git a/spec/api/transactions_spec.rb b/spec/api/transactions_spec.rb index a9cc6e4..0eb14f8 100644 --- a/spec/api/transactions_spec.rb +++ b/spec/api/transactions_spec.rb @@ -2,7 +2,7 @@ describe 'transactions' do let(:access_token) { '9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045' } - let(:budget_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } + let(:plan_id) { 'f419ac25-6217-4175-88dc-c3136ff5f6fd' } let(:category_id) { '84ffe61c-081c-44db-ad23-6ee809206c40' } let(:payee_id) { '2676f959-c5de-4db2-8d3f-2503777b25fb' } let(:client) { YNAB::API.new(access_token, 'api.localhost:3000', false) } @@ -17,7 +17,7 @@ describe 'authorization' do it 'sets the Bearer Auth header correctly' do VCR.use_cassette("transactions") do - response = instance.get_transactions(budget_id) + response = instance.get_transactions(plan_id) expect(client.last_request.options[:headers]["Authorization"]).to eq "Bearer #{access_token}" end @@ -27,7 +27,7 @@ VCR.use_cassette("transactions_unauthorized") do client = YNAB::API.new('not_valid_access_token', 'api.localhost:3000', false) begin - response = client.transactions.get_transactions(budget_id) + response = client.transactions.get_transactions(plan_id) rescue YNAB::ApiError => e expect(e.code).to be 401 expect(client.last_request.response.options[:code]).to be 401 @@ -36,10 +36,10 @@ end end - describe 'GET /budgets/{budget_id}/transactions' do + describe 'GET /budgets/{plan_id}/transactions' do it 'returns a list of transactions' do VCR.use_cassette("transactions") do - response = instance.get_transactions(budget_id) + response = instance.get_transactions(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.transactions.length).to be 2 end @@ -48,7 +48,7 @@ it 'gracefully handles invalid flag_color values' do # transactions_invalid_flags contains transactions with invalid/unsupported flag_color values VCR.use_cassette("transactions_invalid_flags") do - response = instance.get_transactions(budget_id) + response = instance.get_transactions(plan_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.transactions.length).to be 2 # We expect the flag_color to have been converted to nil for these transactions @@ -58,50 +58,50 @@ end end - describe 'GET /budgets/{budget_id}/category/{category_id}/transactions' do + describe 'GET /budgets/{plan_id}/category/{category_id}/transactions' do it 'returns a list of transactions for a category' do VCR.use_cassette("category_transactions") do - response = instance.get_transactions_by_category(budget_id, category_id) + response = instance.get_transactions_by_category(plan_id, category_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.transactions.length).to be 3 end end end - describe 'GET /budgets/{budget_id}/category/{payee_id}/transactions' do + describe 'GET /budgets/{plan_id}/category/{payee_id}/transactions' do it 'returns a list of transactions for a payee' do VCR.use_cassette("payee_transactions") do - response = instance.get_transactions_by_payee(budget_id, payee_id) + response = instance.get_transactions_by_payee(plan_id, payee_id) expect(client.last_request.response.options[:code]).to be 200 expect(response.data.transactions.length).to be 2 end end end - describe 'GET /budgets/{budget_id}/months/{month}/transactions' do + describe 'GET /budgets/{plan_id}/months/{month}/transactions' do it 'returns a list of transactions for a month' do VCR.use_cassette("month_transactions") do - response = instance.get_transactions_by_month(budget_id, "2024-07-01") + response = instance.get_transactions_by_month(plan_id, "2024-07-01") expect(client.last_request.response.options[:code]).to be 200 expect(response.data.transactions.length).to be 2 end end end - describe 'GET /budgets/{budget_id}/transaction/{transaction_id}' do + describe 'GET /budgets/{plan_id}/transaction/{transaction_id}' do it 'returns a transaction' do VCR.use_cassette("transaction") do - response = instance.get_transaction_by_id(budget_id, '81c374ff-74ab-4d6d-8d5a-ba3ad3fa68e4') + response = instance.get_transaction_by_id(plan_id, '81c374ff-74ab-4d6d-8d5a-ba3ad3fa68e4') expect(response.data.transaction).to be expect(response.data.transaction.amount).to eq -2000 end end end - describe 'POST /budgets/{budget_id}/transactions' do + describe 'POST /budgets/{plan_id}/transactions' do it 'creates a transaction' do VCR.use_cassette("create_transaction") do - response = instance.create_transaction(budget_id, { + response = instance.create_transaction(plan_id, { transaction: { date: '2018-01-01', account_id: '5982e895-98e5-41ca-9681-0b6de1036a1c', @@ -116,7 +116,7 @@ it 'creates multiple transactions' do VCR.use_cassette("create_transaction") do - response = instance.create_transactions(budget_id, { + response = instance.create_transactions(plan_id, { transactions: [ { date: '2018-01-01', @@ -137,10 +137,10 @@ end end - describe 'PUT /budgets/{budget_id}/transactions/{transaction_id}' do + describe 'PUT /budgets/{plan_id}/transactions/{transaction_id}' do it 'updates a transaction' do VCR.use_cassette("update_transaction") do - response = instance.update_transaction(budget_id, '4cd63d34-3814-4f50-abd0-59ce05b40d91', { + response = instance.update_transaction(plan_id, '4cd63d34-3814-4f50-abd0-59ce05b40d91', { transaction: { date: '2018-01-02', account_id: '5982e895-98e5-41ca-9681-0b6de1036a1c', @@ -154,10 +154,10 @@ end end - describe 'PATCH /budgets/{budget_id}/transactions' do + describe 'PATCH /budgets/{plan_id}/transactions' do it 'updates multiple transactions' do VCR.use_cassette("update_transactions") do - response = instance.update_transactions(budget_id, { + response = instance.update_transactions(plan_id, { transactions: [ { date: '2018-01-02', @@ -178,10 +178,10 @@ end end - describe 'POST /budgets/{budget_id}/transactions' do + describe 'POST /budgets/{plan_id}/transactions' do it 'create multiple transactions' do VCR.use_cassette("multiple_transactions") do - response = instance.create_transaction(budget_id, { + response = instance.create_transaction(plan_id, { transactions: [ { date: '2018-01-01', @@ -209,10 +209,10 @@ end end - describe 'POST /budgets/{budget_id}/transactions/import' do + describe 'POST /budgets/{plan_id}/transactions/import' do it 'import transactions' do VCR.use_cassette("import_transactions") do - response = instance.import_transactions(budget_id) + response = instance.import_transactions(plan_id) expect(client.last_request.response.options[:code]).to be 201 expect(response.data.transaction_ids.length).to eq 1 expect(response.data.transaction_ids).to include '07b68f11-98bd-4184-8866-83268a654318' @@ -220,10 +220,10 @@ end end - describe 'POST /budgets/{budget_id}/transactions/bulk' do + describe 'POST /budgets/{plan_id}/transactions/bulk' do it 'bulk creations transactions' do VCR.use_cassette("bulk_transactions") do - response = instance.bulk_create_transactions(budget_id, { + response = instance.bulk_create_transactions(plan_id, { transactions: [ { date: '2018-01-01', diff --git a/spec/fixtures/vcr_cassettes/plans.yml b/spec/fixtures/vcr_cassettes/plans.yml new file mode 100644 index 0000000..7df1a14 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/plans.yml @@ -0,0 +1,49 @@ +--- +http_interactions: +- request: + method: get + uri: http://api.localhost:3000/v1/budgets + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - api_client/ruby/0.1.0 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Bearer 9f1a2c4842b614a771aaae9220fc54ae835e298c4654dc2c9205fc1d7bd1a045 + Expect: + - '' + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json; charset=utf-8 + Vary: + - Accept-Encoding, Origin + ETag: + - W/"ab6962c846032f67f346997e36a2d21e" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - cac5447b-f782-466a-9f0e-bf6fc725bf7f + X-Runtime: + - '0.176181' + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: '{"data":{"budgets":[{"id":"36e85244-5254-47be-a7d1-28be746a7f72","name":"Hammel + Budget","last_modified_on":"2018-02-14T20:28:50+00:00","date_format":{"locale":"en_US"},"currency_format":{"locale":"en_US"},"first_month":"2010-10-01","last_month":"2018-02-01"},{"id":"5b202339-ba6a-4498-bc93-f6909ec38153","name":"Household + Budget","last_modified_on":"2018-02-14T20:28:53+00:00","date_format":{"locale":"en_US"},"currency_format":{"locale":"en_US"},"first_month":"2013-09-01","last_month":"2018-02-01"},{"id":"9db9a05d-c61c-4ce8-95ea-06174910f332","name":"My + Budget","last_modified_on":"2018-02-15T18:24:02+00:00","date_format":{"format":"MM/DD/YYYY"},"currency_format":{"iso_code":"USD","example_format":"123,456.78","decimal_digits":2,"decimal_separator":".","symbol_first":true,"group_separator":",","currency_symbol":"$","display_symbol":true},"first_month":"2018-02-01","last_month":"2018-02-01"},{"id":"f419ac25-6217-4175-88dc-c3136ff5f6fd","name":"ABC","last_modified_on":"2018-02-15T18:53:19+00:00","date_format":{"format":"MM/DD/YYYY"},"currency_format":{"iso_code":"USD","example_format":"123,456.78","decimal_digits":2,"decimal_separator":".","symbol_first":true,"group_separator":",","currency_symbol":"$","display_symbol":true},"first_month":"2018-02-01","last_month":"2018-02-01"}]}}' + http_version: '1.1' + adapter_metadata: + effective_url: http://api.localhost:3000/v1/budgets + recorded_at: Thu, 15 Feb 2018 18:59:58 GMT +recorded_with: VCR 3.0.3 diff --git a/spec/fixtures/vcr_cassettes/plans_unauthorized.yml b/spec/fixtures/vcr_cassettes/plans_unauthorized.yml new file mode 100644 index 0000000..3c39288 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/plans_unauthorized.yml @@ -0,0 +1,49 @@ +--- +http_interactions: +- request: + method: get + uri: http://api.localhost:3000/v1/budgets + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - api_client/ruby/3.9.0 + Content-Type: + - application/json + Accept: + - application/json + Authorization: + - Bearer not_valid_access_token + Expect: + - '' + response: + status: + code: 401 + message: Unauthorized + headers: + Cache-Control: + - no-store + Pragma: + - no-cache + WWW-Authenticate: + - Bearer realm="Doorkeeper", error="invalid_token", error_description="The access + token is invalid" + Content-Type: + - application/json; charset=utf-8 + Vary: + - Accept-Encoding, Origin + X-Request-Id: + - 45145cc7-12a5-4f74-bf0a-d25b6c28ff73 + X-Runtime: + - '0.168549' + Transfer-Encoding: + - chunked + body: + encoding: UTF-8 + string: '{"error":{"id":"401","name":"unauthorized","detail":"Unauthorized"}}' + http_version: '1.1' + adapter_metadata: + effective_url: http://api.localhost:3000/v1/budgets + recorded_at: Thu, 15 Feb 2018 18:59:58 GMT +recorded_with: VCR 3.0.3 diff --git a/templates/gem.mustache b/templates/gem.mustache index f123424..f75fdfa 100644 --- a/templates/gem.mustache +++ b/templates/gem.mustache @@ -9,6 +9,7 @@ require '{{gemName}}/version' require '{{gemName}}/configuration' # Models +require '{{gemName}}/api_model_base' {{#models}} {{#model}} require '{{gemName}}/{{modelPackage}}/{{classFilename}}'{{/model}} @@ -39,8 +40,8 @@ module {{moduleName}} UserApi.new(@client) end - def budgets - BudgetsApi.new(@client) + def plans + PlansApi.new(@client) end def accounts diff --git a/templates/partial_model_generic.mustache b/templates/partial_model_generic.mustache index fe4051b..0a687ec 100644 --- a/templates/partial_model_generic.mustache +++ b/templates/partial_model_generic.mustache @@ -1,7 +1,7 @@ {{#description}} # {{{.}}} {{/description}} - class {{classname}}{{#parent}} < {{{.}}}{{/parent}} + class {{classname}}{{#parent}} < {{{.}}}{{/parent}}{{^parent}} < ApiModelBase{{/parent}} {{#vars}} {{#description}} # {{{.}}} diff --git a/ynab.gemspec b/ynab.gemspec index 2ebd92f..925dd9a 100644 --- a/ynab.gemspec +++ b/ynab.gemspec @@ -6,7 +6,6 @@ #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 $:.push File.expand_path("../lib", __FILE__) @@ -20,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.76.0." + s.description = "Official Ruby client for the YNAB API. API documentation available at https://api.ynab.com. Generated from server specification version 1.78.0." s.license = "Apache-2.0" s.required_ruby_version = ">= 3.3" s.metadata = {}