diff --git a/Rakefile b/Rakefile index 64b988e..ba67db5 100644 --- a/Rakefile +++ b/Rakefile @@ -14,11 +14,14 @@ task :default => [:spec] REQUIRED_RUBY_VERSION = ">= 3.3" -desc "Run Swagger Code Generator to update the client from the Swagger spec" +desc "Run OpenAPI Generator to update the client from the spec" task :generate do - # Download latest swagger spec spec_filename = 'open_api_spec.yaml' + # Download latest spec sh "wget https://api.ynab.com/papi/#{spec_filename} -O ./#{spec_filename}" + # Remove existing generated files to ensure old files are not included in the gem + sh "rm -r docs/ lib/ynab/models/" + # Generate the client sh "openapi-generator generate -i ./#{spec_filename} -g ruby --additional-properties=gemRequiredRubyVersion='#{REQUIRED_RUBY_VERSION}' -c config.json -t ./templates -o ./" end diff --git a/docs/AccountWrapper.md b/docs/AccountWrapper.md deleted file mode 100644 index 713362f..0000000 --- a/docs/AccountWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::AccountWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account** | [**Account**](Account.md) | | - - diff --git a/docs/AccountsWrapper.md b/docs/AccountsWrapper.md deleted file mode 100644 index 69094f3..0000000 --- a/docs/AccountsWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::AccountsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**accounts** | [**Array<Account>**](Account.md) | | -**server_knowledge** | **Integer** | The knowledge of the server | - - diff --git a/docs/BudgetDetailAllOf.md b/docs/BudgetDetailAllOf.md deleted file mode 100644 index ef20e44..0000000 --- a/docs/BudgetDetailAllOf.md +++ /dev/null @@ -1,17 +0,0 @@ -# YNAB::BudgetDetailAllOf - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **accounts** | [**Array<Account>**](Account.md) | | [optional] | -| **payees** | [**Array<Payee>**](Payee.md) | | [optional] | -| **payee_locations** | [**Array<PayeeLocation>**](PayeeLocation.md) | | [optional] | -| **category_groups** | [**Array<CategoryGroup>**](CategoryGroup.md) | | [optional] | -| **categories** | [**Array<Category>**](Category.md) | | [optional] | -| **months** | [**Array<MonthDetail>**](MonthDetail.md) | | [optional] | -| **transactions** | [**Array<TransactionSummary>**](TransactionSummary.md) | | [optional] | -| **subtransactions** | [**Array<SubTransaction>**](SubTransaction.md) | | [optional] | -| **scheduled_transactions** | [**Array<ScheduledTransactionSummary>**](ScheduledTransactionSummary.md) | | [optional] | -| **scheduled_subtransactions** | [**Array<ScheduledSubTransaction>**](ScheduledSubTransaction.md) | | [optional] | - diff --git a/docs/BudgetDetailWrapper.md b/docs/BudgetDetailWrapper.md deleted file mode 100644 index c0475af..0000000 --- a/docs/BudgetDetailWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::BudgetDetailWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**budget** | [**BudgetDetail**](BudgetDetail.md) | | -**server_knowledge** | **Integer** | The knowledge of the server | - - diff --git a/docs/BudgetSettingsWrapper.md b/docs/BudgetSettingsWrapper.md deleted file mode 100644 index ecf066a..0000000 --- a/docs/BudgetSettingsWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::BudgetSettingsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**settings** | [**BudgetSettings**](BudgetSettings.md) | | - - diff --git a/docs/BudgetSummaryWrapper.md b/docs/BudgetSummaryWrapper.md deleted file mode 100644 index bf587af..0000000 --- a/docs/BudgetSummaryWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::BudgetSummaryWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**budgets** | [**Array<BudgetSummary>**](BudgetSummary.md) | | -**default_budget** | [**BudgetSummary**](BudgetSummary.md) | The default budget, if the associated application is configured to support specifying it | - - diff --git a/docs/BulkIdWrapper.md b/docs/BulkIdWrapper.md deleted file mode 100644 index cd04e65..0000000 --- a/docs/BulkIdWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::BulkIdWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bulk** | [**BulkIds**](BulkIds.md) | | - - diff --git a/docs/BulkIds.md b/docs/BulkIds.md deleted file mode 100644 index 953bdcd..0000000 --- a/docs/BulkIds.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::BulkIds - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transaction_ids** | **Array<String>** | The list of Transaction ids that were created. | -**duplicate_import_ids** | **Array<String>** | 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. | - - diff --git a/docs/BulkTransactionCreateResponse.md b/docs/BulkTransactionCreateResponse.md deleted file mode 100644 index 5df73b1..0000000 --- a/docs/BulkTransactionCreateResponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::BulkTransactionCreateResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**BulkTransactionIds**](BulkTransactionIds.md) | | - - diff --git a/docs/BulkTransactionIds.md b/docs/BulkTransactionIds.md deleted file mode 100644 index fb2b3cf..0000000 --- a/docs/BulkTransactionIds.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::BulkTransactionIds - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transaction_ids** | **Array<String>** | | - - diff --git a/docs/CategoryGroupWithCategoriesAllOf.md b/docs/CategoryGroupWithCategoriesAllOf.md deleted file mode 100644 index 77c53f0..0000000 --- a/docs/CategoryGroupWithCategoriesAllOf.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::CategoryGroupWithCategoriesAllOf - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **categories** | [**Array<Category>**](Category.md) | Category group categories. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). | | - diff --git a/docs/CategoryGroupsWrapper.md b/docs/CategoryGroupsWrapper.md deleted file mode 100644 index c4a4f2f..0000000 --- a/docs/CategoryGroupsWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::CategoryGroupsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**category_groups** | [**Array<CategoryGroupWithCategories>**](CategoryGroupWithCategories.md) | | -**server_knowledge** | **Integer** | The knowledge of the server | - - diff --git a/docs/CategoryWrapper.md b/docs/CategoryWrapper.md deleted file mode 100644 index 8a47407..0000000 --- a/docs/CategoryWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::CategoryWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**category** | [**Category**](Category.md) | | -**server_knowledge** | **Integer** | The knowledge of the server | - - diff --git a/docs/DeprecatedApi.md b/docs/DeprecatedApi.md deleted file mode 100644 index 9309a45..0000000 --- a/docs/DeprecatedApi.md +++ /dev/null @@ -1,28 +0,0 @@ -# YNAB::DeprecatedApi - -All URIs are relative to *https://api.ynab.com/v1* - -| Method | HTTP request | Description | -| ------ | ------------ | ----------- | -| [**bulk_create_transactions**](DeprecatedApi.md#bulk_create_transactions) | **POST** /budgets/{budget_id}/transactions/bulk | Bulk create transactions | - - -## bulk_create_transactions - -> bulk_create_transactions(budget_id, transactions) - -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. - -### 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). | | -| **transactions** | [**BulkTransactions**](BulkTransactions.md) | The list of transactions to create | | - -### Return type - -[**BulkResponse**](BulkResponse.md) - diff --git a/docs/HybridTransactionAllOf.md b/docs/HybridTransactionAllOf.md deleted file mode 100644 index 473fb12..0000000 --- a/docs/HybridTransactionAllOf.md +++ /dev/null @@ -1,12 +0,0 @@ -# YNAB::HybridTransactionAllOf - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **type** | **String** | Whether the hybrid transaction represents a regular transaction or a subtransaction | | -| **parent_transaction_id** | **String** | For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null. | [optional] | -| **account_name** | **String** | | | -| **payee_name** | **String** | | [optional] | -| **category_name** | **String** | The name of the category. If a split transaction, this will be 'Split'. | [optional] | - diff --git a/docs/HybridTransactionsWrapper.md b/docs/HybridTransactionsWrapper.md deleted file mode 100644 index 04537f9..0000000 --- a/docs/HybridTransactionsWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::HybridTransactionsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transactions** | [**Array<HybridTransaction>**](HybridTransaction.md) | | - - diff --git a/docs/LoanAccountPeriodicValue.md b/docs/LoanAccountPeriodicValue.md deleted file mode 100644 index 624577c..0000000 --- a/docs/LoanAccountPeriodicValue.md +++ /dev/null @@ -1,7 +0,0 @@ -# YNAB::LoanAccountPeriodicValue - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - - diff --git a/docs/MonthDetailAllOf.md b/docs/MonthDetailAllOf.md deleted file mode 100644 index 55a0d91..0000000 --- a/docs/MonthDetailAllOf.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::MonthDetailAllOf - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **categories** | [**Array<Category>**](Category.md) | The budget month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. | | - diff --git a/docs/MonthDetailWrapper.md b/docs/MonthDetailWrapper.md deleted file mode 100644 index 8cf9870..0000000 --- a/docs/MonthDetailWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::MonthDetailWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**month** | [**MonthDetail**](MonthDetail.md) | | - - diff --git a/docs/MonthSummariesWrapper.md b/docs/MonthSummariesWrapper.md deleted file mode 100644 index 7b5702f..0000000 --- a/docs/MonthSummariesWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::MonthSummariesWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**months** | [**Array<MonthSummary>**](MonthSummary.md) | | -**server_knowledge** | **Integer** | The knowledge of the server | - - diff --git a/docs/PayeeLocationWrapper.md b/docs/PayeeLocationWrapper.md deleted file mode 100644 index 7b6c143..0000000 --- a/docs/PayeeLocationWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::PayeeLocationWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**payee_location** | [**PayeeLocation**](PayeeLocation.md) | | - - diff --git a/docs/PayeeLocationsWrapper.md b/docs/PayeeLocationsWrapper.md deleted file mode 100644 index 4747177..0000000 --- a/docs/PayeeLocationsWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::PayeeLocationsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**payee_locations** | [**Array<PayeeLocation>**](PayeeLocation.md) | | - - diff --git a/docs/PayeeWrapper.md b/docs/PayeeWrapper.md deleted file mode 100644 index b6b7031..0000000 --- a/docs/PayeeWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::PayeeWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**payee** | [**Payee**](Payee.md) | | - - diff --git a/docs/PayeesWrapper.md b/docs/PayeesWrapper.md deleted file mode 100644 index 3e3a267..0000000 --- a/docs/PayeesWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::PayeesWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**payees** | [**Array<Payee>**](Payee.md) | | -**server_knowledge** | **Integer** | The knowledge of the server | - - diff --git a/docs/SaveAccountWrapper.md b/docs/SaveAccountWrapper.md deleted file mode 100644 index a1cec0b..0000000 --- a/docs/SaveAccountWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::SaveAccountWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account** | [**SaveAccount**](SaveAccount.md) | | - - diff --git a/docs/SaveMonthCategoryWrapper.md b/docs/SaveMonthCategoryWrapper.md deleted file mode 100644 index 8d2a848..0000000 --- a/docs/SaveMonthCategoryWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::SaveMonthCategoryWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**category** | [**SaveMonthCategory**](SaveMonthCategory.md) | | - - diff --git a/docs/SaveTransaction.md b/docs/SaveTransaction.md deleted file mode 100644 index 625124f..0000000 --- a/docs/SaveTransaction.md +++ /dev/null @@ -1,19 +0,0 @@ -# YNAB::SaveTransaction - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **account_id** | **String** | | [optional] | -| **date** | **Date** | 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. | [optional] | -| **amount** | **Integer** | The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored. | [optional] | -| **payee_id** | **String** | 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 `tranfer_payee_id` on the account resource. | [optional] | -| **payee_name** | **String** | 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. | [optional] | -| **category_id** | **String** | 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 be ignored if supplied. | [optional] | -| **memo** | **String** | | [optional] | -| **cleared** | **String** | The cleared status of the transaction | [optional] | -| **approved** | **Boolean** | Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. | [optional] | -| **flag_color** | **String** | The transaction flag | [optional] | -| **import_id** | **String** | If specified, the 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\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>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.<br><br>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). | [optional] | -| **subtransactions** | [**Array<SaveSubTransaction>**](SaveSubTransaction.md) | An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. | [optional] | - diff --git a/docs/SaveTransactionWithId.md b/docs/SaveTransactionWithId.md deleted file mode 100644 index 10d9e62..0000000 --- a/docs/SaveTransactionWithId.md +++ /dev/null @@ -1,20 +0,0 @@ -# YNAB::SaveTransactionWithId - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | | [optional] | -| **account_id** | **String** | | [optional] | -| **date** | **Date** | 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. | [optional] | -| **amount** | **Integer** | The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored. | [optional] | -| **payee_id** | **String** | 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 `tranfer_payee_id` on the account resource. | [optional] | -| **payee_name** | **String** | 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. | [optional] | -| **category_id** | **String** | 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 be ignored if supplied. | [optional] | -| **memo** | **String** | | [optional] | -| **cleared** | **String** | The cleared status of the transaction | [optional] | -| **approved** | **Boolean** | Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. | [optional] | -| **flag_color** | **String** | The transaction flag | [optional] | -| **import_id** | **String** | If specified, the 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\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>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.<br><br>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). | [optional] | -| **subtransactions** | [**Array<SaveSubTransaction>**](SaveSubTransaction.md) | An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. | [optional] | - diff --git a/docs/SaveTransactionWithIdAllOf.md b/docs/SaveTransactionWithIdAllOf.md deleted file mode 100644 index 5f16ceb..0000000 --- a/docs/SaveTransactionWithIdAllOf.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::SaveTransactionWithIdAllOf - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **id** | **String** | | [optional] | - diff --git a/docs/SaveTransactionWrapper.md b/docs/SaveTransactionWrapper.md deleted file mode 100644 index e0f4f68..0000000 --- a/docs/SaveTransactionWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::SaveTransactionWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transaction** | [**SaveTransaction**](SaveTransaction.md) | | - - diff --git a/docs/SaveTransactionsWrapper.md b/docs/SaveTransactionsWrapper.md deleted file mode 100644 index 175fc7c..0000000 --- a/docs/SaveTransactionsWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::SaveTransactionsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transaction** | [**SaveTransaction**](SaveTransaction.md) | | [optional] -**transactions** | [**Array<SaveTransaction>**](SaveTransaction.md) | | [optional] - - diff --git a/docs/ScheduledTransactionDetailAllOf.md b/docs/ScheduledTransactionDetailAllOf.md deleted file mode 100644 index 5741460..0000000 --- a/docs/ScheduledTransactionDetailAllOf.md +++ /dev/null @@ -1,11 +0,0 @@ -# YNAB::ScheduledTransactionDetailAllOf - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **account_name** | **String** | | | -| **payee_name** | **String** | | [optional] | -| **category_name** | **String** | The name of the category. If a split scheduled transaction, this will be 'Split'. | [optional] | -| **subtransactions** | [**Array<ScheduledSubTransaction>**](ScheduledSubTransaction.md) | If a split scheduled transaction, the subtransactions. | | - diff --git a/docs/ScheduledTransactionWrapper.md b/docs/ScheduledTransactionWrapper.md deleted file mode 100644 index 2af2dcf..0000000 --- a/docs/ScheduledTransactionWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::ScheduledTransactionWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**scheduled_transaction** | [**ScheduledTransactionDetail**](ScheduledTransactionDetail.md) | | - - diff --git a/docs/ScheduledTransactionsWrapper.md b/docs/ScheduledTransactionsWrapper.md deleted file mode 100644 index 2e47ea3..0000000 --- a/docs/ScheduledTransactionsWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::ScheduledTransactionsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**scheduled_transactions** | [**Array<ScheduledTransactionDetail>**](ScheduledTransactionDetail.md) | | - - diff --git a/docs/TransactionDetailAllOf.md b/docs/TransactionDetailAllOf.md deleted file mode 100644 index b1163b6..0000000 --- a/docs/TransactionDetailAllOf.md +++ /dev/null @@ -1,11 +0,0 @@ -# YNAB::TransactionDetailAllOf - -## Properties - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | -| **account_name** | **String** | | | -| **payee_name** | **String** | | [optional] | -| **category_name** | **String** | The name of the category. If a split transaction, this will be 'Split'. | [optional] | -| **subtransactions** | [**Array<SubTransaction>**](SubTransaction.md) | If a split transaction, the subtransactions. | | - diff --git a/docs/TransactionWrapper.md b/docs/TransactionWrapper.md deleted file mode 100644 index ee5338c..0000000 --- a/docs/TransactionWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::TransactionWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transaction** | [**TransactionDetail**](TransactionDetail.md) | | - - diff --git a/docs/TransactionsWrapper.md b/docs/TransactionsWrapper.md deleted file mode 100644 index 9c6bb5f..0000000 --- a/docs/TransactionsWrapper.md +++ /dev/null @@ -1,9 +0,0 @@ -# YNAB::TransactionsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transactions** | [**Array<TransactionDetail>**](TransactionDetail.md) | | -**server_knowledge** | **Integer** | The knowledge of the server | - - diff --git a/docs/UpdateTransaction.md b/docs/UpdateTransaction.md deleted file mode 100644 index ecbf280..0000000 --- a/docs/UpdateTransaction.md +++ /dev/null @@ -1,20 +0,0 @@ -# YNAB::UpdateTransaction - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account_id** | **String** | | -**date** | **Date** | 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. | -**amount** | **Integer** | The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored. | -**payee_id** | **String** | 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 `tranfer_payee_id` on the account resource. | [optional] -**payee_name** | **String** | 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. | [optional] -**category_id** | **String** | 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 be ignored if supplied. | [optional] -**memo** | **String** | | [optional] -**cleared** | **String** | The cleared status of the transaction | [optional] -**approved** | **BOOLEAN** | Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. | [optional] -**flag_color** | **String** | The transaction flag | [optional] -**import_id** | **String** | If specified, the 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\" transation on the same account, with the same amount, and with a date +/-10 days from the imported transaction date.<br><br>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.<br><br>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). | [optional] -**subtransactions** | [**Array<SaveSubTransaction>**](SaveSubTransaction.md) | An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. | [optional] -**id** | **String** | | - - diff --git a/docs/UpdateTransactionsWrapper.md b/docs/UpdateTransactionsWrapper.md deleted file mode 100644 index 6a79933..0000000 --- a/docs/UpdateTransactionsWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::UpdateTransactionsWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**transactions** | [**Array<UpdateTransaction>**](UpdateTransaction.md) | | - - diff --git a/docs/UserWrapper.md b/docs/UserWrapper.md deleted file mode 100644 index 6c1e2f8..0000000 --- a/docs/UserWrapper.md +++ /dev/null @@ -1,8 +0,0 @@ -# YNAB::UserWrapper - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**user** | [**User**](User.md) | | - - diff --git a/lib/ynab/api_error.rb b/lib/ynab/api_error.rb index 7cb93af..748e63e 100644 --- a/lib/ynab/api_error.rb +++ b/lib/ynab/api_error.rb @@ -1,15 +1,3 @@ -=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.youneedabudget.com - -OpenAPI spec version: 1.0.0 - -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - -=end - module YNAB class ApiError < StandardError attr_reader :code, :response_headers, :response_body diff --git a/lib/ynab/models/budget_detail_all_of.rb b/lib/ynab/models/budget_detail_all_of.rb deleted file mode 100644 index fc980a7..0000000 --- a/lib/ynab/models/budget_detail_all_of.rb +++ /dev/null @@ -1,320 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class BudgetDetailAllOf - attr_accessor :accounts - - attr_accessor :payees - - attr_accessor :payee_locations - - attr_accessor :category_groups - - attr_accessor :categories - - attr_accessor :months - - attr_accessor :transactions - - attr_accessor :subtransactions - - attr_accessor :scheduled_transactions - - attr_accessor :scheduled_subtransactions - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'accounts' => :'accounts', - :'payees' => :'payees', - :'payee_locations' => :'payee_locations', - :'category_groups' => :'category_groups', - :'categories' => :'categories', - :'months' => :'months', - :'transactions' => :'transactions', - :'subtransactions' => :'subtransactions', - :'scheduled_transactions' => :'scheduled_transactions', - :'scheduled_subtransactions' => :'scheduled_subtransactions' - } - 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 - { - :'accounts' => :'Array', - :'payees' => :'Array', - :'payee_locations' => :'Array', - :'category_groups' => :'Array', - :'categories' => :'Array', - :'months' => :'Array', - :'transactions' => :'Array', - :'subtransactions' => :'Array', - :'scheduled_transactions' => :'Array', - :'scheduled_subtransactions' => :'Array' - } - 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::BudgetDetailAllOf` 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::BudgetDetailAllOf`. 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?(:'accounts') - if (value = attributes[:'accounts']).is_a?(Array) - self.accounts = value - end - end - - if attributes.key?(:'payees') - if (value = attributes[:'payees']).is_a?(Array) - self.payees = value - end - end - - if attributes.key?(:'payee_locations') - if (value = attributes[:'payee_locations']).is_a?(Array) - self.payee_locations = value - end - end - - if attributes.key?(:'category_groups') - if (value = attributes[:'category_groups']).is_a?(Array) - self.category_groups = value - end - end - - if attributes.key?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - - if attributes.key?(:'months') - if (value = attributes[:'months']).is_a?(Array) - self.months = value - end - end - - if attributes.key?(:'transactions') - if (value = attributes[:'transactions']).is_a?(Array) - self.transactions = value - end - end - - if attributes.key?(:'subtransactions') - if (value = attributes[:'subtransactions']).is_a?(Array) - self.subtransactions = value - end - end - - if attributes.key?(:'scheduled_transactions') - if (value = attributes[:'scheduled_transactions']).is_a?(Array) - self.scheduled_transactions = value - end - end - - if attributes.key?(:'scheduled_subtransactions') - if (value = attributes[:'scheduled_subtransactions']).is_a?(Array) - self.scheduled_subtransactions = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - 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 && - accounts == o.accounts && - payees == o.payees && - payee_locations == o.payee_locations && - category_groups == o.category_groups && - categories == o.categories && - months == o.months && - transactions == o.transactions && - subtransactions == o.subtransactions && - scheduled_transactions == o.scheduled_transactions && - scheduled_subtransactions == o.scheduled_subtransactions - 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 - [accounts, payees, payee_locations, category_groups, categories, months, transactions, subtransactions, scheduled_transactions, scheduled_subtransactions].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) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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_all_of.rb b/lib/ynab/models/category_group_with_categories_all_of.rb deleted file mode 100644 index c63aec0..0000000 --- a/lib/ynab/models/category_group_with_categories_all_of.rb +++ /dev/null @@ -1,223 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class CategoryGroupWithCategoriesAllOf - # Category group categories. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC). - attr_accessor :categories - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'categories' => :'categories' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'categories' => :'Array' - } - 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::CategoryGroupWithCategoriesAllOf` 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::CategoryGroupWithCategoriesAllOf`. 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?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return false if @categories.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - categories == o.categories - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [categories].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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_all_of.rb b/lib/ynab/models/hybrid_transaction_all_of.rb deleted file mode 100644 index a7798a1..0000000 --- a/lib/ynab/models/hybrid_transaction_all_of.rb +++ /dev/null @@ -1,292 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class HybridTransactionAllOf - # Whether the hybrid transaction represents a regular transaction or a subtransaction - attr_accessor :type - - # For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null. - attr_accessor :parent_transaction_id - - attr_accessor :account_name - - attr_accessor :payee_name - - # The name of the category. If a split transaction, this will be 'Split'. - attr_accessor :category_name - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'type' => :'type', - :'parent_transaction_id' => :'parent_transaction_id', - :'account_name' => :'account_name', - :'payee_name' => :'payee_name', - :'category_name' => :'category_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 - { - :'type' => :'String', - :'parent_transaction_id' => :'String', - :'account_name' => :'String', - :'payee_name' => :'String', - :'category_name' => :'String' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'parent_transaction_id', - :'payee_name', - ]) - 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::HybridTransactionAllOf` 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::HybridTransactionAllOf`. 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?(:'type') - self.type = attributes[:'type'] - end - - if attributes.key?(:'parent_transaction_id') - self.parent_transaction_id = attributes[:'parent_transaction_id'] - end - - if attributes.key?(:'account_name') - self.account_name = attributes[:'account_name'] - end - - if attributes.key?(:'payee_name') - self.payee_name = attributes[:'payee_name'] - end - - if attributes.key?(:'category_name') - self.category_name = attributes[:'category_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 @type.nil? - type_validator = EnumAttributeValidator.new('String', ["transaction", "subtransaction"]) - return false unless type_validator.valid?(@type) - return false if @account_name.nil? - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - @type = type - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - type == o.type && - parent_transaction_id == o.parent_transaction_id && - account_name == o.account_name && - payee_name == o.payee_name && - category_name == o.category_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 - [type, parent_transaction_id, account_name, payee_name, category_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) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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_all_of.rb b/lib/ynab/models/month_detail_all_of.rb deleted file mode 100644 index d53389a..0000000 --- a/lib/ynab/models/month_detail_all_of.rb +++ /dev/null @@ -1,223 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class MonthDetailAllOf - # The budget month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. - attr_accessor :categories - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'categories' => :'categories' - } - end - - # Returns all the JSON keys this model knows about - def self.acceptable_attributes - attribute_map.values - end - - # Attribute type mapping. - def self.openapi_types - { - :'categories' => :'Array' - } - 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::MonthDetailAllOf` 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::MonthDetailAllOf`. 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?(:'categories') - if (value = attributes[:'categories']).is_a?(Array) - self.categories = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return false if @categories.nil? - true - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - categories == o.categories - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - def hash - [categories].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def self.build_from_hash(attributes) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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.rb b/lib/ynab/models/save_transaction.rb deleted file mode 100644 index 5440057..0000000 --- a/lib/ynab/models/save_transaction.rb +++ /dev/null @@ -1,401 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class SaveTransaction - 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. - attr_accessor :date - - # The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored. - attr_accessor :amount - - # 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 `tranfer_payee_id` on the account resource. - attr_accessor :payee_id - - # 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. - attr_accessor :payee_name - - # 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 be ignored if supplied. - attr_accessor :category_id - - attr_accessor :memo - - # The cleared status of the transaction - attr_accessor :cleared - - # Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. - attr_accessor :approved - - # The transaction flag - attr_accessor :flag_color - - # If specified, the 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\" transation 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). - attr_accessor :import_id - - # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. - attr_accessor :subtransactions - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'account_id' => :'account_id', - :'date' => :'date', - :'amount' => :'amount', - :'payee_id' => :'payee_id', - :'payee_name' => :'payee_name', - :'category_id' => :'category_id', - :'memo' => :'memo', - :'cleared' => :'cleared', - :'approved' => :'approved', - :'flag_color' => :'flag_color', - :'import_id' => :'import_id', - :'subtransactions' => :'subtransactions' - } - 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 - { - :'account_id' => :'String', - :'date' => :'Date', - :'amount' => :'Integer', - :'payee_id' => :'String', - :'payee_name' => :'String', - :'category_id' => :'String', - :'memo' => :'String', - :'cleared' => :'String', - :'approved' => :'Boolean', - :'flag_color' => :'String', - :'import_id' => :'String', - :'subtransactions' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'payee_id', - :'payee_name', - :'category_id', - :'memo', - :'import_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'SaveTransactionWithOptionalFields' - ] - 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::SaveTransaction` 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::SaveTransaction`. 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?(:'account_id') - self.account_id = attributes[:'account_id'] - end - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'payee_id') - self.payee_id = attributes[:'payee_id'] - end - - if attributes.key?(:'payee_name') - self.payee_name = attributes[:'payee_name'] - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'memo') - self.memo = attributes[:'memo'] - end - - if attributes.key?(:'cleared') - self.cleared = attributes[:'cleared'] - end - - if attributes.key?(:'approved') - self.approved = attributes[:'approved'] - end - - if attributes.key?(:'flag_color') - self.flag_color = attributes[:'flag_color'] - end - - if attributes.key?(:'import_id') - self.import_id = attributes[:'import_id'] - end - - if attributes.key?(:'subtransactions') - if (value = attributes[:'subtransactions']).is_a?(Array) - self.subtransactions = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return false if !@payee_name.nil? && @payee_name.to_s.length > 50 - return false if !@memo.nil? && @memo.to_s.length > 200 - cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"]) - return false unless cleared_validator.valid?(@cleared) - flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"]) - return false unless flag_color_validator.valid?(@flag_color) - return false if !@import_id.nil? && @import_id.to_s.length > 36 - true - end - - # Custom attribute writer method with validation - # @param [Object] payee_name Value to be assigned - def payee_name=(payee_name) - @payee_name = payee_name - end - - # Custom attribute writer method with validation - # @param [Object] memo Value to be assigned - def memo=(memo) - @memo = memo - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] cleared Object to be assigned - def cleared=(cleared) - @cleared = cleared - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] flag_color Object to be assigned - def flag_color=(flag_color) - @flag_color = flag_color - end - - # Custom attribute writer method with validation - # @param [Object] import_id Value to be assigned - def import_id=(import_id) - @import_id = import_id - 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 && - account_id == o.account_id && - date == o.date && - amount == o.amount && - payee_id == o.payee_id && - payee_name == o.payee_name && - category_id == o.category_id && - memo == o.memo && - cleared == o.cleared && - approved == o.approved && - flag_color == o.flag_color && - import_id == o.import_id && - subtransactions == o.subtransactions - 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 - [account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].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) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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.rb b/lib/ynab/models/save_transaction_with_id.rb deleted file mode 100644 index 349227d..0000000 --- a/lib/ynab/models/save_transaction_with_id.rb +++ /dev/null @@ -1,411 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class SaveTransactionWithId - attr_accessor :id - - 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. - attr_accessor :date - - # The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored. - attr_accessor :amount - - # 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 `tranfer_payee_id` on the account resource. - attr_accessor :payee_id - - # 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. - attr_accessor :payee_name - - # 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 be ignored if supplied. - attr_accessor :category_id - - attr_accessor :memo - - # The cleared status of the transaction - attr_accessor :cleared - - # Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default. - attr_accessor :approved - - # The transaction flag - attr_accessor :flag_color - - # If specified, the 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\" transation 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). - attr_accessor :import_id - - # An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported. - attr_accessor :subtransactions - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'account_id' => :'account_id', - :'date' => :'date', - :'amount' => :'amount', - :'payee_id' => :'payee_id', - :'payee_name' => :'payee_name', - :'category_id' => :'category_id', - :'memo' => :'memo', - :'cleared' => :'cleared', - :'approved' => :'approved', - :'flag_color' => :'flag_color', - :'import_id' => :'import_id', - :'subtransactions' => :'subtransactions' - } - 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', - :'account_id' => :'String', - :'date' => :'Date', - :'amount' => :'Integer', - :'payee_id' => :'String', - :'payee_name' => :'String', - :'category_id' => :'String', - :'memo' => :'String', - :'cleared' => :'String', - :'approved' => :'Boolean', - :'flag_color' => :'String', - :'import_id' => :'String', - :'subtransactions' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'payee_id', - :'payee_name', - :'category_id', - :'memo', - :'import_id', - ]) - end - - # List of class defined in allOf (OpenAPI v3) - def self.openapi_all_of - [ - :'SaveTransactionWithIdAllOf', - :'SaveTransactionWithOptionalFields' - ] - 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::SaveTransactionWithId` 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::SaveTransactionWithId`. 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?(:'account_id') - self.account_id = attributes[:'account_id'] - end - - if attributes.key?(:'date') - self.date = attributes[:'date'] - end - - if attributes.key?(:'amount') - self.amount = attributes[:'amount'] - end - - if attributes.key?(:'payee_id') - self.payee_id = attributes[:'payee_id'] - end - - if attributes.key?(:'payee_name') - self.payee_name = attributes[:'payee_name'] - end - - if attributes.key?(:'category_id') - self.category_id = attributes[:'category_id'] - end - - if attributes.key?(:'memo') - self.memo = attributes[:'memo'] - end - - if attributes.key?(:'cleared') - self.cleared = attributes[:'cleared'] - end - - if attributes.key?(:'approved') - self.approved = attributes[:'approved'] - end - - if attributes.key?(:'flag_color') - self.flag_color = attributes[:'flag_color'] - end - - if attributes.key?(:'import_id') - self.import_id = attributes[:'import_id'] - end - - if attributes.key?(:'subtransactions') - if (value = attributes[:'subtransactions']).is_a?(Array) - self.subtransactions = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return false if !@payee_name.nil? && @payee_name.to_s.length > 50 - return false if !@memo.nil? && @memo.to_s.length > 200 - cleared_validator = EnumAttributeValidator.new('String', ["cleared", "uncleared", "reconciled"]) - return false unless cleared_validator.valid?(@cleared) - flag_color_validator = EnumAttributeValidator.new('String', ["red", "orange", "yellow", "green", "blue", "purple", "null"]) - return false unless flag_color_validator.valid?(@flag_color) - return false if !@import_id.nil? && @import_id.to_s.length > 36 - true - end - - # Custom attribute writer method with validation - # @param [Object] payee_name Value to be assigned - def payee_name=(payee_name) - @payee_name = payee_name - end - - # Custom attribute writer method with validation - # @param [Object] memo Value to be assigned - def memo=(memo) - @memo = memo - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] cleared Object to be assigned - def cleared=(cleared) - @cleared = cleared - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] flag_color Object to be assigned - def flag_color=(flag_color) - @flag_color = flag_color - end - - # Custom attribute writer method with validation - # @param [Object] import_id Value to be assigned - def import_id=(import_id) - @import_id = import_id - 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 && - account_id == o.account_id && - date == o.date && - amount == o.amount && - payee_id == o.payee_id && - payee_name == o.payee_name && - category_id == o.category_id && - memo == o.memo && - cleared == o.cleared && - approved == o.approved && - flag_color == o.flag_color && - import_id == o.import_id && - subtransactions == o.subtransactions - 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, account_id, date, amount, payee_id, payee_name, category_id, memo, cleared, approved, flag_color, import_id, subtransactions].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) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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_all_of.rb b/lib/ynab/models/save_transaction_with_id_all_of.rb deleted file mode 100644 index ad7e534..0000000 --- a/lib/ynab/models/save_transaction_with_id_all_of.rb +++ /dev/null @@ -1,219 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class SaveTransactionWithIdAllOf - attr_accessor :id - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'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' - } - 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::SaveTransactionWithIdAllOf` 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::SaveTransactionWithIdAllOf`. 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 - 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 && - id == o.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].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) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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_all_of.rb b/lib/ynab/models/scheduled_transaction_detail_all_of.rb deleted file mode 100644 index 6fe9bf8..0000000 --- a/lib/ynab/models/scheduled_transaction_detail_all_of.rb +++ /dev/null @@ -1,254 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class ScheduledTransactionDetailAllOf - attr_accessor :account_name - - attr_accessor :payee_name - - # The name of the category. If a split scheduled transaction, this will be 'Split'. - attr_accessor :category_name - - # If a split scheduled transaction, the subtransactions. - attr_accessor :subtransactions - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'account_name' => :'account_name', - :'payee_name' => :'payee_name', - :'category_name' => :'category_name', - :'subtransactions' => :'subtransactions' - } - 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 - { - :'account_name' => :'String', - :'payee_name' => :'String', - :'category_name' => :'String', - :'subtransactions' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'payee_name', - :'category_name', - ]) - 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::ScheduledTransactionDetailAllOf` 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::ScheduledTransactionDetailAllOf`. 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?(:'account_name') - self.account_name = attributes[:'account_name'] - end - - if attributes.key?(:'payee_name') - self.payee_name = attributes[:'payee_name'] - end - - if attributes.key?(:'category_name') - self.category_name = attributes[:'category_name'] - end - - if attributes.key?(:'subtransactions') - if (value = attributes[:'subtransactions']).is_a?(Array) - self.subtransactions = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return false if @account_name.nil? - return false if @subtransactions.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 && - account_name == o.account_name && - payee_name == o.payee_name && - category_name == o.category_name && - subtransactions == o.subtransactions - 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 - [account_name, payee_name, category_name, subtransactions].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) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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_all_of.rb b/lib/ynab/models/transaction_detail_all_of.rb deleted file mode 100644 index 49be0b8..0000000 --- a/lib/ynab/models/transaction_detail_all_of.rb +++ /dev/null @@ -1,254 +0,0 @@ -=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 - -The version of the OpenAPI document: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 6.6.0 - -=end - -require 'date' -require 'time' - -module YNAB - class TransactionDetailAllOf - attr_accessor :account_name - - attr_accessor :payee_name - - # The name of the category. If a split transaction, this will be 'Split'. - attr_accessor :category_name - - # If a split transaction, the subtransactions. - attr_accessor :subtransactions - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'account_name' => :'account_name', - :'payee_name' => :'payee_name', - :'category_name' => :'category_name', - :'subtransactions' => :'subtransactions' - } - 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 - { - :'account_name' => :'String', - :'payee_name' => :'String', - :'category_name' => :'String', - :'subtransactions' => :'Array' - } - end - - # List of attributes with nullable: true - def self.openapi_nullable - Set.new([ - :'payee_name', - :'category_name', - ]) - 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::TransactionDetailAllOf` 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::TransactionDetailAllOf`. 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?(:'account_name') - self.account_name = attributes[:'account_name'] - end - - if attributes.key?(:'payee_name') - self.payee_name = attributes[:'payee_name'] - end - - if attributes.key?(:'category_name') - self.category_name = attributes[:'category_name'] - end - - if attributes.key?(:'subtransactions') - if (value = attributes[:'subtransactions']).is_a?(Array) - self.subtransactions = value - end - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - return false if @account_name.nil? - return false if @subtransactions.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 && - account_name == o.account_name && - payee_name == o.payee_name && - category_name == o.category_name && - subtransactions == o.subtransactions - 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 - [account_name, payee_name, category_name, subtransactions].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) - new.build_from_hash(attributes) - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - attributes = attributes.transform_keys(&:to_sym) - self.class.openapi_types.each_pair do |key, type| - if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) - self.send("#{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[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _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_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 - 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 - - # 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 17e8502..7404343 100644 --- a/lib/ynab/overrides/transactions_api.rb +++ b/lib/ynab/overrides/transactions_api.rb @@ -1,15 +1,3 @@ -=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.youneedabudget.com - -OpenAPI spec version: 1.0.0 - -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - -=end - require 'uri' require 'ynab/api/deprecated_api' diff --git a/lib/ynab/version.rb b/lib/ynab/version.rb index 80fc60f..fde2f5e 100644 --- a/lib/ynab/version.rb +++ b/lib/ynab/version.rb @@ -1,15 +1,3 @@ -=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.youneedabudget.com - -OpenAPI spec version: 1.0.0 - -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - -=end - module YNAB VERSION = '3.2.0' end