diff --git a/.gitignore b/.gitignore index 5e1422c..4b91271 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Generated by: https://github.com/swagger-api/swagger-codegen.git +# + *.gem *.rbc /.config @@ -10,24 +13,10 @@ /test/version_tmp/ /tmp/ -# Used by dotenv library to load environment variables. -# .env - ## Specific to RubyMotion: .dat* .repl_history build/ -*.bridgesupport -build-iPhoneOS/ -build-iPhoneSimulator/ - -## Specific to RubyMotion (use of CocoaPods): -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# vendor/Pods/ ## Documentation cache and generated files: /.yardoc/ diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..83e16f8 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/.swagger-codegen-ignore b/.swagger-codegen-ignore new file mode 100644 index 0000000..4c7a2c6 --- /dev/null +++ b/.swagger-codegen-ignore @@ -0,0 +1,27 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md + +Rakefile +git_push.sh +Gemfile.lock \ No newline at end of file diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION new file mode 100644 index 0000000..f9f7450 --- /dev/null +++ b/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..d255a3a --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gemspec + +group :development, :test do + gem 'rake', '~> 12.0.0' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..d33b3eb --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,69 @@ +PATH + remote: . + specs: + ynab (0.1.0) + json (~> 2.1, >= 2.1.0) + typhoeus (~> 1.0, >= 1.0.1) + +GEM + remote: https://rubygems.org/ + specs: + ZenTest (4.11.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + autotest (4.4.6) + ZenTest (>= 4.4.1) + autotest-fsevent (0.2.13) + sys-uname + autotest-growl (0.2.16) + autotest-rails-pure (4.1.2) + crack (0.4.3) + safe_yaml (~> 1.0.0) + diff-lcs (1.3) + ethon (0.11.0) + ffi (>= 1.3.0) + ffi (1.9.18) + hashdiff (0.3.7) + json (2.1.0) + public_suffix (3.0.1) + rake (12.0.0) + rspec (3.7.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-core (3.7.0) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.7.0) + rspec-mocks (3.7.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.7.0) + rspec-support (3.7.0) + safe_yaml (1.0.4) + sys-uname (1.0.3) + ffi (>= 1.0.0) + typhoeus (1.3.0) + ethon (>= 0.9.0) + vcr (3.0.3) + webmock (1.24.6) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff + +PLATFORMS + ruby + +DEPENDENCIES + autotest (~> 4.4, >= 4.4.6) + autotest-fsevent (~> 0.2, >= 0.2.12) + autotest-growl (~> 0.2, >= 0.2.16) + autotest-rails-pure (~> 4.1, >= 4.1.2) + rake (~> 12.0.0) + rspec (~> 3.6, >= 3.6.0) + vcr (~> 3.0, >= 3.0.1) + webmock (~> 1.24, >= 1.24.3) + ynab! + +BUNDLED WITH + 1.15.4 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e48b46a..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 YNAB - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..7c23a98 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 You Need A Budget, LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 9960549..686153f 100644 --- a/README.md +++ b/README.md @@ -1 +1,173 @@ -# ynab-sdk-ruby \ No newline at end of file +# ynab + +YnabAPI - the Ruby gem for the 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 + +This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.0.0 +- Package version: 0.1.0 +- Build package: io.swagger.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build ynab.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./ynab-0.1.0.gem +``` +(for development, run `gem install --dev ./ynab-0.1.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'ynab', '~> 0.1.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'ynab', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: +```ruby +# Load the gem +require 'ynab' + +# Setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::AccountsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +account_id = "account_id_example" # String | ID of account + + +begin + #Single account + result = api_instance.get_account_by_id(budget_id, account_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling AccountsApi->get_account_by_id: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://localhost/papi/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*YnabAPI::AccountsApi* | [**get_account_by_id**](docs/AccountsApi.md#get_account_by_id) | **GET** /budgets/{budget_id}/accounts/{account_id} | Single account +*YnabAPI::AccountsApi* | [**get_accounts**](docs/AccountsApi.md#get_accounts) | **GET** /budgets/{budget_id}/accounts | Account list +*YnabAPI::BudgetsApi* | [**get_budget_contents**](docs/BudgetsApi.md#get_budget_contents) | **GET** /budgets/{budget_id} | Single budget +*YnabAPI::BudgetsApi* | [**get_budgets**](docs/BudgetsApi.md#get_budgets) | **GET** /budgets | List budgets +*YnabAPI::CategoriesApi* | [**get_categories**](docs/CategoriesApi.md#get_categories) | **GET** /budgets/{budget_id}/categories | List categories +*YnabAPI::CategoriesApi* | [**get_category_by_id**](docs/CategoriesApi.md#get_category_by_id) | **GET** /budgets/{budget_id}/categories/{category_id} | Single category +*YnabAPI::MonthsApi* | [**get_budget_month**](docs/MonthsApi.md#get_budget_month) | **GET** /budgets/{budget_id}/months/{month} | Single budget month +*YnabAPI::MonthsApi* | [**get_budget_months**](docs/MonthsApi.md#get_budget_months) | **GET** /budgets/{budget_id}/months | List budget months +*YnabAPI::PayeeLocationsApi* | [**get_payee_location_by_id**](docs/PayeeLocationsApi.md#get_payee_location_by_id) | **GET** /budgets/{budget_id}/payee_locations/{payee_location_id} | Single payee location +*YnabAPI::PayeeLocationsApi* | [**get_payee_locations**](docs/PayeeLocationsApi.md#get_payee_locations) | **GET** /budgets/{budget_id}/payee_locations | List payee locations +*YnabAPI::PayeeLocationsApi* | [**get_payee_locations_by_payee**](docs/PayeeLocationsApi.md#get_payee_locations_by_payee) | **GET** /budgets/{budget_id}/payees/{payee_id}/payee_locations | List locations for a payee +*YnabAPI::PayeesApi* | [**get_payee_by_id**](docs/PayeesApi.md#get_payee_by_id) | **GET** /budgets/{budget_id}/payees/{payee_id} | Single payee +*YnabAPI::PayeesApi* | [**get_payees**](docs/PayeesApi.md#get_payees) | **GET** /budgets/{budget_id}/payees | List payees +*YnabAPI::ScheduledTransactionsApi* | [**get_scheduled_transaction_by_id**](docs/ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | **GET** /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | Single scheduled transaction +*YnabAPI::ScheduledTransactionsApi* | [**get_scheduled_transactions**](docs/ScheduledTransactionsApi.md#get_scheduled_transactions) | **GET** /budgets/{budget_id}/scheduled_transactions | List scheduled transactions +*YnabAPI::TransactionsApi* | [**get_transactions**](docs/TransactionsApi.md#get_transactions) | **GET** /budgets/{budget_id}/transactions | List transactions +*YnabAPI::TransactionsApi* | [**get_transactions_by_account**](docs/TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions +*YnabAPI::TransactionsApi* | [**get_transactions_by_category**](docs/TransactionsApi.md#get_transactions_by_category) | **GET** /budgets/{budget_id}/categories/{category_id}/transactions | List category transactions +*YnabAPI::TransactionsApi* | [**get_transactions_by_id**](docs/TransactionsApi.md#get_transactions_by_id) | **GET** /budgets/{budget_id}/transactions/{transaction_id} | Single transaction + + +## Documentation for Models + + - [YnabAPI::Account](docs/Account.md) + - [YnabAPI::AccountResponse](docs/AccountResponse.md) + - [YnabAPI::AccountWrapper](docs/AccountWrapper.md) + - [YnabAPI::AccountsResponse](docs/AccountsResponse.md) + - [YnabAPI::AccountsWrapper](docs/AccountsWrapper.md) + - [YnabAPI::BudgetDetailResponse](docs/BudgetDetailResponse.md) + - [YnabAPI::BudgetDetailWrapper](docs/BudgetDetailWrapper.md) + - [YnabAPI::BudgetSummary](docs/BudgetSummary.md) + - [YnabAPI::BudgetSummaryResponse](docs/BudgetSummaryResponse.md) + - [YnabAPI::BudgetSummaryWrapper](docs/BudgetSummaryWrapper.md) + - [YnabAPI::CategoriesResponse](docs/CategoriesResponse.md) + - [YnabAPI::Category](docs/Category.md) + - [YnabAPI::CategoryGroup](docs/CategoryGroup.md) + - [YnabAPI::CategoryGroupsWrapper](docs/CategoryGroupsWrapper.md) + - [YnabAPI::CategoryResponse](docs/CategoryResponse.md) + - [YnabAPI::CategoryWrapper](docs/CategoryWrapper.md) + - [YnabAPI::CurrencyFormat](docs/CurrencyFormat.md) + - [YnabAPI::DateFormat](docs/DateFormat.md) + - [YnabAPI::ErrorDetail](docs/ErrorDetail.md) + - [YnabAPI::ErrorResponse](docs/ErrorResponse.md) + - [YnabAPI::MonthDetailResponse](docs/MonthDetailResponse.md) + - [YnabAPI::MonthDetailWrapper](docs/MonthDetailWrapper.md) + - [YnabAPI::MonthSummariesResponse](docs/MonthSummariesResponse.md) + - [YnabAPI::MonthSummariesWrapper](docs/MonthSummariesWrapper.md) + - [YnabAPI::MonthSummary](docs/MonthSummary.md) + - [YnabAPI::Payee](docs/Payee.md) + - [YnabAPI::PayeeLocation](docs/PayeeLocation.md) + - [YnabAPI::PayeeLocationResponse](docs/PayeeLocationResponse.md) + - [YnabAPI::PayeeLocationWrapper](docs/PayeeLocationWrapper.md) + - [YnabAPI::PayeeLocationsResponse](docs/PayeeLocationsResponse.md) + - [YnabAPI::PayeeLocationsWrapper](docs/PayeeLocationsWrapper.md) + - [YnabAPI::PayeeResponse](docs/PayeeResponse.md) + - [YnabAPI::PayeeWrapper](docs/PayeeWrapper.md) + - [YnabAPI::PayeesResponse](docs/PayeesResponse.md) + - [YnabAPI::PayeesWrapper](docs/PayeesWrapper.md) + - [YnabAPI::ScheduledSubTransaction](docs/ScheduledSubTransaction.md) + - [YnabAPI::ScheduledTransactionDetailResponse](docs/ScheduledTransactionDetailResponse.md) + - [YnabAPI::ScheduledTransactionDetailWrapper](docs/ScheduledTransactionDetailWrapper.md) + - [YnabAPI::ScheduledTransactionSummariesResponse](docs/ScheduledTransactionSummariesResponse.md) + - [YnabAPI::ScheduledTransactionSummariesWrapper](docs/ScheduledTransactionSummariesWrapper.md) + - [YnabAPI::ScheduledTransactionSummary](docs/ScheduledTransactionSummary.md) + - [YnabAPI::SubTransaction](docs/SubTransaction.md) + - [YnabAPI::TransactionDetailResponse](docs/TransactionDetailResponse.md) + - [YnabAPI::TransactionDetailWrapper](docs/TransactionDetailWrapper.md) + - [YnabAPI::TransactionSummariesResponse](docs/TransactionSummariesResponse.md) + - [YnabAPI::TransactionSummariesWrapper](docs/TransactionSummariesWrapper.md) + - [YnabAPI::TransactionSummary](docs/TransactionSummary.md) + - [YnabAPI::BudgetDetail](docs/BudgetDetail.md) + - [YnabAPI::CategoryGroupWithCategories](docs/CategoryGroupWithCategories.md) + - [YnabAPI::MonthDetail](docs/MonthDetail.md) + - [YnabAPI::ScheduledTransactionDetail](docs/ScheduledTransactionDetail.md) + - [YnabAPI::TransactionDetail](docs/TransactionDetail.md) + + +## Documentation for Authorization + + +### bearer + +- **Type**: API key +- **API key parameter name**: Authorization +- **Location**: HTTP header + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..42b1b4c --- /dev/null +++ b/Rakefile @@ -0,0 +1,13 @@ +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) do |t| + t.rspec_opts = "--tag fast" + end +rescue LoadError + # no rspec available +end + +task :generate do + sh "docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate -i https://ynab-api-develop.herokuapp.com/papi/spec-v1-swagger.json -l ruby -c /local/config.json -o /local" +end \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..6464444 --- /dev/null +++ b/config.json @@ -0,0 +1,10 @@ +{ + "gemName": "ynab", + "moduleName": "YnabAPI", + "gemVersion": "0.1.0", + "gemDescription": "Ruby gem wrapper for the YNAB API. Read the documentation at https://api.youneedabudget.com", + "gemHomepage": "https://github.com/ynab/ynab-sdk-ruby", + "gemLicense": "Apache-2.0", + "gemAuthor": "You Need A Budget, LLC", + "gemAuthorEmail": "help@youneedabudget.com" +} diff --git a/docs/Account.md b/docs/Account.md new file mode 100644 index 0000000..6abe39f --- /dev/null +++ b/docs/Account.md @@ -0,0 +1,13 @@ +# YnabAPI::Account + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**type** | **String** | | +**on_budget** | **BOOLEAN** | Whether this account is on budget or not | +**closed** | **BOOLEAN** | Whether this account is closed or not | +**balance** | **Float** | The current balance of the account in milliunits format | + + diff --git a/docs/AccountResponse.md b/docs/AccountResponse.md new file mode 100644 index 0000000..a1ac71d --- /dev/null +++ b/docs/AccountResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::AccountResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**AccountWrapper**](AccountWrapper.md) | | + + diff --git a/docs/AccountWrapper.md b/docs/AccountWrapper.md new file mode 100644 index 0000000..54652a3 --- /dev/null +++ b/docs/AccountWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::AccountWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account** | [**Account**](Account.md) | | + + diff --git a/docs/AccountsApi.md b/docs/AccountsApi.md new file mode 100644 index 0000000..0fb6a64 --- /dev/null +++ b/docs/AccountsApi.md @@ -0,0 +1,121 @@ +# YnabAPI::AccountsApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_account_by_id**](AccountsApi.md#get_account_by_id) | **GET** /budgets/{budget_id}/accounts/{account_id} | Single account +[**get_accounts**](AccountsApi.md#get_accounts) | **GET** /budgets/{budget_id}/accounts | Account list + + +# **get_account_by_id** +> AccountResponse get_account_by_id(budget_id, account_id) + +Single account + +Returns a single account + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::AccountsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +account_id = "account_id_example" # String | ID of account + + +begin + #Single account + result = api_instance.get_account_by_id(budget_id, account_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling AccountsApi->get_account_by_id: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **account_id** | **String**| ID of account | + +### Return type + +[**AccountResponse**](AccountResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_accounts** +> AccountsResponse get_accounts(budget_id) + +Account list + +Returns all accounts + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::AccountsApi.new + +budget_id = "budget_id_example" # String | ID of budget + + +begin + #Account list + result = api_instance.get_accounts(budget_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling AccountsApi->get_accounts: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + +### Return type + +[**AccountsResponse**](AccountsResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/docs/AccountsResponse.md b/docs/AccountsResponse.md new file mode 100644 index 0000000..364cc98 --- /dev/null +++ b/docs/AccountsResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::AccountsResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**AccountsWrapper**](AccountsWrapper.md) | | + + diff --git a/docs/AccountsWrapper.md b/docs/AccountsWrapper.md new file mode 100644 index 0000000..64c675a --- /dev/null +++ b/docs/AccountsWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::AccountsWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accounts** | [**Array<Account>**](Account.md) | | + + diff --git a/docs/BudgetDetail.md b/docs/BudgetDetail.md new file mode 100644 index 0000000..7329776 --- /dev/null +++ b/docs/BudgetDetail.md @@ -0,0 +1,21 @@ +# YnabAPI::BudgetDetail + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**date_format** | [**DateFormat**](DateFormat.md) | | [optional] +**currency_format** | [**CurrencyFormat**](CurrencyFormat.md) | | [optional] +**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/BudgetDetailResponse.md b/docs/BudgetDetailResponse.md new file mode 100644 index 0000000..b8dce87 --- /dev/null +++ b/docs/BudgetDetailResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::BudgetDetailResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**BudgetDetailWrapper**](BudgetDetailWrapper.md) | | + + diff --git a/docs/BudgetDetailWrapper.md b/docs/BudgetDetailWrapper.md new file mode 100644 index 0000000..7a8fe19 --- /dev/null +++ b/docs/BudgetDetailWrapper.md @@ -0,0 +1,9 @@ +# YnabAPI::BudgetDetailWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**budget** | [**BudgetDetail**](BudgetDetail.md) | | +**server_knowledge** | **Float** | The knowledge of the server | + + diff --git a/docs/BudgetSummary.md b/docs/BudgetSummary.md new file mode 100644 index 0000000..a67ae12 --- /dev/null +++ b/docs/BudgetSummary.md @@ -0,0 +1,11 @@ +# YnabAPI::BudgetSummary + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**date_format** | [**DateFormat**](DateFormat.md) | | [optional] +**currency_format** | [**CurrencyFormat**](CurrencyFormat.md) | | [optional] + + diff --git a/docs/BudgetSummaryResponse.md b/docs/BudgetSummaryResponse.md new file mode 100644 index 0000000..6e27aba --- /dev/null +++ b/docs/BudgetSummaryResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::BudgetSummaryResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**BudgetSummaryWrapper**](BudgetSummaryWrapper.md) | | + + diff --git a/docs/BudgetSummaryWrapper.md b/docs/BudgetSummaryWrapper.md new file mode 100644 index 0000000..97f40c9 --- /dev/null +++ b/docs/BudgetSummaryWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::BudgetSummaryWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**budgets** | [**Array<BudgetSummary>**](BudgetSummary.md) | | + + diff --git a/docs/BudgetsApi.md b/docs/BudgetsApi.md new file mode 100644 index 0000000..0d67d86 --- /dev/null +++ b/docs/BudgetsApi.md @@ -0,0 +1,116 @@ +# YnabAPI::BudgetsApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_budget_contents**](BudgetsApi.md#get_budget_contents) | **GET** /budgets/{budget_id} | Single budget +[**get_budgets**](BudgetsApi.md#get_budgets) | **GET** /budgets | List budgets + + +# **get_budget_contents** +> BudgetDetailResponse get_budget_contents(budget_id, opts) + +Single budget + +Returns a single budget with all related entities. This resource is effectively a full budget export. + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::BudgetsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +opts = { + last_knowledge_of_server: 8.14 # Float | Starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. +} + +begin + #Single budget + result = api_instance.get_budget_contents(budget_id, opts) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling BudgetsApi->get_budget_contents: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **last_knowledge_of_server** | **Float**| Starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. | [optional] + +### Return type + +[**BudgetDetailResponse**](BudgetDetailResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_budgets** +> BudgetSummaryResponse get_budgets + +List budgets + +Returns budgets list with summary information + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::BudgetsApi.new + +begin + #List budgets + result = api_instance.get_budgets + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling BudgetsApi->get_budgets: #{e}" +end +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**BudgetSummaryResponse**](BudgetSummaryResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/docs/CategoriesApi.md b/docs/CategoriesApi.md new file mode 100644 index 0000000..71f4c96 --- /dev/null +++ b/docs/CategoriesApi.md @@ -0,0 +1,121 @@ +# YnabAPI::CategoriesApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_categories**](CategoriesApi.md#get_categories) | **GET** /budgets/{budget_id}/categories | List categories +[**get_category_by_id**](CategoriesApi.md#get_category_by_id) | **GET** /budgets/{budget_id}/categories/{category_id} | Single category + + +# **get_categories** +> CategoriesResponse get_categories(budget_id) + +List categories + +Returns all categories grouped by category group + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::CategoriesApi.new + +budget_id = "budget_id_example" # String | ID of budget + + +begin + #List categories + result = api_instance.get_categories(budget_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling CategoriesApi->get_categories: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + +### Return type + +[**CategoriesResponse**](CategoriesResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_category_by_id** +> CategoryResponse get_category_by_id(budget_id, category_id) + +Single category + +Returns a single category + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::CategoriesApi.new + +budget_id = "budget_id_example" # String | ID of budget + +category_id = "category_id_example" # String | ID of category + + +begin + #Single category + result = api_instance.get_category_by_id(budget_id, category_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling CategoriesApi->get_category_by_id: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **category_id** | **String**| ID of category | + +### Return type + +[**CategoryResponse**](CategoryResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/docs/CategoriesResponse.md b/docs/CategoriesResponse.md new file mode 100644 index 0000000..8088890 --- /dev/null +++ b/docs/CategoriesResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::CategoriesResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**CategoryGroupsWrapper**](CategoryGroupsWrapper.md) | | + + diff --git a/docs/Category.md b/docs/Category.md new file mode 100644 index 0000000..a78f3eb --- /dev/null +++ b/docs/Category.md @@ -0,0 +1,14 @@ +# YnabAPI::Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**category_group_id** | **String** | | +**name** | **String** | | +**hidden** | **BOOLEAN** | Whether or not the category is hidden | +**budgeted** | **Float** | Budgeted amount in current month in milliunits format | +**activity** | **Float** | Activity amount in current month in milliunits format | +**balance** | **Float** | Balance in current month in milliunits format | + + diff --git a/docs/CategoryGroup.md b/docs/CategoryGroup.md new file mode 100644 index 0000000..4bb9e20 --- /dev/null +++ b/docs/CategoryGroup.md @@ -0,0 +1,10 @@ +# YnabAPI::CategoryGroup + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**hidden** | **BOOLEAN** | Whether or not the category group is hidden | + + diff --git a/docs/CategoryGroupWithCategories.md b/docs/CategoryGroupWithCategories.md new file mode 100644 index 0000000..a9cb528 --- /dev/null +++ b/docs/CategoryGroupWithCategories.md @@ -0,0 +1,10 @@ +# YnabAPI::CategoryGroupWithCategories + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**hidden** | **BOOLEAN** | Whether or not the category group is hidden | + + diff --git a/docs/CategoryGroupsWrapper.md b/docs/CategoryGroupsWrapper.md new file mode 100644 index 0000000..632fbc4 --- /dev/null +++ b/docs/CategoryGroupsWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::CategoryGroupsWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category_groups** | [**Array<CategoryGroupWithCategories>**](CategoryGroupWithCategories.md) | | + + diff --git a/docs/CategoryResponse.md b/docs/CategoryResponse.md new file mode 100644 index 0000000..5728358 --- /dev/null +++ b/docs/CategoryResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::CategoryResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**CategoryWrapper**](CategoryWrapper.md) | | + + diff --git a/docs/CategoryWrapper.md b/docs/CategoryWrapper.md new file mode 100644 index 0000000..ade1dd7 --- /dev/null +++ b/docs/CategoryWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::CategoryWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | [**Category**](Category.md) | | + + diff --git a/docs/CurrencyFormat.md b/docs/CurrencyFormat.md new file mode 100644 index 0000000..cc69e91 --- /dev/null +++ b/docs/CurrencyFormat.md @@ -0,0 +1,7 @@ +# YnabAPI::CurrencyFormat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/docs/DateFormat.md b/docs/DateFormat.md new file mode 100644 index 0000000..23c386f --- /dev/null +++ b/docs/DateFormat.md @@ -0,0 +1,7 @@ +# YnabAPI::DateFormat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/docs/ErrorDetail.md b/docs/ErrorDetail.md new file mode 100644 index 0000000..7065bce --- /dev/null +++ b/docs/ErrorDetail.md @@ -0,0 +1,10 @@ +# YnabAPI::ErrorDetail + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | +**description** | **String** | | + + diff --git a/docs/ErrorResponse.md b/docs/ErrorResponse.md new file mode 100644 index 0000000..39e95e0 --- /dev/null +++ b/docs/ErrorResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::ErrorResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**ErrorDetail**](ErrorDetail.md) | | + + diff --git a/docs/MonthDetail.md b/docs/MonthDetail.md new file mode 100644 index 0000000..035ae72 --- /dev/null +++ b/docs/MonthDetail.md @@ -0,0 +1,9 @@ +# YnabAPI::MonthDetail + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**month** | **Date** | | +**categories** | [**Array<Category>**](Category.md) | The budget month categories | + + diff --git a/docs/MonthDetailResponse.md b/docs/MonthDetailResponse.md new file mode 100644 index 0000000..4c96427 --- /dev/null +++ b/docs/MonthDetailResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::MonthDetailResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**MonthDetailWrapper**](MonthDetailWrapper.md) | | + + diff --git a/docs/MonthDetailWrapper.md b/docs/MonthDetailWrapper.md new file mode 100644 index 0000000..f7db50f --- /dev/null +++ b/docs/MonthDetailWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::MonthDetailWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**month** | [**MonthDetail**](MonthDetail.md) | | + + diff --git a/docs/MonthSummariesResponse.md b/docs/MonthSummariesResponse.md new file mode 100644 index 0000000..cd4c847 --- /dev/null +++ b/docs/MonthSummariesResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::MonthSummariesResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**MonthSummariesWrapper**](MonthSummariesWrapper.md) | | + + diff --git a/docs/MonthSummariesWrapper.md b/docs/MonthSummariesWrapper.md new file mode 100644 index 0000000..4dd4d13 --- /dev/null +++ b/docs/MonthSummariesWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::MonthSummariesWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**months** | [**Array<MonthSummary>**](MonthSummary.md) | | + + diff --git a/docs/MonthSummary.md b/docs/MonthSummary.md new file mode 100644 index 0000000..75f153d --- /dev/null +++ b/docs/MonthSummary.md @@ -0,0 +1,8 @@ +# YnabAPI::MonthSummary + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**month** | **Date** | | + + diff --git a/docs/MonthsApi.md b/docs/MonthsApi.md new file mode 100644 index 0000000..e467c1c --- /dev/null +++ b/docs/MonthsApi.md @@ -0,0 +1,121 @@ +# YnabAPI::MonthsApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_budget_month**](MonthsApi.md#get_budget_month) | **GET** /budgets/{budget_id}/months/{month} | Single budget month +[**get_budget_months**](MonthsApi.md#get_budget_months) | **GET** /budgets/{budget_id}/months | List budget months + + +# **get_budget_month** +> MonthDetailResponse get_budget_month(budget_id, month) + +Single budget month + +Returns a single budget month + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::MonthsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +month = Date.parse("2013-10-20") # Date | The budget month. \"current\" can also be used to specify the current calendar month (UTC). + + +begin + #Single budget month + result = api_instance.get_budget_month(budget_id, month) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling MonthsApi->get_budget_month: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **month** | **Date**| The budget month. \"current\" can also be used to specify the current calendar month (UTC). | + +### Return type + +[**MonthDetailResponse**](MonthDetailResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_budget_months** +> MonthSummariesResponse get_budget_months(budget_id) + +List budget months + +Returns all budget months + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::MonthsApi.new + +budget_id = "budget_id_example" # String | ID of budget + + +begin + #List budget months + result = api_instance.get_budget_months(budget_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling MonthsApi->get_budget_months: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + +### Return type + +[**MonthSummariesResponse**](MonthSummariesResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/docs/Payee.md b/docs/Payee.md new file mode 100644 index 0000000..f86a168 --- /dev/null +++ b/docs/Payee.md @@ -0,0 +1,9 @@ +# YnabAPI::Payee + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**name** | **String** | | + + diff --git a/docs/PayeeLocation.md b/docs/PayeeLocation.md new file mode 100644 index 0000000..46cda81 --- /dev/null +++ b/docs/PayeeLocation.md @@ -0,0 +1,9 @@ +# YnabAPI::PayeeLocation + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**payee_id** | **String** | | + + diff --git a/docs/PayeeLocationResponse.md b/docs/PayeeLocationResponse.md new file mode 100644 index 0000000..2175fee --- /dev/null +++ b/docs/PayeeLocationResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeeLocationResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**PayeeLocationWrapper**](PayeeLocationWrapper.md) | | + + diff --git a/docs/PayeeLocationWrapper.md b/docs/PayeeLocationWrapper.md new file mode 100644 index 0000000..18d52d2 --- /dev/null +++ b/docs/PayeeLocationWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeeLocationWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payee_location** | [**PayeeLocation**](PayeeLocation.md) | | + + diff --git a/docs/PayeeLocationsApi.md b/docs/PayeeLocationsApi.md new file mode 100644 index 0000000..5e42328 --- /dev/null +++ b/docs/PayeeLocationsApi.md @@ -0,0 +1,179 @@ +# YnabAPI::PayeeLocationsApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_payee_location_by_id**](PayeeLocationsApi.md#get_payee_location_by_id) | **GET** /budgets/{budget_id}/payee_locations/{payee_location_id} | Single payee location +[**get_payee_locations**](PayeeLocationsApi.md#get_payee_locations) | **GET** /budgets/{budget_id}/payee_locations | List payee locations +[**get_payee_locations_by_payee**](PayeeLocationsApi.md#get_payee_locations_by_payee) | **GET** /budgets/{budget_id}/payees/{payee_id}/payee_locations | List locations for a payee + + +# **get_payee_location_by_id** +> PayeeLocationResponse get_payee_location_by_id(budget_id, payee_location_id) + +Single payee location + +Returns a single payee location + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::PayeeLocationsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +payee_location_id = "payee_location_id_example" # String | ID of payee location + + +begin + #Single payee location + result = api_instance.get_payee_location_by_id(budget_id, payee_location_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling PayeeLocationsApi->get_payee_location_by_id: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **payee_location_id** | **String**| ID of payee location | + +### Return type + +[**PayeeLocationResponse**](PayeeLocationResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_payee_locations** +> PayeeLocationsResponse get_payee_locations(budget_id) + +List payee locations + +Returns all payee locations + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::PayeeLocationsApi.new + +budget_id = "budget_id_example" # String | ID of budget + + +begin + #List payee locations + result = api_instance.get_payee_locations(budget_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling PayeeLocationsApi->get_payee_locations: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + +### Return type + +[**PayeeLocationsResponse**](PayeeLocationsResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_payee_locations_by_payee** +> PayeeLocationsResponse get_payee_locations_by_payee(budget_id, payee_id) + +List locations for a payee + +Returns all payee locations for the specified payee + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::PayeeLocationsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +payee_id = "payee_id_example" # String | ID of payee + + +begin + #List locations for a payee + result = api_instance.get_payee_locations_by_payee(budget_id, payee_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling PayeeLocationsApi->get_payee_locations_by_payee: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **payee_id** | **String**| ID of payee | + +### Return type + +[**PayeeLocationsResponse**](PayeeLocationsResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/docs/PayeeLocationsResponse.md b/docs/PayeeLocationsResponse.md new file mode 100644 index 0000000..3d45c31 --- /dev/null +++ b/docs/PayeeLocationsResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeeLocationsResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**PayeeLocationsWrapper**](PayeeLocationsWrapper.md) | | + + diff --git a/docs/PayeeLocationsWrapper.md b/docs/PayeeLocationsWrapper.md new file mode 100644 index 0000000..27efef0 --- /dev/null +++ b/docs/PayeeLocationsWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeeLocationsWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payee_locations** | [**Array<PayeeLocation>**](PayeeLocation.md) | | + + diff --git a/docs/PayeeResponse.md b/docs/PayeeResponse.md new file mode 100644 index 0000000..a11fe2c --- /dev/null +++ b/docs/PayeeResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeeResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**PayeeWrapper**](PayeeWrapper.md) | | + + diff --git a/docs/PayeeWrapper.md b/docs/PayeeWrapper.md new file mode 100644 index 0000000..d955d53 --- /dev/null +++ b/docs/PayeeWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeeWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payee** | [**Payee**](Payee.md) | | + + diff --git a/docs/PayeesApi.md b/docs/PayeesApi.md new file mode 100644 index 0000000..8d85293 --- /dev/null +++ b/docs/PayeesApi.md @@ -0,0 +1,121 @@ +# YnabAPI::PayeesApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_payee_by_id**](PayeesApi.md#get_payee_by_id) | **GET** /budgets/{budget_id}/payees/{payee_id} | Single payee +[**get_payees**](PayeesApi.md#get_payees) | **GET** /budgets/{budget_id}/payees | List payees + + +# **get_payee_by_id** +> PayeeResponse get_payee_by_id(budget_id, payee_id) + +Single payee + +Returns single payee + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::PayeesApi.new + +budget_id = "budget_id_example" # String | ID of budget + +payee_id = "payee_id_example" # String | ID of payee + + +begin + #Single payee + result = api_instance.get_payee_by_id(budget_id, payee_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling PayeesApi->get_payee_by_id: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **payee_id** | **String**| ID of payee | + +### Return type + +[**PayeeResponse**](PayeeResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_payees** +> PayeesResponse get_payees(budget_id) + +List payees + +Returns all payees + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::PayeesApi.new + +budget_id = "budget_id_example" # String | ID of budget + + +begin + #List payees + result = api_instance.get_payees(budget_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling PayeesApi->get_payees: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + +### Return type + +[**PayeesResponse**](PayeesResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/docs/PayeesResponse.md b/docs/PayeesResponse.md new file mode 100644 index 0000000..f30f699 --- /dev/null +++ b/docs/PayeesResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeesResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**PayeesWrapper**](PayeesWrapper.md) | | + + diff --git a/docs/PayeesWrapper.md b/docs/PayeesWrapper.md new file mode 100644 index 0000000..d459f63 --- /dev/null +++ b/docs/PayeesWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::PayeesWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payees** | [**Array<Payee>**](Payee.md) | | + + diff --git a/docs/ScheduledSubTransaction.md b/docs/ScheduledSubTransaction.md new file mode 100644 index 0000000..8964baa --- /dev/null +++ b/docs/ScheduledSubTransaction.md @@ -0,0 +1,10 @@ +# YnabAPI::ScheduledSubTransaction + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**scheduled_transaction_id** | **String** | | +**amount** | **Float** | The current balance of the account in milliunits format | + + diff --git a/docs/ScheduledTransactionDetail.md b/docs/ScheduledTransactionDetail.md new file mode 100644 index 0000000..8897d1e --- /dev/null +++ b/docs/ScheduledTransactionDetail.md @@ -0,0 +1,13 @@ +# YnabAPI::ScheduledTransactionDetail + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**date** | **Date** | | +**frequency** | **String** | | +**amount** | **Float** | The current balance of the account in milliunits format | +**account_id** | **String** | | +**subtransactions** | [**Array<ScheduledSubTransaction>**](ScheduledSubTransaction.md) | If a split scheduled transaction, the sub-transactions. | + + diff --git a/docs/ScheduledTransactionDetailResponse.md b/docs/ScheduledTransactionDetailResponse.md new file mode 100644 index 0000000..c7c5c81 --- /dev/null +++ b/docs/ScheduledTransactionDetailResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::ScheduledTransactionDetailResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**ScheduledTransactionDetailWrapper**](ScheduledTransactionDetailWrapper.md) | | + + diff --git a/docs/ScheduledTransactionDetailWrapper.md b/docs/ScheduledTransactionDetailWrapper.md new file mode 100644 index 0000000..5ec99ec --- /dev/null +++ b/docs/ScheduledTransactionDetailWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::ScheduledTransactionDetailWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scheduled_transaction** | [**ScheduledTransactionDetail**](ScheduledTransactionDetail.md) | | + + diff --git a/docs/ScheduledTransactionSummariesResponse.md b/docs/ScheduledTransactionSummariesResponse.md new file mode 100644 index 0000000..2ff4bf8 --- /dev/null +++ b/docs/ScheduledTransactionSummariesResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::ScheduledTransactionSummariesResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**ScheduledTransactionSummariesWrapper**](ScheduledTransactionSummariesWrapper.md) | | + + diff --git a/docs/ScheduledTransactionSummariesWrapper.md b/docs/ScheduledTransactionSummariesWrapper.md new file mode 100644 index 0000000..a22ac30 --- /dev/null +++ b/docs/ScheduledTransactionSummariesWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::ScheduledTransactionSummariesWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**scheduled_transactions** | [**Array<ScheduledTransactionSummary>**](ScheduledTransactionSummary.md) | | + + diff --git a/docs/ScheduledTransactionSummary.md b/docs/ScheduledTransactionSummary.md new file mode 100644 index 0000000..70ef12d --- /dev/null +++ b/docs/ScheduledTransactionSummary.md @@ -0,0 +1,12 @@ +# YnabAPI::ScheduledTransactionSummary + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**date** | **Date** | | +**frequency** | **String** | | +**amount** | **Float** | The current balance of the account in milliunits format | +**account_id** | **String** | | + + diff --git a/docs/ScheduledTransactionsApi.md b/docs/ScheduledTransactionsApi.md new file mode 100644 index 0000000..12a5ac4 --- /dev/null +++ b/docs/ScheduledTransactionsApi.md @@ -0,0 +1,121 @@ +# YnabAPI::ScheduledTransactionsApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_scheduled_transaction_by_id**](ScheduledTransactionsApi.md#get_scheduled_transaction_by_id) | **GET** /budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id} | Single scheduled transaction +[**get_scheduled_transactions**](ScheduledTransactionsApi.md#get_scheduled_transactions) | **GET** /budgets/{budget_id}/scheduled_transactions | List scheduled transactions + + +# **get_scheduled_transaction_by_id** +> ScheduledTransactionDetailResponse get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id) + +Single scheduled transaction + +Returns a single scheduled transaction + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::ScheduledTransactionsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +scheduled_transaction_id = "scheduled_transaction_id_example" # String | ID of scheduled transaction + + +begin + #Single scheduled transaction + result = api_instance.get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling ScheduledTransactionsApi->get_scheduled_transaction_by_id: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **scheduled_transaction_id** | **String**| ID of scheduled transaction | + +### Return type + +[**ScheduledTransactionDetailResponse**](ScheduledTransactionDetailResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_scheduled_transactions** +> ScheduledTransactionSummariesResponse get_scheduled_transactions(budget_id) + +List scheduled transactions + +Returns all scheduled transactions + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::ScheduledTransactionsApi.new + +budget_id = "budget_id_example" # String | ID of budget + + +begin + #List scheduled transactions + result = api_instance.get_scheduled_transactions(budget_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling ScheduledTransactionsApi->get_scheduled_transactions: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + +### Return type + +[**ScheduledTransactionSummariesResponse**](ScheduledTransactionSummariesResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/docs/SubTransaction.md b/docs/SubTransaction.md new file mode 100644 index 0000000..b0493d2 --- /dev/null +++ b/docs/SubTransaction.md @@ -0,0 +1,10 @@ +# YnabAPI::SubTransaction + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**transaction_id** | **String** | | +**amount** | **Float** | The current balance of the account in milliunits format | + + diff --git a/docs/TransactionDetail.md b/docs/TransactionDetail.md new file mode 100644 index 0000000..bdd049e --- /dev/null +++ b/docs/TransactionDetail.md @@ -0,0 +1,14 @@ +# YnabAPI::TransactionDetail + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**date** | **Date** | | +**amount** | **Float** | The current balance of the account in milliunits format | +**cleared** | **String** | The cleared status of the transaction | +**approved** | **BOOLEAN** | Whether or not the transaction is approved | +**account_id** | **String** | | +**subtransactions** | [**Array<SubTransaction>**](SubTransaction.md) | If a split transaction, the sub-transactions. | + + diff --git a/docs/TransactionDetailResponse.md b/docs/TransactionDetailResponse.md new file mode 100644 index 0000000..170d5d6 --- /dev/null +++ b/docs/TransactionDetailResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::TransactionDetailResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**TransactionDetailWrapper**](TransactionDetailWrapper.md) | | + + diff --git a/docs/TransactionDetailWrapper.md b/docs/TransactionDetailWrapper.md new file mode 100644 index 0000000..80008f7 --- /dev/null +++ b/docs/TransactionDetailWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::TransactionDetailWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**transaction** | [**TransactionDetail**](TransactionDetail.md) | | + + diff --git a/docs/TransactionSummariesResponse.md b/docs/TransactionSummariesResponse.md new file mode 100644 index 0000000..67a496e --- /dev/null +++ b/docs/TransactionSummariesResponse.md @@ -0,0 +1,8 @@ +# YnabAPI::TransactionSummariesResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**TransactionSummariesWrapper**](TransactionSummariesWrapper.md) | | + + diff --git a/docs/TransactionSummariesWrapper.md b/docs/TransactionSummariesWrapper.md new file mode 100644 index 0000000..f7a8e2f --- /dev/null +++ b/docs/TransactionSummariesWrapper.md @@ -0,0 +1,8 @@ +# YnabAPI::TransactionSummariesWrapper + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**transactions** | [**Array<TransactionSummary>**](TransactionSummary.md) | | + + diff --git a/docs/TransactionSummary.md b/docs/TransactionSummary.md new file mode 100644 index 0000000..e0fe8a5 --- /dev/null +++ b/docs/TransactionSummary.md @@ -0,0 +1,13 @@ +# YnabAPI::TransactionSummary + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**date** | **Date** | | +**amount** | **Float** | The current balance of the account in milliunits format | +**cleared** | **String** | The cleared status of the transaction | +**approved** | **BOOLEAN** | Whether or not the transaction is approved | +**account_id** | **String** | | + + diff --git a/docs/TransactionsApi.md b/docs/TransactionsApi.md new file mode 100644 index 0000000..3c0cd50 --- /dev/null +++ b/docs/TransactionsApi.md @@ -0,0 +1,249 @@ +# YnabAPI::TransactionsApi + +All URIs are relative to *https://localhost/papi/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_transactions**](TransactionsApi.md#get_transactions) | **GET** /budgets/{budget_id}/transactions | List transactions +[**get_transactions_by_account**](TransactionsApi.md#get_transactions_by_account) | **GET** /budgets/{budget_id}/accounts/{account_id}/transactions | List account transactions +[**get_transactions_by_category**](TransactionsApi.md#get_transactions_by_category) | **GET** /budgets/{budget_id}/categories/{category_id}/transactions | List category transactions +[**get_transactions_by_id**](TransactionsApi.md#get_transactions_by_id) | **GET** /budgets/{budget_id}/transactions/{transaction_id} | Single transaction + + +# **get_transactions** +> TransactionSummariesResponse get_transactions(budget_id, opts) + +List transactions + +Returns all budget transactions + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::TransactionsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +opts = { + since_date: Date.parse("2013-10-20") # Date | Only return transactions on or after this date +} + +begin + #List transactions + result = api_instance.get_transactions(budget_id, opts) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling TransactionsApi->get_transactions: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **since_date** | **Date**| Only return transactions on or after this date | [optional] + +### Return type + +[**TransactionSummariesResponse**](TransactionSummariesResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_transactions_by_account** +> TransactionSummariesResponse get_transactions_by_account(budget_id, account_id, opts) + +List account transactions + +Returns all transactions for a specified account + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::TransactionsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +account_id = "account_id_example" # String | ID of account + +opts = { + since_date: Date.parse("2013-10-20") # Date | Only return transactions on or after this date +} + +begin + #List account transactions + result = api_instance.get_transactions_by_account(budget_id, account_id, opts) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling TransactionsApi->get_transactions_by_account: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **account_id** | **String**| ID of account | + **since_date** | **Date**| Only return transactions on or after this date | [optional] + +### Return type + +[**TransactionSummariesResponse**](TransactionSummariesResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_transactions_by_category** +> TransactionSummariesResponse get_transactions_by_category(budget_id, category_id, opts) + +List category transactions + +Returns all transactions for a specified category + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::TransactionsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +category_id = "category_id_example" # String | ID of category + +opts = { + since_date: Date.parse("2013-10-20") # Date | Only return transactions on or after this date +} + +begin + #List category transactions + result = api_instance.get_transactions_by_category(budget_id, category_id, opts) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling TransactionsApi->get_transactions_by_category: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **category_id** | **String**| ID of category | + **since_date** | **Date**| Only return transactions on or after this date | [optional] + +### Return type + +[**TransactionSummariesResponse**](TransactionSummariesResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + +# **get_transactions_by_id** +> TransactionDetailResponse get_transactions_by_id(budget_id, transaction_id) + +Single transaction + +Returns a single transaction + +### Example +```ruby +# load the gem +require 'ynab' +# setup authorization +YnabAPI.configure do |config| + # Configure API key authorization: bearer + config.api_key['Authorization'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + #config.api_key_prefix['Authorization'] = 'Bearer' +end + +api_instance = YnabAPI::TransactionsApi.new + +budget_id = "budget_id_example" # String | ID of budget + +transaction_id = "transaction_id_example" # String | ID of transaction + + +begin + #Single transaction + result = api_instance.get_transactions_by_id(budget_id, transaction_id) + p result +rescue YnabAPI::ApiError => e + puts "Exception when calling TransactionsApi->get_transactions_by_id: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **budget_id** | **String**| ID of budget | + **transaction_id** | **String**| ID of transaction | + +### Return type + +[**TransactionDetailResponse**](TransactionDetailResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + + diff --git a/lib/swagger_client.rb b/lib/swagger_client.rb new file mode 100644 index 0000000..4df6cbd --- /dev/null +++ b/lib/swagger_client.rb @@ -0,0 +1,99 @@ +=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.3.0-SNAPSHOT + +=end + +# Common files +require 'swagger_client/api_client' +require 'swagger_client/api_error' +require 'swagger_client/version' +require 'swagger_client/configuration' + +# Models +require 'swagger_client/models/account' +require 'swagger_client/models/account_response' +require 'swagger_client/models/account_wrapper' +require 'swagger_client/models/accounts_response' +require 'swagger_client/models/accounts_wrapper' +require 'swagger_client/models/budget_detail_response' +require 'swagger_client/models/budget_detail_wrapper' +require 'swagger_client/models/budget_summary' +require 'swagger_client/models/budget_summary_response' +require 'swagger_client/models/budget_summary_wrapper' +require 'swagger_client/models/categories_response' +require 'swagger_client/models/category' +require 'swagger_client/models/category_group' +require 'swagger_client/models/category_groups_wrapper' +require 'swagger_client/models/category_response' +require 'swagger_client/models/category_wrapper' +require 'swagger_client/models/currency_format' +require 'swagger_client/models/date_format' +require 'swagger_client/models/error_detail' +require 'swagger_client/models/error_response' +require 'swagger_client/models/month_detail_response' +require 'swagger_client/models/month_detail_wrapper' +require 'swagger_client/models/month_summaries_response' +require 'swagger_client/models/month_summaries_wrapper' +require 'swagger_client/models/month_summary' +require 'swagger_client/models/payee' +require 'swagger_client/models/payee_location' +require 'swagger_client/models/payee_location_response' +require 'swagger_client/models/payee_location_wrapper' +require 'swagger_client/models/payee_locations_response' +require 'swagger_client/models/payee_locations_wrapper' +require 'swagger_client/models/payee_response' +require 'swagger_client/models/payee_wrapper' +require 'swagger_client/models/payees_response' +require 'swagger_client/models/payees_wrapper' +require 'swagger_client/models/scheduled_sub_transaction' +require 'swagger_client/models/scheduled_transaction_detail_response' +require 'swagger_client/models/scheduled_transaction_detail_wrapper' +require 'swagger_client/models/scheduled_transaction_summaries_response' +require 'swagger_client/models/scheduled_transaction_summaries_wrapper' +require 'swagger_client/models/scheduled_transaction_summary' +require 'swagger_client/models/sub_transaction' +require 'swagger_client/models/transaction_detail_response' +require 'swagger_client/models/transaction_detail_wrapper' +require 'swagger_client/models/transaction_summaries_response' +require 'swagger_client/models/transaction_summaries_wrapper' +require 'swagger_client/models/transaction_summary' +require 'swagger_client/models/budget_detail' +require 'swagger_client/models/category_group_with_categories' +require 'swagger_client/models/month_detail' +require 'swagger_client/models/scheduled_transaction_detail' +require 'swagger_client/models/transaction_detail' + +# APIs +require 'swagger_client/api/accounts_api' +require 'swagger_client/api/budgets_api' +require 'swagger_client/api/categories_api' +require 'swagger_client/api/months_api' +require 'swagger_client/api/payee_locations_api' +require 'swagger_client/api/payees_api' +require 'swagger_client/api/scheduled_transactions_api' +require 'swagger_client/api/transactions_api' + +module SwaggerClient + class << self + # Customize default settings for the SDK using block. + # SwaggerClient.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/swagger_client/api/accounts_api.rb b/lib/swagger_client/api/accounts_api.rb new file mode 100644 index 0000000..63777ef --- /dev/null +++ b/lib/swagger_client/api/accounts_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class AccountsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single account + # Returns a single account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @return [AccountResponse] + def get_account_by_id(budget_id, account_id, opts = {}) + data, _status_code, _headers = get_account_by_id_with_http_info(budget_id, account_id, opts) + return data + end + + # Single account + # Returns a single account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @return [Array<(AccountResponse, Fixnum, Hash)>] AccountResponse data, response status code and response headers + def get_account_by_id_with_http_info(budget_id, account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: AccountsApi.get_account_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_account_by_id" + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/accounts/{account_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'account_id' + '}', account_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'AccountResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AccountsApi#get_account_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Account list + # Returns all accounts + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [AccountsResponse] + def get_accounts(budget_id, opts = {}) + data, _status_code, _headers = get_accounts_with_http_info(budget_id, opts) + return data + end + + # Account list + # Returns all accounts + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(AccountsResponse, Fixnum, Hash)>] AccountsResponse data, response status code and response headers + def get_accounts_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: AccountsApi.get_accounts ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_accounts" + end + # resource path + local_var_path = "/budgets/{budget_id}/accounts".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'AccountsResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AccountsApi#get_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api/budgets_api.rb b/lib/swagger_client/api/budgets_api.rb new file mode 100644 index 0000000..b5812e5 --- /dev/null +++ b/lib/swagger_client/api/budgets_api.rb @@ -0,0 +1,126 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class BudgetsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single budget + # Returns a single budget with all related entities. This resource is effectively a full budget export. + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Float] :last_knowledge_of_server Starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. + # @return [BudgetDetailResponse] + def get_budget_contents(budget_id, opts = {}) + data, _status_code, _headers = get_budget_contents_with_http_info(budget_id, opts) + return data + end + + # Single budget + # Returns a single budget with all related entities. This resource is effectively a full budget export. + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Float] :last_knowledge_of_server Starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. + # @return [Array<(BudgetDetailResponse, Fixnum, Hash)>] BudgetDetailResponse data, response status code and response headers + def get_budget_contents_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: BudgetsApi.get_budget_contents ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_contents" + end + # resource path + local_var_path = "/budgets/{budget_id}".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'BudgetDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BudgetsApi#get_budget_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List budgets + # Returns budgets list with summary information + # @param [Hash] opts the optional parameters + # @return [BudgetSummaryResponse] + def get_budgets(opts = {}) + data, _status_code, _headers = get_budgets_with_http_info(opts) + return data + end + + # List budgets + # Returns budgets list with summary information + # @param [Hash] opts the optional parameters + # @return [Array<(BudgetSummaryResponse, Fixnum, Hash)>] BudgetSummaryResponse data, response status code and response headers + def get_budgets_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: BudgetsApi.get_budgets ..." + end + # resource path + local_var_path = "/budgets" + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'BudgetSummaryResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BudgetsApi#get_budgets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api/categories_api.rb b/lib/swagger_client/api/categories_api.rb new file mode 100644 index 0000000..676ab06 --- /dev/null +++ b/lib/swagger_client/api/categories_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class CategoriesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # List categories + # Returns all categories grouped by category group + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [CategoriesResponse] + def get_categories(budget_id, opts = {}) + data, _status_code, _headers = get_categories_with_http_info(budget_id, opts) + return data + end + + # List categories + # Returns all categories grouped by category group + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(CategoriesResponse, Fixnum, Hash)>] CategoriesResponse data, response status code and response headers + def get_categories_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: CategoriesApi.get_categories ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_categories" + end + # resource path + local_var_path = "/budgets/{budget_id}/categories".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'CategoriesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CategoriesApi#get_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Single category + # Returns a single category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @return [CategoryResponse] + def get_category_by_id(budget_id, category_id, opts = {}) + data, _status_code, _headers = get_category_by_id_with_http_info(budget_id, category_id, opts) + return data + end + + # Single category + # Returns a single category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @return [Array<(CategoryResponse, Fixnum, Hash)>] CategoryResponse data, response status code and response headers + def get_category_by_id_with_http_info(budget_id, category_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: CategoriesApi.get_category_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_category_by_id" + end + # verify the required parameter 'category_id' is set + if @api_client.config.client_side_validation && category_id.nil? + fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.get_category_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/categories/{category_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'category_id' + '}', category_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'CategoryResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CategoriesApi#get_category_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api/months_api.rb b/lib/swagger_client/api/months_api.rb new file mode 100644 index 0000000..03b07ae --- /dev/null +++ b/lib/swagger_client/api/months_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class MonthsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single budget month + # Returns a single budget month + # @param budget_id ID of budget + # @param month The budget month. \"current\" can also be used to specify the current calendar month (UTC). + # @param [Hash] opts the optional parameters + # @return [MonthDetailResponse] + def get_budget_month(budget_id, month, opts = {}) + data, _status_code, _headers = get_budget_month_with_http_info(budget_id, month, opts) + return data + end + + # Single budget month + # Returns a single budget month + # @param budget_id ID of budget + # @param month The budget month. \"current\" can also be used to specify the current calendar month (UTC). + # @param [Hash] opts the optional parameters + # @return [Array<(MonthDetailResponse, Fixnum, Hash)>] MonthDetailResponse data, response status code and response headers + def get_budget_month_with_http_info(budget_id, month, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: MonthsApi.get_budget_month ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling MonthsApi.get_budget_month" + end + # verify the required parameter 'month' is set + if @api_client.config.client_side_validation && month.nil? + fail ArgumentError, "Missing the required parameter 'month' when calling MonthsApi.get_budget_month" + end + # resource path + local_var_path = "/budgets/{budget_id}/months/{month}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'month' + '}', month.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'MonthDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonthsApi#get_budget_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List budget months + # Returns all budget months + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [MonthSummariesResponse] + def get_budget_months(budget_id, opts = {}) + data, _status_code, _headers = get_budget_months_with_http_info(budget_id, opts) + return data + end + + # List budget months + # Returns all budget months + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(MonthSummariesResponse, Fixnum, Hash)>] MonthSummariesResponse data, response status code and response headers + def get_budget_months_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: MonthsApi.get_budget_months ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling MonthsApi.get_budget_months" + end + # resource path + local_var_path = "/budgets/{budget_id}/months".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'MonthSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonthsApi#get_budget_months\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api/payee_locations_api.rb b/lib/swagger_client/api/payee_locations_api.rb new file mode 100644 index 0000000..5ab76ea --- /dev/null +++ b/lib/swagger_client/api/payee_locations_api.rb @@ -0,0 +1,194 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class PayeeLocationsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single payee location + # Returns a single payee location + # @param budget_id ID of budget + # @param payee_location_id ID of payee location + # @param [Hash] opts the optional parameters + # @return [PayeeLocationResponse] + def get_payee_location_by_id(budget_id, payee_location_id, opts = {}) + data, _status_code, _headers = get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts) + return data + end + + # Single payee location + # Returns a single payee location + # @param budget_id ID of budget + # @param payee_location_id ID of payee location + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeLocationResponse, Fixnum, Hash)>] PayeeLocationResponse data, response status code and response headers + def get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_location_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_location_by_id" + end + # verify the required parameter 'payee_location_id' is set + if @api_client.config.client_side_validation && payee_location_id.nil? + fail ArgumentError, "Missing the required parameter 'payee_location_id' when calling PayeeLocationsApi.get_payee_location_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/payee_locations/{payee_location_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_location_id' + '}', payee_location_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeLocationResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_location_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List payee locations + # Returns all payee locations + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [PayeeLocationsResponse] + def get_payee_locations(budget_id, opts = {}) + data, _status_code, _headers = get_payee_locations_with_http_info(budget_id, opts) + return data + end + + # List payee locations + # Returns all payee locations + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeLocationsResponse, Fixnum, Hash)>] PayeeLocationsResponse data, response status code and response headers + def get_payee_locations_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_locations ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_locations" + end + # resource path + local_var_path = "/budgets/{budget_id}/payee_locations".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeLocationsResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List locations for a payee + # Returns all payee locations for the specified payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [PayeeLocationsResponse] + def get_payee_locations_by_payee(budget_id, payee_id, opts = {}) + data, _status_code, _headers = get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts) + return data + end + + # List locations for a payee + # Returns all payee locations for the specified payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeLocationsResponse, Fixnum, Hash)>] PayeeLocationsResponse data, response status code and response headers + def get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_locations_by_payee ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_locations_by_payee" + end + # verify the required parameter 'payee_id' is set + if @api_client.config.client_side_validation && payee_id.nil? + fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeeLocationsApi.get_payee_locations_by_payee" + end + # resource path + local_var_path = "/budgets/{budget_id}/payees/{payee_id}/payee_locations".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_id' + '}', payee_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeLocationsResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_locations_by_payee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api/payees_api.rb b/lib/swagger_client/api/payees_api.rb new file mode 100644 index 0000000..d5b5ab4 --- /dev/null +++ b/lib/swagger_client/api/payees_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class PayeesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single payee + # Returns single payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [PayeeResponse] + def get_payee_by_id(budget_id, payee_id, opts = {}) + data, _status_code, _headers = get_payee_by_id_with_http_info(budget_id, payee_id, opts) + return data + end + + # Single payee + # Returns single payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeResponse, Fixnum, Hash)>] PayeeResponse data, response status code and response headers + def get_payee_by_id_with_http_info(budget_id, payee_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeesApi.get_payee_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payee_by_id" + end + # verify the required parameter 'payee_id' is set + if @api_client.config.client_side_validation && payee_id.nil? + fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeesApi.get_payee_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/payees/{payee_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_id' + '}', payee_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeesApi#get_payee_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List payees + # Returns all payees + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [PayeesResponse] + def get_payees(budget_id, opts = {}) + data, _status_code, _headers = get_payees_with_http_info(budget_id, opts) + return data + end + + # List payees + # Returns all payees + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(PayeesResponse, Fixnum, Hash)>] PayeesResponse data, response status code and response headers + def get_payees_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeesApi.get_payees ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payees" + end + # resource path + local_var_path = "/budgets/{budget_id}/payees".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeesApi#get_payees\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api/scheduled_transactions_api.rb b/lib/swagger_client/api/scheduled_transactions_api.rb new file mode 100644 index 0000000..6a9ec41 --- /dev/null +++ b/lib/swagger_client/api/scheduled_transactions_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class ScheduledTransactionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single scheduled transaction + # Returns a single scheduled transaction + # @param budget_id ID of budget + # @param scheduled_transaction_id ID of scheduled transaction + # @param [Hash] opts the optional parameters + # @return [ScheduledTransactionDetailResponse] + def get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id, opts = {}) + data, _status_code, _headers = get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts) + return data + end + + # Single scheduled transaction + # Returns a single scheduled transaction + # @param budget_id ID of budget + # @param scheduled_transaction_id ID of scheduled transaction + # @param [Hash] opts the optional parameters + # @return [Array<(ScheduledTransactionDetailResponse, Fixnum, Hash)>] ScheduledTransactionDetailResponse data, response status code and response headers + def get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: ScheduledTransactionsApi.get_scheduled_transaction_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id" + end + # verify the required parameter 'scheduled_transaction_id' is set + if @api_client.config.client_side_validation && scheduled_transaction_id.nil? + fail ArgumentError, "Missing the required parameter 'scheduled_transaction_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'scheduled_transaction_id' + '}', scheduled_transaction_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'ScheduledTransactionDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScheduledTransactionsApi#get_scheduled_transaction_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List scheduled transactions + # Returns all scheduled transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [ScheduledTransactionSummariesResponse] + def get_scheduled_transactions(budget_id, opts = {}) + data, _status_code, _headers = get_scheduled_transactions_with_http_info(budget_id, opts) + return data + end + + # List scheduled transactions + # Returns all scheduled transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(ScheduledTransactionSummariesResponse, Fixnum, Hash)>] ScheduledTransactionSummariesResponse data, response status code and response headers + def get_scheduled_transactions_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: ScheduledTransactionsApi.get_scheduled_transactions ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transactions" + end + # resource path + local_var_path = "/budgets/{budget_id}/scheduled_transactions".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'ScheduledTransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScheduledTransactionsApi#get_scheduled_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api/transactions_api.rb b/lib/swagger_client/api/transactions_api.rb new file mode 100644 index 0000000..5c5c999 --- /dev/null +++ b/lib/swagger_client/api/transactions_api.rb @@ -0,0 +1,262 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module SwaggerClient + class TransactionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # List transactions + # Returns all budget transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + def get_transactions(budget_id, opts = {}) + data, _status_code, _headers = get_transactions_with_http_info(budget_id, opts) + return data + end + + # List transactions + # Returns all budget transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [Array<(TransactionSummariesResponse, Fixnum, Hash)>] TransactionSummariesResponse data, response status code and response headers + def get_transactions_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions" + end + # resource path + local_var_path = "/budgets/{budget_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List account transactions + # Returns all transactions for a specified account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + def get_transactions_by_account(budget_id, account_id, opts = {}) + data, _status_code, _headers = get_transactions_by_account_with_http_info(budget_id, account_id, opts) + return data + end + + # List account transactions + # Returns all transactions for a specified account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [Array<(TransactionSummariesResponse, Fixnum, Hash)>] TransactionSummariesResponse data, response status code and response headers + def get_transactions_by_account_with_http_info(budget_id, account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_account ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_account" + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TransactionsApi.get_transactions_by_account" + end + # resource path + local_var_path = "/budgets/{budget_id}/accounts/{account_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'account_id' + '}', account_id.to_s) + + # query parameters + query_params = {} + query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List category transactions + # Returns all transactions for a specified category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + def get_transactions_by_category(budget_id, category_id, opts = {}) + data, _status_code, _headers = get_transactions_by_category_with_http_info(budget_id, category_id, opts) + return data + end + + # List category transactions + # Returns all transactions for a specified category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [Array<(TransactionSummariesResponse, Fixnum, Hash)>] TransactionSummariesResponse data, response status code and response headers + def get_transactions_by_category_with_http_info(budget_id, category_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_category ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_category" + end + # verify the required parameter 'category_id' is set + if @api_client.config.client_side_validation && category_id.nil? + fail ArgumentError, "Missing the required parameter 'category_id' when calling TransactionsApi.get_transactions_by_category" + end + # resource path + local_var_path = "/budgets/{budget_id}/categories/{category_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'category_id' + '}', category_id.to_s) + + # query parameters + query_params = {} + query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Single transaction + # Returns a single transaction + # @param budget_id ID of budget + # @param transaction_id ID of transaction + # @param [Hash] opts the optional parameters + # @return [TransactionDetailResponse] + def get_transactions_by_id(budget_id, transaction_id, opts = {}) + data, _status_code, _headers = get_transactions_by_id_with_http_info(budget_id, transaction_id, opts) + return data + end + + # Single transaction + # Returns a single transaction + # @param budget_id ID of budget + # @param transaction_id ID of transaction + # @param [Hash] opts the optional parameters + # @return [Array<(TransactionDetailResponse, Fixnum, Hash)>] TransactionDetailResponse data, response status code and response headers + def get_transactions_by_id_with_http_info(budget_id, transaction_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_id" + end + # verify the required parameter 'transaction_id' is set + if @api_client.config.client_side_validation && transaction_id.nil? + fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.get_transactions_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/transactions/{transaction_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/swagger_client/api_client.rb b/lib/swagger_client/api_client.rb new file mode 100644 index 0000000..6242413 --- /dev/null +++ b/lib/swagger_client/api_client.rb @@ -0,0 +1,389 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'typhoeus' +require 'uri' + +module SwaggerClient + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "Swagger-Codegen/#{VERSION}/ruby" + @default_headers = { + 'Content-Type' => "application/json", + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date DateTime).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'BOOLEAN' + data == true + when 'DateTime' + # parse date time (expecting ISO 8601 format) + DateTime.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map {|item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each {|k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models, e.g. Pet + SwaggerClient.const_get(return_type).new.tap do |model| + model.build_from_hash data + end + end + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition and content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + URI.encode(@config.base_url + path) + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Update hearder and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` of `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + return json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # use application/json by default + return 'application/json' if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + return json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map{|m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/swagger_client/api_error.rb b/lib/swagger_client/api_error.rb new file mode 100644 index 0000000..2b513d7 --- /dev/null +++ b/lib/swagger_client/api_error.rb @@ -0,0 +1,38 @@ +=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.3.0-SNAPSHOT + +=end + +module SwaggerClient + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + end + end + end +end diff --git a/lib/swagger_client/configuration.rb b/lib/swagger_client/configuration.rb new file mode 100644 index 0000000..394195c --- /dev/null +++ b/lib/swagger_client/configuration.rb @@ -0,0 +1,209 @@ +=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.3.0-SNAPSHOT + +=end + +require 'uri' + +module SwaggerClient + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = '' + @base_path = '/papi/v1' + @api_key = {} + @api_key_prefix = {} + @timeout = 0 + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @params_encoding = nil + @cert_file = nil + @key_file = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = "" if @base_path == "/" + end + + def base_url + url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') + URI.encode(url) + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name) + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" + else + @api_key[param_name] + end + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'bearer' => + { + type: 'api_key', + in: 'header', + key: 'Authorization', + value: api_key_with_prefix('Authorization') + }, + } + end + end +end diff --git a/lib/swagger_client/models/account.rb b/lib/swagger_client/models/account.rb new file mode 100644 index 0000000..13c938e --- /dev/null +++ b/lib/swagger_client/models/account.rb @@ -0,0 +1,266 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class Account + attr_accessor :id + + attr_accessor :name + + attr_accessor :type + + # Whether this account is on budget or not + attr_accessor :on_budget + + # Whether this account is closed or not + attr_accessor :closed + + # The current balance of the account in milliunits format + attr_accessor :balance + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'type' => :'type', + :'on_budget' => :'on_budget', + :'closed' => :'closed', + :'balance' => :'balance' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'type' => :'String', + :'on_budget' => :'BOOLEAN', + :'closed' => :'BOOLEAN', + :'balance' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.has_key?(:'on_budget') + self.on_budget = attributes[:'on_budget'] + end + + if attributes.has_key?(:'closed') + self.closed = attributes[:'closed'] + end + + if attributes.has_key?(:'balance') + self.balance = attributes[:'balance'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @type.nil? + invalid_properties.push("invalid value for 'type', type cannot be nil.") + end + + if @on_budget.nil? + invalid_properties.push("invalid value for 'on_budget', on_budget cannot be nil.") + end + + if @closed.nil? + invalid_properties.push("invalid value for 'closed', closed cannot be nil.") + end + + if @balance.nil? + invalid_properties.push("invalid value for 'balance', balance cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @type.nil? + return false if @on_budget.nil? + return false if @closed.nil? + return false if @balance.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + type == o.type && + on_budget == o.on_budget && + closed == o.closed && + balance == o.balance + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, type, on_budget, closed, balance].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/account_response.rb b/lib/swagger_client/models/account_response.rb new file mode 100644 index 0000000..3aad5d3 --- /dev/null +++ b/lib/swagger_client/models/account_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class AccountResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'AccountWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/account_wrapper.rb b/lib/swagger_client/models/account_wrapper.rb new file mode 100644 index 0000000..e5dc202 --- /dev/null +++ b/lib/swagger_client/models/account_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class AccountWrapper + attr_accessor :account + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account' => :'account' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'account' => :'Account' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'account') + self.account = attributes[:'account'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @account.nil? + invalid_properties.push("invalid value for 'account', account cannot be nil.") + end + + return 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.nil? + return 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 == o.account + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [account].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/accounts_response.rb b/lib/swagger_client/models/accounts_response.rb new file mode 100644 index 0000000..da5b3c2 --- /dev/null +++ b/lib/swagger_client/models/accounts_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class AccountsResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'AccountsWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/accounts_wrapper.rb b/lib/swagger_client/models/accounts_wrapper.rb new file mode 100644 index 0000000..e81acb9 --- /dev/null +++ b/lib/swagger_client/models/accounts_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class AccountsWrapper + attr_accessor :accounts + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'accounts' => :'accounts' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'accounts' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'accounts') + if (value = attributes[:'accounts']).is_a?(Array) + self.accounts = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @accounts.nil? + invalid_properties.push("invalid value for 'accounts', accounts cannot be nil.") + end + + return 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 @accounts.nil? + return 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 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [accounts].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/budget_detail.rb b/lib/swagger_client/models/budget_detail.rb new file mode 100644 index 0000000..9a1adf0 --- /dev/null +++ b/lib/swagger_client/models/budget_detail.rb @@ -0,0 +1,335 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class BudgetDetail + attr_accessor :id + + attr_accessor :name + + attr_accessor :date_format + + attr_accessor :currency_format + + 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 + { + :'id' => :'id', + :'name' => :'name', + :'date_format' => :'date_format', + :'currency_format' => :'currency_format', + :'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 + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'date_format' => :'DateFormat', + :'currency_format' => :'CurrencyFormat', + :'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 + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'date_format') + self.date_format = attributes[:'date_format'] + end + + if attributes.has_key?(:'currency_format') + self.currency_format = attributes[:'currency_format'] + end + + if attributes.has_key?(:'accounts') + if (value = attributes[:'accounts']).is_a?(Array) + self.accounts = value + end + end + + if attributes.has_key?(:'payees') + if (value = attributes[:'payees']).is_a?(Array) + self.payees = value + end + end + + if attributes.has_key?(:'payee_locations') + if (value = attributes[:'payee_locations']).is_a?(Array) + self.payee_locations = value + end + end + + if attributes.has_key?(:'category_groups') + if (value = attributes[:'category_groups']).is_a?(Array) + self.category_groups = value + end + end + + if attributes.has_key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.has_key?(:'months') + if (value = attributes[:'months']).is_a?(Array) + self.months = value + end + end + + if attributes.has_key?(:'transactions') + if (value = attributes[:'transactions']).is_a?(Array) + self.transactions = value + end + end + + if attributes.has_key?(:'subtransactions') + if (value = attributes[:'subtransactions']).is_a?(Array) + self.subtransactions = value + end + end + + if attributes.has_key?(:'scheduled_transactions') + if (value = attributes[:'scheduled_transactions']).is_a?(Array) + self.scheduled_transactions = value + end + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + date_format == o.date_format && + currency_format == o.currency_format && + 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 [Fixnum] Hash code + def hash + [id, name, date_format, currency_format, 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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/budget_detail_response.rb b/lib/swagger_client/models/budget_detail_response.rb new file mode 100644 index 0000000..d29441b --- /dev/null +++ b/lib/swagger_client/models/budget_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class BudgetDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'BudgetDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/budget_detail_wrapper.rb b/lib/swagger_client/models/budget_detail_wrapper.rb new file mode 100644 index 0000000..a4665e7 --- /dev/null +++ b/lib/swagger_client/models/budget_detail_wrapper.rb @@ -0,0 +1,208 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class BudgetDetailWrapper + attr_accessor :budget + + # The knowledge of the server + attr_accessor :server_knowledge + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'budget' => :'budget', + :'server_knowledge' => :'server_knowledge' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'budget' => :'BudgetDetail', + :'server_knowledge' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'budget') + self.budget = attributes[:'budget'] + end + + if attributes.has_key?(:'server_knowledge') + self.server_knowledge = attributes[:'server_knowledge'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @budget.nil? + invalid_properties.push("invalid value for 'budget', budget cannot be nil.") + end + + if @server_knowledge.nil? + invalid_properties.push("invalid value for 'server_knowledge', server_knowledge cannot be nil.") + end + + return 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 @budget.nil? + return false if @server_knowledge.nil? + return 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 && + budget == o.budget && + server_knowledge == o.server_knowledge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [budget, server_knowledge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/budget_summary.rb b/lib/swagger_client/models/budget_summary.rb new file mode 100644 index 0000000..839fc6d --- /dev/null +++ b/lib/swagger_client/models/budget_summary.rb @@ -0,0 +1,225 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class BudgetSummary + attr_accessor :id + + attr_accessor :name + + attr_accessor :date_format + + attr_accessor :currency_format + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'date_format' => :'date_format', + :'currency_format' => :'currency_format' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'date_format' => :'DateFormat', + :'currency_format' => :'CurrencyFormat' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'date_format') + self.date_format = attributes[:'date_format'] + end + + if attributes.has_key?(:'currency_format') + self.currency_format = attributes[:'currency_format'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + date_format == o.date_format && + currency_format == o.currency_format + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, date_format, currency_format].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/budget_summary_response.rb b/lib/swagger_client/models/budget_summary_response.rb new file mode 100644 index 0000000..9b9519c --- /dev/null +++ b/lib/swagger_client/models/budget_summary_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class BudgetSummaryResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'BudgetSummaryWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/budget_summary_wrapper.rb b/lib/swagger_client/models/budget_summary_wrapper.rb new file mode 100644 index 0000000..c7ed9f7 --- /dev/null +++ b/lib/swagger_client/models/budget_summary_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class BudgetSummaryWrapper + attr_accessor :budgets + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'budgets' => :'budgets' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'budgets' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'budgets') + if (value = attributes[:'budgets']).is_a?(Array) + self.budgets = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @budgets.nil? + invalid_properties.push("invalid value for 'budgets', budgets cannot be nil.") + end + + return 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 @budgets.nil? + return 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 && + budgets == o.budgets + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [budgets].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/categories_response.rb b/lib/swagger_client/models/categories_response.rb new file mode 100644 index 0000000..4ad2fd7 --- /dev/null +++ b/lib/swagger_client/models/categories_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class CategoriesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'CategoryGroupsWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/category.rb b/lib/swagger_client/models/category.rb new file mode 100644 index 0000000..fa5928e --- /dev/null +++ b/lib/swagger_client/models/category.rb @@ -0,0 +1,281 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class Category + attr_accessor :id + + attr_accessor :category_group_id + + attr_accessor :name + + # Whether or not the category is hidden + attr_accessor :hidden + + # Budgeted amount in current month in milliunits format + attr_accessor :budgeted + + # Activity amount in current month in milliunits format + attr_accessor :activity + + # Balance in current month in milliunits format + attr_accessor :balance + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'category_group_id' => :'category_group_id', + :'name' => :'name', + :'hidden' => :'hidden', + :'budgeted' => :'budgeted', + :'activity' => :'activity', + :'balance' => :'balance' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'category_group_id' => :'String', + :'name' => :'String', + :'hidden' => :'BOOLEAN', + :'budgeted' => :'Float', + :'activity' => :'Float', + :'balance' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'category_group_id') + self.category_group_id = attributes[:'category_group_id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + if attributes.has_key?(:'budgeted') + self.budgeted = attributes[:'budgeted'] + end + + if attributes.has_key?(:'activity') + self.activity = attributes[:'activity'] + end + + if attributes.has_key?(:'balance') + self.balance = attributes[:'balance'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @category_group_id.nil? + invalid_properties.push("invalid value for 'category_group_id', category_group_id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @hidden.nil? + invalid_properties.push("invalid value for 'hidden', hidden cannot be nil.") + end + + if @budgeted.nil? + invalid_properties.push("invalid value for 'budgeted', budgeted cannot be nil.") + end + + if @activity.nil? + invalid_properties.push("invalid value for 'activity', activity cannot be nil.") + end + + if @balance.nil? + invalid_properties.push("invalid value for 'balance', balance cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @category_group_id.nil? + return false if @name.nil? + return false if @hidden.nil? + return false if @budgeted.nil? + return false if @activity.nil? + return false if @balance.nil? + return 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 && + category_group_id == o.category_group_id && + name == o.name && + hidden == o.hidden && + budgeted == o.budgeted && + activity == o.activity && + balance == o.balance + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, category_group_id, name, hidden, budgeted, activity, balance].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/category_group.rb b/lib/swagger_client/models/category_group.rb new file mode 100644 index 0000000..ae804c3 --- /dev/null +++ b/lib/swagger_client/models/category_group.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class CategoryGroup + attr_accessor :id + + attr_accessor :name + + # Whether or not the category group is hidden + attr_accessor :hidden + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'hidden' => :'hidden' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'hidden' => :'BOOLEAN' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @hidden.nil? + invalid_properties.push("invalid value for 'hidden', hidden cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @hidden.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + hidden == o.hidden + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, hidden].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/category_group_with_categories.rb b/lib/swagger_client/models/category_group_with_categories.rb new file mode 100644 index 0000000..fb1654a --- /dev/null +++ b/lib/swagger_client/models/category_group_with_categories.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class CategoryGroupWithCategories + attr_accessor :id + + attr_accessor :name + + # Whether or not the category group is hidden + attr_accessor :hidden + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'hidden' => :'hidden' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'hidden' => :'BOOLEAN' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @hidden.nil? + invalid_properties.push("invalid value for 'hidden', hidden cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @hidden.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + hidden == o.hidden + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, hidden].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/category_groups_wrapper.rb b/lib/swagger_client/models/category_groups_wrapper.rb new file mode 100644 index 0000000..c31c780 --- /dev/null +++ b/lib/swagger_client/models/category_groups_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class CategoryGroupsWrapper + attr_accessor :category_groups + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category_groups' => :'category_groups' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'category_groups' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'category_groups') + if (value = attributes[:'category_groups']).is_a?(Array) + self.category_groups = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @category_groups.nil? + invalid_properties.push("invalid value for 'category_groups', category_groups cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @category_groups.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category_groups == o.category_groups + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [category_groups].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/category_response.rb b/lib/swagger_client/models/category_response.rb new file mode 100644 index 0000000..8302451 --- /dev/null +++ b/lib/swagger_client/models/category_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class CategoryResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'CategoryWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/category_wrapper.rb b/lib/swagger_client/models/category_wrapper.rb new file mode 100644 index 0000000..5412e91 --- /dev/null +++ b/lib/swagger_client/models/category_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class CategoryWrapper + attr_accessor :category + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'category' => :'Category' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'category') + self.category = attributes[:'category'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @category.nil? + invalid_properties.push("invalid value for 'category', category cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @category.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [category].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/currency_format.rb b/lib/swagger_client/models/currency_format.rb new file mode 100644 index 0000000..7d35e3a --- /dev/null +++ b/lib/swagger_client/models/currency_format.rb @@ -0,0 +1,179 @@ +=begin +#YNAB API Endpoints + +#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com + +OpenAPI spec version: 1.0.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +Swagger Codegen version: 2.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class CurrencyFormat + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return 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 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 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/date_format.rb b/lib/swagger_client/models/date_format.rb new file mode 100644 index 0000000..17845ba --- /dev/null +++ b/lib/swagger_client/models/date_format.rb @@ -0,0 +1,179 @@ +=begin +#YNAB API Endpoints + +#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com + +OpenAPI spec version: 1.0.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +Swagger Codegen version: 2.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class DateFormat + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return 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 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 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/error_detail.rb b/lib/swagger_client/models/error_detail.rb new file mode 100644 index 0000000..a5dd728 --- /dev/null +++ b/lib/swagger_client/models/error_detail.rb @@ -0,0 +1,221 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ErrorDetail + attr_accessor :id + + attr_accessor :name + + attr_accessor :description + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'description') + self.description = attributes[:'description'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @description.nil? + invalid_properties.push("invalid value for 'description', description cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @description.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, description].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/error_response.rb b/lib/swagger_client/models/error_response.rb new file mode 100644 index 0000000..a90f624 --- /dev/null +++ b/lib/swagger_client/models/error_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ErrorResponse + attr_accessor :error + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'error' => :'error' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'error' => :'ErrorDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'error') + self.error = attributes[:'error'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @error.nil? + invalid_properties.push("invalid value for 'error', error cannot be nil.") + end + + return 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 @error.nil? + return 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 && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [error].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/month_detail.rb b/lib/swagger_client/models/month_detail.rb new file mode 100644 index 0000000..d8b1ccd --- /dev/null +++ b/lib/swagger_client/models/month_detail.rb @@ -0,0 +1,210 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class MonthDetail + attr_accessor :month + + # The budget month categories + attr_accessor :categories + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month', + :'categories' => :'categories' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'month' => :'Date', + :'categories' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @month.nil? + invalid_properties.push("invalid value for 'month', month cannot be nil.") + end + + if @categories.nil? + invalid_properties.push("invalid value for 'categories', categories cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return false if @categories.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month && + 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 [Fixnum] Hash code + def hash + [month, 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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/month_detail_response.rb b/lib/swagger_client/models/month_detail_response.rb new file mode 100644 index 0000000..ec8290b --- /dev/null +++ b/lib/swagger_client/models/month_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class MonthDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'MonthDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/month_detail_wrapper.rb b/lib/swagger_client/models/month_detail_wrapper.rb new file mode 100644 index 0000000..27bd8bf --- /dev/null +++ b/lib/swagger_client/models/month_detail_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class MonthDetailWrapper + attr_accessor :month + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'month' => :'MonthDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'month') + self.month = attributes[:'month'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @month.nil? + invalid_properties.push("invalid value for 'month', month cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [month].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/month_summaries_response.rb b/lib/swagger_client/models/month_summaries_response.rb new file mode 100644 index 0000000..536ba73 --- /dev/null +++ b/lib/swagger_client/models/month_summaries_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class MonthSummariesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'MonthSummariesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/month_summaries_wrapper.rb b/lib/swagger_client/models/month_summaries_wrapper.rb new file mode 100644 index 0000000..0736070 --- /dev/null +++ b/lib/swagger_client/models/month_summaries_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class MonthSummariesWrapper + attr_accessor :months + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'months' => :'months' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'months' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'months') + if (value = attributes[:'months']).is_a?(Array) + self.months = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @months.nil? + invalid_properties.push("invalid value for 'months', months cannot be nil.") + end + + return 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 @months.nil? + return 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 && + months == o.months + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [months].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/month_summary.rb b/lib/swagger_client/models/month_summary.rb new file mode 100644 index 0000000..8294ff4 --- /dev/null +++ b/lib/swagger_client/models/month_summary.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class MonthSummary + attr_accessor :month + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'month' => :'Date' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'month') + self.month = attributes[:'month'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @month.nil? + invalid_properties.push("invalid value for 'month', month cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [month].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee.rb b/lib/swagger_client/models/payee.rb new file mode 100644 index 0000000..a65d6bd --- /dev/null +++ b/lib/swagger_client/models/payee.rb @@ -0,0 +1,207 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class Payee + attr_accessor :id + + attr_accessor :name + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, 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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee_location.rb b/lib/swagger_client/models/payee_location.rb new file mode 100644 index 0000000..12755c4 --- /dev/null +++ b/lib/swagger_client/models/payee_location.rb @@ -0,0 +1,207 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeeLocation + attr_accessor :id + + attr_accessor :payee_id + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'payee_id' => :'payee_id' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'payee_id' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @payee_id.nil? + invalid_properties.push("invalid value for 'payee_id', payee_id cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @payee_id.nil? + return 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 && + payee_id == o.payee_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 [Fixnum] Hash code + def hash + [id, payee_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee_location_response.rb b/lib/swagger_client/models/payee_location_response.rb new file mode 100644 index 0000000..c646c8e --- /dev/null +++ b/lib/swagger_client/models/payee_location_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeeLocationResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeeLocationWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee_location_wrapper.rb b/lib/swagger_client/models/payee_location_wrapper.rb new file mode 100644 index 0000000..8663c02 --- /dev/null +++ b/lib/swagger_client/models/payee_location_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeeLocationWrapper + attr_accessor :payee_location + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee_location' => :'payee_location' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payee_location' => :'PayeeLocation' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payee_location') + self.payee_location = attributes[:'payee_location'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee_location.nil? + invalid_properties.push("invalid value for 'payee_location', payee_location cannot be nil.") + end + + return 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_location.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee_location == o.payee_location + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payee_location].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee_locations_response.rb b/lib/swagger_client/models/payee_locations_response.rb new file mode 100644 index 0000000..59c283a --- /dev/null +++ b/lib/swagger_client/models/payee_locations_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeeLocationsResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeeLocationsWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee_locations_wrapper.rb b/lib/swagger_client/models/payee_locations_wrapper.rb new file mode 100644 index 0000000..d2b4466 --- /dev/null +++ b/lib/swagger_client/models/payee_locations_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeeLocationsWrapper + attr_accessor :payee_locations + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee_locations' => :'payee_locations' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payee_locations' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payee_locations') + if (value = attributes[:'payee_locations']).is_a?(Array) + self.payee_locations = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee_locations.nil? + invalid_properties.push("invalid value for 'payee_locations', payee_locations cannot be nil.") + end + + return 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_locations.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee_locations == o.payee_locations + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payee_locations].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee_response.rb b/lib/swagger_client/models/payee_response.rb new file mode 100644 index 0000000..69bbf82 --- /dev/null +++ b/lib/swagger_client/models/payee_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeeResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeeWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payee_wrapper.rb b/lib/swagger_client/models/payee_wrapper.rb new file mode 100644 index 0000000..0db21fa --- /dev/null +++ b/lib/swagger_client/models/payee_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeeWrapper + attr_accessor :payee + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee' => :'payee' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payee' => :'Payee' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payee') + self.payee = attributes[:'payee'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee.nil? + invalid_properties.push("invalid value for 'payee', payee cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @payee.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee == o.payee + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payee].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payees_response.rb b/lib/swagger_client/models/payees_response.rb new file mode 100644 index 0000000..3896847 --- /dev/null +++ b/lib/swagger_client/models/payees_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/payees_wrapper.rb b/lib/swagger_client/models/payees_wrapper.rb new file mode 100644 index 0000000..155a137 --- /dev/null +++ b/lib/swagger_client/models/payees_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class PayeesWrapper + attr_accessor :payees + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payees' => :'payees' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payees' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payees') + if (value = attributes[:'payees']).is_a?(Array) + self.payees = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payees.nil? + invalid_properties.push("invalid value for 'payees', payees cannot be nil.") + end + + return 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 @payees.nil? + return 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 && + payees == o.payees + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payees].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/scheduled_sub_transaction.rb b/lib/swagger_client/models/scheduled_sub_transaction.rb new file mode 100644 index 0000000..257b09f --- /dev/null +++ b/lib/swagger_client/models/scheduled_sub_transaction.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ScheduledSubTransaction + attr_accessor :id + + attr_accessor :scheduled_transaction_id + + # The current balance of the account in milliunits format + attr_accessor :amount + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'scheduled_transaction_id' => :'scheduled_transaction_id', + :'amount' => :'amount' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'scheduled_transaction_id' => :'String', + :'amount' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'scheduled_transaction_id') + self.scheduled_transaction_id = attributes[:'scheduled_transaction_id'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @scheduled_transaction_id.nil? + invalid_properties.push("invalid value for 'scheduled_transaction_id', scheduled_transaction_id cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @scheduled_transaction_id.nil? + return false if @amount.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + scheduled_transaction_id == o.scheduled_transaction_id && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, scheduled_transaction_id, amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/scheduled_transaction_detail.rb b/lib/swagger_client/models/scheduled_transaction_detail.rb new file mode 100644 index 0000000..eddcbe6 --- /dev/null +++ b/lib/swagger_client/models/scheduled_transaction_detail.rb @@ -0,0 +1,267 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ScheduledTransactionDetail + attr_accessor :id + + attr_accessor :date + + attr_accessor :frequency + + # The current balance of the account in milliunits format + attr_accessor :amount + + attr_accessor :account_id + + # If a split scheduled transaction, the sub-transactions. + attr_accessor :subtransactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'frequency' => :'frequency', + :'amount' => :'amount', + :'account_id' => :'account_id', + :'subtransactions' => :'subtransactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'frequency' => :'String', + :'amount' => :'Float', + :'account_id' => :'String', + :'subtransactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'frequency') + self.frequency = attributes[:'frequency'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @frequency.nil? + invalid_properties.push("invalid value for 'frequency', frequency cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + if @subtransactions.nil? + invalid_properties.push("invalid value for 'subtransactions', subtransactions cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @frequency.nil? + return false if @amount.nil? + return false if @account_id.nil? + return false if @subtransactions.nil? + return 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 && + date == o.date && + frequency == o.frequency && + amount == o.amount && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, frequency, amount, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/scheduled_transaction_detail_response.rb b/lib/swagger_client/models/scheduled_transaction_detail_response.rb new file mode 100644 index 0000000..8fe7e3f --- /dev/null +++ b/lib/swagger_client/models/scheduled_transaction_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ScheduledTransactionDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'ScheduledTransactionDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/scheduled_transaction_detail_wrapper.rb b/lib/swagger_client/models/scheduled_transaction_detail_wrapper.rb new file mode 100644 index 0000000..5a2f575 --- /dev/null +++ b/lib/swagger_client/models/scheduled_transaction_detail_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ScheduledTransactionDetailWrapper + attr_accessor :scheduled_transaction + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'scheduled_transaction' => :'scheduled_transaction' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'scheduled_transaction' => :'ScheduledTransactionDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'scheduled_transaction') + self.scheduled_transaction = attributes[:'scheduled_transaction'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @scheduled_transaction.nil? + invalid_properties.push("invalid value for 'scheduled_transaction', scheduled_transaction cannot be nil.") + end + + return 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 @scheduled_transaction.nil? + return 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 && + scheduled_transaction == o.scheduled_transaction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [scheduled_transaction].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/scheduled_transaction_summaries_response.rb b/lib/swagger_client/models/scheduled_transaction_summaries_response.rb new file mode 100644 index 0000000..b5617ba --- /dev/null +++ b/lib/swagger_client/models/scheduled_transaction_summaries_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ScheduledTransactionSummariesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'ScheduledTransactionSummariesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/scheduled_transaction_summaries_wrapper.rb b/lib/swagger_client/models/scheduled_transaction_summaries_wrapper.rb new file mode 100644 index 0000000..bbb28c1 --- /dev/null +++ b/lib/swagger_client/models/scheduled_transaction_summaries_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ScheduledTransactionSummariesWrapper + attr_accessor :scheduled_transactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'scheduled_transactions' => :'scheduled_transactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'scheduled_transactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'scheduled_transactions') + if (value = attributes[:'scheduled_transactions']).is_a?(Array) + self.scheduled_transactions = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @scheduled_transactions.nil? + invalid_properties.push("invalid value for 'scheduled_transactions', scheduled_transactions cannot be nil.") + end + + return 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 @scheduled_transactions.nil? + return 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 && + scheduled_transactions == o.scheduled_transactions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [scheduled_transactions].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/scheduled_transaction_summary.rb b/lib/swagger_client/models/scheduled_transaction_summary.rb new file mode 100644 index 0000000..580e41d --- /dev/null +++ b/lib/swagger_client/models/scheduled_transaction_summary.rb @@ -0,0 +1,250 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class ScheduledTransactionSummary + attr_accessor :id + + attr_accessor :date + + attr_accessor :frequency + + # The current balance of the account in milliunits format + attr_accessor :amount + + attr_accessor :account_id + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'frequency' => :'frequency', + :'amount' => :'amount', + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'frequency' => :'String', + :'amount' => :'Float', + :'account_id' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'frequency') + self.frequency = attributes[:'frequency'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @frequency.nil? + invalid_properties.push("invalid value for 'frequency', frequency cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @frequency.nil? + return false if @amount.nil? + return false if @account_id.nil? + return 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 && + date == o.date && + frequency == o.frequency && + amount == o.amount && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, frequency, amount, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/sub_transaction.rb b/lib/swagger_client/models/sub_transaction.rb new file mode 100644 index 0000000..85dfe54 --- /dev/null +++ b/lib/swagger_client/models/sub_transaction.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class SubTransaction + attr_accessor :id + + attr_accessor :transaction_id + + # The current balance of the account in milliunits format + attr_accessor :amount + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'transaction_id' => :'transaction_id', + :'amount' => :'amount' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'transaction_id' => :'String', + :'amount' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'transaction_id') + self.transaction_id = attributes[:'transaction_id'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @transaction_id.nil? + invalid_properties.push("invalid value for 'transaction_id', transaction_id cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @transaction_id.nil? + return false if @amount.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + transaction_id == o.transaction_id && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, transaction_id, amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/transaction_detail.rb b/lib/swagger_client/models/transaction_detail.rb new file mode 100644 index 0000000..14b9946 --- /dev/null +++ b/lib/swagger_client/models/transaction_detail.rb @@ -0,0 +1,283 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class TransactionDetail + attr_accessor :id + + attr_accessor :date + + # The current balance of the account in milliunits format + attr_accessor :amount + + # The cleared status of the transaction + attr_accessor :cleared + + # Whether or not the transaction is approved + attr_accessor :approved + + attr_accessor :account_id + + # If a split transaction, the sub-transactions. + attr_accessor :subtransactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'amount' => :'amount', + :'cleared' => :'cleared', + :'approved' => :'approved', + :'account_id' => :'account_id', + :'subtransactions' => :'subtransactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'amount' => :'Float', + :'cleared' => :'String', + :'approved' => :'BOOLEAN', + :'account_id' => :'String', + :'subtransactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'cleared') + self.cleared = attributes[:'cleared'] + end + + if attributes.has_key?(:'approved') + self.approved = attributes[:'approved'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @cleared.nil? + invalid_properties.push("invalid value for 'cleared', cleared cannot be nil.") + end + + if @approved.nil? + invalid_properties.push("invalid value for 'approved', approved cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + if @subtransactions.nil? + invalid_properties.push("invalid value for 'subtransactions', subtransactions cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @amount.nil? + return false if @cleared.nil? + return false if @approved.nil? + return false if @account_id.nil? + return false if @subtransactions.nil? + return 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 && + date == o.date && + amount == o.amount && + cleared == o.cleared && + approved == o.approved && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, amount, cleared, approved, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/transaction_detail_response.rb b/lib/swagger_client/models/transaction_detail_response.rb new file mode 100644 index 0000000..e4997b6 --- /dev/null +++ b/lib/swagger_client/models/transaction_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class TransactionDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'TransactionDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/transaction_detail_wrapper.rb b/lib/swagger_client/models/transaction_detail_wrapper.rb new file mode 100644 index 0000000..f950323 --- /dev/null +++ b/lib/swagger_client/models/transaction_detail_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class TransactionDetailWrapper + attr_accessor :transaction + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'transaction' => :'transaction' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'transaction' => :'TransactionDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'transaction') + self.transaction = attributes[:'transaction'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @transaction.nil? + invalid_properties.push("invalid value for 'transaction', transaction cannot be nil.") + end + + return 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 @transaction.nil? + return 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 && + transaction == o.transaction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [transaction].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/transaction_summaries_response.rb b/lib/swagger_client/models/transaction_summaries_response.rb new file mode 100644 index 0000000..599adb0 --- /dev/null +++ b/lib/swagger_client/models/transaction_summaries_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class TransactionSummariesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'TransactionSummariesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/transaction_summaries_wrapper.rb b/lib/swagger_client/models/transaction_summaries_wrapper.rb new file mode 100644 index 0000000..78c77a9 --- /dev/null +++ b/lib/swagger_client/models/transaction_summaries_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class TransactionSummariesWrapper + attr_accessor :transactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'transactions' => :'transactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'transactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'transactions') + if (value = attributes[:'transactions']).is_a?(Array) + self.transactions = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @transactions.nil? + invalid_properties.push("invalid value for 'transactions', transactions cannot be nil.") + end + + return 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 @transactions.nil? + return 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 && + transactions == o.transactions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [transactions].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/models/transaction_summary.rb b/lib/swagger_client/models/transaction_summary.rb new file mode 100644 index 0000000..6d9f3b8 --- /dev/null +++ b/lib/swagger_client/models/transaction_summary.rb @@ -0,0 +1,266 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module SwaggerClient + + class TransactionSummary + attr_accessor :id + + attr_accessor :date + + # The current balance of the account in milliunits format + attr_accessor :amount + + # The cleared status of the transaction + attr_accessor :cleared + + # Whether or not the transaction is approved + attr_accessor :approved + + attr_accessor :account_id + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'amount' => :'amount', + :'cleared' => :'cleared', + :'approved' => :'approved', + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'amount' => :'Float', + :'cleared' => :'String', + :'approved' => :'BOOLEAN', + :'account_id' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'cleared') + self.cleared = attributes[:'cleared'] + end + + if attributes.has_key?(:'approved') + self.approved = attributes[:'approved'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @cleared.nil? + invalid_properties.push("invalid value for 'cleared', cleared cannot be nil.") + end + + if @approved.nil? + invalid_properties.push("invalid value for 'approved', approved cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @amount.nil? + return false if @cleared.nil? + return false if @approved.nil? + return false if @account_id.nil? + return 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 && + date == o.date && + amount == o.amount && + cleared == o.cleared && + approved == o.approved && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, amount, cleared, approved, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = SwaggerClient.const_get(type).new + temp_model.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) + next if value.nil? + 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/swagger_client/version.rb b/lib/swagger_client/version.rb new file mode 100644 index 0000000..6e37493 --- /dev/null +++ b/lib/swagger_client/version.rb @@ -0,0 +1,15 @@ +=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.3.0-SNAPSHOT + +=end + +module SwaggerClient + VERSION = "1.0.0" +end diff --git a/lib/ynab.rb b/lib/ynab.rb new file mode 100644 index 0000000..97e2c75 --- /dev/null +++ b/lib/ynab.rb @@ -0,0 +1,99 @@ +=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.3.0-SNAPSHOT + +=end + +# Common files +require 'ynab/api_client' +require 'ynab/api_error' +require 'ynab/version' +require 'ynab/configuration' + +# Models +require 'ynab/models/account' +require 'ynab/models/account_response' +require 'ynab/models/account_wrapper' +require 'ynab/models/accounts_response' +require 'ynab/models/accounts_wrapper' +require 'ynab/models/budget_detail_response' +require 'ynab/models/budget_detail_wrapper' +require 'ynab/models/budget_summary' +require 'ynab/models/budget_summary_response' +require 'ynab/models/budget_summary_wrapper' +require 'ynab/models/categories_response' +require 'ynab/models/category' +require 'ynab/models/category_group' +require 'ynab/models/category_groups_wrapper' +require 'ynab/models/category_response' +require 'ynab/models/category_wrapper' +require 'ynab/models/currency_format' +require 'ynab/models/date_format' +require 'ynab/models/error_detail' +require 'ynab/models/error_response' +require 'ynab/models/month_detail_response' +require 'ynab/models/month_detail_wrapper' +require 'ynab/models/month_summaries_response' +require 'ynab/models/month_summaries_wrapper' +require 'ynab/models/month_summary' +require 'ynab/models/payee' +require 'ynab/models/payee_location' +require 'ynab/models/payee_location_response' +require 'ynab/models/payee_location_wrapper' +require 'ynab/models/payee_locations_response' +require 'ynab/models/payee_locations_wrapper' +require 'ynab/models/payee_response' +require 'ynab/models/payee_wrapper' +require 'ynab/models/payees_response' +require 'ynab/models/payees_wrapper' +require 'ynab/models/scheduled_sub_transaction' +require 'ynab/models/scheduled_transaction_detail_response' +require 'ynab/models/scheduled_transaction_detail_wrapper' +require 'ynab/models/scheduled_transaction_summaries_response' +require 'ynab/models/scheduled_transaction_summaries_wrapper' +require 'ynab/models/scheduled_transaction_summary' +require 'ynab/models/sub_transaction' +require 'ynab/models/transaction_detail_response' +require 'ynab/models/transaction_detail_wrapper' +require 'ynab/models/transaction_summaries_response' +require 'ynab/models/transaction_summaries_wrapper' +require 'ynab/models/transaction_summary' +require 'ynab/models/budget_detail' +require 'ynab/models/category_group_with_categories' +require 'ynab/models/month_detail' +require 'ynab/models/scheduled_transaction_detail' +require 'ynab/models/transaction_detail' + +# APIs +require 'ynab/api/accounts_api' +require 'ynab/api/budgets_api' +require 'ynab/api/categories_api' +require 'ynab/api/months_api' +require 'ynab/api/payee_locations_api' +require 'ynab/api/payees_api' +require 'ynab/api/scheduled_transactions_api' +require 'ynab/api/transactions_api' + +module YnabAPI + class << self + # Customize default settings for the SDK using block. + # YnabAPI.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/ynab/api/accounts_api.rb b/lib/ynab/api/accounts_api.rb new file mode 100644 index 0000000..7b7494f --- /dev/null +++ b/lib/ynab/api/accounts_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class AccountsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single account + # Returns a single account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @return [AccountResponse] + def get_account_by_id(budget_id, account_id, opts = {}) + data, _status_code, _headers = get_account_by_id_with_http_info(budget_id, account_id, opts) + return data + end + + # Single account + # Returns a single account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @return [Array<(AccountResponse, Fixnum, Hash)>] AccountResponse data, response status code and response headers + def get_account_by_id_with_http_info(budget_id, account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: AccountsApi.get_account_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_account_by_id" + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountsApi.get_account_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/accounts/{account_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'account_id' + '}', account_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'AccountResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AccountsApi#get_account_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Account list + # Returns all accounts + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [AccountsResponse] + def get_accounts(budget_id, opts = {}) + data, _status_code, _headers = get_accounts_with_http_info(budget_id, opts) + return data + end + + # Account list + # Returns all accounts + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(AccountsResponse, Fixnum, Hash)>] AccountsResponse data, response status code and response headers + def get_accounts_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: AccountsApi.get_accounts ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling AccountsApi.get_accounts" + end + # resource path + local_var_path = "/budgets/{budget_id}/accounts".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'AccountsResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AccountsApi#get_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/budgets_api.rb b/lib/ynab/api/budgets_api.rb new file mode 100644 index 0000000..b3c13d7 --- /dev/null +++ b/lib/ynab/api/budgets_api.rb @@ -0,0 +1,126 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class BudgetsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single budget + # Returns a single budget with all related entities. This resource is effectively a full budget export. + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Float] :last_knowledge_of_server Starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. + # @return [BudgetDetailResponse] + def get_budget_contents(budget_id, opts = {}) + data, _status_code, _headers = get_budget_contents_with_http_info(budget_id, opts) + return data + end + + # Single budget + # Returns a single budget with all related entities. This resource is effectively a full budget export. + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Float] :last_knowledge_of_server Starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. + # @return [Array<(BudgetDetailResponse, Fixnum, Hash)>] BudgetDetailResponse data, response status code and response headers + def get_budget_contents_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: BudgetsApi.get_budget_contents ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_contents" + end + # resource path + local_var_path = "/budgets/{budget_id}".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'BudgetDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BudgetsApi#get_budget_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List budgets + # Returns budgets list with summary information + # @param [Hash] opts the optional parameters + # @return [BudgetSummaryResponse] + def get_budgets(opts = {}) + data, _status_code, _headers = get_budgets_with_http_info(opts) + return data + end + + # List budgets + # Returns budgets list with summary information + # @param [Hash] opts the optional parameters + # @return [Array<(BudgetSummaryResponse, Fixnum, Hash)>] BudgetSummaryResponse data, response status code and response headers + def get_budgets_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: BudgetsApi.get_budgets ..." + end + # resource path + local_var_path = "/budgets" + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'BudgetSummaryResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BudgetsApi#get_budgets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/categories_api.rb b/lib/ynab/api/categories_api.rb new file mode 100644 index 0000000..e582058 --- /dev/null +++ b/lib/ynab/api/categories_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class CategoriesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # List categories + # Returns all categories grouped by category group + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [CategoriesResponse] + def get_categories(budget_id, opts = {}) + data, _status_code, _headers = get_categories_with_http_info(budget_id, opts) + return data + end + + # List categories + # Returns all categories grouped by category group + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(CategoriesResponse, Fixnum, Hash)>] CategoriesResponse data, response status code and response headers + def get_categories_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: CategoriesApi.get_categories ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_categories" + end + # resource path + local_var_path = "/budgets/{budget_id}/categories".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'CategoriesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CategoriesApi#get_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Single category + # Returns a single category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @return [CategoryResponse] + def get_category_by_id(budget_id, category_id, opts = {}) + data, _status_code, _headers = get_category_by_id_with_http_info(budget_id, category_id, opts) + return data + end + + # Single category + # Returns a single category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @return [Array<(CategoryResponse, Fixnum, Hash)>] CategoryResponse data, response status code and response headers + def get_category_by_id_with_http_info(budget_id, category_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: CategoriesApi.get_category_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling CategoriesApi.get_category_by_id" + end + # verify the required parameter 'category_id' is set + if @api_client.config.client_side_validation && category_id.nil? + fail ArgumentError, "Missing the required parameter 'category_id' when calling CategoriesApi.get_category_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/categories/{category_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'category_id' + '}', category_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'CategoryResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CategoriesApi#get_category_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/months_api.rb b/lib/ynab/api/months_api.rb new file mode 100644 index 0000000..618f9e2 --- /dev/null +++ b/lib/ynab/api/months_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class MonthsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single budget month + # Returns a single budget month + # @param budget_id ID of budget + # @param month The budget month. \"current\" can also be used to specify the current calendar month (UTC). + # @param [Hash] opts the optional parameters + # @return [MonthDetailResponse] + def get_budget_month(budget_id, month, opts = {}) + data, _status_code, _headers = get_budget_month_with_http_info(budget_id, month, opts) + return data + end + + # Single budget month + # Returns a single budget month + # @param budget_id ID of budget + # @param month The budget month. \"current\" can also be used to specify the current calendar month (UTC). + # @param [Hash] opts the optional parameters + # @return [Array<(MonthDetailResponse, Fixnum, Hash)>] MonthDetailResponse data, response status code and response headers + def get_budget_month_with_http_info(budget_id, month, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: MonthsApi.get_budget_month ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling MonthsApi.get_budget_month" + end + # verify the required parameter 'month' is set + if @api_client.config.client_side_validation && month.nil? + fail ArgumentError, "Missing the required parameter 'month' when calling MonthsApi.get_budget_month" + end + # resource path + local_var_path = "/budgets/{budget_id}/months/{month}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'month' + '}', month.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'MonthDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonthsApi#get_budget_month\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List budget months + # Returns all budget months + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [MonthSummariesResponse] + def get_budget_months(budget_id, opts = {}) + data, _status_code, _headers = get_budget_months_with_http_info(budget_id, opts) + return data + end + + # List budget months + # Returns all budget months + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(MonthSummariesResponse, Fixnum, Hash)>] MonthSummariesResponse data, response status code and response headers + def get_budget_months_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: MonthsApi.get_budget_months ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling MonthsApi.get_budget_months" + end + # resource path + local_var_path = "/budgets/{budget_id}/months".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'MonthSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonthsApi#get_budget_months\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/payee_locations_api.rb b/lib/ynab/api/payee_locations_api.rb new file mode 100644 index 0000000..cb55b79 --- /dev/null +++ b/lib/ynab/api/payee_locations_api.rb @@ -0,0 +1,194 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class PayeeLocationsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single payee location + # Returns a single payee location + # @param budget_id ID of budget + # @param payee_location_id ID of payee location + # @param [Hash] opts the optional parameters + # @return [PayeeLocationResponse] + def get_payee_location_by_id(budget_id, payee_location_id, opts = {}) + data, _status_code, _headers = get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts) + return data + end + + # Single payee location + # Returns a single payee location + # @param budget_id ID of budget + # @param payee_location_id ID of payee location + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeLocationResponse, Fixnum, Hash)>] PayeeLocationResponse data, response status code and response headers + def get_payee_location_by_id_with_http_info(budget_id, payee_location_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_location_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_location_by_id" + end + # verify the required parameter 'payee_location_id' is set + if @api_client.config.client_side_validation && payee_location_id.nil? + fail ArgumentError, "Missing the required parameter 'payee_location_id' when calling PayeeLocationsApi.get_payee_location_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/payee_locations/{payee_location_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_location_id' + '}', payee_location_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeLocationResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_location_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List payee locations + # Returns all payee locations + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [PayeeLocationsResponse] + def get_payee_locations(budget_id, opts = {}) + data, _status_code, _headers = get_payee_locations_with_http_info(budget_id, opts) + return data + end + + # List payee locations + # Returns all payee locations + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeLocationsResponse, Fixnum, Hash)>] PayeeLocationsResponse data, response status code and response headers + def get_payee_locations_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_locations ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_locations" + end + # resource path + local_var_path = "/budgets/{budget_id}/payee_locations".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeLocationsResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List locations for a payee + # Returns all payee locations for the specified payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [PayeeLocationsResponse] + def get_payee_locations_by_payee(budget_id, payee_id, opts = {}) + data, _status_code, _headers = get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts) + return data + end + + # List locations for a payee + # Returns all payee locations for the specified payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeLocationsResponse, Fixnum, Hash)>] PayeeLocationsResponse data, response status code and response headers + def get_payee_locations_by_payee_with_http_info(budget_id, payee_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeeLocationsApi.get_payee_locations_by_payee ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeeLocationsApi.get_payee_locations_by_payee" + end + # verify the required parameter 'payee_id' is set + if @api_client.config.client_side_validation && payee_id.nil? + fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeeLocationsApi.get_payee_locations_by_payee" + end + # resource path + local_var_path = "/budgets/{budget_id}/payees/{payee_id}/payee_locations".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_id' + '}', payee_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeLocationsResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeeLocationsApi#get_payee_locations_by_payee\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/payees_api.rb b/lib/ynab/api/payees_api.rb new file mode 100644 index 0000000..c0c4fa5 --- /dev/null +++ b/lib/ynab/api/payees_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class PayeesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single payee + # Returns single payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [PayeeResponse] + def get_payee_by_id(budget_id, payee_id, opts = {}) + data, _status_code, _headers = get_payee_by_id_with_http_info(budget_id, payee_id, opts) + return data + end + + # Single payee + # Returns single payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [Array<(PayeeResponse, Fixnum, Hash)>] PayeeResponse data, response status code and response headers + def get_payee_by_id_with_http_info(budget_id, payee_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeesApi.get_payee_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payee_by_id" + end + # verify the required parameter 'payee_id' is set + if @api_client.config.client_side_validation && payee_id.nil? + fail ArgumentError, "Missing the required parameter 'payee_id' when calling PayeesApi.get_payee_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/payees/{payee_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'payee_id' + '}', payee_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeeResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeesApi#get_payee_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List payees + # Returns all payees + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [PayeesResponse] + def get_payees(budget_id, opts = {}) + data, _status_code, _headers = get_payees_with_http_info(budget_id, opts) + return data + end + + # List payees + # Returns all payees + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(PayeesResponse, Fixnum, Hash)>] PayeesResponse data, response status code and response headers + def get_payees_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: PayeesApi.get_payees ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling PayeesApi.get_payees" + end + # resource path + local_var_path = "/budgets/{budget_id}/payees".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'PayeesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayeesApi#get_payees\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/scheduled_transactions_api.rb b/lib/ynab/api/scheduled_transactions_api.rb new file mode 100644 index 0000000..963d1cd --- /dev/null +++ b/lib/ynab/api/scheduled_transactions_api.rb @@ -0,0 +1,135 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class ScheduledTransactionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # Single scheduled transaction + # Returns a single scheduled transaction + # @param budget_id ID of budget + # @param scheduled_transaction_id ID of scheduled transaction + # @param [Hash] opts the optional parameters + # @return [ScheduledTransactionDetailResponse] + def get_scheduled_transaction_by_id(budget_id, scheduled_transaction_id, opts = {}) + data, _status_code, _headers = get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts) + return data + end + + # Single scheduled transaction + # Returns a single scheduled transaction + # @param budget_id ID of budget + # @param scheduled_transaction_id ID of scheduled transaction + # @param [Hash] opts the optional parameters + # @return [Array<(ScheduledTransactionDetailResponse, Fixnum, Hash)>] ScheduledTransactionDetailResponse data, response status code and response headers + def get_scheduled_transaction_by_id_with_http_info(budget_id, scheduled_transaction_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: ScheduledTransactionsApi.get_scheduled_transaction_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id" + end + # verify the required parameter 'scheduled_transaction_id' is set + if @api_client.config.client_side_validation && scheduled_transaction_id.nil? + fail ArgumentError, "Missing the required parameter 'scheduled_transaction_id' when calling ScheduledTransactionsApi.get_scheduled_transaction_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/scheduled_transactions/{scheduled_transaction_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'scheduled_transaction_id' + '}', scheduled_transaction_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'ScheduledTransactionDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScheduledTransactionsApi#get_scheduled_transaction_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List scheduled transactions + # Returns all scheduled transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [ScheduledTransactionSummariesResponse] + def get_scheduled_transactions(budget_id, opts = {}) + data, _status_code, _headers = get_scheduled_transactions_with_http_info(budget_id, opts) + return data + end + + # List scheduled transactions + # Returns all scheduled transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [Array<(ScheduledTransactionSummariesResponse, Fixnum, Hash)>] ScheduledTransactionSummariesResponse data, response status code and response headers + def get_scheduled_transactions_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: ScheduledTransactionsApi.get_scheduled_transactions ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling ScheduledTransactionsApi.get_scheduled_transactions" + end + # resource path + local_var_path = "/budgets/{budget_id}/scheduled_transactions".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'ScheduledTransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScheduledTransactionsApi#get_scheduled_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api/transactions_api.rb b/lib/ynab/api/transactions_api.rb new file mode 100644 index 0000000..b673b86 --- /dev/null +++ b/lib/ynab/api/transactions_api.rb @@ -0,0 +1,262 @@ +=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.3.0-SNAPSHOT + +=end + +require "uri" + +module YnabAPI + class TransactionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # List transactions + # Returns all budget transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + def get_transactions(budget_id, opts = {}) + data, _status_code, _headers = get_transactions_with_http_info(budget_id, opts) + return data + end + + # List transactions + # Returns all budget transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [Array<(TransactionSummariesResponse, Fixnum, Hash)>] TransactionSummariesResponse data, response status code and response headers + def get_transactions_with_http_info(budget_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions" + end + # resource path + local_var_path = "/budgets/{budget_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s) + + # query parameters + query_params = {} + query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List account transactions + # Returns all transactions for a specified account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + def get_transactions_by_account(budget_id, account_id, opts = {}) + data, _status_code, _headers = get_transactions_by_account_with_http_info(budget_id, account_id, opts) + return data + end + + # List account transactions + # Returns all transactions for a specified account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [Array<(TransactionSummariesResponse, Fixnum, Hash)>] TransactionSummariesResponse data, response status code and response headers + def get_transactions_by_account_with_http_info(budget_id, account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_account ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_account" + end + # verify the required parameter 'account_id' is set + if @api_client.config.client_side_validation && account_id.nil? + fail ArgumentError, "Missing the required parameter 'account_id' when calling TransactionsApi.get_transactions_by_account" + end + # resource path + local_var_path = "/budgets/{budget_id}/accounts/{account_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'account_id' + '}', account_id.to_s) + + # query parameters + query_params = {} + query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List category transactions + # Returns all transactions for a specified category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + def get_transactions_by_category(budget_id, category_id, opts = {}) + data, _status_code, _headers = get_transactions_by_category_with_http_info(budget_id, category_id, opts) + return data + end + + # List category transactions + # Returns all transactions for a specified category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [Array<(TransactionSummariesResponse, Fixnum, Hash)>] TransactionSummariesResponse data, response status code and response headers + def get_transactions_by_category_with_http_info(budget_id, category_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_category ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_category" + end + # verify the required parameter 'category_id' is set + if @api_client.config.client_side_validation && category_id.nil? + fail ArgumentError, "Missing the required parameter 'category_id' when calling TransactionsApi.get_transactions_by_category" + end + # resource path + local_var_path = "/budgets/{budget_id}/categories/{category_id}/transactions".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'category_id' + '}', category_id.to_s) + + # query parameters + query_params = {} + query_params[:'since_date'] = opts[:'since_date'] if !opts[:'since_date'].nil? + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionSummariesResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_category\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Single transaction + # Returns a single transaction + # @param budget_id ID of budget + # @param transaction_id ID of transaction + # @param [Hash] opts the optional parameters + # @return [TransactionDetailResponse] + def get_transactions_by_id(budget_id, transaction_id, opts = {}) + data, _status_code, _headers = get_transactions_by_id_with_http_info(budget_id, transaction_id, opts) + return data + end + + # Single transaction + # Returns a single transaction + # @param budget_id ID of budget + # @param transaction_id ID of transaction + # @param [Hash] opts the optional parameters + # @return [Array<(TransactionDetailResponse, Fixnum, Hash)>] TransactionDetailResponse data, response status code and response headers + def get_transactions_by_id_with_http_info(budget_id, transaction_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: TransactionsApi.get_transactions_by_id ..." + end + # verify the required parameter 'budget_id' is set + if @api_client.config.client_side_validation && budget_id.nil? + fail ArgumentError, "Missing the required parameter 'budget_id' when calling TransactionsApi.get_transactions_by_id" + end + # verify the required parameter 'transaction_id' is set + if @api_client.config.client_side_validation && transaction_id.nil? + fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.get_transactions_by_id" + end + # resource path + local_var_path = "/budgets/{budget_id}/transactions/{transaction_id}".sub('{' + 'budget_id' + '}', budget_id.to_s).sub('{' + 'transaction_id' + '}', transaction_id.to_s) + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = nil + auth_names = ['bearer'] + data, status_code, headers = @api_client.call_api(:GET, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'TransactionDetailResponse') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TransactionsApi#get_transactions_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/ynab/api_client.rb b/lib/ynab/api_client.rb new file mode 100644 index 0000000..e7730e3 --- /dev/null +++ b/lib/ynab/api_client.rb @@ -0,0 +1,389 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'typhoeus' +require 'uri' + +module YnabAPI + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "Swagger-Codegen/#{VERSION}/ruby" + @default_headers = { + 'Content-Type' => "application/json", + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date DateTime).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'BOOLEAN' + data == true + when 'DateTime' + # parse date time (expecting ISO 8601 format) + DateTime.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map {|item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each {|k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models, e.g. Pet + YnabAPI.const_get(return_type).new.tap do |model| + model.build_from_hash data + end + end + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition and content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + URI.encode(@config.base_url + path) + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Update hearder and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` of `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + return json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # use application/json by default + return 'application/json' if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + return json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map{|m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/ynab/api_error.rb b/lib/ynab/api_error.rb new file mode 100644 index 0000000..36b21db --- /dev/null +++ b/lib/ynab/api_error.rb @@ -0,0 +1,38 @@ +=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.3.0-SNAPSHOT + +=end + +module YnabAPI + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + end + end + end +end diff --git a/lib/ynab/configuration.rb b/lib/ynab/configuration.rb new file mode 100644 index 0000000..176364f --- /dev/null +++ b/lib/ynab/configuration.rb @@ -0,0 +1,209 @@ +=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.3.0-SNAPSHOT + +=end + +require 'uri' + +module YnabAPI + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = '' + @base_path = '/papi/v1' + @api_key = {} + @api_key_prefix = {} + @timeout = 0 + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @params_encoding = nil + @cert_file = nil + @key_file = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = "" if @base_path == "/" + end + + def base_url + url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') + URI.encode(url) + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name) + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" + else + @api_key[param_name] + end + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'bearer' => + { + type: 'api_key', + in: 'header', + key: 'Authorization', + value: api_key_with_prefix('Authorization') + }, + } + end + end +end diff --git a/lib/ynab/models/account.rb b/lib/ynab/models/account.rb new file mode 100644 index 0000000..78a09cd --- /dev/null +++ b/lib/ynab/models/account.rb @@ -0,0 +1,266 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class Account + attr_accessor :id + + attr_accessor :name + + attr_accessor :type + + # Whether this account is on budget or not + attr_accessor :on_budget + + # Whether this account is closed or not + attr_accessor :closed + + # The current balance of the account in milliunits format + attr_accessor :balance + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'type' => :'type', + :'on_budget' => :'on_budget', + :'closed' => :'closed', + :'balance' => :'balance' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'type' => :'String', + :'on_budget' => :'BOOLEAN', + :'closed' => :'BOOLEAN', + :'balance' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.has_key?(:'on_budget') + self.on_budget = attributes[:'on_budget'] + end + + if attributes.has_key?(:'closed') + self.closed = attributes[:'closed'] + end + + if attributes.has_key?(:'balance') + self.balance = attributes[:'balance'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @type.nil? + invalid_properties.push("invalid value for 'type', type cannot be nil.") + end + + if @on_budget.nil? + invalid_properties.push("invalid value for 'on_budget', on_budget cannot be nil.") + end + + if @closed.nil? + invalid_properties.push("invalid value for 'closed', closed cannot be nil.") + end + + if @balance.nil? + invalid_properties.push("invalid value for 'balance', balance cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @type.nil? + return false if @on_budget.nil? + return false if @closed.nil? + return false if @balance.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + type == o.type && + on_budget == o.on_budget && + closed == o.closed && + balance == o.balance + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, type, on_budget, closed, balance].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/account_response.rb b/lib/ynab/models/account_response.rb new file mode 100644 index 0000000..737dd4a --- /dev/null +++ b/lib/ynab/models/account_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class AccountResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'AccountWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/account_wrapper.rb b/lib/ynab/models/account_wrapper.rb new file mode 100644 index 0000000..12c51a8 --- /dev/null +++ b/lib/ynab/models/account_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class AccountWrapper + attr_accessor :account + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account' => :'account' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'account' => :'Account' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'account') + self.account = attributes[:'account'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @account.nil? + invalid_properties.push("invalid value for 'account', account cannot be nil.") + end + + return 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.nil? + return 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 == o.account + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [account].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/accounts_response.rb b/lib/ynab/models/accounts_response.rb new file mode 100644 index 0000000..45a9f19 --- /dev/null +++ b/lib/ynab/models/accounts_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class AccountsResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'AccountsWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/accounts_wrapper.rb b/lib/ynab/models/accounts_wrapper.rb new file mode 100644 index 0000000..8978a2f --- /dev/null +++ b/lib/ynab/models/accounts_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class AccountsWrapper + attr_accessor :accounts + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'accounts' => :'accounts' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'accounts' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'accounts') + if (value = attributes[:'accounts']).is_a?(Array) + self.accounts = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @accounts.nil? + invalid_properties.push("invalid value for 'accounts', accounts cannot be nil.") + end + + return 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 @accounts.nil? + return 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 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [accounts].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/budget_detail.rb b/lib/ynab/models/budget_detail.rb new file mode 100644 index 0000000..8d2a692 --- /dev/null +++ b/lib/ynab/models/budget_detail.rb @@ -0,0 +1,335 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class BudgetDetail + attr_accessor :id + + attr_accessor :name + + attr_accessor :date_format + + attr_accessor :currency_format + + 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 + { + :'id' => :'id', + :'name' => :'name', + :'date_format' => :'date_format', + :'currency_format' => :'currency_format', + :'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 + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'date_format' => :'DateFormat', + :'currency_format' => :'CurrencyFormat', + :'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 + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'date_format') + self.date_format = attributes[:'date_format'] + end + + if attributes.has_key?(:'currency_format') + self.currency_format = attributes[:'currency_format'] + end + + if attributes.has_key?(:'accounts') + if (value = attributes[:'accounts']).is_a?(Array) + self.accounts = value + end + end + + if attributes.has_key?(:'payees') + if (value = attributes[:'payees']).is_a?(Array) + self.payees = value + end + end + + if attributes.has_key?(:'payee_locations') + if (value = attributes[:'payee_locations']).is_a?(Array) + self.payee_locations = value + end + end + + if attributes.has_key?(:'category_groups') + if (value = attributes[:'category_groups']).is_a?(Array) + self.category_groups = value + end + end + + if attributes.has_key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + + if attributes.has_key?(:'months') + if (value = attributes[:'months']).is_a?(Array) + self.months = value + end + end + + if attributes.has_key?(:'transactions') + if (value = attributes[:'transactions']).is_a?(Array) + self.transactions = value + end + end + + if attributes.has_key?(:'subtransactions') + if (value = attributes[:'subtransactions']).is_a?(Array) + self.subtransactions = value + end + end + + if attributes.has_key?(:'scheduled_transactions') + if (value = attributes[:'scheduled_transactions']).is_a?(Array) + self.scheduled_transactions = value + end + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + date_format == o.date_format && + currency_format == o.currency_format && + 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 [Fixnum] Hash code + def hash + [id, name, date_format, currency_format, 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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/budget_detail_response.rb b/lib/ynab/models/budget_detail_response.rb new file mode 100644 index 0000000..77d3178 --- /dev/null +++ b/lib/ynab/models/budget_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class BudgetDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'BudgetDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/budget_detail_wrapper.rb b/lib/ynab/models/budget_detail_wrapper.rb new file mode 100644 index 0000000..62c335b --- /dev/null +++ b/lib/ynab/models/budget_detail_wrapper.rb @@ -0,0 +1,208 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class BudgetDetailWrapper + attr_accessor :budget + + # The knowledge of the server + attr_accessor :server_knowledge + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'budget' => :'budget', + :'server_knowledge' => :'server_knowledge' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'budget' => :'BudgetDetail', + :'server_knowledge' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'budget') + self.budget = attributes[:'budget'] + end + + if attributes.has_key?(:'server_knowledge') + self.server_knowledge = attributes[:'server_knowledge'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @budget.nil? + invalid_properties.push("invalid value for 'budget', budget cannot be nil.") + end + + if @server_knowledge.nil? + invalid_properties.push("invalid value for 'server_knowledge', server_knowledge cannot be nil.") + end + + return 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 @budget.nil? + return false if @server_knowledge.nil? + return 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 && + budget == o.budget && + server_knowledge == o.server_knowledge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [budget, server_knowledge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/budget_summary.rb b/lib/ynab/models/budget_summary.rb new file mode 100644 index 0000000..1379537 --- /dev/null +++ b/lib/ynab/models/budget_summary.rb @@ -0,0 +1,225 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class BudgetSummary + attr_accessor :id + + attr_accessor :name + + attr_accessor :date_format + + attr_accessor :currency_format + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'date_format' => :'date_format', + :'currency_format' => :'currency_format' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'date_format' => :'DateFormat', + :'currency_format' => :'CurrencyFormat' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'date_format') + self.date_format = attributes[:'date_format'] + end + + if attributes.has_key?(:'currency_format') + self.currency_format = attributes[:'currency_format'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + date_format == o.date_format && + currency_format == o.currency_format + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, date_format, currency_format].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/budget_summary_response.rb b/lib/ynab/models/budget_summary_response.rb new file mode 100644 index 0000000..75faaa1 --- /dev/null +++ b/lib/ynab/models/budget_summary_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class BudgetSummaryResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'BudgetSummaryWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/budget_summary_wrapper.rb b/lib/ynab/models/budget_summary_wrapper.rb new file mode 100644 index 0000000..bd5e19c --- /dev/null +++ b/lib/ynab/models/budget_summary_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class BudgetSummaryWrapper + attr_accessor :budgets + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'budgets' => :'budgets' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'budgets' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'budgets') + if (value = attributes[:'budgets']).is_a?(Array) + self.budgets = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @budgets.nil? + invalid_properties.push("invalid value for 'budgets', budgets cannot be nil.") + end + + return 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 @budgets.nil? + return 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 && + budgets == o.budgets + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [budgets].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/categories_response.rb b/lib/ynab/models/categories_response.rb new file mode 100644 index 0000000..5b763c5 --- /dev/null +++ b/lib/ynab/models/categories_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class CategoriesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'CategoryGroupsWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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.rb b/lib/ynab/models/category.rb new file mode 100644 index 0000000..2f34488 --- /dev/null +++ b/lib/ynab/models/category.rb @@ -0,0 +1,281 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class Category + attr_accessor :id + + attr_accessor :category_group_id + + attr_accessor :name + + # Whether or not the category is hidden + attr_accessor :hidden + + # Budgeted amount in current month in milliunits format + attr_accessor :budgeted + + # Activity amount in current month in milliunits format + attr_accessor :activity + + # Balance in current month in milliunits format + attr_accessor :balance + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'category_group_id' => :'category_group_id', + :'name' => :'name', + :'hidden' => :'hidden', + :'budgeted' => :'budgeted', + :'activity' => :'activity', + :'balance' => :'balance' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'category_group_id' => :'String', + :'name' => :'String', + :'hidden' => :'BOOLEAN', + :'budgeted' => :'Float', + :'activity' => :'Float', + :'balance' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'category_group_id') + self.category_group_id = attributes[:'category_group_id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + if attributes.has_key?(:'budgeted') + self.budgeted = attributes[:'budgeted'] + end + + if attributes.has_key?(:'activity') + self.activity = attributes[:'activity'] + end + + if attributes.has_key?(:'balance') + self.balance = attributes[:'balance'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @category_group_id.nil? + invalid_properties.push("invalid value for 'category_group_id', category_group_id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @hidden.nil? + invalid_properties.push("invalid value for 'hidden', hidden cannot be nil.") + end + + if @budgeted.nil? + invalid_properties.push("invalid value for 'budgeted', budgeted cannot be nil.") + end + + if @activity.nil? + invalid_properties.push("invalid value for 'activity', activity cannot be nil.") + end + + if @balance.nil? + invalid_properties.push("invalid value for 'balance', balance cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @category_group_id.nil? + return false if @name.nil? + return false if @hidden.nil? + return false if @budgeted.nil? + return false if @activity.nil? + return false if @balance.nil? + return 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 && + category_group_id == o.category_group_id && + name == o.name && + hidden == o.hidden && + budgeted == o.budgeted && + activity == o.activity && + balance == o.balance + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, category_group_id, name, hidden, budgeted, activity, balance].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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.rb b/lib/ynab/models/category_group.rb new file mode 100644 index 0000000..2abb2e5 --- /dev/null +++ b/lib/ynab/models/category_group.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class CategoryGroup + attr_accessor :id + + attr_accessor :name + + # Whether or not the category group is hidden + attr_accessor :hidden + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'hidden' => :'hidden' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'hidden' => :'BOOLEAN' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @hidden.nil? + invalid_properties.push("invalid value for 'hidden', hidden cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @hidden.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + hidden == o.hidden + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, hidden].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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.rb b/lib/ynab/models/category_group_with_categories.rb new file mode 100644 index 0000000..a9af859 --- /dev/null +++ b/lib/ynab/models/category_group_with_categories.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class CategoryGroupWithCategories + attr_accessor :id + + attr_accessor :name + + # Whether or not the category group is hidden + attr_accessor :hidden + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'hidden' => :'hidden' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'hidden' => :'BOOLEAN' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'hidden') + self.hidden = attributes[:'hidden'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @hidden.nil? + invalid_properties.push("invalid value for 'hidden', hidden cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @hidden.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + hidden == o.hidden + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, hidden].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_groups_wrapper.rb b/lib/ynab/models/category_groups_wrapper.rb new file mode 100644 index 0000000..7a8532b --- /dev/null +++ b/lib/ynab/models/category_groups_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class CategoryGroupsWrapper + attr_accessor :category_groups + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category_groups' => :'category_groups' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'category_groups' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'category_groups') + if (value = attributes[:'category_groups']).is_a?(Array) + self.category_groups = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @category_groups.nil? + invalid_properties.push("invalid value for 'category_groups', category_groups cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @category_groups.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category_groups == o.category_groups + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [category_groups].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_response.rb b/lib/ynab/models/category_response.rb new file mode 100644 index 0000000..151da6c --- /dev/null +++ b/lib/ynab/models/category_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class CategoryResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'CategoryWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_wrapper.rb b/lib/ynab/models/category_wrapper.rb new file mode 100644 index 0000000..795d77d --- /dev/null +++ b/lib/ynab/models/category_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class CategoryWrapper + attr_accessor :category + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'category' => :'category' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'category' => :'Category' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'category') + self.category = attributes[:'category'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @category.nil? + invalid_properties.push("invalid value for 'category', category cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @category.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [category].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/currency_format.rb b/lib/ynab/models/currency_format.rb new file mode 100644 index 0000000..70bdcec --- /dev/null +++ b/lib/ynab/models/currency_format.rb @@ -0,0 +1,179 @@ +=begin +#YNAB API Endpoints + +#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com + +OpenAPI spec version: 1.0.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +Swagger Codegen version: 2.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class CurrencyFormat + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return 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 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 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/date_format.rb b/lib/ynab/models/date_format.rb new file mode 100644 index 0000000..e1865a4 --- /dev/null +++ b/lib/ynab/models/date_format.rb @@ -0,0 +1,179 @@ +=begin +#YNAB API Endpoints + +#Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.youneedabudget.com + +OpenAPI spec version: 1.0.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +Swagger Codegen version: 2.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class DateFormat + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return 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 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 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/error_detail.rb b/lib/ynab/models/error_detail.rb new file mode 100644 index 0000000..22a5491 --- /dev/null +++ b/lib/ynab/models/error_detail.rb @@ -0,0 +1,221 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ErrorDetail + attr_accessor :id + + attr_accessor :name + + attr_accessor :description + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.has_key?(:'description') + self.description = attributes[:'description'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + if @description.nil? + invalid_properties.push("invalid value for 'description', description cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return false if @description.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, name, description].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/error_response.rb b/lib/ynab/models/error_response.rb new file mode 100644 index 0000000..4be52bb --- /dev/null +++ b/lib/ynab/models/error_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ErrorResponse + attr_accessor :error + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'error' => :'error' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'error' => :'ErrorDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'error') + self.error = attributes[:'error'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @error.nil? + invalid_properties.push("invalid value for 'error', error cannot be nil.") + end + + return 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 @error.nil? + return 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 && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [error].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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.rb b/lib/ynab/models/month_detail.rb new file mode 100644 index 0000000..6a4b7f4 --- /dev/null +++ b/lib/ynab/models/month_detail.rb @@ -0,0 +1,210 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class MonthDetail + attr_accessor :month + + # The budget month categories + attr_accessor :categories + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month', + :'categories' => :'categories' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'month' => :'Date', + :'categories' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @month.nil? + invalid_properties.push("invalid value for 'month', month cannot be nil.") + end + + if @categories.nil? + invalid_properties.push("invalid value for 'categories', categories cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return false if @categories.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month && + 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 [Fixnum] Hash code + def hash + [month, 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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_response.rb b/lib/ynab/models/month_detail_response.rb new file mode 100644 index 0000000..5d893e8 --- /dev/null +++ b/lib/ynab/models/month_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class MonthDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'MonthDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_wrapper.rb b/lib/ynab/models/month_detail_wrapper.rb new file mode 100644 index 0000000..76896b5 --- /dev/null +++ b/lib/ynab/models/month_detail_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class MonthDetailWrapper + attr_accessor :month + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'month' => :'MonthDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'month') + self.month = attributes[:'month'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @month.nil? + invalid_properties.push("invalid value for 'month', month cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [month].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summaries_response.rb b/lib/ynab/models/month_summaries_response.rb new file mode 100644 index 0000000..66eb9cd --- /dev/null +++ b/lib/ynab/models/month_summaries_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class MonthSummariesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'MonthSummariesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summaries_wrapper.rb b/lib/ynab/models/month_summaries_wrapper.rb new file mode 100644 index 0000000..72bc4bb --- /dev/null +++ b/lib/ynab/models/month_summaries_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class MonthSummariesWrapper + attr_accessor :months + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'months' => :'months' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'months' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'months') + if (value = attributes[:'months']).is_a?(Array) + self.months = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @months.nil? + invalid_properties.push("invalid value for 'months', months cannot be nil.") + end + + return 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 @months.nil? + return 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 && + months == o.months + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [months].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summary.rb b/lib/ynab/models/month_summary.rb new file mode 100644 index 0000000..c1f5140 --- /dev/null +++ b/lib/ynab/models/month_summary.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class MonthSummary + attr_accessor :month + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'month' => :'month' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'month' => :'Date' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'month') + self.month = attributes[:'month'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @month.nil? + invalid_properties.push("invalid value for 'month', month cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @month.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + month == o.month + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [month].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee.rb b/lib/ynab/models/payee.rb new file mode 100644 index 0000000..88e6583 --- /dev/null +++ b/lib/ynab/models/payee.rb @@ -0,0 +1,207 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class Payee + attr_accessor :id + + attr_accessor :name + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'name') + self.name = attributes[:'name'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @name.nil? + invalid_properties.push("invalid value for 'name', name cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @name.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, 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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee_location.rb b/lib/ynab/models/payee_location.rb new file mode 100644 index 0000000..79a726b --- /dev/null +++ b/lib/ynab/models/payee_location.rb @@ -0,0 +1,207 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeeLocation + attr_accessor :id + + attr_accessor :payee_id + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'payee_id' => :'payee_id' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'payee_id' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'payee_id') + self.payee_id = attributes[:'payee_id'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @payee_id.nil? + invalid_properties.push("invalid value for 'payee_id', payee_id cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @payee_id.nil? + return 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 && + payee_id == o.payee_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 [Fixnum] Hash code + def hash + [id, payee_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee_location_response.rb b/lib/ynab/models/payee_location_response.rb new file mode 100644 index 0000000..cbe033d --- /dev/null +++ b/lib/ynab/models/payee_location_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeeLocationResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeeLocationWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee_location_wrapper.rb b/lib/ynab/models/payee_location_wrapper.rb new file mode 100644 index 0000000..a50b575 --- /dev/null +++ b/lib/ynab/models/payee_location_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeeLocationWrapper + attr_accessor :payee_location + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee_location' => :'payee_location' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payee_location' => :'PayeeLocation' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payee_location') + self.payee_location = attributes[:'payee_location'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee_location.nil? + invalid_properties.push("invalid value for 'payee_location', payee_location cannot be nil.") + end + + return 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_location.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee_location == o.payee_location + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payee_location].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee_locations_response.rb b/lib/ynab/models/payee_locations_response.rb new file mode 100644 index 0000000..f1efedb --- /dev/null +++ b/lib/ynab/models/payee_locations_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeeLocationsResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeeLocationsWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee_locations_wrapper.rb b/lib/ynab/models/payee_locations_wrapper.rb new file mode 100644 index 0000000..03750bb --- /dev/null +++ b/lib/ynab/models/payee_locations_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeeLocationsWrapper + attr_accessor :payee_locations + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee_locations' => :'payee_locations' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payee_locations' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payee_locations') + if (value = attributes[:'payee_locations']).is_a?(Array) + self.payee_locations = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee_locations.nil? + invalid_properties.push("invalid value for 'payee_locations', payee_locations cannot be nil.") + end + + return 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_locations.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee_locations == o.payee_locations + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payee_locations].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee_response.rb b/lib/ynab/models/payee_response.rb new file mode 100644 index 0000000..dd7d6c4 --- /dev/null +++ b/lib/ynab/models/payee_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeeResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeeWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payee_wrapper.rb b/lib/ynab/models/payee_wrapper.rb new file mode 100644 index 0000000..0bceebd --- /dev/null +++ b/lib/ynab/models/payee_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeeWrapper + attr_accessor :payee + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payee' => :'payee' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payee' => :'Payee' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payee') + self.payee = attributes[:'payee'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payee.nil? + invalid_properties.push("invalid value for 'payee', payee cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @payee.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payee == o.payee + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payee].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payees_response.rb b/lib/ynab/models/payees_response.rb new file mode 100644 index 0000000..c3b0fc3 --- /dev/null +++ b/lib/ynab/models/payees_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'PayeesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/payees_wrapper.rb b/lib/ynab/models/payees_wrapper.rb new file mode 100644 index 0000000..46e396c --- /dev/null +++ b/lib/ynab/models/payees_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class PayeesWrapper + attr_accessor :payees + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payees' => :'payees' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'payees' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'payees') + if (value = attributes[:'payees']).is_a?(Array) + self.payees = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @payees.nil? + invalid_properties.push("invalid value for 'payees', payees cannot be nil.") + end + + return 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 @payees.nil? + return 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 && + payees == o.payees + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [payees].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_sub_transaction.rb b/lib/ynab/models/scheduled_sub_transaction.rb new file mode 100644 index 0000000..e9ebbb4 --- /dev/null +++ b/lib/ynab/models/scheduled_sub_transaction.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ScheduledSubTransaction + attr_accessor :id + + attr_accessor :scheduled_transaction_id + + # The current balance of the account in milliunits format + attr_accessor :amount + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'scheduled_transaction_id' => :'scheduled_transaction_id', + :'amount' => :'amount' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'scheduled_transaction_id' => :'String', + :'amount' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'scheduled_transaction_id') + self.scheduled_transaction_id = attributes[:'scheduled_transaction_id'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @scheduled_transaction_id.nil? + invalid_properties.push("invalid value for 'scheduled_transaction_id', scheduled_transaction_id cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @scheduled_transaction_id.nil? + return false if @amount.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + scheduled_transaction_id == o.scheduled_transaction_id && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, scheduled_transaction_id, amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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.rb b/lib/ynab/models/scheduled_transaction_detail.rb new file mode 100644 index 0000000..dd2c4cc --- /dev/null +++ b/lib/ynab/models/scheduled_transaction_detail.rb @@ -0,0 +1,267 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ScheduledTransactionDetail + attr_accessor :id + + attr_accessor :date + + attr_accessor :frequency + + # The current balance of the account in milliunits format + attr_accessor :amount + + attr_accessor :account_id + + # If a split scheduled transaction, the sub-transactions. + attr_accessor :subtransactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'frequency' => :'frequency', + :'amount' => :'amount', + :'account_id' => :'account_id', + :'subtransactions' => :'subtransactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'frequency' => :'String', + :'amount' => :'Float', + :'account_id' => :'String', + :'subtransactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'frequency') + self.frequency = attributes[:'frequency'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @frequency.nil? + invalid_properties.push("invalid value for 'frequency', frequency cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + if @subtransactions.nil? + invalid_properties.push("invalid value for 'subtransactions', subtransactions cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @frequency.nil? + return false if @amount.nil? + return false if @account_id.nil? + return false if @subtransactions.nil? + return 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 && + date == o.date && + frequency == o.frequency && + amount == o.amount && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, frequency, amount, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_response.rb b/lib/ynab/models/scheduled_transaction_detail_response.rb new file mode 100644 index 0000000..e05417f --- /dev/null +++ b/lib/ynab/models/scheduled_transaction_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ScheduledTransactionDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'ScheduledTransactionDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_wrapper.rb b/lib/ynab/models/scheduled_transaction_detail_wrapper.rb new file mode 100644 index 0000000..1530648 --- /dev/null +++ b/lib/ynab/models/scheduled_transaction_detail_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ScheduledTransactionDetailWrapper + attr_accessor :scheduled_transaction + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'scheduled_transaction' => :'scheduled_transaction' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'scheduled_transaction' => :'ScheduledTransactionDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'scheduled_transaction') + self.scheduled_transaction = attributes[:'scheduled_transaction'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @scheduled_transaction.nil? + invalid_properties.push("invalid value for 'scheduled_transaction', scheduled_transaction cannot be nil.") + end + + return 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 @scheduled_transaction.nil? + return 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 && + scheduled_transaction == o.scheduled_transaction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [scheduled_transaction].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summaries_response.rb b/lib/ynab/models/scheduled_transaction_summaries_response.rb new file mode 100644 index 0000000..eed2aa7 --- /dev/null +++ b/lib/ynab/models/scheduled_transaction_summaries_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ScheduledTransactionSummariesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'ScheduledTransactionSummariesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summaries_wrapper.rb b/lib/ynab/models/scheduled_transaction_summaries_wrapper.rb new file mode 100644 index 0000000..ca83f04 --- /dev/null +++ b/lib/ynab/models/scheduled_transaction_summaries_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ScheduledTransactionSummariesWrapper + attr_accessor :scheduled_transactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'scheduled_transactions' => :'scheduled_transactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'scheduled_transactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'scheduled_transactions') + if (value = attributes[:'scheduled_transactions']).is_a?(Array) + self.scheduled_transactions = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @scheduled_transactions.nil? + invalid_properties.push("invalid value for 'scheduled_transactions', scheduled_transactions cannot be nil.") + end + + return 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 @scheduled_transactions.nil? + return 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 && + scheduled_transactions == o.scheduled_transactions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [scheduled_transactions].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summary.rb b/lib/ynab/models/scheduled_transaction_summary.rb new file mode 100644 index 0000000..b45a36c --- /dev/null +++ b/lib/ynab/models/scheduled_transaction_summary.rb @@ -0,0 +1,250 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class ScheduledTransactionSummary + attr_accessor :id + + attr_accessor :date + + attr_accessor :frequency + + # The current balance of the account in milliunits format + attr_accessor :amount + + attr_accessor :account_id + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'frequency' => :'frequency', + :'amount' => :'amount', + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'frequency' => :'String', + :'amount' => :'Float', + :'account_id' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'frequency') + self.frequency = attributes[:'frequency'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @frequency.nil? + invalid_properties.push("invalid value for 'frequency', frequency cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @frequency.nil? + return false if @amount.nil? + return false if @account_id.nil? + return 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 && + date == o.date && + frequency == o.frequency && + amount == o.amount && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, frequency, amount, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/sub_transaction.rb b/lib/ynab/models/sub_transaction.rb new file mode 100644 index 0000000..25d4b0f --- /dev/null +++ b/lib/ynab/models/sub_transaction.rb @@ -0,0 +1,222 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class SubTransaction + attr_accessor :id + + attr_accessor :transaction_id + + # The current balance of the account in milliunits format + attr_accessor :amount + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'transaction_id' => :'transaction_id', + :'amount' => :'amount' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'transaction_id' => :'String', + :'amount' => :'Float' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'transaction_id') + self.transaction_id = attributes[:'transaction_id'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @transaction_id.nil? + invalid_properties.push("invalid value for 'transaction_id', transaction_id cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @transaction_id.nil? + return false if @amount.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + transaction_id == o.transaction_id && + amount == o.amount + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [id, transaction_id, amount].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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.rb b/lib/ynab/models/transaction_detail.rb new file mode 100644 index 0000000..33ce1df --- /dev/null +++ b/lib/ynab/models/transaction_detail.rb @@ -0,0 +1,283 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class TransactionDetail + attr_accessor :id + + attr_accessor :date + + # The current balance of the account in milliunits format + attr_accessor :amount + + # The cleared status of the transaction + attr_accessor :cleared + + # Whether or not the transaction is approved + attr_accessor :approved + + attr_accessor :account_id + + # If a split transaction, the sub-transactions. + attr_accessor :subtransactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'amount' => :'amount', + :'cleared' => :'cleared', + :'approved' => :'approved', + :'account_id' => :'account_id', + :'subtransactions' => :'subtransactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'amount' => :'Float', + :'cleared' => :'String', + :'approved' => :'BOOLEAN', + :'account_id' => :'String', + :'subtransactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'cleared') + self.cleared = attributes[:'cleared'] + end + + if attributes.has_key?(:'approved') + self.approved = attributes[:'approved'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.has_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 properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @cleared.nil? + invalid_properties.push("invalid value for 'cleared', cleared cannot be nil.") + end + + if @approved.nil? + invalid_properties.push("invalid value for 'approved', approved cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + if @subtransactions.nil? + invalid_properties.push("invalid value for 'subtransactions', subtransactions cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @amount.nil? + return false if @cleared.nil? + return false if @approved.nil? + return false if @account_id.nil? + return false if @subtransactions.nil? + return 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 && + date == o.date && + amount == o.amount && + cleared == o.cleared && + approved == o.approved && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, amount, cleared, approved, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_response.rb b/lib/ynab/models/transaction_detail_response.rb new file mode 100644 index 0000000..8a695bf --- /dev/null +++ b/lib/ynab/models/transaction_detail_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class TransactionDetailResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'TransactionDetailWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_wrapper.rb b/lib/ynab/models/transaction_detail_wrapper.rb new file mode 100644 index 0000000..6591e4e --- /dev/null +++ b/lib/ynab/models/transaction_detail_wrapper.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class TransactionDetailWrapper + attr_accessor :transaction + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'transaction' => :'transaction' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'transaction' => :'TransactionDetail' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'transaction') + self.transaction = attributes[:'transaction'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @transaction.nil? + invalid_properties.push("invalid value for 'transaction', transaction cannot be nil.") + end + + return 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 @transaction.nil? + return 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 && + transaction == o.transaction + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [transaction].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summaries_response.rb b/lib/ynab/models/transaction_summaries_response.rb new file mode 100644 index 0000000..6e667a2 --- /dev/null +++ b/lib/ynab/models/transaction_summaries_response.rb @@ -0,0 +1,193 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class TransactionSummariesResponse + attr_accessor :data + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'data' => :'TransactionSummariesWrapper' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'data') + self.data = attributes[:'data'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @data.nil? + invalid_properties.push("invalid value for 'data', data cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @data.nil? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summaries_wrapper.rb b/lib/ynab/models/transaction_summaries_wrapper.rb new file mode 100644 index 0000000..1d37e0c --- /dev/null +++ b/lib/ynab/models/transaction_summaries_wrapper.rb @@ -0,0 +1,195 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class TransactionSummariesWrapper + attr_accessor :transactions + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'transactions' => :'transactions' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'transactions' => :'Array' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'transactions') + if (value = attributes[:'transactions']).is_a?(Array) + self.transactions = value + end + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @transactions.nil? + invalid_properties.push("invalid value for 'transactions', transactions cannot be nil.") + end + + return 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 @transactions.nil? + return 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 && + transactions == o.transactions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [transactions].hash + 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) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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_summary.rb b/lib/ynab/models/transaction_summary.rb new file mode 100644 index 0000000..86d23ff --- /dev/null +++ b/lib/ynab/models/transaction_summary.rb @@ -0,0 +1,266 @@ +=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.3.0-SNAPSHOT + +=end + +require 'date' + +module YnabAPI + + class TransactionSummary + attr_accessor :id + + attr_accessor :date + + # The current balance of the account in milliunits format + attr_accessor :amount + + # The cleared status of the transaction + attr_accessor :cleared + + # Whether or not the transaction is approved + attr_accessor :approved + + attr_accessor :account_id + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'date' => :'date', + :'amount' => :'amount', + :'cleared' => :'cleared', + :'approved' => :'approved', + :'account_id' => :'account_id' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'id' => :'String', + :'date' => :'Date', + :'amount' => :'Float', + :'cleared' => :'String', + :'approved' => :'BOOLEAN', + :'account_id' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.has_key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.has_key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.has_key?(:'cleared') + self.cleared = attributes[:'cleared'] + end + + if attributes.has_key?(:'approved') + self.approved = attributes[:'approved'] + end + + if attributes.has_key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push("invalid value for 'id', id cannot be nil.") + end + + if @date.nil? + invalid_properties.push("invalid value for 'date', date cannot be nil.") + end + + if @amount.nil? + invalid_properties.push("invalid value for 'amount', amount cannot be nil.") + end + + if @cleared.nil? + invalid_properties.push("invalid value for 'cleared', cleared cannot be nil.") + end + + if @approved.nil? + invalid_properties.push("invalid value for 'approved', approved cannot be nil.") + end + + if @account_id.nil? + invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") + end + + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @date.nil? + return false if @amount.nil? + return false if @cleared.nil? + return false if @approved.nil? + return false if @account_id.nil? + return 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 && + date == o.date && + amount == o.amount && + cleared == o.cleared && + approved == o.approved && + account_id == o.account_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 [Fixnum] Hash code + def hash + [id, date, amount, cleared, approved, account_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 build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional + 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 :DateTime + DateTime.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 + temp_model = YnabAPI.const_get(type).new + temp_model.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) + next if value.nil? + 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/version.rb b/lib/ynab/version.rb new file mode 100644 index 0000000..09429e3 --- /dev/null +++ b/lib/ynab/version.rb @@ -0,0 +1,15 @@ +=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.3.0-SNAPSHOT + +=end + +module YnabAPI + VERSION = "0.1.0" +end diff --git a/spec/api/accounts_api_spec.rb b/spec/api/accounts_api_spec.rb new file mode 100644 index 0000000..a2abe27 --- /dev/null +++ b/spec/api/accounts_api_spec.rb @@ -0,0 +1,60 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::AccountsApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'AccountsApi' do + before do + # run before each test + @instance = SwaggerClient::AccountsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of AccountsApi' do + it 'should create an instance of AccountsApi' do + expect(@instance).to be_instance_of(SwaggerClient::AccountsApi) + end + end + + # unit tests for get_account_by_id + # Single account + # Returns a single account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @return [AccountResponse] + describe 'get_account_by_id test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_accounts + # Account list + # Returns all accounts + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [AccountsResponse] + describe 'get_accounts test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api/budgets_api_spec.rb b/spec/api/budgets_api_spec.rb new file mode 100644 index 0000000..1e0810d --- /dev/null +++ b/spec/api/budgets_api_spec.rb @@ -0,0 +1,59 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::BudgetsApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'BudgetsApi' do + before do + # run before each test + @instance = SwaggerClient::BudgetsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of BudgetsApi' do + it 'should create an instance of BudgetsApi' do + expect(@instance).to be_instance_of(SwaggerClient::BudgetsApi) + end + end + + # unit tests for get_budget_contents + # Single budget + # Returns a single budget with all related entities. This resource is effectively a full budget export. + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Float] :last_knowledge_of_server Starting server knowledge. If provided, only entities that have changed since last_knowledge_of_server will be included. + # @return [BudgetDetailResponse] + describe 'get_budget_contents test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_budgets + # List budgets + # Returns budgets list with summary information + # @param [Hash] opts the optional parameters + # @return [BudgetSummaryResponse] + describe 'get_budgets test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api/categories_api_spec.rb b/spec/api/categories_api_spec.rb new file mode 100644 index 0000000..ffeb114 --- /dev/null +++ b/spec/api/categories_api_spec.rb @@ -0,0 +1,60 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::CategoriesApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CategoriesApi' do + before do + # run before each test + @instance = SwaggerClient::CategoriesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoriesApi' do + it 'should create an instance of CategoriesApi' do + expect(@instance).to be_instance_of(SwaggerClient::CategoriesApi) + end + end + + # unit tests for get_categories + # List categories + # Returns all categories grouped by category group + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [CategoriesResponse] + describe 'get_categories test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_category_by_id + # Single category + # Returns a single category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @return [CategoryResponse] + describe 'get_category_by_id test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api/months_api_spec.rb b/spec/api/months_api_spec.rb new file mode 100644 index 0000000..2258948 --- /dev/null +++ b/spec/api/months_api_spec.rb @@ -0,0 +1,60 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::MonthsApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'MonthsApi' do + before do + # run before each test + @instance = SwaggerClient::MonthsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of MonthsApi' do + it 'should create an instance of MonthsApi' do + expect(@instance).to be_instance_of(SwaggerClient::MonthsApi) + end + end + + # unit tests for get_budget_month + # Single budget month + # Returns a single budget month + # @param budget_id ID of budget + # @param month The budget month. \"current\" can also be used to specify the current calendar month (UTC). + # @param [Hash] opts the optional parameters + # @return [MonthDetailResponse] + describe 'get_budget_month test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_budget_months + # List budget months + # Returns all budget months + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [MonthSummariesResponse] + describe 'get_budget_months test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api/payee_locations_api_spec.rb b/spec/api/payee_locations_api_spec.rb new file mode 100644 index 0000000..d22039d --- /dev/null +++ b/spec/api/payee_locations_api_spec.rb @@ -0,0 +1,73 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::PayeeLocationsApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeLocationsApi' do + before do + # run before each test + @instance = SwaggerClient::PayeeLocationsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeLocationsApi' do + it 'should create an instance of PayeeLocationsApi' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeLocationsApi) + end + end + + # unit tests for get_payee_location_by_id + # Single payee location + # Returns a single payee location + # @param budget_id ID of budget + # @param payee_location_id ID of payee location + # @param [Hash] opts the optional parameters + # @return [PayeeLocationResponse] + describe 'get_payee_location_by_id test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_payee_locations + # List payee locations + # Returns all payee locations + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [PayeeLocationsResponse] + describe 'get_payee_locations test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_payee_locations_by_payee + # List locations for a payee + # Returns all payee locations for the specified payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [PayeeLocationsResponse] + describe 'get_payee_locations_by_payee test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api/payees_api_spec.rb b/spec/api/payees_api_spec.rb new file mode 100644 index 0000000..70664a3 --- /dev/null +++ b/spec/api/payees_api_spec.rb @@ -0,0 +1,60 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::PayeesApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeesApi' do + before do + # run before each test + @instance = SwaggerClient::PayeesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeesApi' do + it 'should create an instance of PayeesApi' do + expect(@instance).to be_instance_of(SwaggerClient::PayeesApi) + end + end + + # unit tests for get_payee_by_id + # Single payee + # Returns single payee + # @param budget_id ID of budget + # @param payee_id ID of payee + # @param [Hash] opts the optional parameters + # @return [PayeeResponse] + describe 'get_payee_by_id test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_payees + # List payees + # Returns all payees + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [PayeesResponse] + describe 'get_payees test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api/scheduled_transactions_api_spec.rb b/spec/api/scheduled_transactions_api_spec.rb new file mode 100644 index 0000000..5c344ff --- /dev/null +++ b/spec/api/scheduled_transactions_api_spec.rb @@ -0,0 +1,60 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::ScheduledTransactionsApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledTransactionsApi' do + before do + # run before each test + @instance = SwaggerClient::ScheduledTransactionsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledTransactionsApi' do + it 'should create an instance of ScheduledTransactionsApi' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledTransactionsApi) + end + end + + # unit tests for get_scheduled_transaction_by_id + # Single scheduled transaction + # Returns a single scheduled transaction + # @param budget_id ID of budget + # @param scheduled_transaction_id ID of scheduled transaction + # @param [Hash] opts the optional parameters + # @return [ScheduledTransactionDetailResponse] + describe 'get_scheduled_transaction_by_id test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_scheduled_transactions + # List scheduled transactions + # Returns all scheduled transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @return [ScheduledTransactionSummariesResponse] + describe 'get_scheduled_transactions test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api/transactions_api_spec.rb b/spec/api/transactions_api_spec.rb new file mode 100644 index 0000000..e7befeb --- /dev/null +++ b/spec/api/transactions_api_spec.rb @@ -0,0 +1,89 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for SwaggerClient::TransactionsApi +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'TransactionsApi' do + before do + # run before each test + @instance = SwaggerClient::TransactionsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionsApi' do + it 'should create an instance of TransactionsApi' do + expect(@instance).to be_instance_of(SwaggerClient::TransactionsApi) + end + end + + # unit tests for get_transactions + # List transactions + # Returns all budget transactions + # @param budget_id ID of budget + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + describe 'get_transactions test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_transactions_by_account + # List account transactions + # Returns all transactions for a specified account + # @param budget_id ID of budget + # @param account_id ID of account + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + describe 'get_transactions_by_account test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_transactions_by_category + # List category transactions + # Returns all transactions for a specified category + # @param budget_id ID of budget + # @param category_id ID of category + # @param [Hash] opts the optional parameters + # @option opts [Date] :since_date Only return transactions on or after this date + # @return [TransactionSummariesResponse] + describe 'get_transactions_by_category test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for get_transactions_by_id + # Single transaction + # Returns a single transaction + # @param budget_id ID of budget + # @param transaction_id ID of transaction + # @param [Hash] opts the optional parameters + # @return [TransactionDetailResponse] + describe 'get_transactions_by_id test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/api_client_spec.rb b/spec/api_client_spec.rb new file mode 100644 index 0000000..8056a99 --- /dev/null +++ b/spec/api_client_spec.rb @@ -0,0 +1,226 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' + +describe SwaggerClient::ApiClient do + context 'initialization' do + context 'URL stuff' do + context 'host' do + it 'removes http from host' do + SwaggerClient.configure { |c| c.host = 'http://example.com' } + expect(SwaggerClient::Configuration.default.host).to eq('example.com') + end + + it 'removes https from host' do + SwaggerClient.configure { |c| c.host = 'https://wookiee.com' } + expect(SwaggerClient::ApiClient.default.config.host).to eq('wookiee.com') + end + + it 'removes trailing path from host' do + SwaggerClient.configure { |c| c.host = 'hobo.com/v4' } + expect(SwaggerClient::Configuration.default.host).to eq('hobo.com') + end + end + + context 'base_path' do + it "prepends a slash to base_path" do + SwaggerClient.configure { |c| c.base_path = 'v4/dog' } + expect(SwaggerClient::Configuration.default.base_path).to eq('/v4/dog') + end + + it "doesn't prepend a slash if one is already there" do + SwaggerClient.configure { |c| c.base_path = '/v4/dog' } + expect(SwaggerClient::Configuration.default.base_path).to eq('/v4/dog') + end + + it "ends up as a blank string if nil" do + SwaggerClient.configure { |c| c.base_path = nil } + expect(SwaggerClient::Configuration.default.base_path).to eq('') + end + end + end + end + + describe "params_encoding in #build_request" do + let(:config) { SwaggerClient::Configuration.new } + let(:api_client) { SwaggerClient::ApiClient.new(config) } + + it "defaults to nil" do + expect(SwaggerClient::Configuration.default.params_encoding).to eq(nil) + expect(config.params_encoding).to eq(nil) + + request = api_client.build_request(:get, '/test') + expect(request.options[:params_encoding]).to eq(nil) + end + + it "can be customized" do + config.params_encoding = :multi + request = api_client.build_request(:get, '/test') + expect(request.options[:params_encoding]).to eq(:multi) + end + end + + describe "timeout in #build_request" do + let(:config) { SwaggerClient::Configuration.new } + let(:api_client) { SwaggerClient::ApiClient.new(config) } + + it "defaults to 0" do + expect(SwaggerClient::Configuration.default.timeout).to eq(0) + expect(config.timeout).to eq(0) + + request = api_client.build_request(:get, '/test') + expect(request.options[:timeout]).to eq(0) + end + + it "can be customized" do + config.timeout = 100 + request = api_client.build_request(:get, '/test') + expect(request.options[:timeout]).to eq(100) + end + end + + describe "#deserialize" do + it "handles Array" do + api_client = SwaggerClient::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '[12, 34]') + data = api_client.deserialize(response, 'Array') + expect(data).to be_instance_of(Array) + expect(data).to eq([12, 34]) + end + + it "handles Array>" do + api_client = SwaggerClient::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '[[12, 34], [56]]') + data = api_client.deserialize(response, 'Array>') + expect(data).to be_instance_of(Array) + expect(data).to eq([[12, 34], [56]]) + end + + it "handles Hash" do + api_client = SwaggerClient::ApiClient.new + headers = {'Content-Type' => 'application/json'} + response = double('response', headers: headers, body: '{"message": "Hello"}') + data = api_client.deserialize(response, 'Hash') + expect(data).to be_instance_of(Hash) + expect(data).to eq({:message => 'Hello'}) + end + end + + describe "#object_to_hash" do + it "ignores nils and includes empty arrays" do + # uncomment below to test object_to_hash for model + #api_client = SwaggerClient::ApiClient.new + #_model = SwaggerClient::ModelName.new + # update the model attribute below + #_model.id = 1 + # update the expected value (hash) below + #expected = {id: 1, name: '', tags: []} + #expect(api_client.object_to_hash(_model)).to eq(expected) + end + end + + describe "#build_collection_param" do + let(:param) { ['aa', 'bb', 'cc'] } + let(:api_client) { SwaggerClient::ApiClient.new } + + it "works for csv" do + expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc') + end + + it "works for ssv" do + expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc') + end + + it "works for tsv" do + expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc") + end + + it "works for pipes" do + expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc') + end + + it "works for multi" do + expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc']) + end + + it "fails for invalid collection format" do + expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID') + end + end + + describe "#json_mime?" do + let(:api_client) { SwaggerClient::ApiClient.new } + + it "works" do + expect(api_client.json_mime?(nil)).to eq false + expect(api_client.json_mime?('')).to eq false + + expect(api_client.json_mime?('application/json')).to eq true + expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true + expect(api_client.json_mime?('APPLICATION/JSON')).to eq true + + expect(api_client.json_mime?('application/xml')).to eq false + expect(api_client.json_mime?('text/plain')).to eq false + expect(api_client.json_mime?('application/jsonp')).to eq false + end + end + + describe "#select_header_accept" do + let(:api_client) { SwaggerClient::ApiClient.new } + + it "works" do + expect(api_client.select_header_accept(nil)).to be_nil + expect(api_client.select_header_accept([])).to be_nil + + expect(api_client.select_header_accept(['application/json'])).to eq('application/json') + expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + + expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml') + end + end + + describe "#select_header_content_type" do + let(:api_client) { SwaggerClient::ApiClient.new } + + it "works" do + expect(api_client.select_header_content_type(nil)).to eq('application/json') + expect(api_client.select_header_content_type([])).to eq('application/json') + + expect(api_client.select_header_content_type(['application/json'])).to eq('application/json') + expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain') + end + end + + describe "#sanitize_filename" do + let(:api_client) { SwaggerClient::ApiClient.new } + + it "works" do + expect(api_client.sanitize_filename('sun')).to eq('sun') + expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif') + end + end +end diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb new file mode 100644 index 0000000..2ad9352 --- /dev/null +++ b/spec/configuration_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' + +describe SwaggerClient::Configuration do + let(:config) { SwaggerClient::Configuration.default } + + before(:each) do + # uncomment below to setup host and base_path + #require 'URI' + #uri = URI.parse("https://localhost/papi/v1") + #SwaggerClient.configure do |c| + # c.host = uri.host + # c.base_path = uri.path + #end + end + + describe '#base_url' do + it 'should have the default value' do + # uncomment below to test default value of the base path + #expect(config.base_url).to eq("https://localhost/papi/v1") + end + + it 'should remove trailing slashes' do + [nil, '', '/', '//'].each do |base_path| + config.base_path = base_path + # uncomment below to test trailing slashes + #expect(config.base_url).to eq("https://localhost/papi/v1") + end + end + end +end diff --git a/spec/models/account_response_spec.rb b/spec/models/account_response_spec.rb new file mode 100644 index 0000000..13b235c --- /dev/null +++ b/spec/models/account_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::AccountResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'AccountResponse' do + before do + # run before each test + @instance = SwaggerClient::AccountResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of AccountResponse' do + it 'should create an instance of AccountResponse' do + expect(@instance).to be_instance_of(SwaggerClient::AccountResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb new file mode 100644 index 0000000..26b3cc1 --- /dev/null +++ b/spec/models/account_spec.rb @@ -0,0 +1,72 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::Account +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'Account' do + before do + # run before each test + @instance = SwaggerClient::Account.new + end + + after do + # run after each test + end + + describe 'test an instance of Account' do + it 'should create an instance of Account' do + expect(@instance).to be_instance_of(SwaggerClient::Account) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "on_budget"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "closed"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "balance"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/account_wrapper_spec.rb b/spec/models/account_wrapper_spec.rb new file mode 100644 index 0000000..c1ace14 --- /dev/null +++ b/spec/models/account_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::AccountWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'AccountWrapper' do + before do + # run before each test + @instance = SwaggerClient::AccountWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of AccountWrapper' do + it 'should create an instance of AccountWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::AccountWrapper) + end + end + describe 'test attribute "account"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/accounts_response_spec.rb b/spec/models/accounts_response_spec.rb new file mode 100644 index 0000000..bcc1260 --- /dev/null +++ b/spec/models/accounts_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::AccountsResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'AccountsResponse' do + before do + # run before each test + @instance = SwaggerClient::AccountsResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of AccountsResponse' do + it 'should create an instance of AccountsResponse' do + expect(@instance).to be_instance_of(SwaggerClient::AccountsResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/accounts_wrapper_spec.rb b/spec/models/accounts_wrapper_spec.rb new file mode 100644 index 0000000..b73a1e8 --- /dev/null +++ b/spec/models/accounts_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::AccountsWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'AccountsWrapper' do + before do + # run before each test + @instance = SwaggerClient::AccountsWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of AccountsWrapper' do + it 'should create an instance of AccountsWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::AccountsWrapper) + end + end + describe 'test attribute "accounts"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/budget_detail_response_spec.rb b/spec/models/budget_detail_response_spec.rb new file mode 100644 index 0000000..13820ee --- /dev/null +++ b/spec/models/budget_detail_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::BudgetDetailResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'BudgetDetailResponse' do + before do + # run before each test + @instance = SwaggerClient::BudgetDetailResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of BudgetDetailResponse' do + it 'should create an instance of BudgetDetailResponse' do + expect(@instance).to be_instance_of(SwaggerClient::BudgetDetailResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/budget_detail_spec.rb b/spec/models/budget_detail_spec.rb new file mode 100644 index 0000000..4f8e48b --- /dev/null +++ b/spec/models/budget_detail_spec.rb @@ -0,0 +1,120 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::BudgetDetail +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'BudgetDetail' do + before do + # run before each test + @instance = SwaggerClient::BudgetDetail.new + end + + after do + # run after each test + end + + describe 'test an instance of BudgetDetail' do + it 'should create an instance of BudgetDetail' do + expect(@instance).to be_instance_of(SwaggerClient::BudgetDetail) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "currency_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "accounts"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "payees"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "payee_locations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "category_groups"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "categories"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "months"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "transactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "subtransactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "scheduled_transactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "scheduled_subtransactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/budget_detail_wrapper_spec.rb b/spec/models/budget_detail_wrapper_spec.rb new file mode 100644 index 0000000..99d7a80 --- /dev/null +++ b/spec/models/budget_detail_wrapper_spec.rb @@ -0,0 +1,48 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::BudgetDetailWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'BudgetDetailWrapper' do + before do + # run before each test + @instance = SwaggerClient::BudgetDetailWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of BudgetDetailWrapper' do + it 'should create an instance of BudgetDetailWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::BudgetDetailWrapper) + end + end + describe 'test attribute "budget"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "server_knowledge"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/budget_summary_response_spec.rb b/spec/models/budget_summary_response_spec.rb new file mode 100644 index 0000000..4a18f7b --- /dev/null +++ b/spec/models/budget_summary_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::BudgetSummaryResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'BudgetSummaryResponse' do + before do + # run before each test + @instance = SwaggerClient::BudgetSummaryResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of BudgetSummaryResponse' do + it 'should create an instance of BudgetSummaryResponse' do + expect(@instance).to be_instance_of(SwaggerClient::BudgetSummaryResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/budget_summary_spec.rb b/spec/models/budget_summary_spec.rb new file mode 100644 index 0000000..bde9318 --- /dev/null +++ b/spec/models/budget_summary_spec.rb @@ -0,0 +1,60 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::BudgetSummary +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'BudgetSummary' do + before do + # run before each test + @instance = SwaggerClient::BudgetSummary.new + end + + after do + # run after each test + end + + describe 'test an instance of BudgetSummary' do + it 'should create an instance of BudgetSummary' do + expect(@instance).to be_instance_of(SwaggerClient::BudgetSummary) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "currency_format"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/budget_summary_wrapper_spec.rb b/spec/models/budget_summary_wrapper_spec.rb new file mode 100644 index 0000000..a7f904c --- /dev/null +++ b/spec/models/budget_summary_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::BudgetSummaryWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'BudgetSummaryWrapper' do + before do + # run before each test + @instance = SwaggerClient::BudgetSummaryWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of BudgetSummaryWrapper' do + it 'should create an instance of BudgetSummaryWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::BudgetSummaryWrapper) + end + end + describe 'test attribute "budgets"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/categories_response_spec.rb b/spec/models/categories_response_spec.rb new file mode 100644 index 0000000..95881fa --- /dev/null +++ b/spec/models/categories_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::CategoriesResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CategoriesResponse' do + before do + # run before each test + @instance = SwaggerClient::CategoriesResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoriesResponse' do + it 'should create an instance of CategoriesResponse' do + expect(@instance).to be_instance_of(SwaggerClient::CategoriesResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/category_group_spec.rb b/spec/models/category_group_spec.rb new file mode 100644 index 0000000..dac1ef4 --- /dev/null +++ b/spec/models/category_group_spec.rb @@ -0,0 +1,54 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::CategoryGroup +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CategoryGroup' do + before do + # run before each test + @instance = SwaggerClient::CategoryGroup.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoryGroup' do + it 'should create an instance of CategoryGroup' do + expect(@instance).to be_instance_of(SwaggerClient::CategoryGroup) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "hidden"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/category_group_with_categories_spec.rb b/spec/models/category_group_with_categories_spec.rb new file mode 100644 index 0000000..c8f1731 --- /dev/null +++ b/spec/models/category_group_with_categories_spec.rb @@ -0,0 +1,54 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::CategoryGroupWithCategories +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CategoryGroupWithCategories' do + before do + # run before each test + @instance = SwaggerClient::CategoryGroupWithCategories.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoryGroupWithCategories' do + it 'should create an instance of CategoryGroupWithCategories' do + expect(@instance).to be_instance_of(SwaggerClient::CategoryGroupWithCategories) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "hidden"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/category_groups_wrapper_spec.rb b/spec/models/category_groups_wrapper_spec.rb new file mode 100644 index 0000000..2996835 --- /dev/null +++ b/spec/models/category_groups_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::CategoryGroupsWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CategoryGroupsWrapper' do + before do + # run before each test + @instance = SwaggerClient::CategoryGroupsWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoryGroupsWrapper' do + it 'should create an instance of CategoryGroupsWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::CategoryGroupsWrapper) + end + end + describe 'test attribute "category_groups"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/category_response_spec.rb b/spec/models/category_response_spec.rb new file mode 100644 index 0000000..1dae3f6 --- /dev/null +++ b/spec/models/category_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::CategoryResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CategoryResponse' do + before do + # run before each test + @instance = SwaggerClient::CategoryResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoryResponse' do + it 'should create an instance of CategoryResponse' do + expect(@instance).to be_instance_of(SwaggerClient::CategoryResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb new file mode 100644 index 0000000..eceb383 --- /dev/null +++ b/spec/models/category_spec.rb @@ -0,0 +1,78 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::Category +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'Category' do + before do + # run before each test + @instance = SwaggerClient::Category.new + end + + after do + # run after each test + end + + describe 'test an instance of Category' do + it 'should create an instance of Category' do + expect(@instance).to be_instance_of(SwaggerClient::Category) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "category_group_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "hidden"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "budgeted"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "activity"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "balance"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/category_wrapper_spec.rb b/spec/models/category_wrapper_spec.rb new file mode 100644 index 0000000..e267b92 --- /dev/null +++ b/spec/models/category_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::CategoryWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CategoryWrapper' do + before do + # run before each test + @instance = SwaggerClient::CategoryWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoryWrapper' do + it 'should create an instance of CategoryWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::CategoryWrapper) + end + end + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/currency_format_spec.rb b/spec/models/currency_format_spec.rb new file mode 100644 index 0000000..bd5971e --- /dev/null +++ b/spec/models/currency_format_spec.rb @@ -0,0 +1,36 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::CurrencyFormat +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'CurrencyFormat' do + before do + # run before each test + @instance = SwaggerClient::CurrencyFormat.new + end + + after do + # run after each test + end + + describe 'test an instance of CurrencyFormat' do + it 'should create an instance of CurrencyFormat' do + expect(@instance).to be_instance_of(SwaggerClient::CurrencyFormat) + end + end +end + diff --git a/spec/models/date_format_spec.rb b/spec/models/date_format_spec.rb new file mode 100644 index 0000000..a4ba2ba --- /dev/null +++ b/spec/models/date_format_spec.rb @@ -0,0 +1,36 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::DateFormat +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'DateFormat' do + before do + # run before each test + @instance = SwaggerClient::DateFormat.new + end + + after do + # run after each test + end + + describe 'test an instance of DateFormat' do + it 'should create an instance of DateFormat' do + expect(@instance).to be_instance_of(SwaggerClient::DateFormat) + end + end +end + diff --git a/spec/models/error_detail_spec.rb b/spec/models/error_detail_spec.rb new file mode 100644 index 0000000..563feae --- /dev/null +++ b/spec/models/error_detail_spec.rb @@ -0,0 +1,54 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ErrorDetail +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ErrorDetail' do + before do + # run before each test + @instance = SwaggerClient::ErrorDetail.new + end + + after do + # run after each test + end + + describe 'test an instance of ErrorDetail' do + it 'should create an instance of ErrorDetail' do + expect(@instance).to be_instance_of(SwaggerClient::ErrorDetail) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/error_response_spec.rb b/spec/models/error_response_spec.rb new file mode 100644 index 0000000..b23c796 --- /dev/null +++ b/spec/models/error_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ErrorResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ErrorResponse' do + before do + # run before each test + @instance = SwaggerClient::ErrorResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of ErrorResponse' do + it 'should create an instance of ErrorResponse' do + expect(@instance).to be_instance_of(SwaggerClient::ErrorResponse) + end + end + describe 'test attribute "error"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/month_detail_response_spec.rb b/spec/models/month_detail_response_spec.rb new file mode 100644 index 0000000..07e16ea --- /dev/null +++ b/spec/models/month_detail_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::MonthDetailResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'MonthDetailResponse' do + before do + # run before each test + @instance = SwaggerClient::MonthDetailResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of MonthDetailResponse' do + it 'should create an instance of MonthDetailResponse' do + expect(@instance).to be_instance_of(SwaggerClient::MonthDetailResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/month_detail_spec.rb b/spec/models/month_detail_spec.rb new file mode 100644 index 0000000..7a639ef --- /dev/null +++ b/spec/models/month_detail_spec.rb @@ -0,0 +1,48 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::MonthDetail +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'MonthDetail' do + before do + # run before each test + @instance = SwaggerClient::MonthDetail.new + end + + after do + # run after each test + end + + describe 'test an instance of MonthDetail' do + it 'should create an instance of MonthDetail' do + expect(@instance).to be_instance_of(SwaggerClient::MonthDetail) + end + end + describe 'test attribute "month"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "categories"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/month_detail_wrapper_spec.rb b/spec/models/month_detail_wrapper_spec.rb new file mode 100644 index 0000000..298aeae --- /dev/null +++ b/spec/models/month_detail_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::MonthDetailWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'MonthDetailWrapper' do + before do + # run before each test + @instance = SwaggerClient::MonthDetailWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of MonthDetailWrapper' do + it 'should create an instance of MonthDetailWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::MonthDetailWrapper) + end + end + describe 'test attribute "month"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/month_summaries_response_spec.rb b/spec/models/month_summaries_response_spec.rb new file mode 100644 index 0000000..86b0f71 --- /dev/null +++ b/spec/models/month_summaries_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::MonthSummariesResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'MonthSummariesResponse' do + before do + # run before each test + @instance = SwaggerClient::MonthSummariesResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of MonthSummariesResponse' do + it 'should create an instance of MonthSummariesResponse' do + expect(@instance).to be_instance_of(SwaggerClient::MonthSummariesResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/month_summaries_wrapper_spec.rb b/spec/models/month_summaries_wrapper_spec.rb new file mode 100644 index 0000000..d89ffb8 --- /dev/null +++ b/spec/models/month_summaries_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::MonthSummariesWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'MonthSummariesWrapper' do + before do + # run before each test + @instance = SwaggerClient::MonthSummariesWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of MonthSummariesWrapper' do + it 'should create an instance of MonthSummariesWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::MonthSummariesWrapper) + end + end + describe 'test attribute "months"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/month_summary_spec.rb b/spec/models/month_summary_spec.rb new file mode 100644 index 0000000..809ed5c --- /dev/null +++ b/spec/models/month_summary_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::MonthSummary +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'MonthSummary' do + before do + # run before each test + @instance = SwaggerClient::MonthSummary.new + end + + after do + # run after each test + end + + describe 'test an instance of MonthSummary' do + it 'should create an instance of MonthSummary' do + expect(@instance).to be_instance_of(SwaggerClient::MonthSummary) + end + end + describe 'test attribute "month"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_location_response_spec.rb b/spec/models/payee_location_response_spec.rb new file mode 100644 index 0000000..cc6cb29 --- /dev/null +++ b/spec/models/payee_location_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeeLocationResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeLocationResponse' do + before do + # run before each test + @instance = SwaggerClient::PayeeLocationResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeLocationResponse' do + it 'should create an instance of PayeeLocationResponse' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeLocationResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_location_spec.rb b/spec/models/payee_location_spec.rb new file mode 100644 index 0000000..bfbcedc --- /dev/null +++ b/spec/models/payee_location_spec.rb @@ -0,0 +1,48 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeeLocation +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeLocation' do + before do + # run before each test + @instance = SwaggerClient::PayeeLocation.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeLocation' do + it 'should create an instance of PayeeLocation' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeLocation) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "payee_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_location_wrapper_spec.rb b/spec/models/payee_location_wrapper_spec.rb new file mode 100644 index 0000000..8916408 --- /dev/null +++ b/spec/models/payee_location_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeeLocationWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeLocationWrapper' do + before do + # run before each test + @instance = SwaggerClient::PayeeLocationWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeLocationWrapper' do + it 'should create an instance of PayeeLocationWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeLocationWrapper) + end + end + describe 'test attribute "payee_location"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_locations_response_spec.rb b/spec/models/payee_locations_response_spec.rb new file mode 100644 index 0000000..b016503 --- /dev/null +++ b/spec/models/payee_locations_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeeLocationsResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeLocationsResponse' do + before do + # run before each test + @instance = SwaggerClient::PayeeLocationsResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeLocationsResponse' do + it 'should create an instance of PayeeLocationsResponse' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeLocationsResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_locations_wrapper_spec.rb b/spec/models/payee_locations_wrapper_spec.rb new file mode 100644 index 0000000..7d34afd --- /dev/null +++ b/spec/models/payee_locations_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeeLocationsWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeLocationsWrapper' do + before do + # run before each test + @instance = SwaggerClient::PayeeLocationsWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeLocationsWrapper' do + it 'should create an instance of PayeeLocationsWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeLocationsWrapper) + end + end + describe 'test attribute "payee_locations"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_response_spec.rb b/spec/models/payee_response_spec.rb new file mode 100644 index 0000000..c4a6f37 --- /dev/null +++ b/spec/models/payee_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeeResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeResponse' do + before do + # run before each test + @instance = SwaggerClient::PayeeResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeResponse' do + it 'should create an instance of PayeeResponse' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_spec.rb b/spec/models/payee_spec.rb new file mode 100644 index 0000000..7f86ee9 --- /dev/null +++ b/spec/models/payee_spec.rb @@ -0,0 +1,48 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::Payee +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'Payee' do + before do + # run before each test + @instance = SwaggerClient::Payee.new + end + + after do + # run after each test + end + + describe 'test an instance of Payee' do + it 'should create an instance of Payee' do + expect(@instance).to be_instance_of(SwaggerClient::Payee) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payee_wrapper_spec.rb b/spec/models/payee_wrapper_spec.rb new file mode 100644 index 0000000..18caff8 --- /dev/null +++ b/spec/models/payee_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeeWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeeWrapper' do + before do + # run before each test + @instance = SwaggerClient::PayeeWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeeWrapper' do + it 'should create an instance of PayeeWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::PayeeWrapper) + end + end + describe 'test attribute "payee"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payees_response_spec.rb b/spec/models/payees_response_spec.rb new file mode 100644 index 0000000..62ebdc3 --- /dev/null +++ b/spec/models/payees_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeesResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeesResponse' do + before do + # run before each test + @instance = SwaggerClient::PayeesResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeesResponse' do + it 'should create an instance of PayeesResponse' do + expect(@instance).to be_instance_of(SwaggerClient::PayeesResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/payees_wrapper_spec.rb b/spec/models/payees_wrapper_spec.rb new file mode 100644 index 0000000..ad33ac0 --- /dev/null +++ b/spec/models/payees_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::PayeesWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'PayeesWrapper' do + before do + # run before each test + @instance = SwaggerClient::PayeesWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of PayeesWrapper' do + it 'should create an instance of PayeesWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::PayeesWrapper) + end + end + describe 'test attribute "payees"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/scheduled_sub_transaction_spec.rb b/spec/models/scheduled_sub_transaction_spec.rb new file mode 100644 index 0000000..6290509 --- /dev/null +++ b/spec/models/scheduled_sub_transaction_spec.rb @@ -0,0 +1,54 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ScheduledSubTransaction +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledSubTransaction' do + before do + # run before each test + @instance = SwaggerClient::ScheduledSubTransaction.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledSubTransaction' do + it 'should create an instance of ScheduledSubTransaction' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledSubTransaction) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "scheduled_transaction_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/scheduled_transaction_detail_response_spec.rb b/spec/models/scheduled_transaction_detail_response_spec.rb new file mode 100644 index 0000000..6765f28 --- /dev/null +++ b/spec/models/scheduled_transaction_detail_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ScheduledTransactionDetailResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledTransactionDetailResponse' do + before do + # run before each test + @instance = SwaggerClient::ScheduledTransactionDetailResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledTransactionDetailResponse' do + it 'should create an instance of ScheduledTransactionDetailResponse' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledTransactionDetailResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/scheduled_transaction_detail_spec.rb b/spec/models/scheduled_transaction_detail_spec.rb new file mode 100644 index 0000000..f231148 --- /dev/null +++ b/spec/models/scheduled_transaction_detail_spec.rb @@ -0,0 +1,72 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ScheduledTransactionDetail +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledTransactionDetail' do + before do + # run before each test + @instance = SwaggerClient::ScheduledTransactionDetail.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledTransactionDetail' do + it 'should create an instance of ScheduledTransactionDetail' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledTransactionDetail) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "frequency"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "subtransactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/scheduled_transaction_detail_wrapper_spec.rb b/spec/models/scheduled_transaction_detail_wrapper_spec.rb new file mode 100644 index 0000000..5d9b364 --- /dev/null +++ b/spec/models/scheduled_transaction_detail_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ScheduledTransactionDetailWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledTransactionDetailWrapper' do + before do + # run before each test + @instance = SwaggerClient::ScheduledTransactionDetailWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledTransactionDetailWrapper' do + it 'should create an instance of ScheduledTransactionDetailWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledTransactionDetailWrapper) + end + end + describe 'test attribute "scheduled_transaction"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/scheduled_transaction_summaries_response_spec.rb b/spec/models/scheduled_transaction_summaries_response_spec.rb new file mode 100644 index 0000000..f7e37da --- /dev/null +++ b/spec/models/scheduled_transaction_summaries_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ScheduledTransactionSummariesResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledTransactionSummariesResponse' do + before do + # run before each test + @instance = SwaggerClient::ScheduledTransactionSummariesResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledTransactionSummariesResponse' do + it 'should create an instance of ScheduledTransactionSummariesResponse' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledTransactionSummariesResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/scheduled_transaction_summaries_wrapper_spec.rb b/spec/models/scheduled_transaction_summaries_wrapper_spec.rb new file mode 100644 index 0000000..8cc446f --- /dev/null +++ b/spec/models/scheduled_transaction_summaries_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ScheduledTransactionSummariesWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledTransactionSummariesWrapper' do + before do + # run before each test + @instance = SwaggerClient::ScheduledTransactionSummariesWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledTransactionSummariesWrapper' do + it 'should create an instance of ScheduledTransactionSummariesWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledTransactionSummariesWrapper) + end + end + describe 'test attribute "scheduled_transactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/scheduled_transaction_summary_spec.rb b/spec/models/scheduled_transaction_summary_spec.rb new file mode 100644 index 0000000..b0eeac1 --- /dev/null +++ b/spec/models/scheduled_transaction_summary_spec.rb @@ -0,0 +1,66 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::ScheduledTransactionSummary +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ScheduledTransactionSummary' do + before do + # run before each test + @instance = SwaggerClient::ScheduledTransactionSummary.new + end + + after do + # run after each test + end + + describe 'test an instance of ScheduledTransactionSummary' do + it 'should create an instance of ScheduledTransactionSummary' do + expect(@instance).to be_instance_of(SwaggerClient::ScheduledTransactionSummary) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "frequency"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/sub_transaction_spec.rb b/spec/models/sub_transaction_spec.rb new file mode 100644 index 0000000..d1345f0 --- /dev/null +++ b/spec/models/sub_transaction_spec.rb @@ -0,0 +1,54 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::SubTransaction +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'SubTransaction' do + before do + # run before each test + @instance = SwaggerClient::SubTransaction.new + end + + after do + # run after each test + end + + describe 'test an instance of SubTransaction' do + it 'should create an instance of SubTransaction' do + expect(@instance).to be_instance_of(SwaggerClient::SubTransaction) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "transaction_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/transaction_detail_response_spec.rb b/spec/models/transaction_detail_response_spec.rb new file mode 100644 index 0000000..9485708 --- /dev/null +++ b/spec/models/transaction_detail_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::TransactionDetailResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'TransactionDetailResponse' do + before do + # run before each test + @instance = SwaggerClient::TransactionDetailResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionDetailResponse' do + it 'should create an instance of TransactionDetailResponse' do + expect(@instance).to be_instance_of(SwaggerClient::TransactionDetailResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/transaction_detail_spec.rb b/spec/models/transaction_detail_spec.rb new file mode 100644 index 0000000..fc074e0 --- /dev/null +++ b/spec/models/transaction_detail_spec.rb @@ -0,0 +1,78 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::TransactionDetail +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'TransactionDetail' do + before do + # run before each test + @instance = SwaggerClient::TransactionDetail.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionDetail' do + it 'should create an instance of TransactionDetail' do + expect(@instance).to be_instance_of(SwaggerClient::TransactionDetail) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "cleared"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "approved"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "subtransactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/transaction_detail_wrapper_spec.rb b/spec/models/transaction_detail_wrapper_spec.rb new file mode 100644 index 0000000..f5ff00f --- /dev/null +++ b/spec/models/transaction_detail_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::TransactionDetailWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'TransactionDetailWrapper' do + before do + # run before each test + @instance = SwaggerClient::TransactionDetailWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionDetailWrapper' do + it 'should create an instance of TransactionDetailWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::TransactionDetailWrapper) + end + end + describe 'test attribute "transaction"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/transaction_summaries_response_spec.rb b/spec/models/transaction_summaries_response_spec.rb new file mode 100644 index 0000000..33d3661 --- /dev/null +++ b/spec/models/transaction_summaries_response_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::TransactionSummariesResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'TransactionSummariesResponse' do + before do + # run before each test + @instance = SwaggerClient::TransactionSummariesResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionSummariesResponse' do + it 'should create an instance of TransactionSummariesResponse' do + expect(@instance).to be_instance_of(SwaggerClient::TransactionSummariesResponse) + end + end + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/transaction_summaries_wrapper_spec.rb b/spec/models/transaction_summaries_wrapper_spec.rb new file mode 100644 index 0000000..5cadf8d --- /dev/null +++ b/spec/models/transaction_summaries_wrapper_spec.rb @@ -0,0 +1,42 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::TransactionSummariesWrapper +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'TransactionSummariesWrapper' do + before do + # run before each test + @instance = SwaggerClient::TransactionSummariesWrapper.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionSummariesWrapper' do + it 'should create an instance of TransactionSummariesWrapper' do + expect(@instance).to be_instance_of(SwaggerClient::TransactionSummariesWrapper) + end + end + describe 'test attribute "transactions"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/models/transaction_summary_spec.rb b/spec/models/transaction_summary_spec.rb new file mode 100644 index 0000000..1b09f05 --- /dev/null +++ b/spec/models/transaction_summary_spec.rb @@ -0,0 +1,72 @@ +=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.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for SwaggerClient::TransactionSummary +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'TransactionSummary' do + before do + # run before each test + @instance = SwaggerClient::TransactionSummary.new + end + + after do + # run after each test + end + + describe 'test an instance of TransactionSummary' do + it 'should create an instance of TransactionSummary' do + expect(@instance).to be_instance_of(SwaggerClient::TransactionSummary) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "cleared"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "approved"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..e9baf69 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,111 @@ +=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.3.0-SNAPSHOT + +=end + +# load the gem +require 'swagger_client' + +# The following was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end diff --git a/ynab.gemspec b/ynab.gemspec new file mode 100644 index 0000000..6d2ce56 --- /dev/null +++ b/ynab.gemspec @@ -0,0 +1,45 @@ +# -*- encoding: utf-8 -*- +# +=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.3.0-SNAPSHOT + +=end + +$:.push File.expand_path("../lib", __FILE__) +require "ynab/version" + +Gem::Specification.new do |s| + s.name = "ynab" + s.version = YnabAPI::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["You Need A Budget, LLC"] + s.email = ["help@youneedabudget.com"] + s.homepage = "https://github.com/ynab/ynab-sdk-ruby" + s.summary = "YNAB API Endpoints Ruby Gem" + s.description = "Ruby gem wrapper for the YNAB API. Read the documentation at https://api.youneedabudget.com" + s.license = "Apache-2.0" + s.required_ruby_version = ">= 1.9" + + s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' + s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0' + + s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' + s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1' + s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3' + s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6' + s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2' + s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16' + s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12' + + s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? } + s.test_files = `find spec/*`.split("\n") + s.executables = [] + s.require_paths = ["lib"] +end