mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
Merge pull request #2946 from wing328/ruby_license
[Ruby] update Ruby API client to use apache v2 license
This commit is contained in:
commit
d05d552b74
@ -225,6 +225,9 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
|
||||
|
||||
// test files should not be overwritten
|
||||
writeOptional(outputFolder, new SupportingFile("rspec.mustache", "", ".rspec"));
|
||||
writeOptional(outputFolder, new SupportingFile("spec_helper.mustache", specFolder, "spec_helper.rb"));
|
||||
writeOptional(outputFolder, new SupportingFile("configuration_spec.mustache", specFolder, "configuration_spec.rb"));
|
||||
|
@ -1,18 +1,23 @@
|
||||
{{#appName}}{{{appName}}}
|
||||
{{#appName}}
|
||||
{{{appName}}}
|
||||
|
||||
{{/appName}}
|
||||
{{#appDescription}}{{{appDescription}}}
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
|
||||
{{/appDescription}}
|
||||
{{#version}}OpenAPI spec version: {{version}}{{/version}}
|
||||
{{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}}
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
{{#licenseInfo}}
|
||||
License: {{{licenseInfo}}}
|
||||
{{#licenseUrl}}{{licenseUrl}}{{/licenseUrl}}
|
||||
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
|
||||
|
||||
{{/licenseInfo}}
|
||||
{{#termsOfService}}
|
||||
Terms of Service: {{{termsOfService}}}
|
||||
{{/termsOfService}}
|
||||
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.
|
||||
|
23
samples/client/petstore/ruby/.swagger-codegen-ignore
Normal file
23
samples/client/petstore/ruby/.swagger-codegen-ignore
Normal file
@ -0,0 +1,23 @@
|
||||
# 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
|
||||
# Thsi 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
|
201
samples/client/petstore/ruby/LICENSE
Normal file
201
samples/client/petstore/ruby/LICENSE
Normal file
@ -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 {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-05-11T16:13:11.464+08:00
|
||||
- Build date: 2016-05-24T17:47:46.459+08:00
|
||||
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
||||
|
||||
## Installation
|
||||
@ -116,6 +116,7 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
- [Petstore::AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [Petstore::Animal](docs/Animal.md)
|
||||
- [Petstore::AnimalFarm](docs/AnimalFarm.md)
|
||||
- [Petstore::ApiResponse](docs/ApiResponse.md)
|
||||
@ -125,11 +126,13 @@ Class | Method | HTTP request | Description
|
||||
- [Petstore::EnumClass](docs/EnumClass.md)
|
||||
- [Petstore::EnumTest](docs/EnumTest.md)
|
||||
- [Petstore::FormatTest](docs/FormatTest.md)
|
||||
- [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Petstore::Model200Response](docs/Model200Response.md)
|
||||
- [Petstore::ModelReturn](docs/ModelReturn.md)
|
||||
- [Petstore::Name](docs/Name.md)
|
||||
- [Petstore::Order](docs/Order.md)
|
||||
- [Petstore::Pet](docs/Pet.md)
|
||||
- [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [Petstore::SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Petstore::Tag](docs/Tag.md)
|
||||
- [Petstore::User](docs/User.md)
|
||||
@ -138,6 +141,12 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@ -147,9 +156,3 @@ Class | Method | HTTP request | Description
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
# Petstore::AdditionalPropertiesClass
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
@ -75,8 +75,8 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Petstore::MixedPropertiesAndAdditionalPropertiesClass
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**uuid** | **String** | | [optional]
|
||||
**date_time** | **DateTime** | | [optional]
|
||||
|
||||
|
9
samples/client/petstore/ruby/docs/ReadOnlyFirst.md
Normal file
9
samples/client/petstore/ruby/docs/ReadOnlyFirst.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Petstore::ReadOnlyFirst
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bar** | **String** | | [optional]
|
||||
**baz** | **String** | | [optional]
|
||||
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
@ -21,6 +28,7 @@ require 'petstore/version'
|
||||
require 'petstore/configuration'
|
||||
|
||||
# Models
|
||||
require 'petstore/models/additional_properties_class'
|
||||
require 'petstore/models/animal'
|
||||
require 'petstore/models/animal_farm'
|
||||
require 'petstore/models/api_response'
|
||||
@ -30,11 +38,13 @@ require 'petstore/models/dog'
|
||||
require 'petstore/models/enum_class'
|
||||
require 'petstore/models/enum_test'
|
||||
require 'petstore/models/format_test'
|
||||
require 'petstore/models/mixed_properties_and_additional_properties_class'
|
||||
require 'petstore/models/model_200_response'
|
||||
require 'petstore/models/model_return'
|
||||
require 'petstore/models/name'
|
||||
require 'petstore/models/order'
|
||||
require 'petstore/models/pet'
|
||||
require 'petstore/models/read_only_first'
|
||||
require 'petstore/models/special_model_name'
|
||||
require 'petstore/models/tag'
|
||||
require 'petstore/models/user'
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
@ -131,11 +138,11 @@ module Petstore
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
local_header_accept = ['application/xml', 'application/json']
|
||||
local_header_accept = ['application/xml; charset=utf-8', 'application/json; charset=utf-8']
|
||||
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
local_header_content_type = []
|
||||
local_header_content_type = ['application/xml; charset=utf-8', 'application/json; charset=utf-8']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
||||
|
||||
# form parameters
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
|
@ -157,13 +157,6 @@ module Petstore
|
||||
# Returns Auth Settings hash for api client.
|
||||
def auth_settings
|
||||
{
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
'api_key' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
@ -171,6 +164,13 @@ module Petstore
|
||||
key: 'api_key',
|
||||
value: api_key_with_prefix('api_key')
|
||||
},
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,188 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class AdditionalPropertiesClass
|
||||
# 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?
|
||||
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 =~ /^Array<(.*)>/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 =~ /^(true|t|yes|y|1)$/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\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 = Petstore.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
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Animal
|
||||
attr_accessor :class_name
|
||||
|
||||
@ -200,4 +208,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class AnimalFarm
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
@ -176,4 +184,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class ApiResponse
|
||||
attr_accessor :code
|
||||
|
||||
@ -203,4 +211,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Cat
|
||||
attr_accessor :class_name
|
||||
|
||||
@ -209,4 +217,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Category
|
||||
attr_accessor :id
|
||||
|
||||
@ -194,4 +202,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Dog
|
||||
attr_accessor :class_name
|
||||
|
||||
@ -209,4 +217,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,16 +1,23 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
@ -18,9 +25,10 @@ require 'date'
|
||||
|
||||
module Petstore
|
||||
class EnumClass
|
||||
|
||||
ABC = "_ab\"c".freeze
|
||||
|
||||
ABC = "_abc".freeze
|
||||
EFG = "-efg".freeze
|
||||
XYZ = "(xy'z)".freeze
|
||||
XYZ = "(xyz)".freeze
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class EnumTest
|
||||
attr_accessor :enum_string
|
||||
|
||||
@ -245,4 +253,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class FormatTest
|
||||
attr_accessor :integer
|
||||
|
||||
@ -483,4 +491,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -0,0 +1,206 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class MixedPropertiesAndAdditionalPropertiesClass
|
||||
attr_accessor :uuid
|
||||
|
||||
attr_accessor :date_time
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'uuid' => :'uuid',
|
||||
:'date_time' => :'dateTime'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.swagger_types
|
||||
{
|
||||
:'uuid' => :'String',
|
||||
:'date_time' => :'DateTime'
|
||||
}
|
||||
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?(:'uuid')
|
||||
self.uuid = attributes[:'uuid']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'dateTime')
|
||||
self.date_time = attributes[:'dateTime']
|
||||
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
|
||||
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?
|
||||
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 &&
|
||||
uuid == o.uuid &&
|
||||
date_time == o.date_time
|
||||
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
|
||||
[uuid, date_time].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 =~ /^Array<(.*)>/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 =~ /^(true|t|yes|y|1)$/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\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 = Petstore.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
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
@ -186,4 +193,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
@ -186,4 +193,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
@ -217,4 +224,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Order
|
||||
attr_accessor :id
|
||||
|
||||
@ -247,4 +255,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Pet
|
||||
attr_accessor :id
|
||||
|
||||
@ -257,4 +265,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -0,0 +1,206 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class ReadOnlyFirst
|
||||
attr_accessor :bar
|
||||
|
||||
attr_accessor :baz
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'bar' => :'bar',
|
||||
:'baz' => :'baz'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.swagger_types
|
||||
{
|
||||
:'bar' => :'String',
|
||||
:'baz' => :'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?(:'bar')
|
||||
self.bar = attributes[:'bar']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'baz')
|
||||
self.baz = attributes[:'baz']
|
||||
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
|
||||
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?
|
||||
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 &&
|
||||
bar == o.bar &&
|
||||
baz == o.baz
|
||||
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
|
||||
[bar, baz].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 =~ /^Array<(.*)>/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 =~ /^(true|t|yes|y|1)$/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\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 = Petstore.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
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class SpecialModelName
|
||||
attr_accessor :special_property_name
|
||||
|
||||
@ -185,4 +193,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Tag
|
||||
attr_accessor :id
|
||||
|
||||
@ -194,4 +202,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,16 +7,24 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class User
|
||||
attr_accessor :id
|
||||
|
||||
@ -249,4 +257,5 @@ module Petstore
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,10 +7,17 @@ OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
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
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
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.
|
||||
|
||||
=end
|
||||
|
||||
|
71
samples/client/petstore/ruby/spec/.spec_helper.rb
Normal file
71
samples/client/petstore/ruby/spec/.spec_helper.rb
Normal file
@ -0,0 +1,71 @@
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
require 'petstore'
|
||||
require 'vcr'
|
||||
require 'typhoeus'
|
||||
require 'json'
|
||||
require 'yaml'
|
||||
require 'rspec'
|
||||
|
||||
RSpec.configure do |config|
|
||||
# some (optional) config here
|
||||
config.expect_with :rspec do |c|
|
||||
c.syntax = :should
|
||||
end
|
||||
config.mock_with :rspec do |c|
|
||||
c.syntax = :should
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
WebMock.allow_net_connect! if defined? WebMock
|
||||
|
||||
def help
|
||||
puts "\nOh noes! You gotta stuff your swagger credentials in ~/.swagger.yml like so:\n\n"
|
||||
puts "api_key: '12345abcdefg'"
|
||||
puts "username: 'fumanchu'"
|
||||
puts "password: 'kalamazoo'\n\n"
|
||||
exit
|
||||
end
|
||||
|
||||
# no longer reading credentials (not used) from file (20150413)
|
||||
# Parse ~/.swagger.yml for user credentials
|
||||
#begin
|
||||
# CREDENTIALS = YAML::load_file(File.join(ENV['HOME'], ".swagger.yml")).symbolize_keys
|
||||
#rescue
|
||||
# help
|
||||
#end
|
||||
|
||||
API_CLIENT = Petstore::ApiClient.new(Petstore::Configuration.new)
|
||||
|
||||
def random_id
|
||||
rand(1000000) + 20000
|
||||
end
|
||||
|
||||
# create a random pet, return its id
|
||||
def prepare_pet(pet_api)
|
||||
pet_id = random_id
|
||||
category = Petstore::Category.new('id' => 20002, 'name' => 'category test')
|
||||
tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')
|
||||
pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url',
|
||||
'category' => category, 'tags' => [tag], 'status' => 'pending')
|
||||
pet_api.add_pet(pet)
|
||||
return pet_id
|
||||
end
|
||||
|
||||
# create a random order, return its id
|
||||
def prepare_store(store_api)
|
||||
order_id = 5
|
||||
order = Petstore::Order.new("id" => order_id,
|
||||
"petId" => 123,
|
||||
"quantity" => 789,
|
||||
"shipDate" => "2015-04-06T23:42:01.678Z",
|
||||
"status" => "placed",
|
||||
"complete" => false)
|
||||
store_api.place_order(order)
|
||||
return order_id
|
||||
end
|
||||
|
||||
# A random string to tack onto stuff to ensure we're not seeing
|
||||
# data from a previous test run
|
||||
RAND = ("a".."z").to_a.sample(8).join
|
@ -0,0 +1,40 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::AdditionalPropertiesClass
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'AdditionalPropertiesClass' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::AdditionalPropertiesClass.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of AdditionalPropertiesClass' do
|
||||
it 'should create an instact of AdditionalPropertiesClass' do
|
||||
expect(@instance).to be_instance_of(Petstore::AdditionalPropertiesClass)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,52 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::MixedPropertiesAndAdditionalPropertiesClass
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::MixedPropertiesAndAdditionalPropertiesClass.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
it 'should create an instact of MixedPropertiesAndAdditionalPropertiesClass' do
|
||||
expect(@instance).to be_instance_of(Petstore::MixedPropertiesAndAdditionalPropertiesClass)
|
||||
end
|
||||
end
|
||||
describe 'test attribute "uuid"' 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_time"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -0,0 +1,52 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
require 'date'
|
||||
|
||||
# Unit tests for Petstore::ReadOnlyFirst
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'ReadOnlyFirst' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ReadOnlyFirst.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ReadOnlyFirst' do
|
||||
it 'should create an instact of ReadOnlyFirst' do
|
||||
expect(@instance).to be_instance_of(Petstore::ReadOnlyFirst)
|
||||
end
|
||||
end
|
||||
describe 'test attribute "bar"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "baz"' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user