From 91bae765ef13654ef99a0011f39e72f3c4315d6c Mon Sep 17 00:00:00 2001 From: xhh Date: Wed, 9 Mar 2016 19:36:28 +0800 Subject: [PATCH] Some fixes to Ruby docs on links and File parameter --- .../codegen/languages/RubyClientCodegen.java | 7 +- .../src/main/resources/ruby/README.mustache | 2 +- .../src/main/resources/ruby/api_doc.mustache | 2 +- samples/client/petstore/ruby/README.md | 68 +-- samples/client/petstore/ruby/docs/Category.md | 9 + .../petstore/ruby/docs/InlineResponse200.md | 13 + .../client/petstore/ruby/docs/ModelReturn.md | 8 + samples/client/petstore/ruby/docs/Order.md | 13 + samples/client/petstore/ruby/docs/Pet.md | 13 + samples/client/petstore/ruby/docs/PetApi.md | 502 ++++++++++++++++++ .../petstore/ruby/docs/SpecialModelName.md | 8 + samples/client/petstore/ruby/docs/StoreApi.md | 264 +++++++++ samples/client/petstore/ruby/docs/Tag.md | 9 + samples/client/petstore/ruby/docs/User.md | 15 + samples/client/petstore/ruby/docs/UserApi.md | 360 +++++++++++++ 15 files changed, 1255 insertions(+), 38 deletions(-) create mode 100644 samples/client/petstore/ruby/docs/Category.md create mode 100644 samples/client/petstore/ruby/docs/InlineResponse200.md create mode 100644 samples/client/petstore/ruby/docs/ModelReturn.md create mode 100644 samples/client/petstore/ruby/docs/Order.md create mode 100644 samples/client/petstore/ruby/docs/Pet.md create mode 100644 samples/client/petstore/ruby/docs/PetApi.md create mode 100644 samples/client/petstore/ruby/docs/SpecialModelName.md create mode 100644 samples/client/petstore/ruby/docs/StoreApi.md create mode 100644 samples/client/petstore/ruby/docs/Tag.md create mode 100644 samples/client/petstore/ruby/docs/User.md create mode 100644 samples/client/petstore/ruby/docs/UserApi.md diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java index 198350b3903..dde9f6a65f6 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java @@ -199,6 +199,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"); @@ -433,7 +436,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toModelDocFilename(String name) { - return toModelFilename(name); + return toModelName(name); } @Override @@ -447,7 +450,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toApiDocFilename(String name) { - return toApiFilename(name); + return toApiName(name); } @Override diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache index 58f4b881e86..b016412053f 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache @@ -65,7 +65,7 @@ end # Assuming there's a `PetApi` containing a `get_pet_by_id` method # which returns a model object: -pet_api = Petstore::PetApi.new +pet_api = {{moduleName}}::PetApi.new pet = pet_api.get_pet_by_id(5) puts pet.to_body ``` diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache index 66b97fb19be..b97938467c2 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache @@ -37,7 +37,7 @@ end {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#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 diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 35720bfe3a1..29a02930399 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -6,7 +6,7 @@ Version: 1.0.0 Automatically generated by the Ruby Swagger Codegen project: -- Build date: 2016-03-09T17:12:59.008+08:00 +- Build date: 2016-03-09T19:35:57.300+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -76,43 +76,43 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*Petstore::PetApi* | [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -*Petstore::PetApi* | [**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 -*Petstore::PetApi* | [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet -*Petstore::PetApi* | [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status -*Petstore::PetApi* | [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags -*Petstore::PetApi* | [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -*Petstore::PetApi* | [**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' -*Petstore::PetApi* | [**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' -*Petstore::PetApi* | [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet -*Petstore::PetApi* | [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data -*Petstore::PetApi* | [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image -*Petstore::StoreApi* | [**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*Petstore::StoreApi* | [**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status -*Petstore::StoreApi* | [**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -*Petstore::StoreApi* | [**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' -*Petstore::StoreApi* | [**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID -*Petstore::StoreApi* | [**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet -*Petstore::UserApi* | [**create_user**](UserApi.md#create_user) | **POST** /user | Create user -*Petstore::UserApi* | [**create_users_with_array_input**](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**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array -*Petstore::UserApi* | [**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user -*Petstore::UserApi* | [**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name -*Petstore::UserApi* | [**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system -*Petstore::UserApi* | [**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session -*Petstore::UserApi* | [**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user +*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](Category.md) - - [Petstore::InlineResponse200](InlineResponse200.md) - - [Petstore::ModelReturn](ModelReturn.md) - - [Petstore::Order](Order.md) - - [Petstore::Pet](Pet.md) - - [Petstore::SpecialModelName](SpecialModelName.md) - - [Petstore::Tag](Tag.md) - - [Petstore::User](User.md) + - [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 diff --git a/samples/client/petstore/ruby/docs/Category.md b/samples/client/petstore/ruby/docs/Category.md new file mode 100644 index 00000000000..f642a3d6b86 --- /dev/null +++ b/samples/client/petstore/ruby/docs/Category.md @@ -0,0 +1,9 @@ +# Petstore::Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Integer** | | [optional] +**name** | **String** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/InlineResponse200.md b/samples/client/petstore/ruby/docs/InlineResponse200.md new file mode 100644 index 00000000000..d06f729f2f8 --- /dev/null +++ b/samples/client/petstore/ruby/docs/InlineResponse200.md @@ -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] + + diff --git a/samples/client/petstore/ruby/docs/ModelReturn.md b/samples/client/petstore/ruby/docs/ModelReturn.md new file mode 100644 index 00000000000..dfcfff1dd06 --- /dev/null +++ b/samples/client/petstore/ruby/docs/ModelReturn.md @@ -0,0 +1,8 @@ +# Petstore::ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/Order.md b/samples/client/petstore/ruby/docs/Order.md new file mode 100644 index 00000000000..ed1b69874ee --- /dev/null +++ b/samples/client/petstore/ruby/docs/Order.md @@ -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] + + diff --git a/samples/client/petstore/ruby/docs/Pet.md b/samples/client/petstore/ruby/docs/Pet.md new file mode 100644 index 00000000000..f4320a0b72b --- /dev/null +++ b/samples/client/petstore/ruby/docs/Pet.md @@ -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] + + diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md new file mode 100644 index 00000000000..d776fdd1be7 --- /dev/null +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -0,0 +1,502 @@ +# 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 +api = Petstore::PetApi.new + +opts = { + body: , +} + +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 +api = Petstore::PetApi.new + +opts = { + body: "B", +} + +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 +api = Petstore::PetApi.new +pet_id = 789 # [Integer] Pet id to delete + +opts = { + api_key: "api_key_example", +} + +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 find_pets_by_status(opts) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```ruby +api = Petstore::PetApi.new + +opts = { + status: , +} + +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.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 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 +api = Petstore::PetApi.new + +opts = { + tags: , +} + +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.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, opts) + +Find pet by ID + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```ruby +api = Petstore::PetApi.new +pet_id = 789 # [Integer] ID of pet that needs to be fetched + +opts = { +} + +begin + result = api.get_pet_by_id(pet_id, opts) +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, opts) + +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 +api = Petstore::PetApi.new +pet_id = 789 # [Integer] ID of pet that needs to be fetched + +opts = { +} + +begin + result = api.get_pet_by_id_in_object(pet_id, opts) +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, opts) + +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 +api = Petstore::PetApi.new +pet_id = 789 # [Integer] ID of pet that needs to be fetched + +opts = { +} + +begin + result = api.pet_pet_idtesting_byte_arraytrue_get(pet_id, opts) +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 +api = Petstore::PetApi.new + +opts = { + body: , +} + +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 +api = Petstore::PetApi.new +pet_id = "pet_id_example" # [String] ID of pet that needs to be updated + +opts = { + name: "name_example", + status: "status_example", +} + +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 +api = Petstore::PetApi.new +pet_id = 789 # [Integer] ID of pet to update + +opts = { + additional_metadata: "additional_metadata_example", + file: "/path/to/file.txt", +} + +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 + + + diff --git a/samples/client/petstore/ruby/docs/SpecialModelName.md b/samples/client/petstore/ruby/docs/SpecialModelName.md new file mode 100644 index 00000000000..581ab6907ef --- /dev/null +++ b/samples/client/petstore/ruby/docs/SpecialModelName.md @@ -0,0 +1,8 @@ +# Petstore::SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**special_property_name** | **Integer** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md new file mode 100644 index 00000000000..794c93e32f5 --- /dev/null +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -0,0 +1,264 @@ +# 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, opts) + +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 + +opts = { +} + +begin + api.delete_order(order_id, opts) +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 find_orders_by_status(opts) + +Finds orders by status + +A single status value can be provided as a string + +### Example +```ruby +api = Petstore::StoreApi.new + +opts = { + status: "status_example", +} + +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.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 get_inventory(opts) + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```ruby +api = Petstore::StoreApi.new + +opts = { +} + +begin + result = api.get_inventory(opts) +rescue Petstore::ApiError => e + puts "Exception when calling get_inventory: #{e}" +end +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Hash** + +### 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(opts) + +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 +api = Petstore::StoreApi.new + +opts = { +} + +begin + result = api.get_inventory_in_object(opts) +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, opts) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```ruby +api = Petstore::StoreApi.new +order_id = "order_id_example" # [String] ID of pet that needs to be fetched + +opts = { +} + +begin + result = api.get_order_by_id(order_id, opts) +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 +api = Petstore::StoreApi.new + +opts = { + body: , +} + +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 + + + diff --git a/samples/client/petstore/ruby/docs/Tag.md b/samples/client/petstore/ruby/docs/Tag.md new file mode 100644 index 00000000000..5bd94d6c04e --- /dev/null +++ b/samples/client/petstore/ruby/docs/Tag.md @@ -0,0 +1,9 @@ +# Petstore::Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Integer** | | [optional] +**name** | **String** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/User.md b/samples/client/petstore/ruby/docs/User.md new file mode 100644 index 00000000000..bd76116e023 --- /dev/null +++ b/samples/client/petstore/ruby/docs/User.md @@ -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] + + diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md new file mode 100644 index 00000000000..504f1e8de95 --- /dev/null +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -0,0 +1,360 @@ +# 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: , +} + +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: , +} + +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: , +} + +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, opts) + +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 + +opts = { +} + +begin + api.delete_user(username, opts) +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, opts) + +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. + +opts = { +} + +begin + result = api.get_user_by_name(username, opts) +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", + password: "password_example", +} + +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(opts) + +Logs out current logged in user session + + + +### Example +```ruby +api = Petstore::UserApi.new + +opts = { +} + +begin + api.logout_user(opts) +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: , +} + +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 + + +