forked from loafle/openapi-generator-original
Merge pull request #2408 from wing328/enhancement/getting-started
[JS][Ruby] Auto generate the "Getting Started" section in the README
This commit is contained in:
@@ -1,69 +1,104 @@
|
||||
# {{projectName}}
|
||||
|
||||
{{moduleName}} - JavaScript client for {{projectName}}
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
Version: {{projectVersion}}
|
||||
|
||||
Automatically generated by the JavaScript Swagger Codegen project:
|
||||
|
||||
- API verion: {{appVersion}}
|
||||
- Package version: {{projectVersion}}
|
||||
- Build date: {{generatedDate}}
|
||||
- Build package: {{generatorClass}}
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
## Installation
|
||||
|
||||
### Use in [Node.js](https://nodejs.org/)
|
||||
### For [Node.js](https://nodejs.org/)
|
||||
|
||||
The generated client is valid [npm](https://www.npmjs.com/) package, you can publish it as described
|
||||
in [Publishing npm packages](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
||||
#### npm
|
||||
|
||||
After that, you can install it into your project via:
|
||||
To publish the library as a [npm](https://www.npmjs.com/),
|
||||
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
||||
|
||||
Then install it via:
|
||||
|
||||
```shell
|
||||
npm install {{{projectName}}} --save
|
||||
```
|
||||
|
||||
You can also host the generated client as a git repository on github, e.g.
|
||||
https://github.com/YOUR_USERNAME/{{projectName}}
|
||||
|
||||
Then you can install it via:
|
||||
#### git
|
||||
#
|
||||
If the library is hosted at a git repository, e.g.
|
||||
https://github.com/{{#gitUserName}}{{.}}{{/gitUserName}}{{^gitUserName}}YOUR_USERNAME{{/gitUserName}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}}
|
||||
then install it via:
|
||||
|
||||
```shell
|
||||
npm install YOUR_USERNAME/{{{projectName}}} --save
|
||||
npm install {{#gitUserName}}{{.}}{{/gitUserName}}{{^gitUserName}}YOUR_USERNAME{{/gitUserName}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}{{projectName}}{{/gitRepoId}} --save
|
||||
```
|
||||
|
||||
### Use in browser with [browserify](http://browserify.org/)
|
||||
### For browser
|
||||
|
||||
The client also works in browser environment via npm and browserify. After following
|
||||
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
||||
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
||||
you can do this in your project (assuming *main.js* is your entry file):
|
||||
perform the following (assuming *main.js* is your entry file):
|
||||
|
||||
```shell
|
||||
browserify main.js > bundle.js
|
||||
```
|
||||
|
||||
The generated *bundle.js* can now be included in your HTML pages.
|
||||
Then include *bundle.js* in the HTML pages.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following JS code:
|
||||
|
||||
```javascript
|
||||
var {{{moduleName}}} = require('{{{projectName}}}');
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
|
||||
var defaultClient = {{{moduleName}}}.ApiClient.default;
|
||||
defaultClient.timeout = 10 * 1000;
|
||||
defaultClient.defaultHeaders['Test-Header'] = 'test_value';
|
||||
{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.username = 'YOUR USERNAME'
|
||||
{{{name}}}.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//{{{name}}}.apiKeyPrefix['{{{keyParamName}}}'] = "Token"{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{{name}}}.accessToken = "YOUR ACCESS TOKEN"{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
// Assuming there's a `PetApi` containing a `getPetById` method
|
||||
// which returns a model object:
|
||||
var api = new {{{moduleName}}}.PetApi();
|
||||
api.getPetById(2, function(err, pet, resp) {
|
||||
console.log('HTTP status code: ' + resp.status);
|
||||
console.log('Response Content-Type: ' + resp.get('Content-Type'));
|
||||
if (err) {
|
||||
console.error(err);
|
||||
} else {
|
||||
console.log(pet);
|
||||
}
|
||||
var api = new {{{moduleName}}}.{{{classname}}}(){{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
var {{{paramName}}} = {{{example}}}; // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
var opts = { {{#allParams}}{{^required}}
|
||||
'{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}{{/required}}{{/allParams}}
|
||||
};{{/hasOptionalParams}}{{/hasParams}}
|
||||
{{#usePromises}}
|
||||
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
{{/usePromises}}{{^usePromises}}
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}
|
||||
};
|
||||
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}{{#hasParams}}, {{/hasParams}}callback);
|
||||
{{/usePromises}}{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* <description></description>
|
||||
* @alias module:<#apiPackage><apiPackage>/</apiPackage><classname>
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
</emitJSDoc> var exports = function(apiClient) {
|
||||
@@ -46,7 +46,7 @@
|
||||
* <notes></notes><#allParams><#required>
|
||||
* @param <&vendorExtensions.x-jsdoc-type> <paramName> <description></required></allParams><#hasOptionalParams>
|
||||
* @param {Object} opts Optional parameters<#allParams><^required>
|
||||
* @param <&vendorExtensions.x-jsdoc-type> opts.<paramName> <description></required></allParams></hasOptionalParams><^usePromises>
|
||||
* @param <&vendorExtensions.x-jsdoc-type> opts.<paramName> <description><#defaultValue> (default to <.>)</defaultValue></required></allParams></hasOptionalParams><^usePromises>
|
||||
* @param {module:<#apiPackage><apiPackage>/</apiPackage><classname>~<nickname>Callback} callback The callback function, accepting three arguments: error, data, response</usePromises><#returnType>
|
||||
* data is of type: <&vendorExtensions.x-jsdoc-type></returnType>
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ var {{{name}}} = defaultClient.authentications['{{{name}}}'];
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
var api = new {{{moduleName}}}.{{{classname}}}(){{#hasParams}}
|
||||
var apiInstance = new {{{moduleName}}}.{{{classname}}}(){{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
var {{{paramName}}} = {{{example}}}; // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
@@ -47,7 +47,7 @@ var opts = { {{#allParams}}{{^required}}
|
||||
'{{{paramName}}}': {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} // {{=< >=}}{<&dataType>}<={{ }}=> {{{description}}}{{/required}}{{/allParams}}
|
||||
};{{/hasOptionalParams}}{{/hasParams}}
|
||||
{{#usePromises}}
|
||||
api.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
|
||||
apiInstance.{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}).then(function({{#returnType}}data{{/returnType}}) {
|
||||
{{#returnType}}console.log('API called successfully. Returned data: ' + data);{{/returnType}}{{^returnType}}console.log('API called successfully.');{{/returnType}}
|
||||
}, function(error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -2,47 +2,51 @@
|
||||
|
||||
{{moduleName}} - the Ruby gem for the {{appName}}
|
||||
|
||||
Version: {{gemVersion}}
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
|
||||
Automatically generated by the Ruby Swagger Codegen project:
|
||||
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API verion: {{appVersion}}
|
||||
- Package version: {{gemVersion}}
|
||||
- Build date: {{generatedDate}}
|
||||
- Build package: {{generatorClass}}
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
## Installation
|
||||
|
||||
### Build a gem
|
||||
|
||||
You can build the generated client into a gem:
|
||||
To build the Ruby code into a gem:
|
||||
|
||||
```shell
|
||||
gem build {{{gemName}}}.gemspec
|
||||
```
|
||||
|
||||
Then you can either install the gem:
|
||||
Then either install the gem locally:
|
||||
|
||||
```shell
|
||||
gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
|
||||
```
|
||||
|
||||
or publish the gem to a gem server like [RubyGems](https://rubygems.org/).
|
||||
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
||||
|
||||
Finally add this to your Gemfile:
|
||||
Finally add this to the Gemfile:
|
||||
|
||||
gem '{{{gemName}}}', '~> {{{gemVersion}}}'
|
||||
|
||||
### Host as a git repository
|
||||
### Install from Git
|
||||
|
||||
You can also choose to host the generated client as a git repository, e.g. on github:
|
||||
https://github.com/YOUR_USERNAME/YOUR_REPO
|
||||
If the Ruby gem is hosted at a git repository: https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile:
|
||||
|
||||
Then you can reference it in Gemfile:
|
||||
gem '{{{gemName}}}', :git => 'https://github.com/{{#gitUserId}}{{.}}{{/gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{#gitRepoId}}{{.}}{{/gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git'
|
||||
|
||||
gem '{{{gemName}}}', :git => 'https://github.com/YOUR_USERNAME/YOUR_REPO.git'
|
||||
### Include the Ruby code directly
|
||||
|
||||
### Use without installation
|
||||
|
||||
You can also use the client directly like this:
|
||||
Include the Ruby code directly using `-I` as follows:
|
||||
|
||||
```shell
|
||||
ruby -Ilib script.rb
|
||||
@@ -50,24 +54,41 @@ ruby -Ilib script.rb
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) procedure and then run the following code:
|
||||
```ruby
|
||||
# Load the gem
|
||||
require '{{{gemName}}}'
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}
|
||||
# Setup authorization
|
||||
{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}
|
||||
# Configure HTTP basic authorization: {{{name}}}
|
||||
config.username = 'YOUR USERNAME'
|
||||
config.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
|
||||
# Configure API key authorization: {{{name}}}
|
||||
config.api_key['{{{keyParamName}}}'] = '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['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
|
||||
# Configure OAuth2 access token for authorization: {{{name}}}
|
||||
config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
|
||||
{{/authMethods}}end
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{{moduleName}}}.configure do |config|
|
||||
# Use the line below to configure API key authorization if needed:
|
||||
#config.api_key['api_key'] = 'your api key'
|
||||
api_instance = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
opts = { {{#allParams}}{{^required}}
|
||||
{{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
|
||||
}{{/hasOptionalParams}}{{/hasParams}}
|
||||
|
||||
config.host = 'petstore.swagger.io'
|
||||
config.base_path = '/v2'
|
||||
# Enable debugging (default is disabled).
|
||||
config.debugging = true
|
||||
begin
|
||||
{{#summary}} #{{{.}}}
|
||||
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
|
||||
p result{{/returnType}}
|
||||
rescue {{{moduleName}}}::ApiError => e
|
||||
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
|
||||
end
|
||||
|
||||
# Assuming there's a `PetApi` containing a `get_pet_by_id` method
|
||||
# which returns a model object:
|
||||
pet_api = {{{moduleName}}}::PetApi.new
|
||||
pet = pet_api.get_pet_by_id(5)
|
||||
puts pet.to_body
|
||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
@@ -76,7 +97,7 @@ All URIs are relative to *{{basePath}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
@@ -14,8 +14,8 @@ module {{moduleName}}
|
||||
end
|
||||
{{#operation}}
|
||||
{{newline}}
|
||||
# {{summary}}
|
||||
# {{notes}}
|
||||
# {{{summary}}}
|
||||
# {{{notes}}}
|
||||
{{#allParams}}{{#required}} # @param {{paramName}} {{description}}
|
||||
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
|
||||
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
|
||||
@@ -13,41 +13,43 @@ Method | HTTP request | Description
|
||||
# **{{operationId}}**
|
||||
> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}
|
||||
|
||||
{{summary}}{{#notes}}
|
||||
{{{summary}}}{{#notes}}
|
||||
|
||||
{{notes}}{{/notes}}
|
||||
{{{notes}}}{{/notes}}
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require '{{{gemName}}}'
|
||||
{{#hasAuthMethods}}
|
||||
|
||||
# setup authorization
|
||||
{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}
|
||||
# Configure HTTP basic authorization: {{{name}}}
|
||||
config.username = 'YOUR USERNAME'
|
||||
config.password = 'YOUR PASSWORD'{{/isBasic}}{{#isApiKey}}
|
||||
# Configure API key authorization: {{{name}}}
|
||||
config.api_key['{{{keyParamName}}}'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['{{{keyParamName}}}'] = "Token"{{/isApiKey}}{{#isOAuth}}
|
||||
config.api_key['{{{keyParamName}}}'] = '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['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
|
||||
# Configure OAuth2 access token for authorization: {{{name}}}
|
||||
config.access_token = "YOUR ACCESS TOKEN"{{/isOAuth}}
|
||||
config.access_token = 'YOUR ACCESS TOKEN'{{/isOAuth}}
|
||||
{{/authMethods}}end
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
api = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}}
|
||||
api_instance = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
{{{paramName}}} = {{{example}}} # [{{{dataType}}}] {{{description}}}
|
||||
{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
opts = { {{#allParams}}{{^required}}
|
||||
{{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # [{{{dataType}}}] {{{description}}}{{/required}}{{/allParams}}
|
||||
{{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
|
||||
}{{/hasOptionalParams}}{{/hasParams}}
|
||||
|
||||
begin
|
||||
{{#returnType}}result = {{/returnType}}api.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
|
||||
{{#summary}} #{{{.}}}
|
||||
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
|
||||
p result{{/returnType}}
|
||||
rescue {{{moduleName}}}::ApiError => e
|
||||
puts "Exception when calling {{{operationId}}}: #{e}"
|
||||
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
@@ -1,69 +1,79 @@
|
||||
# swagger-petstore
|
||||
|
||||
SwaggerPetstore - JavaScript client for swagger-petstore
|
||||
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
Version: 1.0.0
|
||||
|
||||
Automatically generated by the JavaScript Swagger Codegen project:
|
||||
|
||||
- Build date: 2016-03-18T12:55:58.976Z
|
||||
- API verion: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-03-18T18:26:17.121+08:00
|
||||
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
### Use in [Node.js](https://nodejs.org/)
|
||||
### For [Node.js](https://nodejs.org/)
|
||||
|
||||
The generated client is valid [npm](https://www.npmjs.com/) package, you can publish it as described
|
||||
in [Publishing npm packages](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
||||
#### npm
|
||||
|
||||
After that, you can install it into your project via:
|
||||
To publish the library as a [npm](https://www.npmjs.com/),
|
||||
please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
|
||||
|
||||
Then install it via:
|
||||
|
||||
```shell
|
||||
npm install swagger-petstore --save
|
||||
```
|
||||
|
||||
You can also host the generated client as a git repository on github, e.g.
|
||||
https://github.com/YOUR_USERNAME/swagger-petstore
|
||||
|
||||
Then you can install it via:
|
||||
#### git
|
||||
#
|
||||
If the library is hosted at a git repository, e.g.
|
||||
https://github.com/YOUR_USERNAME/YOUR_GIT_REPO_ID
|
||||
then install it via:
|
||||
|
||||
```shell
|
||||
npm install YOUR_USERNAME/swagger-petstore --save
|
||||
npm install YOUR_USERNAME/YOUR_GIT_REPO_ID --save
|
||||
```
|
||||
|
||||
### Use in browser with [browserify](http://browserify.org/)
|
||||
### For browser
|
||||
|
||||
The client also works in browser environment via npm and browserify. After following
|
||||
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
|
||||
the above steps with Node.js and installing browserify with `npm install -g browserify`,
|
||||
you can do this in your project (assuming *main.js* is your entry file):
|
||||
perform the following (assuming *main.js* is your entry file):
|
||||
|
||||
```shell
|
||||
browserify main.js > bundle.js
|
||||
```
|
||||
|
||||
The generated *bundle.js* can now be included in your HTML pages.
|
||||
Then include *bundle.js* in the HTML pages.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following JS code:
|
||||
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
defaultClient.timeout = 10 * 1000;
|
||||
defaultClient.defaultHeaders['Test-Header'] = 'test_value';
|
||||
|
||||
// Assuming there's a `PetApi` containing a `getPetById` method
|
||||
// which returns a model object:
|
||||
var api = new SwaggerPetstore.PetApi();
|
||||
api.getPetById(2, function(err, pet, resp) {
|
||||
console.log('HTTP status code: ' + resp.status);
|
||||
console.log('Response Content-Type: ' + resp.get('Content-Type'));
|
||||
if (err) {
|
||||
console.error(err);
|
||||
// Configure OAuth2 access token for authorization: petstore_auth
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
||||
};
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
console.log(pet);
|
||||
console.log('API called successfully.');
|
||||
}
|
||||
});
|
||||
};
|
||||
api.addPet(opts, callback);
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
@@ -34,7 +34,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
||||
@@ -86,7 +86,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var opts = {
|
||||
'body': "B" // {String} Pet object in the form of byte array
|
||||
@@ -138,7 +138,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} Pet id to delete
|
||||
|
||||
@@ -193,7 +193,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var opts = {
|
||||
'status': ["available"] // {[String]} Status values that need to be considered for query
|
||||
@@ -245,7 +245,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var opts = {
|
||||
'tags': ["tags_example"] // {[String]} Tags to filter by
|
||||
@@ -303,7 +303,7 @@ api_key.apiKey = "YOUR API KEY"
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
|
||||
@@ -360,7 +360,7 @@ api_key.apiKey = "YOUR API KEY"
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
|
||||
@@ -417,7 +417,7 @@ api_key.apiKey = "YOUR API KEY"
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet that needs to be fetched
|
||||
|
||||
@@ -468,7 +468,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.Pet() // {Pet} Pet object that needs to be added to the store
|
||||
@@ -520,7 +520,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = "petId_example"; // {String} ID of pet that needs to be updated
|
||||
|
||||
@@ -577,7 +577,7 @@ var defaultClient = SwaggerPetstore.ApiClient.default;
|
||||
var petstore_auth = defaultClient.authentications['petstore_auth'];
|
||||
petstore_auth.accessToken = "YOUR ACCESS TOKEN"
|
||||
|
||||
var api = new SwaggerPetstore.PetApi()
|
||||
var apiInstance = new SwaggerPetstore.PetApi()
|
||||
|
||||
var petId = 789; // {Integer} ID of pet to update
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var orderId = "orderId_example"; // {String} ID of the order that needs to be deleted
|
||||
|
||||
@@ -83,7 +83,7 @@ test_api_client_secret.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var opts = {
|
||||
'status': "placed" // {String} Status value that needs to be considered for query
|
||||
@@ -137,7 +137,7 @@ api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
@@ -184,7 +184,7 @@ api_key.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//api_key.apiKeyPrefix['api_key'] = "Token"
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
@@ -237,7 +237,7 @@ test_api_key_query.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//test_api_key_query.apiKeyPrefix['test_api_key_query'] = "Token"
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var orderId = "orderId_example"; // {String} ID of pet that needs to be fetched
|
||||
|
||||
@@ -296,7 +296,7 @@ test_api_client_secret.apiKey = "YOUR API KEY"
|
||||
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
|
||||
//test_api_client_secret.apiKeyPrefix['x-test_api_client_secret'] = "Token"
|
||||
|
||||
var api = new SwaggerPetstore.StoreApi()
|
||||
var apiInstance = new SwaggerPetstore.StoreApi()
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.Order() // {Order} order placed for purchasing the pet
|
||||
|
||||
@@ -26,7 +26,7 @@ This can only be done by the logged in user.
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var opts = {
|
||||
'body': new SwaggerPetstore.User() // {User} Created user object
|
||||
@@ -73,7 +73,7 @@ Creates list of users with given input array
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var opts = {
|
||||
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
|
||||
@@ -120,7 +120,7 @@ Creates list of users with given input array
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var opts = {
|
||||
'body': [new SwaggerPetstore.User()] // {[User]} List of user object
|
||||
@@ -173,7 +173,7 @@ var test_http_basic = defaultClient.authentications['test_http_basic'];
|
||||
test_http_basic.username = 'YOUR USERNAME'
|
||||
test_http_basic.password = 'YOUR PASSWORD'
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var username = "username_example"; // {String} The name that needs to be deleted
|
||||
|
||||
@@ -219,7 +219,7 @@ Get user by user name
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var username = "username_example"; // {String} The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
@@ -265,7 +265,7 @@ Logs user into the system
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var opts = {
|
||||
'username': "username_example", // {String} The user name for login
|
||||
@@ -314,7 +314,7 @@ Logs out current logged in user session
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var callback = function(error, data, response) {
|
||||
if (error) {
|
||||
@@ -354,7 +354,7 @@ This can only be done by the logged in user.
|
||||
```javascript
|
||||
var SwaggerPetstore = require('swagger-petstore');
|
||||
|
||||
var api = new SwaggerPetstore.UserApi()
|
||||
var apiInstance = new SwaggerPetstore.UserApi()
|
||||
|
||||
var username = "username_example"; // {String} name that need to be deleted
|
||||
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
* Constructs a new PetApi.
|
||||
* @alias module:api/PetApi
|
||||
* @class
|
||||
<<<<<<< HEAD
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
=======
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||
>>>>>>> update js doc
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
@@ -175,7 +179,11 @@
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @param {Object} opts Optional parameters
|
||||
<<<<<<< HEAD
|
||||
* @param {Array.<String>} opts.status Status values that need to be considered for query
|
||||
=======
|
||||
* @param {Array.<String>} opts.status Status values that need to be considered for query (default to available)
|
||||
>>>>>>> update js doc
|
||||
* @param {module:api/PetApi~findPetsByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {Array.<module:model/Pet>}
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* Constructs a new StoreApi.
|
||||
* @alias module:api/StoreApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
@@ -89,7 +89,7 @@
|
||||
* Finds orders by status
|
||||
* A single status value can be provided as a string
|
||||
* @param {Object} opts Optional parameters
|
||||
* @param {module:model/String} opts.status Status value that needs to be considered for query
|
||||
* @param {module:model/String} opts.status Status value that needs to be considered for query (default to placed)
|
||||
* @param {module:api/StoreApi~findOrdersByStatusCallback} callback The callback function, accepting three arguments: error, data, response
|
||||
* data is of type: {Array.<module:model/Order>}
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* Constructs a new UserApi.
|
||||
* @alias module:api/UserApi
|
||||
* @class
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, defaulting to {@link module:ApiClient#instance}
|
||||
* @param {module:ApiClient} apiClient Optional API client implementation to use, default to {@link module:ApiClient#instance}
|
||||
* if unspecified.
|
||||
*/
|
||||
var exports = function(apiClient) {
|
||||
|
||||
@@ -2,47 +2,46 @@
|
||||
|
||||
Petstore - the Ruby gem for the Swagger Petstore
|
||||
|
||||
Version: 1.0.0
|
||||
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
|
||||
Automatically generated by the Ruby Swagger Codegen project:
|
||||
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- Build date: 2016-03-17T16:01:35.253+08:00
|
||||
- API verion: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-03-19T11:13:14.822+08:00
|
||||
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
### Build a gem
|
||||
|
||||
You can build the generated client into a gem:
|
||||
To build the Ruby code into a gem:
|
||||
|
||||
```shell
|
||||
gem build petstore.gemspec
|
||||
```
|
||||
|
||||
Then you can either install the gem:
|
||||
Then either install the gem locally:
|
||||
|
||||
```shell
|
||||
gem install ./petstore-1.0.0.gem
|
||||
```
|
||||
|
||||
or publish the gem to a gem server like [RubyGems](https://rubygems.org/).
|
||||
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
||||
|
||||
Finally add this to your Gemfile:
|
||||
Finally add this to the Gemfile:
|
||||
|
||||
gem 'petstore', '~> 1.0.0'
|
||||
|
||||
### Host as a git repository
|
||||
### Install from Git
|
||||
|
||||
You can also choose to host the generated client as a git repository, e.g. on github:
|
||||
https://github.com/YOUR_USERNAME/YOUR_REPO
|
||||
If the Ruby gem is hosted at a git repository: https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID, then add the following in the Gemfile:
|
||||
|
||||
Then you can reference it in Gemfile:
|
||||
gem 'petstore', :git => 'https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git'
|
||||
|
||||
gem 'petstore', :git => 'https://github.com/YOUR_USERNAME/YOUR_REPO.git'
|
||||
### Include the Ruby code directly
|
||||
|
||||
### Use without installation
|
||||
|
||||
You can also use the client directly like this:
|
||||
Include the Ruby code directly using `-I` as follows:
|
||||
|
||||
```shell
|
||||
ruby -Ilib script.rb
|
||||
@@ -50,24 +49,30 @@ ruby -Ilib script.rb
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) procedure and then run the following code:
|
||||
```ruby
|
||||
# Load the gem
|
||||
require 'petstore'
|
||||
|
||||
# Setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Use the line below to configure API key authorization if needed:
|
||||
#config.api_key['api_key'] = 'your api key'
|
||||
|
||||
config.host = 'petstore.swagger.io'
|
||||
config.base_path = '/v2'
|
||||
# Enable debugging (default is disabled).
|
||||
config.debugging = true
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store
|
||||
}
|
||||
|
||||
begin
|
||||
#Add a new pet to the store
|
||||
api_instance.add_pet(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling PetApi->add_pet: #{e}"
|
||||
end
|
||||
|
||||
# Assuming there's a `PetApi` containing a `get_pet_by_id` method
|
||||
# which returns a model object:
|
||||
pet_api = Petstore::PetApi.new
|
||||
pet = pet_api.get_pet_by_id(5)
|
||||
puts pet.to_body
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
@@ -82,15 +87,15 @@ Class | Method | HTTP request | Description
|
||||
*Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*Petstore::PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*Petstore::PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
|
||||
*Petstore::PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
*Petstore::PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
*Petstore::PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
*Petstore::PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
*Petstore::PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
*Petstore::PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*Petstore::PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*Petstore::StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*Petstore::StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
|
||||
*Petstore::StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*Petstore::StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
*Petstore::StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
*Petstore::StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*Petstore::StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
*Petstore::UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
|
||||
@@ -120,25 +125,10 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
### test_api_client_id
|
||||
### test_api_key_header
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
|
||||
### api_key
|
||||
@@ -151,15 +141,30 @@ Class | Method | HTTP request | Description
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_client_id
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
### test_api_key_query
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
### test_api_key_header
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**photo_urls** | **Array<String>** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**tags** | [**Array<Tag>**](Tag.md) | | [optional]
|
||||
**id** | **Integer** | |
|
||||
**category** | **Object** | | [optional]
|
||||
**tags** | [**Array<Tag>**](Tag.md) | | [optional]
|
||||
**status** | **String** | pet status in the store | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**photo_urls** | **Array<String>** | | [optional]
|
||||
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **Integer** | | [optional]
|
||||
**snake_case** | **Integer** | | [optional]
|
||||
|
||||
|
||||
|
||||
@@ -26,23 +26,25 @@ Add a new pet to the store
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::Pet.new # [Pet] Pet object that needs to be added to the store
|
||||
body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store
|
||||
}
|
||||
|
||||
begin
|
||||
api.add_pet(opts)
|
||||
#Add a new pet to the store
|
||||
api_instance.add_pet(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling add_pet: #{e}"
|
||||
puts "Exception when calling PetApi->add_pet: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -76,23 +78,25 @@ Fake endpoint to test byte array in body parameter for adding a new pet to the s
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
body: "B" # [String] Pet object in the form of byte array
|
||||
body: "B" # String | Pet object in the form of byte array
|
||||
}
|
||||
|
||||
begin
|
||||
api.add_pet_using_byte_array(opts)
|
||||
#Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
api_instance.add_pet_using_byte_array(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling add_pet_using_byte_array: #{e}"
|
||||
puts "Exception when calling PetApi->add_pet_using_byte_array: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -126,25 +130,27 @@ Deletes a pet
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] Pet id to delete
|
||||
pet_id = 789 # Integer | Pet id to delete
|
||||
|
||||
opts = {
|
||||
api_key: "api_key_example" # [String]
|
||||
api_key: "api_key_example" # String |
|
||||
}
|
||||
|
||||
begin
|
||||
api.delete_pet(pet_id, opts)
|
||||
#Deletes a pet
|
||||
api_instance.delete_pet(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling delete_pet: #{e}"
|
||||
puts "Exception when calling PetApi->delete_pet: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -179,24 +185,26 @@ Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
status: ["available"] # [Array<String>] Status values that need to be considered for query
|
||||
status: ["available"] # Array<String> | Status values that need to be considered for query
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.find_pets_by_status(opts)
|
||||
#Finds Pets by status
|
||||
result = api_instance.find_pets_by_status(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling find_pets_by_status: #{e}"
|
||||
puts "Exception when calling PetApi->find_pets_by_status: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -230,24 +238,26 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
tags: ["tags_example"] # [Array<String>] Tags to filter by
|
||||
tags: ["tags_example"] # Array<String> | Tags to filter by
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.find_pets_by_tags(opts)
|
||||
#Finds Pets by tags
|
||||
result = api_instance.find_pets_by_tags(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling find_pets_by_tags: #{e}"
|
||||
puts "Exception when calling PetApi->find_pets_by_tags: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -277,32 +287,34 @@ Name | Type | Description | Notes
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
config.api_key['api_key'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['api_key'] = "Token"
|
||||
config.api_key['api_key'] = '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['api_key'] = 'BEARER'
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] ID of pet that needs to be fetched
|
||||
pet_id = 789 # Integer | ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_pet_by_id(pet_id)
|
||||
#Find pet by ID
|
||||
result = api_instance.get_pet_by_id(pet_id)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_pet_by_id: #{e}"
|
||||
puts "Exception when calling PetApi->get_pet_by_id: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -318,7 +330,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@@ -330,34 +342,36 @@ Name | Type | Description | Notes
|
||||
# **get_pet_by_id_in_object**
|
||||
> InlineResponse200 get_pet_by_id_in_object(pet_id)
|
||||
|
||||
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
config.api_key['api_key'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['api_key'] = "Token"
|
||||
config.api_key['api_key'] = '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['api_key'] = 'BEARER'
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] ID of pet that needs to be fetched
|
||||
pet_id = 789 # Integer | ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_pet_by_id_in_object(pet_id)
|
||||
#Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
result = api_instance.get_pet_by_id_in_object(pet_id)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_pet_by_id_in_object: #{e}"
|
||||
puts "Exception when calling PetApi->get_pet_by_id_in_object: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -373,7 +387,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@@ -385,34 +399,36 @@ Name | Type | Description | Notes
|
||||
# **pet_pet_idtesting_byte_arraytrue_get**
|
||||
> String pet_pet_idtesting_byte_arraytrue_get(pet_id)
|
||||
|
||||
Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
config.api_key['api_key'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['api_key'] = "Token"
|
||||
config.api_key['api_key'] = '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['api_key'] = 'BEARER'
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] ID of pet that needs to be fetched
|
||||
pet_id = 789 # Integer | ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.pet_pet_idtesting_byte_arraytrue_get(pet_id)
|
||||
#Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
result = api_instance.pet_pet_idtesting_byte_arraytrue_get(pet_id)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling pet_pet_idtesting_byte_arraytrue_get: #{e}"
|
||||
puts "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -428,7 +444,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@@ -446,23 +462,25 @@ Update an existing pet
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::Pet.new # [Pet] Pet object that needs to be added to the store
|
||||
body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store
|
||||
}
|
||||
|
||||
begin
|
||||
api.update_pet(opts)
|
||||
#Update an existing pet
|
||||
api_instance.update_pet(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling update_pet: #{e}"
|
||||
puts "Exception when calling PetApi->update_pet: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -496,26 +514,28 @@ Updates a pet in the store with form data
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = "pet_id_example" # [String] ID of pet that needs to be updated
|
||||
pet_id = "pet_id_example" # String | ID of pet that needs to be updated
|
||||
|
||||
opts = {
|
||||
name: "name_example", # [String] Updated name of the pet
|
||||
status: "status_example" # [String] Updated status of the pet
|
||||
name: "name_example", # String | Updated name of the pet
|
||||
status: "status_example" # String | Updated status of the pet
|
||||
}
|
||||
|
||||
begin
|
||||
api.update_pet_with_form(pet_id, opts)
|
||||
#Updates a pet in the store with form data
|
||||
api_instance.update_pet_with_form(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling update_pet_with_form: #{e}"
|
||||
puts "Exception when calling PetApi->update_pet_with_form: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -551,26 +571,28 @@ uploads an image
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
config.access_token = 'YOUR ACCESS TOKEN'
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] ID of pet to update
|
||||
pet_id = 789 # Integer | ID of pet to update
|
||||
|
||||
opts = {
|
||||
additional_metadata: "additional_metadata_example", # [String] Additional data to pass to server
|
||||
file: File.new("/path/to/file.txt") # [File] file to upload
|
||||
additional_metadata: "additional_metadata_example", # String | Additional data to pass to server
|
||||
file: File.new("/path/to/file.txt") # File | file to upload
|
||||
}
|
||||
|
||||
begin
|
||||
api.upload_file(pet_id, opts)
|
||||
#uploads an image
|
||||
api_instance.upload_file(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling upload_file: #{e}"
|
||||
puts "Exception when calling PetApi->upload_file: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
@@ -17,21 +17,23 @@ Method | HTTP request | Description
|
||||
|
||||
Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
order_id = "order_id_example" # [String] ID of the order that needs to be deleted
|
||||
order_id = "order_id_example" # String | ID of the order that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
api.delete_order(order_id)
|
||||
#Delete purchase order by ID
|
||||
api_instance.delete_order(order_id)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling delete_order: #{e}"
|
||||
puts "Exception when calling StoreApi->delete_order: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -65,31 +67,33 @@ A single status value can be provided as a string
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure API key authorization: test_api_client_id
|
||||
config.api_key['x-test_api_client_id'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['x-test_api_client_id'] = "Token"
|
||||
config.api_key['x-test_api_client_id'] = '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['x-test_api_client_id'] = 'BEARER'
|
||||
|
||||
# Configure API key authorization: test_api_client_secret
|
||||
config.api_key['x-test_api_client_secret'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['x-test_api_client_secret'] = "Token"
|
||||
config.api_key['x-test_api_client_secret'] = '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['x-test_api_client_secret'] = 'BEARER'
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
opts = {
|
||||
status: "placed" # [String] Status value that needs to be considered for query
|
||||
status: "placed" # String | Status value that needs to be considered for query
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.find_orders_by_status(opts)
|
||||
#Finds orders by status
|
||||
result = api_instance.find_orders_by_status(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling find_orders_by_status: #{e}"
|
||||
puts "Exception when calling StoreApi->find_orders_by_status: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -123,22 +127,24 @@ Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure API key authorization: api_key
|
||||
config.api_key['api_key'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['api_key'] = "Token"
|
||||
config.api_key['api_key'] = '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['api_key'] = 'BEARER'
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
begin
|
||||
result = api.get_inventory
|
||||
#Returns pet inventories by status
|
||||
result = api_instance.get_inventory
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_inventory: #{e}"
|
||||
puts "Exception when calling StoreApi->get_inventory: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -163,28 +169,30 @@ This endpoint does not need any parameter.
|
||||
# **get_inventory_in_object**
|
||||
> Object get_inventory_in_object
|
||||
|
||||
Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
|
||||
Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure API key authorization: api_key
|
||||
config.api_key['api_key'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['api_key'] = "Token"
|
||||
config.api_key['api_key'] = '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['api_key'] = 'BEARER'
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
begin
|
||||
result = api.get_inventory_in_object
|
||||
#Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
result = api_instance.get_inventory_in_object
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_inventory_in_object: #{e}"
|
||||
puts "Exception when calling StoreApi->get_inventory_in_object: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -211,34 +219,36 @@ This endpoint does not need any parameter.
|
||||
|
||||
Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure API key authorization: test_api_key_query
|
||||
config.api_key['test_api_key_query'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['test_api_key_query'] = "Token"
|
||||
|
||||
# Configure API key authorization: test_api_key_header
|
||||
config.api_key['test_api_key_header'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['test_api_key_header'] = "Token"
|
||||
config.api_key['test_api_key_header'] = '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['test_api_key_header'] = 'BEARER'
|
||||
|
||||
# Configure API key authorization: test_api_key_query
|
||||
config.api_key['test_api_key_query'] = '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['test_api_key_query'] = 'BEARER'
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
order_id = "order_id_example" # [String] ID of pet that needs to be fetched
|
||||
order_id = "order_id_example" # String | ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_order_by_id(order_id)
|
||||
#Find purchase order by ID
|
||||
result = api_instance.get_order_by_id(order_id)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_order_by_id: #{e}"
|
||||
puts "Exception when calling StoreApi->get_order_by_id: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -254,7 +264,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header)
|
||||
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
@@ -272,31 +282,33 @@ Place an order for a pet
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure API key authorization: test_api_client_id
|
||||
config.api_key['x-test_api_client_id'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['x-test_api_client_id'] = "Token"
|
||||
config.api_key['x-test_api_client_id'] = '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['x-test_api_client_id'] = 'BEARER'
|
||||
|
||||
# Configure API key authorization: test_api_client_secret
|
||||
config.api_key['x-test_api_client_secret'] = "YOUR API KEY"
|
||||
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
|
||||
#config.api_key_prefix['x-test_api_client_secret'] = "Token"
|
||||
config.api_key['x-test_api_client_secret'] = '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['x-test_api_client_secret'] = 'BEARER'
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::Order.new # [Order] order placed for purchasing the pet
|
||||
body: Petstore::Order.new # Order | order placed for purchasing the pet
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.place_order(opts)
|
||||
#Place an order for a pet
|
||||
result = api_instance.place_order(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling place_order: #{e}"
|
||||
puts "Exception when calling StoreApi->place_order: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
@@ -23,18 +23,20 @@ This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::User.new # [User] Created user object
|
||||
body: Petstore::User.new # User | Created user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.create_user(opts)
|
||||
#Create user
|
||||
api_instance.create_user(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling create_user: #{e}"
|
||||
puts "Exception when calling UserApi->create_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -68,18 +70,20 @@ Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
body: [Petstore::User.new] # [Array<User>] List of user object
|
||||
body: [Petstore::User.new] # Array<User> | List of user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.create_users_with_array_input(opts)
|
||||
#Creates list of users with given input array
|
||||
api_instance.create_users_with_array_input(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling create_users_with_array_input: #{e}"
|
||||
puts "Exception when calling UserApi->create_users_with_array_input: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -113,18 +117,20 @@ Creates list of users with given input array
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
body: [Petstore::User.new] # [Array<User>] List of user object
|
||||
body: [Petstore::User.new] # Array<User> | List of user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.create_users_with_list_input(opts)
|
||||
#Creates list of users with given input array
|
||||
api_instance.create_users_with_list_input(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling create_users_with_list_input: #{e}"
|
||||
puts "Exception when calling UserApi->create_users_with_list_input: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -158,23 +164,25 @@ This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
# setup authorization
|
||||
Petstore.configure do |config|
|
||||
# Configure HTTP basic authorization: test_http_basic
|
||||
config.username = 'YOUR USERNAME'
|
||||
config.password = 'YOUR PASSWORD'
|
||||
end
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # [String] The name that needs to be deleted
|
||||
username = "username_example" # String | The name that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
api.delete_user(username)
|
||||
#Delete user
|
||||
api_instance.delete_user(username)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling delete_user: #{e}"
|
||||
puts "Exception when calling UserApi->delete_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -208,18 +216,20 @@ Get user by user name
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing.
|
||||
username = "username_example" # String | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_user_by_name(username)
|
||||
#Get user by user name
|
||||
result = api_instance.get_user_by_name(username)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_user_by_name: #{e}"
|
||||
puts "Exception when calling UserApi->get_user_by_name: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -253,20 +263,22 @@ Logs user into the system
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
username: "username_example", # [String] The user name for login
|
||||
password: "password_example" # [String] The password for login in clear text
|
||||
username: "username_example", # String | The user name for login
|
||||
password: "password_example" # String | The password for login in clear text
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.login_user(opts)
|
||||
#Logs user into the system
|
||||
result = api_instance.login_user(opts)
|
||||
p result
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling login_user: #{e}"
|
||||
puts "Exception when calling UserApi->login_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -301,14 +313,16 @@ Logs out current logged in user session
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
begin
|
||||
api.logout_user
|
||||
#Logs out current logged in user session
|
||||
api_instance.logout_user
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling logout_user: #{e}"
|
||||
puts "Exception when calling UserApi->logout_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -339,20 +353,22 @@ This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
# load the gem
|
||||
require 'petstore'
|
||||
|
||||
api = Petstore::UserApi.new
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # [String] name that need to be deleted
|
||||
username = "username_example" # String | name that need to be deleted
|
||||
|
||||
opts = {
|
||||
body: Petstore::User.new # [User] Updated user object
|
||||
body: Petstore::User.new # User | Updated user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.update_user(username, opts)
|
||||
#Updated user
|
||||
api_instance.update_user(username, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling update_user: #{e}"
|
||||
puts "Exception when calling UserApi->update_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
@@ -315,7 +315,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# Find pet by ID
|
||||
# Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
# Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
# @param pet_id ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Pet]
|
||||
@@ -360,7 +360,7 @@ module Petstore
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth', 'api_key']
|
||||
auth_names = ['api_key', 'petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -374,8 +374,8 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
# Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
# Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
# Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
# @param pet_id ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [InlineResponse200]
|
||||
@@ -420,7 +420,7 @@ module Petstore
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth', 'api_key']
|
||||
auth_names = ['api_key', 'petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
@@ -434,8 +434,8 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
# Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
# Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
# Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
# @param pet_id ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [String]
|
||||
@@ -480,7 +480,7 @@ module Petstore
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth', 'api_key']
|
||||
auth_names = ['api_key', 'petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
|
||||
@@ -25,7 +25,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# Delete purchase order by ID
|
||||
# For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
# For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
# @param order_id ID of the order that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
@@ -200,7 +200,7 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
# Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
# Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Object]
|
||||
@@ -256,7 +256,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# Find purchase order by ID
|
||||
# For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
# For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
# @param order_id ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Order]
|
||||
@@ -301,7 +301,7 @@ module Petstore
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['test_api_key_query', 'test_api_key_header']
|
||||
auth_names = ['test_api_key_header', 'test_api_key_query']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
|
||||
@@ -157,26 +157,12 @@ module Petstore
|
||||
# Returns Auth Settings hash for api client.
|
||||
def auth_settings
|
||||
{
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
'test_api_client_id' =>
|
||||
'test_api_key_header' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
in: 'header',
|
||||
key: 'x-test_api_client_id',
|
||||
value: api_key_with_prefix('x-test_api_client_id')
|
||||
},
|
||||
'test_api_client_secret' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
in: 'header',
|
||||
key: 'x-test_api_client_secret',
|
||||
value: api_key_with_prefix('x-test_api_client_secret')
|
||||
key: 'test_api_key_header',
|
||||
value: api_key_with_prefix('test_api_key_header')
|
||||
},
|
||||
'api_key' =>
|
||||
{
|
||||
@@ -192,6 +178,20 @@ module Petstore
|
||||
key: 'Authorization',
|
||||
value: basic_auth_token
|
||||
},
|
||||
'test_api_client_secret' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
in: 'header',
|
||||
key: 'x-test_api_client_secret',
|
||||
value: api_key_with_prefix('x-test_api_client_secret')
|
||||
},
|
||||
'test_api_client_id' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
in: 'header',
|
||||
key: 'x-test_api_client_id',
|
||||
value: api_key_with_prefix('x-test_api_client_id')
|
||||
},
|
||||
'test_api_key_query' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
@@ -199,12 +199,12 @@ module Petstore
|
||||
key: 'test_api_key_query',
|
||||
value: api_key_with_prefix('test_api_key_query')
|
||||
},
|
||||
'test_api_key_header' =>
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'test_api_key_header',
|
||||
value: api_key_with_prefix('test_api_key_header')
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -18,34 +18,34 @@ require 'date'
|
||||
|
||||
module Petstore
|
||||
class InlineResponse200
|
||||
attr_accessor :photo_urls
|
||||
|
||||
attr_accessor :name
|
||||
attr_accessor :tags
|
||||
|
||||
attr_accessor :id
|
||||
|
||||
attr_accessor :category
|
||||
|
||||
attr_accessor :tags
|
||||
|
||||
# pet status in the store
|
||||
attr_accessor :status
|
||||
|
||||
attr_accessor :name
|
||||
|
||||
attr_accessor :photo_urls
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
|
||||
:'photo_urls' => :'photoUrls',
|
||||
|
||||
:'name' => :'name',
|
||||
:'tags' => :'tags',
|
||||
|
||||
:'id' => :'id',
|
||||
|
||||
:'category' => :'category',
|
||||
|
||||
:'tags' => :'tags',
|
||||
:'status' => :'status',
|
||||
|
||||
:'status' => :'status'
|
||||
:'name' => :'name',
|
||||
|
||||
:'photo_urls' => :'photoUrls'
|
||||
|
||||
}
|
||||
end
|
||||
@@ -53,12 +53,12 @@ module Petstore
|
||||
# Attribute type mapping.
|
||||
def self.swagger_types
|
||||
{
|
||||
:'photo_urls' => :'Array<String>',
|
||||
:'name' => :'String',
|
||||
:'tags' => :'Array<Tag>',
|
||||
:'id' => :'Integer',
|
||||
:'category' => :'Object',
|
||||
:'tags' => :'Array<Tag>',
|
||||
:'status' => :'String'
|
||||
:'status' => :'String',
|
||||
:'name' => :'String',
|
||||
:'photo_urls' => :'Array<String>'
|
||||
|
||||
}
|
||||
end
|
||||
@@ -70,16 +70,12 @@ module Petstore
|
||||
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
||||
|
||||
|
||||
if attributes[:'photoUrls']
|
||||
if (value = attributes[:'photoUrls']).is_a?(Array)
|
||||
self.photo_urls = value
|
||||
if attributes[:'tags']
|
||||
if (value = attributes[:'tags']).is_a?(Array)
|
||||
self.tags = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes[:'name']
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
if attributes[:'id']
|
||||
self.id = attributes[:'id']
|
||||
end
|
||||
@@ -88,16 +84,20 @@ module Petstore
|
||||
self.category = attributes[:'category']
|
||||
end
|
||||
|
||||
if attributes[:'tags']
|
||||
if (value = attributes[:'tags']).is_a?(Array)
|
||||
self.tags = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes[:'status']
|
||||
self.status = attributes[:'status']
|
||||
end
|
||||
|
||||
if attributes[:'name']
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
if attributes[:'photoUrls']
|
||||
if (value = attributes[:'photoUrls']).is_a?(Array)
|
||||
self.photo_urls = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
@@ -113,12 +113,12 @@ module Petstore
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
photo_urls == o.photo_urls &&
|
||||
name == o.name &&
|
||||
tags == o.tags &&
|
||||
id == o.id &&
|
||||
category == o.category &&
|
||||
tags == o.tags &&
|
||||
status == o.status
|
||||
status == o.status &&
|
||||
name == o.name &&
|
||||
photo_urls == o.photo_urls
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@@ -128,7 +128,7 @@ module Petstore
|
||||
|
||||
# Calculate hash code according to all attributes.
|
||||
def hash
|
||||
[photo_urls, name, id, category, tags, status].hash
|
||||
[tags, id, category, status, name, photo_urls].hash
|
||||
end
|
||||
|
||||
# build the object from hash
|
||||
|
||||
@@ -20,11 +20,15 @@ module Petstore
|
||||
class Name
|
||||
attr_accessor :name
|
||||
|
||||
attr_accessor :snake_case
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
|
||||
:'name' => :'name'
|
||||
:'name' => :'name',
|
||||
|
||||
:'snake_case' => :'snake_case'
|
||||
|
||||
}
|
||||
end
|
||||
@@ -32,7 +36,8 @@ module Petstore
|
||||
# Attribute type mapping.
|
||||
def self.swagger_types
|
||||
{
|
||||
:'name' => :'Integer'
|
||||
:'name' => :'Integer',
|
||||
:'snake_case' => :'Integer'
|
||||
|
||||
}
|
||||
end
|
||||
@@ -48,13 +53,18 @@ module Petstore
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
if attributes[:'snake_case']
|
||||
self.snake_case = attributes[:'snake_case']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Check equality by comparing each attribute.
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
name == o.name
|
||||
name == o.name &&
|
||||
snake_case == o.snake_case
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@@ -64,7 +74,7 @@ module Petstore
|
||||
|
||||
# Calculate hash code according to all attributes.
|
||||
def hash
|
||||
[name].hash
|
||||
[name, snake_case].hash
|
||||
end
|
||||
|
||||
# build the object from hash
|
||||
|
||||
@@ -36,17 +36,7 @@ describe 'InlineResponse200' do
|
||||
@instance.should be_a(Petstore::InlineResponse200)
|
||||
end
|
||||
end
|
||||
describe 'test attribute "photo_urls"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "name"' do
|
||||
describe 'test attribute "tags"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
@@ -76,7 +66,7 @@ describe 'InlineResponse200' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "tags"' do
|
||||
describe 'test attribute "status"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
@@ -86,7 +76,17 @@ describe 'InlineResponse200' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "status"' do
|
||||
describe 'test attribute "name"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "photo_urls"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
|
||||
@@ -46,5 +46,15 @@ describe 'Name' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "snake_case"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user