From eafcc2427df9a01ef459de32181fedda210691c0 Mon Sep 17 00:00:00 2001 From: xhh Date: Thu, 10 Mar 2016 17:19:18 +0800 Subject: [PATCH] Some improvements on Ruby docs --- .../codegen/languages/RubyClientCodegen.java | 45 +++++++++++++- .../src/main/resources/ruby/README.mustache | 24 +++---- .../src/main/resources/ruby/api_doc.mustache | 29 ++++----- samples/client/petstore/ruby/README.md | 2 +- samples/client/petstore/ruby/docs/PetApi.md | 62 +++++++++---------- samples/client/petstore/ruby/docs/StoreApi.md | 44 ++++++------- samples/client/petstore/ruby/docs/UserApi.md | 34 +++++----- 7 files changed, 135 insertions(+), 105 deletions(-) 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 dde9f6a65f6b..ede3a23c8980 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 @@ -3,16 +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; @@ -218,6 +223,35 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); } + @Override + public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map 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() { @@ -498,9 +532,16 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public void setParameterExampleValue(CodegenParameter p) { - if (Boolean.TRUE.equals(p.isString) || Boolean.TRUE.equals(p.isBinary) || - Boolean.TRUE.equals(p.isByteArray) || Boolean.TRUE.equals(p.isFile)) { + // NOTE: Can not get default value from ArrayProperty + //String defaultValue = p.defaultValue; + //if (!StringUtils.isEmpty(defaultValue)) { + // p.example = defaultValue; + // return; + //} + if (Boolean.TRUE.equals(p.isString) || Boolean.TRUE.equals(p.isBinary) || Boolean.TRUE.equals(p.isByteArray)) { p.example = "\"" + escapeText(p.example) + "\""; + } else if (Boolean.TRUE.equals(p.isFile)) { + p.example = "File.new(\"" + escapeText(p.example) + "\")"; } else if (Boolean.TRUE.equals(p.isDateTime) || Boolean.TRUE.equals(p.isDate)) { p.example = "Date.parse(\"" + escapeText(p.example) + "\")"; } diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache index b016412053fb..c9a21277c772 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache @@ -16,20 +16,20 @@ Automatically generated by the Ruby Swagger Codegen project: You can build the generated client into a gem: ```shell -gem build {{gemName}}.gemspec +gem build {{{gemName}}}.gemspec ``` Then you can either install the gem: ```shell -gem install ./{{gemName}}-{{gemVersion}}.gem +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}}' + gem '{{{gemName}}}', '~> {{{gemVersion}}}' ### Host as a git repository @@ -38,7 +38,7 @@ 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' + gem '{{{gemName}}}', :git => 'https://github.com/YOUR_USERNAME/YOUR_REPO.git' ### Use without installation @@ -51,9 +51,9 @@ ruby -Ilib script.rb ## Getting Started ```ruby -require '{{gemName}}' +require '{{{gemName}}}' -{{moduleName}}.configure do |config| +{{{moduleName}}}.configure do |config| # Use the line below to configure API key authorization if needed: #config.api_key['api_key'] = 'your api key' @@ -65,7 +65,7 @@ end # Assuming there's a `PetApi` containing a `get_pet_by_id` method # which returns a model object: -pet_api = {{moduleName}}::PetApi.new +pet_api = {{{moduleName}}}::PetApi.new pet = pet_api.get_pet_by_id(5) puts pet.to_body ``` @@ -88,19 +88,19 @@ Class | Method | HTTP request | Description {{^authMethods}} All endpoints do not require authorization. {{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} -{{#authMethods}}### {{{name}}} +{{#authMethods}}### {{name}} {{#isApiKey}}- **Type**: API key -- **API key parameter name**: {{{keyParamName}}} +- **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}}} +- **Flow**: {{flow}} +- **Authorizatoin URL**: {{authorizationUrl}} - **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}}-- {{{scope}}}: {{{description}}} +{{#scopes}}-- {{scope}}: {{description}} {{/scopes}} {{/isOAuth}} 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 b97938467c22..08050f3949e3 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache @@ -10,26 +10,27 @@ Method | HTTP request | Description {{#operations}} {{#operation}} -# **{{{operationId}}}** -> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts) +# **{{operationId}}** +> {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}} -{{{summary}}}{{#notes}} +{{summary}}{{#notes}} -{{{notes}}}{{/notes}} +{{notes}}{{/notes}} ### Example ```ruby -api = {{moduleName}}::{{classname}}.new -{{#allParams}}{{#required}}{{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}{{{moduleName}}}::{{dataType}}.new{{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}} # [{{{dataType}}}] {{description}} -{{/required}}{{/allParams}} +api = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}} +{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}} +{{{paramName}}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}{{{moduleName}}}::{{{baseType}}}.new{{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}} # [{{{dataType}}}] {{{description}}} +{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}} opts = { {{#allParams}}{{^required}} - {{paramName}}: {{{example}}},{{/required}}{{/allParams}} -} + {{{paramName}}}: {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}{{{moduleName}}}::{{{baseType}}}.new{{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # [{{{dataType}}}] {{{description}}}{{/required}}{{/allParams}} +}{{/hasOptionalParams}}{{/hasParams}} begin - {{#returnType}}result = {{/returnType}}api.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts) -rescue {{moduleName}}::ApiError => e - puts "Exception when calling {{operationId}}: #{e}" + {{#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 ``` @@ -42,11 +43,11 @@ Name | Type | Description | Notes ### Return type -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}nil (empty response body){{/returnType}} +{{#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}} +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}} ### HTTP reuqest headers diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 29a029303991..9c9b686c5b56 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-09T19:35:57.300+08:00 +- Build date: 2016-03-10T17:17:33.736+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index d776fdd1be78..fc9d4ecb2769 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -29,7 +29,7 @@ Add a new pet to the store api = Petstore::PetApi.new opts = { - body: , + body: Petstore::Pet.new # [Pet] Pet object that needs to be added to the store } begin @@ -72,7 +72,7 @@ Fake endpoint to test byte array in body parameter for adding a new pet to the s api = Petstore::PetApi.new opts = { - body: "B", + body: Petstore::String.new # [String] Pet object in the form of byte array } begin @@ -113,10 +113,11 @@ Deletes a pet ### Example ```ruby api = Petstore::PetApi.new + pet_id = 789 # [Integer] Pet id to delete opts = { - api_key: "api_key_example", + api_key: "api_key_example" # [String] } begin @@ -149,7 +150,7 @@ nil (empty response body) # **find_pets_by_status** -> Array find_pets_by_status(opts) +> Array<Pet> find_pets_by_status(opts) Finds Pets by status @@ -160,7 +161,7 @@ Multiple status values can be provided with comma separated strings api = Petstore::PetApi.new opts = { - status: , + status: [] # [Array] Status values that need to be considered for query } begin @@ -178,7 +179,7 @@ Name | Type | Description | Notes ### Return type -[**Array**](Pet.md) +[**Array<Pet>**](Pet.md) ### Authorization @@ -192,7 +193,7 @@ Name | Type | Description | Notes # **find_pets_by_tags** -> Array find_pets_by_tags(opts) +> Array<Pet> find_pets_by_tags(opts) Finds Pets by tags @@ -203,7 +204,7 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 api = Petstore::PetApi.new opts = { - tags: , + tags: [] # [Array] Tags to filter by } begin @@ -221,7 +222,7 @@ Name | Type | Description | Notes ### Return type -[**Array**](Pet.md) +[**Array<Pet>**](Pet.md) ### Authorization @@ -235,22 +236,21 @@ Name | Type | Description | Notes # **get_pet_by_id** -> Pet get_pet_by_id(pet_id, opts) +> 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 +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) + result = api.get_pet_by_id(pet_id) rescue Petstore::ApiError => e puts "Exception when calling get_pet_by_id: #{e}" end @@ -278,22 +278,21 @@ Name | Type | Description | Notes # **get_pet_by_id_in_object** -> InlineResponse200 get_pet_by_id_in_object(pet_id, opts) +> InlineResponse200 get_pet_by_id_in_object(pet_id) -Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example ```ruby 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) + 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 @@ -321,22 +320,21 @@ Name | Type | Description | Notes # **pet_pet_idtesting_byte_arraytrue_get** -> String pet_pet_idtesting_byte_arraytrue_get(pet_id, opts) +> String pet_pet_idtesting_byte_arraytrue_get(pet_id) -Fake endpoint to test byte array return by 'Find pet by ID' +Fake endpoint to test byte array return by 'Find pet by ID' -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example ```ruby 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) + 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 @@ -375,7 +373,7 @@ Update an existing pet api = Petstore::PetApi.new opts = { - body: , + body: Petstore::Pet.new # [Pet] Pet object that needs to be added to the store } begin @@ -416,11 +414,12 @@ 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", + name: "name_example", # [String] Updated name of the pet + status: "status_example" # [String] Updated status of the pet } begin @@ -463,11 +462,12 @@ 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", + additional_metadata: "additional_metadata_example", # [String] Additional data to pass to server + file: File.new("/path/to/file.txt") # [File] file to upload } begin diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 794c93e32f51..da2b4219680b 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -13,22 +13,21 @@ Method | HTTP request | Description # **delete_order** -> delete_order(order_id, opts) +> 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 +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) + api.delete_order(order_id) rescue Petstore::ApiError => e puts "Exception when calling delete_order: #{e}" end @@ -56,7 +55,7 @@ No authorization required # **find_orders_by_status** -> Array find_orders_by_status(opts) +> Array<Order> find_orders_by_status(opts) Finds orders by status @@ -67,7 +66,7 @@ A single status value can be provided as a string api = Petstore::StoreApi.new opts = { - status: "status_example", + status: "status_example" # [String] Status value that needs to be considered for query } begin @@ -85,7 +84,7 @@ Name | Type | Description | Notes ### Return type -[**Array**](Order.md) +[**Array<Order>**](Order.md) ### Authorization @@ -99,7 +98,7 @@ Name | Type | Description | Notes # **get_inventory** -> Hash get_inventory(opts) +> Hash<String, Integer> get_inventory Returns pet inventories by status @@ -109,11 +108,8 @@ Returns a map of status codes to quantities ```ruby api = Petstore::StoreApi.new -opts = { -} - begin - result = api.get_inventory(opts) + result = api.get_inventory rescue Petstore::ApiError => e puts "Exception when calling get_inventory: #{e}" end @@ -124,7 +120,7 @@ This endpoint does not need any parameter. ### Return type -**Hash** +**Hash<String, Integer>** ### Authorization @@ -138,9 +134,9 @@ This endpoint does not need any parameter. # **get_inventory_in_object** -> Object get_inventory_in_object(opts) +> Object get_inventory_in_object -Fake endpoint to test arbitrary object return by 'Get inventory' +Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities @@ -148,11 +144,8 @@ Returns an arbitrary object which is actually a map of status codes to quantitie ```ruby api = Petstore::StoreApi.new -opts = { -} - begin - result = api.get_inventory_in_object(opts) + result = api.get_inventory_in_object rescue Petstore::ApiError => e puts "Exception when calling get_inventory_in_object: #{e}" end @@ -177,22 +170,21 @@ This endpoint does not need any parameter. # **get_order_by_id** -> Order get_order_by_id(order_id, opts) +> 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 +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) + result = api.get_order_by_id(order_id) rescue Petstore::ApiError => e puts "Exception when calling get_order_by_id: #{e}" end @@ -231,7 +223,7 @@ Place an order for a pet api = Petstore::StoreApi.new opts = { - body: , + body: Petstore::Order.new # [Order] order placed for purchasing the pet } begin diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 504f1e8de957..b7dbb9c69aa7 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -26,7 +26,7 @@ This can only be done by the logged in user. api = Petstore::UserApi.new opts = { - body: , + body: Petstore::User.new # [User] Created user object } begin @@ -69,7 +69,7 @@ Creates list of users with given input array api = Petstore::UserApi.new opts = { - body: , + body: [Petstore::User.new] # [Array] List of user object } begin @@ -112,7 +112,7 @@ Creates list of users with given input array api = Petstore::UserApi.new opts = { - body: , + body: [Petstore::User.new] # [Array] List of user object } begin @@ -144,7 +144,7 @@ No authorization required # **delete_user** -> delete_user(username, opts) +> delete_user(username) Delete user @@ -153,13 +153,12 @@ 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) + api.delete_user(username) rescue Petstore::ApiError => e puts "Exception when calling delete_user: #{e}" end @@ -187,7 +186,7 @@ No authorization required # **get_user_by_name** -> User get_user_by_name(username, opts) +> User get_user_by_name(username) Get user by user name @@ -196,13 +195,12 @@ 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) + result = api.get_user_by_name(username) rescue Petstore::ApiError => e puts "Exception when calling get_user_by_name: #{e}" end @@ -241,8 +239,8 @@ Logs user into the system api = Petstore::UserApi.new opts = { - username: "username_example", - password: "password_example", + username: "username_example", # [String] The user name for login + password: "password_example" # [String] The password for login in clear text } begin @@ -275,7 +273,7 @@ No authorization required # **logout_user** -> logout_user(opts) +> logout_user Logs out current logged in user session @@ -285,11 +283,8 @@ Logs out current logged in user session ```ruby api = Petstore::UserApi.new -opts = { -} - begin - api.logout_user(opts) + api.logout_user rescue Petstore::ApiError => e puts "Exception when calling logout_user: #{e}" end @@ -323,10 +318,11 @@ 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: , + body: Petstore::User.new # [User] Updated user object } begin