forked from loafle/openapi-generator-original
Merge pull request #2344 from xhh/ruby-doc
[Ruby] Add auto-generated documentation in Markdown to Ruby client
This commit is contained in:
commit
9368fccecc
@ -3,15 +3,21 @@ package io.swagger.codegen.languages;
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -40,6 +46,8 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected String gemDescription = "This gem maps to a swagger API";
|
||||
protected String gemAuthor = "";
|
||||
protected String gemAuthorEmail = "";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
protected static int emptyMethodNameCounter = 0;
|
||||
|
||||
@ -50,6 +58,8 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
outputFolder = "generated-code" + File.separator + "ruby";
|
||||
modelTemplateFiles.put("model.mustache", ".rb");
|
||||
apiTemplateFiles.put("api.mustache", ".rb");
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
embeddedTemplateDir = templateDir = "ruby";
|
||||
|
||||
modelTestTemplateFiles.put("model_test.mustache", ".rb");
|
||||
@ -194,6 +204,9 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
setGemAuthorEmail((String) additionalProperties.get(GEM_AUTHOR_EMAIL));
|
||||
}
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
// use constant model/api package (folder path)
|
||||
setModelPackage("models");
|
||||
@ -206,8 +219,39 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("api_error.mustache", gemFolder, "api_error.rb"));
|
||||
supportingFiles.add(new SupportingFile("configuration.mustache", gemFolder, "configuration.rb"));
|
||||
supportingFiles.add(new SupportingFile("version.mustache", gemFolder, "version.rb"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions, Swagger swagger) {
|
||||
CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger);
|
||||
// Set vendor-extension to be used in template:
|
||||
// x-codegen-hasMoreRequired
|
||||
// x-codegen-hasMoreOptional
|
||||
// x-codegen-hasRequiredParams
|
||||
CodegenParameter lastRequired = null;
|
||||
CodegenParameter lastOptional = null;
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (p.required != null && p.required) {
|
||||
lastRequired = p;
|
||||
} else {
|
||||
lastOptional = p;
|
||||
}
|
||||
}
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (p == lastRequired) {
|
||||
p.vendorExtensions.put("x-codegen-hasMoreRequired", false);
|
||||
} else if (p == lastOptional) {
|
||||
p.vendorExtensions.put("x-codegen-hasMoreOptional", false);
|
||||
} else {
|
||||
p.vendorExtensions.put("x-codegen-hasMoreRequired", true);
|
||||
p.vendorExtensions.put("x-codegen-hasMoreOptional", true);
|
||||
}
|
||||
}
|
||||
op.vendorExtensions.put("x-codegen-hasRequiredParams", lastRequired != null);
|
||||
return op;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
@ -271,6 +315,16 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return outputFolder + File.separator + specFolder + File.separator + modelPackage.replace("/", File.separator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Property p) {
|
||||
if (p instanceof ArrayProperty) {
|
||||
@ -414,6 +468,11 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return underscore(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiFilename(String name) {
|
||||
// replace - with _ e.g. created-at => created_at
|
||||
@ -423,6 +482,11 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return underscore(name) + "_api";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiTestFilename(String name) {
|
||||
return toApiFilename(name) + "_spec";
|
||||
@ -466,6 +530,69 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return gemName + "/" + apiPackage() + "/" + toApiFilename(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
String example;
|
||||
|
||||
if (p.defaultValue == null) {
|
||||
example = p.example;
|
||||
} else {
|
||||
example = p.defaultValue;
|
||||
}
|
||||
|
||||
String type = p.baseType;
|
||||
if (type == null) {
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
if ("String".equals(type)) {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
} else if ("Integer".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
} else if ("Float".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
}
|
||||
} else if ("BOOLEAN".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "true";
|
||||
}
|
||||
} else if ("File".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "/path/to/file";
|
||||
}
|
||||
example = "File.new(\"" + escapeText(example) + "\")";
|
||||
} else if ("Date".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20";
|
||||
}
|
||||
example = "Date.parse(\"" + escapeText(example) + "\")";
|
||||
} else if ("DateTime".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20T19:20:30+01:00";
|
||||
}
|
||||
example = "DateTime.parse(\"" + escapeText(example) + "\")";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = moduleName + "::" + type + ".new";
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
example = "nil";
|
||||
} else if (Boolean.TRUE.equals(p.isListContainer)) {
|
||||
example = "[" + example + "]";
|
||||
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
|
||||
example = "{'key': " + example + "}";
|
||||
}
|
||||
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
public void setGemName(String gemName) {
|
||||
this.gemName = gemName;
|
||||
}
|
||||
|
107
modules/swagger-codegen/src/main/resources/ruby/README.mustache
Normal file
107
modules/swagger-codegen/src/main/resources/ruby/README.mustache
Normal file
@ -0,0 +1,107 @@
|
||||
# {{gemName}}
|
||||
|
||||
{{moduleName}} - the Ruby gem for the {{appName}}
|
||||
|
||||
Version: {{gemVersion}}
|
||||
|
||||
Automatically generated by the Ruby Swagger Codegen project:
|
||||
|
||||
- Build date: {{generatedDate}}
|
||||
- Build package: {{generatorClass}}
|
||||
|
||||
## Installation
|
||||
|
||||
### Build a gem
|
||||
|
||||
You can build the generated client into a gem:
|
||||
|
||||
```shell
|
||||
gem build {{{gemName}}}.gemspec
|
||||
```
|
||||
|
||||
Then you can either install the gem:
|
||||
|
||||
```shell
|
||||
gem install ./{{{gemName}}}-{{{gemVersion}}}.gem
|
||||
```
|
||||
|
||||
or publish the gem to a gem server like [RubyGems](https://rubygems.org/).
|
||||
|
||||
Finally add this to your Gemfile:
|
||||
|
||||
gem '{{{gemName}}}', '~> {{{gemVersion}}}'
|
||||
|
||||
### Host as a git repository
|
||||
|
||||
You can also choose to host the generated client as a git repository, e.g. on github:
|
||||
https://github.com/YOUR_USERNAME/YOUR_REPO
|
||||
|
||||
Then you can reference it in Gemfile:
|
||||
|
||||
gem '{{{gemName}}}', :git => 'https://github.com/YOUR_USERNAME/YOUR_REPO.git'
|
||||
|
||||
### Use without installation
|
||||
|
||||
You can also use the client directly like this:
|
||||
|
||||
```shell
|
||||
ruby -Ilib script.rb
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
```ruby
|
||||
require '{{{gemName}}}'
|
||||
|
||||
{{{moduleName}}}.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
|
||||
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
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
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}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
{{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
{{^authMethods}} All endpoints do not require authorization.
|
||||
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||
{{#authMethods}}### {{name}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
- **API key parameter name**: {{keyParamName}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}- **Type**: OAuth
|
||||
- **Flow**: {{flow}}
|
||||
- **Authorizatoin URL**: {{authorizationUrl}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}}-- {{scope}}: {{description}}
|
||||
{{/scopes}}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
@ -0,0 +1,73 @@
|
||||
# {{moduleName}}::{{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
# **{{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}}
|
||||
|
||||
{{notes}}{{/notes}}
|
||||
|
||||
### Example
|
||||
```ruby{{#hasAuthMethods}}
|
||||
{{{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}}
|
||||
# Configure OAuth2 access token for authorization: {{{name}}}
|
||||
config.access_token = "YOUR ACCESS TOKEN"{{/isOAuth}}
|
||||
{{/authMethods}}end
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
api = {{{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}}
|
||||
|
||||
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}}
|
||||
rescue {{{moduleName}}}::ApiError => e
|
||||
puts "Exception when calling {{{operationId}}}: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
@ -0,0 +1,36 @@
|
||||
*.gem
|
||||
*.rbc
|
||||
/.config
|
||||
/coverage/
|
||||
/InstalledFiles
|
||||
/pkg/
|
||||
/spec/reports/
|
||||
/spec/examples.txt
|
||||
/test/tmp/
|
||||
/test/version_tmp/
|
||||
/tmp/
|
||||
|
||||
## Specific to RubyMotion:
|
||||
.dat*
|
||||
.repl_history
|
||||
build/
|
||||
|
||||
## Documentation cache and generated files:
|
||||
/.yardoc/
|
||||
/_yardoc/
|
||||
/doc/
|
||||
/rdoc/
|
||||
|
||||
## Environment normalization:
|
||||
/.bundle/
|
||||
/vendor/bundle
|
||||
/lib/bundler/man/
|
||||
|
||||
# for a library or gem, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# Gemfile.lock
|
||||
# .ruby-version
|
||||
# .ruby-gemset
|
||||
|
||||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
||||
.rvmrc
|
@ -0,0 +1,9 @@
|
||||
{{#models}}{{#model}}# {{moduleName}}::{{classname}}
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||
{{/vars}}
|
||||
|
||||
{{/model}}{{/models}}
|
36
samples/client/petstore/ruby/.gitignore
vendored
Normal file
36
samples/client/petstore/ruby/.gitignore
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
*.gem
|
||||
*.rbc
|
||||
/.config
|
||||
/coverage/
|
||||
/InstalledFiles
|
||||
/pkg/
|
||||
/spec/reports/
|
||||
/spec/examples.txt
|
||||
/test/tmp/
|
||||
/test/version_tmp/
|
||||
/tmp/
|
||||
|
||||
## Specific to RubyMotion:
|
||||
.dat*
|
||||
.repl_history
|
||||
build/
|
||||
|
||||
## Documentation cache and generated files:
|
||||
/.yardoc/
|
||||
/_yardoc/
|
||||
/doc/
|
||||
/rdoc/
|
||||
|
||||
## Environment normalization:
|
||||
/.bundle/
|
||||
/vendor/bundle
|
||||
/lib/bundler/man/
|
||||
|
||||
# for a library or gem, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# Gemfile.lock
|
||||
# .ruby-version
|
||||
# .ruby-gemset
|
||||
|
||||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
||||
.rvmrc
|
@ -1,3 +1,14 @@
|
||||
# petstore
|
||||
|
||||
Petstore - the Ruby gem for the Swagger Petstore
|
||||
|
||||
Version: 1.0.0
|
||||
|
||||
Automatically generated by the Ruby Swagger Codegen project:
|
||||
|
||||
- Build date: 2016-03-11T18:59:01.854+08:00
|
||||
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
### Build a gem
|
||||
@ -23,11 +34,11 @@ Finally add this to your Gemfile:
|
||||
### Host as a git repository
|
||||
|
||||
You can also choose to host the generated client as a git repository, e.g. on github:
|
||||
https://github.com/xhh/swagger-petstore-ruby
|
||||
https://github.com/YOUR_USERNAME/YOUR_REPO
|
||||
|
||||
Then you can reference it in Gemfile:
|
||||
|
||||
gem 'petstore', :git => 'https://github.com/xhh/swagger-petstore-ruby.git'
|
||||
gem 'petstore', :git => 'https://github.com/YOUR_USERNAME/YOUR_REPO.git'
|
||||
|
||||
### Use without installation
|
||||
|
||||
@ -43,14 +54,106 @@ ruby -Ilib script.rb
|
||||
require 'petstore'
|
||||
|
||||
Petstore.configure do |config|
|
||||
config.api_key['api_key'] = 'special-key'
|
||||
# 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)
|
||||
# Enable debugging (default is disabled).
|
||||
config.debugging = true
|
||||
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
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
*Petstore::PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*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* | [**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_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
|
||||
*Petstore::UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*Petstore::UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*Petstore::UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
|
||||
*Petstore::UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
|
||||
*Petstore::UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system
|
||||
*Petstore::UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
|
||||
*Petstore::UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
- [Petstore::Category](docs/Category.md)
|
||||
- [Petstore::InlineResponse200](docs/InlineResponse200.md)
|
||||
- [Petstore::ModelReturn](docs/ModelReturn.md)
|
||||
- [Petstore::Order](docs/Order.md)
|
||||
- [Petstore::Pet](docs/Pet.md)
|
||||
- [Petstore::SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Petstore::Tag](docs/Tag.md)
|
||||
- [Petstore::User](docs/User.md)
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
- **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
|
||||
- **Location**: HTTP header
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **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
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
9
samples/client/petstore/ruby/docs/Category.md
Normal file
9
samples/client/petstore/ruby/docs/Category.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Petstore::Category
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Integer** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
|
||||
|
13
samples/client/petstore/ruby/docs/InlineResponse200.md
Normal file
13
samples/client/petstore/ruby/docs/InlineResponse200.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Petstore::InlineResponse200
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**photo_urls** | **Array<String>** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
**id** | **Integer** | |
|
||||
**category** | **Object** | | [optional]
|
||||
**tags** | [**Array<Tag>**](Tag.md) | | [optional]
|
||||
**status** | **String** | pet status in the store | [optional]
|
||||
|
||||
|
8
samples/client/petstore/ruby/docs/ModelReturn.md
Normal file
8
samples/client/petstore/ruby/docs/ModelReturn.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Petstore::ModelReturn
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**_return** | **Integer** | | [optional]
|
||||
|
||||
|
13
samples/client/petstore/ruby/docs/Order.md
Normal file
13
samples/client/petstore/ruby/docs/Order.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Petstore::Order
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Integer** | | [optional]
|
||||
**pet_id** | **Integer** | | [optional]
|
||||
**quantity** | **Integer** | | [optional]
|
||||
**ship_date** | **DateTime** | | [optional]
|
||||
**status** | **String** | Order Status | [optional]
|
||||
**complete** | **BOOLEAN** | | [optional]
|
||||
|
||||
|
13
samples/client/petstore/ruby/docs/Pet.md
Normal file
13
samples/client/petstore/ruby/docs/Pet.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Petstore::Pet
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Integer** | | [optional]
|
||||
**category** | [**Category**](Category.md) | | [optional]
|
||||
**name** | **String** | |
|
||||
**photo_urls** | **Array<String>** | |
|
||||
**tags** | [**Array<Tag>**](Tag.md) | | [optional]
|
||||
**status** | **String** | pet status in the store | [optional]
|
||||
|
||||
|
572
samples/client/petstore/ruby/docs/PetApi.md
Normal file
572
samples/client/petstore/ruby/docs/PetApi.md
Normal file
@ -0,0 +1,572 @@
|
||||
# Petstore::PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**get_pet_by_id_in_object**](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'
|
||||
[**pet_pet_idtesting_byte_arraytrue_get**](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'
|
||||
[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **add_pet**
|
||||
> add_pet(opts)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::Pet.new # [Pet] Pet object that needs to be added to the store
|
||||
}
|
||||
|
||||
begin
|
||||
api.add_pet(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling add_pet: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **add_pet_using_byte_array**
|
||||
> add_pet_using_byte_array(opts)
|
||||
|
||||
Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
body: "B" # [String] Pet object in the form of byte array
|
||||
}
|
||||
|
||||
begin
|
||||
api.add_pet_using_byte_array(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling add_pet_using_byte_array: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | **String**| Pet object in the form of byte array | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **delete_pet**
|
||||
> delete_pet(pet_id, opts)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] Pet id to delete
|
||||
|
||||
opts = {
|
||||
api_key: "api_key_example" # [String]
|
||||
}
|
||||
|
||||
begin
|
||||
api.delete_pet(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling delete_pet: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **Integer**| Pet id to delete |
|
||||
**api_key** | **String**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **find_pets_by_status**
|
||||
> Array<Pet> find_pets_by_status(opts)
|
||||
|
||||
Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
status: ["available"] # [Array<String>] Status values that need to be considered for query
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.find_pets_by_status(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling find_pets_by_status: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**Array<String>**](String.md)| Status values that need to be considered for query | [optional] [default to available]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Array<Pet>**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **find_pets_by_tags**
|
||||
> Array<Pet> find_pets_by_tags(opts)
|
||||
|
||||
Finds Pets by tags
|
||||
|
||||
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
tags: ["tags_example"] # [Array<String>] Tags to filter by
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.find_pets_by_tags(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling find_pets_by_tags: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**Array<String>**](String.md)| Tags to filter by | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Array<Pet>**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **get_pet_by_id**
|
||||
> Pet get_pet_by_id(pet_id)
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
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"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_pet_by_id(pet_id)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_pet_by_id: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **Integer**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **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'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
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"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_pet_by_id_in_object(pet_id)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_pet_by_id_in_object: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **Integer**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**InlineResponse200**](InlineResponse200.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **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'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
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"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
pet_id = 789 # [Integer] ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.pet_pet_idtesting_byte_arraytrue_get(pet_id)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling pet_pet_idtesting_byte_arraytrue_get: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **Integer**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **update_pet**
|
||||
> update_pet(opts)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::Pet.new # [Pet] Pet object that needs to be added to the store
|
||||
}
|
||||
|
||||
begin
|
||||
api.update_pet(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling update_pet: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **update_pet_with_form**
|
||||
> update_pet_with_form(pet_id, opts)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
begin
|
||||
api.update_pet_with_form(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling update_pet_with_form: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **String**| ID of pet that needs to be updated |
|
||||
**name** | **String**| Updated name of the pet | [optional]
|
||||
**status** | **String**| Updated status of the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **upload_file**
|
||||
> upload_file(pet_id, opts)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
Petstore.configure do |config|
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
config.access_token = "YOUR ACCESS TOKEN"
|
||||
end
|
||||
|
||||
api = Petstore::PetApi.new
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
begin
|
||||
api.upload_file(pet_id, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling upload_file: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **Integer**| ID of pet to update |
|
||||
**additional_metadata** | **String**| Additional data to pass to server | [optional]
|
||||
**file** | **File**| file to upload | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
8
samples/client/petstore/ruby/docs/SpecialModelName.md
Normal file
8
samples/client/petstore/ruby/docs/SpecialModelName.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Petstore::SpecialModelName
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**special_property_name** | **Integer** | | [optional]
|
||||
|
||||
|
306
samples/client/petstore/ruby/docs/StoreApi.md
Normal file
306
samples/client/petstore/ruby/docs/StoreApi.md
Normal file
@ -0,0 +1,306 @@
|
||||
# Petstore::StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
|
||||
[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **delete_order**
|
||||
> delete_order(order_id)
|
||||
|
||||
Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::StoreApi.new
|
||||
|
||||
order_id = "order_id_example" # [String] ID of the order that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
api.delete_order(order_id)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling delete_order: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order_id** | **String**| ID of the order that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **find_orders_by_status**
|
||||
> Array<Order> find_orders_by_status(opts)
|
||||
|
||||
Finds orders by status
|
||||
|
||||
A single status value can be provided as a string
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
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"
|
||||
|
||||
# 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"
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
|
||||
opts = {
|
||||
status: "placed" # [String] Status value that needs to be considered for query
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.find_orders_by_status(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling find_orders_by_status: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **String**| Status value that needs to be considered for query | [optional] [default to placed]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Array<Order>**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **get_inventory**
|
||||
> Hash<String, Integer> get_inventory
|
||||
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
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"
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
|
||||
begin
|
||||
result = api.get_inventory
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_inventory: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**Hash<String, Integer>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **get_inventory_in_object**
|
||||
> Object get_inventory_in_object
|
||||
|
||||
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
|
||||
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"
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
|
||||
begin
|
||||
result = api.get_inventory_in_object
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_inventory_in_object: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**Object**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **get_order_by_id**
|
||||
> Order get_order_by_id(order_id)
|
||||
|
||||
Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
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"
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
|
||||
order_id = "order_id_example" # [String] ID of pet that needs to be fetched
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_order_by_id(order_id)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_order_by_id: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order_id** | **String**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **place_order**
|
||||
> Order place_order(opts)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
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"
|
||||
|
||||
# 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"
|
||||
end
|
||||
|
||||
api = Petstore::StoreApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::Order.new # [Order] order placed for purchasing the pet
|
||||
}
|
||||
|
||||
begin
|
||||
result = api.place_order(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling place_order: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
9
samples/client/petstore/ruby/docs/Tag.md
Normal file
9
samples/client/petstore/ruby/docs/Tag.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Petstore::Tag
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Integer** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
|
||||
|
15
samples/client/petstore/ruby/docs/User.md
Normal file
15
samples/client/petstore/ruby/docs/User.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Petstore::User
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Integer** | | [optional]
|
||||
**username** | **String** | | [optional]
|
||||
**first_name** | **String** | | [optional]
|
||||
**last_name** | **String** | | [optional]
|
||||
**email** | **String** | | [optional]
|
||||
**password** | **String** | | [optional]
|
||||
**phone** | **String** | | [optional]
|
||||
**user_status** | **Integer** | User Status | [optional]
|
||||
|
||||
|
356
samples/client/petstore/ruby/docs/UserApi.md
Normal file
356
samples/client/petstore/ruby/docs/UserApi.md
Normal file
@ -0,0 +1,356 @@
|
||||
# Petstore::UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**create_user**](UserApi.md#create_user) | **POST** /user | Create user
|
||||
[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
|
||||
[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
|
||||
[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system
|
||||
[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **create_user**
|
||||
> create_user(opts)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
body: Petstore::User.new # [User] Created user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.create_user(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling create_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **create_users_with_array_input**
|
||||
> create_users_with_array_input(opts)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
body: [Petstore::User.new] # [Array<User>] List of user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.create_users_with_array_input(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling create_users_with_array_input: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Array<User>**](User.md)| List of user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **create_users_with_list_input**
|
||||
> create_users_with_list_input(opts)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
body: [Petstore::User.new] # [Array<User>] List of user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.create_users_with_list_input(opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling create_users_with_list_input: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Array<User>**](User.md)| List of user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **delete_user**
|
||||
> delete_user(username)
|
||||
|
||||
Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # [String] The name that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
api.delete_user(username)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling delete_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **get_user_by_name**
|
||||
> User get_user_by_name(username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
|
||||
begin
|
||||
result = api.get_user_by_name(username)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling get_user_by_name: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**User**](User.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **login_user**
|
||||
> String login_user(opts)
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
opts = {
|
||||
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)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling login_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The user name for login | [optional]
|
||||
**password** | **String**| The password for login in clear text | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **logout_user**
|
||||
> logout_user
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
begin
|
||||
api.logout_user
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling logout_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
||||
# **update_user**
|
||||
> update_user(username, opts)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```ruby
|
||||
api = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # [String] name that need to be deleted
|
||||
|
||||
opts = {
|
||||
body: Petstore::User.new # [User] Updated user object
|
||||
}
|
||||
|
||||
begin
|
||||
api.update_user(username, opts)
|
||||
rescue Petstore::ApiError => e
|
||||
puts "Exception when calling update_user: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
nil (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
|
||||
|
@ -21,19 +21,19 @@ require 'petstore/version'
|
||||
require 'petstore/configuration'
|
||||
|
||||
# Models
|
||||
require 'petstore/models/order'
|
||||
require 'petstore/models/special_model_name'
|
||||
require 'petstore/models/user'
|
||||
require 'petstore/models/category'
|
||||
require 'petstore/models/object_return'
|
||||
require 'petstore/models/inline_response_200'
|
||||
require 'petstore/models/tag'
|
||||
require 'petstore/models/model_return'
|
||||
require 'petstore/models/order'
|
||||
require 'petstore/models/pet'
|
||||
require 'petstore/models/special_model_name'
|
||||
require 'petstore/models/tag'
|
||||
require 'petstore/models/user'
|
||||
|
||||
# APIs
|
||||
require 'petstore/api/user_api'
|
||||
require 'petstore/api/store_api'
|
||||
require 'petstore/api/pet_api'
|
||||
require 'petstore/api/store_api'
|
||||
require 'petstore/api/user_api'
|
||||
|
||||
module Petstore
|
||||
class << self
|
||||
|
@ -24,62 +24,6 @@ module Petstore
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [nil]
|
||||
def update_pet(opts = {})
|
||||
update_pet_with_http_info(opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_pet_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#update_pet ..."
|
||||
end
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet".sub('{format}','json')
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = ['application/json', 'application/xml']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Add a new pet to the store
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -136,6 +80,124 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :body Pet object in the form of byte array
|
||||
# @return [nil]
|
||||
def add_pet_using_byte_array(opts = {})
|
||||
add_pet_using_byte_array_with_http_info(opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :body Pet object in the form of byte array
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def add_pet_using_byte_array_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#add_pet_using_byte_array ..."
|
||||
end
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet?testing_byte_array=true".sub('{format}','json')
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = ['application/json', 'application/xml']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#add_pet_using_byte_array\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
def delete_pet(pet_id, opts = {})
|
||||
delete_pet_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_pet_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#delete_pet ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
fail "Missing the required parameter 'pet_id' when calling delete_pet" if pet_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
header_params[:'api_key'] = opts[:'api_key'] if opts[:'api_key']
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Finds Pets by status
|
||||
# Multiple status values can be provided with comma separated strings
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -312,198 +374,6 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [nil]
|
||||
def update_pet_with_form(pet_id, opts = {})
|
||||
update_pet_with_form_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_pet_with_form_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#update_pet_with_form ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
fail "Missing the required parameter 'pet_id' when calling update_pet_with_form" if pet_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = ['application/x-www-form-urlencoded']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["name"] = opts[:'name'] if opts[:'name']
|
||||
form_params["status"] = opts[:'status'] if opts[:'status']
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
def delete_pet(pet_id, opts = {})
|
||||
delete_pet_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_pet_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#delete_pet ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
fail "Missing the required parameter 'pet_id' when calling delete_pet" if pet_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
header_params[:'api_key'] = opts[:'api_key'] if opts[:'api_key']
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [nil]
|
||||
def upload_file(pet_id, opts = {})
|
||||
upload_file_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def upload_file_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#upload_file ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
fail "Missing the required parameter 'pet_id' when calling upload_file" if pet_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = ['multipart/form-data']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["additionalMetadata"] = opts[:'additional_metadata'] if opts[:'additional_metadata']
|
||||
form_params["file"] = opts[:'file'] if opts[:'file']
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
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
|
||||
# @param pet_id ID of pet that needs to be fetched
|
||||
@ -624,28 +494,28 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :body Pet object in the form of byte array
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [nil]
|
||||
def add_pet_using_byte_array(opts = {})
|
||||
add_pet_using_byte_array_with_http_info(opts)
|
||||
def update_pet(opts = {})
|
||||
update_pet_with_http_info(opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :body Pet object in the form of byte array
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def add_pet_using_byte_array_with_http_info(opts = {})
|
||||
def update_pet_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#add_pet_using_byte_array ..."
|
||||
@api_client.config.logger.debug "Calling API: PetApi#update_pet ..."
|
||||
end
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet?testing_byte_array=true".sub('{format}','json')
|
||||
local_var_path = "/pet".sub('{format}','json')
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -667,6 +537,71 @@ module Petstore
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [nil]
|
||||
def update_pet_with_form(pet_id, opts = {})
|
||||
update_pet_with_form_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_pet_with_form_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#update_pet_with_form ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
fail "Missing the required parameter 'pet_id' when calling update_pet_with_form" if pet_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = ['application/x-www-form-urlencoded']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["name"] = opts[:'name'] if opts[:'name']
|
||||
form_params["status"] = opts[:'status'] if opts[:'status']
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
@ -675,7 +610,72 @@ module Petstore
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#add_pet_using_byte_array\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
@api_client.config.logger.debug "API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [nil]
|
||||
def upload_file(pet_id, opts = {})
|
||||
upload_file_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def upload_file_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi#upload_file ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'pet_id' is set
|
||||
fail "Missing the required parameter 'pet_id' when calling upload_file" if pet_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}/uploadImage".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = ['multipart/form-data']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["additionalMetadata"] = opts[:'additional_metadata'] if opts[:'additional_metadata']
|
||||
form_params["file"] = opts[:'file'] if opts[:'file']
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
@ -24,6 +24,65 @@ module Petstore
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# Delete purchase order by ID
|
||||
# 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]
|
||||
def delete_order(order_id, opts = {})
|
||||
delete_order_with_http_info(order_id, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Delete purchase order by ID
|
||||
# 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 [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_order_with_http_info(order_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: StoreApi#delete_order ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'order_id' is set
|
||||
fail "Missing the required parameter 'order_id' when calling delete_order" if order_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Finds orders by status
|
||||
# A single status value can be provided as a string
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -196,63 +255,6 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return [Order]
|
||||
def place_order(opts = {})
|
||||
data, status_code, headers = place_order_with_http_info(opts)
|
||||
return data
|
||||
end
|
||||
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers
|
||||
def place_order_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: StoreApi#place_order ..."
|
||||
end
|
||||
|
||||
# resource path
|
||||
local_var_path = "/store/order".sub('{format}','json')
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
auth_names = ['test_api_client_id', 'test_api_client_secret']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Order')
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Find purchase order by ID
|
||||
# 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
|
||||
@ -313,31 +315,28 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Delete purchase order by ID
|
||||
# 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
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def delete_order(order_id, opts = {})
|
||||
delete_order_with_http_info(order_id, opts)
|
||||
return nil
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return [Order]
|
||||
def place_order(opts = {})
|
||||
data, status_code, headers = place_order_with_http_info(opts)
|
||||
return data
|
||||
end
|
||||
|
||||
# Delete purchase order by ID
|
||||
# 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
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_order_with_http_info(order_id, opts = {})
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers
|
||||
def place_order_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: StoreApi#delete_order ..."
|
||||
@api_client.config.logger.debug "Calling API: StoreApi#place_order ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'order_id' is set
|
||||
fail "Missing the required parameter 'order_id' when calling delete_order" if order_id.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/store/order/{orderId}".sub('{format}','json').sub('{' + 'orderId' + '}', order_id.to_s)
|
||||
local_var_path = "/store/order".sub('{format}','json')
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -357,17 +356,18 @@ module Petstore
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
auth_names = ['test_api_client_id', 'test_api_client_secret']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Order')
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
@api_client.config.logger.debug "API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
@ -192,6 +192,125 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def delete_user(username, opts = {})
|
||||
delete_user_with_http_info(username, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_user_with_http_info(username, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi#delete_user ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'username' is set
|
||||
fail "Missing the required parameter 'username' when calling delete_user" if username.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
def get_user_by_name(username, opts = {})
|
||||
data, status_code, headers = get_user_by_name_with_http_info(username, opts)
|
||||
return data
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers
|
||||
def get_user_by_name_with_http_info(username, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi#get_user_by_name ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'username' is set
|
||||
fail "Missing the required parameter 'username' when calling get_user_by_name" if username.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'User')
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Logs user into the system
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -307,66 +426,6 @@ module Petstore
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
def get_user_by_name(username, opts = {})
|
||||
data, status_code, headers = get_user_by_name_with_http_info(username, opts)
|
||||
return data
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers
|
||||
def get_user_by_name_with_http_info(username, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi#get_user_by_name ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'username' is set
|
||||
fail "Missing the required parameter 'username' when calling get_user_by_name" if username.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'User')
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Updated user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username name that need to be deleted
|
||||
@ -427,64 +486,5 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def delete_user(username, opts = {})
|
||||
delete_user_with_http_info(username, opts)
|
||||
return nil
|
||||
end
|
||||
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_user_with_http_info(username, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi#delete_user ..."
|
||||
end
|
||||
|
||||
# verify the required parameter 'username' is set
|
||||
fail "Missing the required parameter 'username' when calling delete_user" if username.nil?
|
||||
|
||||
# resource path
|
||||
local_var_path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = ['application/json', 'application/xml']
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = []
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -18,21 +18,34 @@ require 'date'
|
||||
|
||||
module Petstore
|
||||
class InlineResponse200
|
||||
attr_accessor :photo_urls
|
||||
|
||||
attr_accessor :name
|
||||
|
||||
attr_accessor :id
|
||||
|
||||
attr_accessor :category
|
||||
|
||||
attr_accessor :tags
|
||||
|
||||
# pet status in the store
|
||||
attr_accessor :status
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
|
||||
:'photo_urls' => :'photoUrls',
|
||||
|
||||
:'name' => :'name',
|
||||
|
||||
:'id' => :'id',
|
||||
|
||||
:'category' => :'category'
|
||||
:'category' => :'category',
|
||||
|
||||
:'tags' => :'tags',
|
||||
|
||||
:'status' => :'status'
|
||||
|
||||
}
|
||||
end
|
||||
@ -40,9 +53,12 @@ module Petstore
|
||||
# Attribute type mapping.
|
||||
def self.swagger_types
|
||||
{
|
||||
:'photo_urls' => :'Array<String>',
|
||||
:'name' => :'String',
|
||||
:'id' => :'Integer',
|
||||
:'category' => :'Object'
|
||||
:'category' => :'Object',
|
||||
:'tags' => :'Array<Tag>',
|
||||
:'status' => :'String'
|
||||
|
||||
}
|
||||
end
|
||||
@ -54,6 +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
|
||||
end
|
||||
end
|
||||
|
||||
if attributes[:'name']
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
@ -66,15 +88,37 @@ 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
|
||||
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
def status=(status)
|
||||
allowed_values = ["available", "pending", "sold"]
|
||||
if status && !allowed_values.include?(status)
|
||||
fail "invalid value for 'status', must be one of #{allowed_values}"
|
||||
end
|
||||
@status = status
|
||||
end
|
||||
|
||||
# Check equality by comparing each attribute.
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
photo_urls == o.photo_urls &&
|
||||
name == o.name &&
|
||||
id == o.id &&
|
||||
category == o.category
|
||||
category == o.category &&
|
||||
tags == o.tags &&
|
||||
status == o.status
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@ -84,7 +128,7 @@ module Petstore
|
||||
|
||||
# Calculate hash code according to all attributes.
|
||||
def hash
|
||||
[name, id, category].hash
|
||||
[photo_urls, name, id, category, tags, status].hash
|
||||
end
|
||||
|
||||
# build the object from hash
|
||||
|
165
samples/client/petstore/ruby/lib/petstore/models/model_return.rb
Normal file
165
samples/client/petstore/ruby/lib/petstore/models/model_return.rb
Normal file
@ -0,0 +1,165 @@
|
||||
=begin
|
||||
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
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class ModelReturn
|
||||
attr_accessor :_return
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
|
||||
:'_return' => :'return'
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.swagger_types
|
||||
{
|
||||
:'_return' => :'Integer'
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
||||
|
||||
|
||||
if attributes[:'return']
|
||||
self._return = attributes[:'return']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Check equality by comparing each attribute.
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
_return == o._return
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculate hash code according to all attributes.
|
||||
def hash
|
||||
[_return].hash
|
||||
end
|
||||
|
||||
# build the object from hash
|
||||
def build_from_hash(attributes)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.swagger_types.each_pair do |key, type|
|
||||
if type =~ /^Array<(.*)>/i
|
||||
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
||||
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
||||
else
|
||||
#TODO show warning in debug mode
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
else
|
||||
# data not found in attributes(hash), not an issue as the data can be optional
|
||||
end
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
def _deserialize(type, value)
|
||||
case type.to_sym
|
||||
when :DateTime
|
||||
DateTime.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
else # model
|
||||
_model = Petstore.const_get(type).new
|
||||
_model.build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_body (backward compatibility))
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# return the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
next if value.nil?
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Method to output non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map{ |v| _to_hash(v) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,204 +0,0 @@
|
||||
=begin
|
||||
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
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::PetApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'PetApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::PetApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of PetApi' do
|
||||
it 'should create an instact of PetApi' do
|
||||
@instance.should be_a(Petstore::PetApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_pet
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [nil]
|
||||
describe 'update_pet test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for add_pet
|
||||
# Add a new pet to the store
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [nil]
|
||||
describe 'add_pet test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for find_pets_by_status
|
||||
# Finds Pets by status
|
||||
# Multiple status values can be provided with comma separated strings
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Array<String>] :status Status values that need to be considered for query
|
||||
# @return [Array<Pet>]
|
||||
describe 'find_pets_by_status test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for find_pets_by_tags
|
||||
# Finds Pets by tags
|
||||
# Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Array<String>] :tags Tags to filter by
|
||||
# @return [Array<Pet>]
|
||||
describe 'find_pets_by_tags test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_pet_by_id
|
||||
# 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 [Pet]
|
||||
describe 'get_pet_by_id test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_pet_with_form
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [nil]
|
||||
describe 'update_pet_with_form test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_pet
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
describe 'delete_pet test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for upload_file
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [nil]
|
||||
describe 'upload_file test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for pet_pet_idtesting_byte_arraytrue_get
|
||||
# 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]
|
||||
describe 'pet_pet_idtesting_byte_arraytrue_get test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for add_pet_using_byte_array
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :body Pet object in the form of byte array
|
||||
# @return [nil]
|
||||
describe 'add_pet_using_byte_array test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,118 +0,0 @@
|
||||
=begin
|
||||
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
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::StoreApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'StoreApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::StoreApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of StoreApi' do
|
||||
it 'should create an instact of StoreApi' do
|
||||
@instance.should be_a(Petstore::StoreApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for find_orders_by_status
|
||||
# Finds orders by status
|
||||
# A single status value can be provided as a string
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :status Status value that needs to be considered for query
|
||||
# @return [Array<Order>]
|
||||
describe 'find_orders_by_status test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_inventory
|
||||
# Returns pet inventories by status
|
||||
# Returns a map of status codes to quantities
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Hash<String, Integer>]
|
||||
describe 'get_inventory test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for place_order
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return [Order]
|
||||
describe 'place_order test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_order_by_id
|
||||
# Find purchase order by ID
|
||||
# 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]
|
||||
describe 'get_order_by_id test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_order
|
||||
# Delete purchase order by ID
|
||||
# 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]
|
||||
describe 'delete_order test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,168 +0,0 @@
|
||||
=begin
|
||||
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
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::UserApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'UserApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::UserApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of UserApi' do
|
||||
it 'should create an instact of UserApi' do
|
||||
@instance.should be_a(Petstore::UserApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for create_user
|
||||
# Create user
|
||||
# This can only be done by the logged in user.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [User] :body Created user object
|
||||
# @return [nil]
|
||||
describe 'create_user test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for create_users_with_array_input
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Array<User>] :body List of user object
|
||||
# @return [nil]
|
||||
describe 'create_users_with_array_input test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for create_users_with_list_input
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Array<User>] :body List of user object
|
||||
# @return [nil]
|
||||
describe 'create_users_with_list_input test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for login_user
|
||||
# Logs user into the system
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :username The user name for login
|
||||
# @option opts [String] :password The password for login in clear text
|
||||
# @return [String]
|
||||
describe 'login_user test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for logout_user
|
||||
# Logs out current logged in user session
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'logout_user test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_user_by_name
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
describe 'get_user_by_name test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_user
|
||||
# Updated user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username name that need to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [User] :body Updated user object
|
||||
# @return [nil]
|
||||
describe 'update_user test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_user
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'delete_user test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -36,13 +36,13 @@ describe 'PetApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_pet
|
||||
# Update an existing pet
|
||||
# unit tests for add_pet
|
||||
# Add a new pet to the store
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [nil]
|
||||
describe 'update_pet test' do
|
||||
describe 'add_pet test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
@ -52,13 +52,30 @@ describe 'PetApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for add_pet
|
||||
# Add a new pet to the store
|
||||
# unit tests for add_pet_using_byte_array
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @option opts [String] :body Pet object in the form of byte array
|
||||
# @return [nil]
|
||||
describe 'add_pet test' do
|
||||
describe 'add_pet_using_byte_array test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_pet
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
describe 'delete_pet test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
@ -116,59 +133,6 @@ describe 'PetApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_pet_with_form
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [nil]
|
||||
describe 'update_pet_with_form test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_pet
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
describe 'delete_pet test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for upload_file
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [nil]
|
||||
describe 'upload_file test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_pet_by_id_in_object
|
||||
# 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
|
||||
@ -201,13 +165,49 @@ describe 'PetApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for add_pet_using_byte_array
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
# unit tests for update_pet
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :body Pet object in the form of byte array
|
||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||
# @return [nil]
|
||||
describe 'add_pet_using_byte_array test' do
|
||||
describe 'update_pet test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_pet_with_form
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [nil]
|
||||
describe 'update_pet_with_form test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for upload_file
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [nil]
|
||||
describe 'upload_file test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
|
@ -36,6 +36,22 @@ describe 'StoreApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_order
|
||||
# Delete purchase order by ID
|
||||
# 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]
|
||||
describe 'delete_order test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for find_orders_by_status
|
||||
# Finds orders by status
|
||||
# A single status value can be provided as a string
|
||||
@ -82,22 +98,6 @@ describe 'StoreApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for place_order
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return [Order]
|
||||
describe 'place_order test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_order_by_id
|
||||
# Find purchase order by ID
|
||||
# For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
@ -114,13 +114,13 @@ describe 'StoreApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_order
|
||||
# Delete purchase order by ID
|
||||
# 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
|
||||
# unit tests for place_order
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'delete_order test' do
|
||||
# @option opts [Order] :body order placed for purchasing the pet
|
||||
# @return [Order]
|
||||
describe 'place_order test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
|
@ -84,6 +84,38 @@ describe 'UserApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_user
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'delete_user test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_user_by_name
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
describe 'get_user_by_name test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for login_user
|
||||
# Logs user into the system
|
||||
#
|
||||
@ -116,22 +148,6 @@ describe 'UserApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_user_by_name
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
describe 'get_user_by_name test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_user
|
||||
# Updated user
|
||||
# This can only be done by the logged in user.
|
||||
@ -149,20 +165,4 @@ describe 'UserApi' do
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_user
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'delete_user test' do
|
||||
it "should work" do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -36,6 +36,16 @@ 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
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
@ -66,5 +76,25 @@ describe 'InlineResponse200' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "tags"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
describe 'test attribute "status"' do
|
||||
it 'should work' do
|
||||
# assertion here
|
||||
# should be_a()
|
||||
# should be_nil
|
||||
# should ==
|
||||
# should_not ==
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
@ -21,19 +21,19 @@ require 'date'
|
||||
# Unit tests for Petstore::
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'ObjectReturn' do
|
||||
describe 'ModelReturn' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::ObjectReturn.new
|
||||
@instance = Petstore::ModelReturn.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of ObjectReturn' do
|
||||
it 'should create an instact of ObjectReturn' do
|
||||
@instance.should be_a(Petstore::ObjectReturn)
|
||||
describe 'test an instance of ModelReturn' do
|
||||
it 'should create an instact of ModelReturn' do
|
||||
@instance.should be_a(Petstore::ModelReturn)
|
||||
end
|
||||
end
|
||||
describe 'test attribute "_return"' do
|
Loading…
x
Reference in New Issue
Block a user