fix ruby parameters in documentation, fix reuqiredParams, optionalParams

This commit is contained in:
wing328 2018-04-09 10:48:45 +08:00
parent 26f08aa8ad
commit a08164592a
9 changed files with 95 additions and 83 deletions

View File

@ -34,6 +34,7 @@ public class CodegenOperation {
public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>(); public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>(); public List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>(); public List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
public List<CodegenParameter> optionalParams = new ArrayList<CodegenParameter>();
public List<CodegenSecurity> authMethods; public List<CodegenSecurity> authMethods;
public List<Tag> tags; public List<Tag> tags;
public List<CodegenResponse> responses = new ArrayList<CodegenResponse>(); public List<CodegenResponse> responses = new ArrayList<CodegenResponse>();
@ -111,6 +112,24 @@ public class CodegenOperation {
return nonempty(cookieParams); return nonempty(cookieParams);
} }
/**
* Check if there's at least one optional parameter
*
* @return true if any optional parameter exists, false otherwise
*/
public boolean getHasOptionalParams() {
return nonempty(optionalParams);
}
/**
* Check if there's at least one required parameter
*
* @return true if any optional parameter exists, false otherwise
*/
public boolean getHasRequiredParams() {
return nonempty(requiredParams);
}
/** /**
* Check if there's at least one example parameter * Check if there's at least one example parameter
* *
@ -293,6 +312,10 @@ public class CodegenOperation {
return false; return false;
if (cookieParams != null ? !cookieParams.equals(that.cookieParams) : that.cookieParams != null) if (cookieParams != null ? !cookieParams.equals(that.cookieParams) : that.cookieParams != null)
return false; return false;
if (requiredParams != null ? !requiredParams.equals(that.requiredParams) : that.requiredParams!= null)
return false;
if (optionalParams != null ? !optionalParams.equals(that.optionalParams) : that.optionalParams!= null)
return false;
if (authMethods != null ? !authMethods.equals(that.authMethods) : that.authMethods != null) if (authMethods != null ? !authMethods.equals(that.authMethods) : that.authMethods != null)
return false; return false;
if (tags != null ? !tags.equals(that.tags) : that.tags != null) if (tags != null ? !tags.equals(that.tags) : that.tags != null)
@ -360,6 +383,8 @@ public class CodegenOperation {
result = 31 * result + (headerParams != null ? headerParams.hashCode() : 0); result = 31 * result + (headerParams != null ? headerParams.hashCode() : 0);
result = 31 * result + (formParams != null ? formParams.hashCode() : 0); result = 31 * result + (formParams != null ? formParams.hashCode() : 0);
result = 31 * result + (cookieParams != null ? cookieParams.hashCode() : 0); result = 31 * result + (cookieParams != null ? cookieParams.hashCode() : 0);
result = 31 * result + (requiredParams!= null ? requiredParams.hashCode() : 0);
result = 31 * result + (optionalParams != null ? optionalParams.hashCode() : 0);
result = 31 * result + (authMethods != null ? authMethods.hashCode() : 0); result = 31 * result + (authMethods != null ? authMethods.hashCode() : 0);
result = 31 * result + (tags != null ? tags.hashCode() : 0); result = 31 * result + (tags != null ? tags.hashCode() : 0);
result = 31 * result + (responses != null ? responses.hashCode() : 0); result = 31 * result + (responses != null ? responses.hashCode() : 0);

View File

@ -2135,6 +2135,7 @@ public class DefaultCodegen implements CodegenConfig {
List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>(); List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> formParams = new ArrayList<CodegenParameter>(); List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>(); List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
List<CodegenParameter> optionalParams = new ArrayList<CodegenParameter>();
CodegenParameter bodyParam = null; CodegenParameter bodyParam = null;
RequestBody requestBody = operation.getRequestBody(); RequestBody requestBody = operation.getRequestBody();
@ -2202,9 +2203,9 @@ public class DefaultCodegen implements CodegenConfig {
for (CodegenParameter cp : bodyParams) { for (CodegenParameter cp : bodyParams) {
allParams.add(cp.copy()); allParams.add(cp.copy());
} }
} }
// ensure unique parameter name
for (CodegenParameter cp : allParams) { for (CodegenParameter cp : allParams) {
if (ensureUniqueParams) { if (ensureUniqueParams) {
if (isParameterNameUnique(cp, allParams)) { if (isParameterNameUnique(cp, allParams)) {
@ -2213,9 +2214,14 @@ public class DefaultCodegen implements CodegenConfig {
cp.paramName = generateNextName(cp.paramName); cp.paramName = generateNextName(cp.paramName);
} }
} }
}
// create optional, required parameters
for (CodegenParameter cp : allParams) {
if (cp.required) { //required parameters if (cp.required) { //required parameters
requiredParams.add(cp.copy()); requiredParams.add(cp.copy());
} else { // optional parameters } else { // optional parameters
optionalParams.add(cp.copy());
op.hasOptionalParams = true; op.hasOptionalParams = true;
} }
} }
@ -2250,6 +2256,7 @@ public class DefaultCodegen implements CodegenConfig {
op.cookieParams = addHasMore(cookieParams); op.cookieParams = addHasMore(cookieParams);
op.formParams = addHasMore(formParams); op.formParams = addHasMore(formParams);
op.requiredParams = addHasMore(requiredParams); op.requiredParams = addHasMore(requiredParams);
op.optionalParams = addHasMore(optionalParams);
op.externalDocs = operation.getExternalDocs(); op.externalDocs = operation.getExternalDocs();
// legacy support // legacy support
op.nickname = op.operationId; op.nickname = op.operationId;

View File

@ -11,7 +11,7 @@ Method | HTTP request | Description
{{#operations}} {{#operations}}
{{#operation}} {{#operation}}
# **{{operationId}}** # **{{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}} > {{#returnType}}{{returnType}} {{/returnType}}{{operationId}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}
{{{summary}}}{{#notes}} {{{summary}}}{{#notes}}
@ -36,17 +36,23 @@ require '{{{gemName}}}'
{{/authMethods}}end {{/authMethods}}end
{{/hasAuthMethods}} {{/hasAuthMethods}}
api_instance = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}} api_instance = {{{moduleName}}}::{{{classname}}}.new
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}} {{#requiredParams}}
{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}} {{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}} {{/requiredParams}}
opts = { {{#allParams}}{{^required}} {{#optionalParams}}
{{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}} {{#-first}}
}{{/hasOptionalParams}}{{/hasParams}} opts = {
{{/-first}}
{{{paramName}}}: {{{example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
{{#-last}}
}
{{/-last}}
{{/optionalParams}}
begin begin
{{#summary}} #{{{.}}} {{#summary}} #{{{.}}}
{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}} {{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}}
p result{{/returnType}} p result{{/returnType}}
rescue {{{moduleName}}}::ApiError => e rescue {{{moduleName}}}::ApiError => e
puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}" puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}"

View File

@ -20,10 +20,8 @@ To test special tags
require 'petstore' require 'petstore'
api_instance = Petstore::AnotherFakeApi.new api_instance = Petstore::AnotherFakeApi.new
client = Petstore::Client.new # Client | client model client = Petstore::Client.new # Client | client model
begin begin
#To test special tags #To test special tags
result = api_instance.test_special_tags(client) result = api_instance.test_special_tags(client)

View File

@ -17,7 +17,7 @@ Method | HTTP request | Description
# **fake_outer_boolean_serialize** # **fake_outer_boolean_serialize**
> OuterBoolean fake_outer_boolean_serialize() > OuterBoolean fake_outer_boolean_serialize(opts)
@ -29,10 +29,12 @@ Test serialization of outer boolean types
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
opts = {
UNKNOWN_PARAM_NAME: Petstore::null.new # | Input boolean as post body
}
begin begin
result = api_instance.fake_outer_boolean_serialize() result = api_instance.fake_outer_boolean_serialize(opts)
p result p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->fake_outer_boolean_serialize: #{e}" puts "Exception when calling FakeApi->fake_outer_boolean_serialize: #{e}"
@ -61,7 +63,7 @@ No authorization required
# **fake_outer_composite_serialize** # **fake_outer_composite_serialize**
> OuterComposite fake_outer_composite_serialize() > OuterComposite fake_outer_composite_serialize(opts)
@ -73,10 +75,12 @@ Test serialization of object with outer number type
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
opts = {
outer_composite: Petstore::OuterComposite.new # OuterComposite | Input composite as post body
}
begin begin
result = api_instance.fake_outer_composite_serialize() result = api_instance.fake_outer_composite_serialize(opts)
p result p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->fake_outer_composite_serialize: #{e}" puts "Exception when calling FakeApi->fake_outer_composite_serialize: #{e}"
@ -105,7 +109,7 @@ No authorization required
# **fake_outer_number_serialize** # **fake_outer_number_serialize**
> OuterNumber fake_outer_number_serialize() > OuterNumber fake_outer_number_serialize(opts)
@ -117,10 +121,12 @@ Test serialization of outer number types
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
opts = {
UNKNOWN_PARAM_NAME: Petstore::null.new # | Input number as post body
}
begin begin
result = api_instance.fake_outer_number_serialize() result = api_instance.fake_outer_number_serialize(opts)
p result p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->fake_outer_number_serialize: #{e}" puts "Exception when calling FakeApi->fake_outer_number_serialize: #{e}"
@ -149,7 +155,7 @@ No authorization required
# **fake_outer_string_serialize** # **fake_outer_string_serialize**
> OuterString fake_outer_string_serialize() > OuterString fake_outer_string_serialize(opts)
@ -161,10 +167,12 @@ Test serialization of outer string types
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
opts = {
UNKNOWN_PARAM_NAME: Petstore::null.new # | Input string as post body
}
begin begin
result = api_instance.fake_outer_string_serialize() result = api_instance.fake_outer_string_serialize(opts)
p result p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->fake_outer_string_serialize: #{e}" puts "Exception when calling FakeApi->fake_outer_string_serialize: #{e}"
@ -203,12 +211,9 @@ No authorization required
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
query = 'query_example' # String | query = 'query_example' # String |
user = Petstore::User.new # User | user = Petstore::User.new # User |
begin begin
api_instance.test_body_with_query_params(query, user) api_instance.test_body_with_query_params(query, user)
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
@ -251,10 +256,8 @@ To test \"client\" model
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
client = Petstore::Client.new # Client | client model client = Petstore::Client.new # Client | client model
begin begin
#To test \"client\" model #To test \"client\" model
result = api_instance.test_client_model(client) result = api_instance.test_client_model(client)
@ -304,10 +307,8 @@ Petstore.configure do |config|
end end
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
UNKNOWN_PARAM_NAME = Petstore::null.new # | UNKNOWN_PARAM_NAME = Petstore::null.new # |
begin begin
#Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 #Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
api_instance.test_endpoint_parameters(UNKNOWN_PARAM_NAME) api_instance.test_endpoint_parameters(UNKNOWN_PARAM_NAME)
@ -338,7 +339,7 @@ nil (empty response body)
# **test_enum_parameters** # **test_enum_parameters**
> test_enum_parameters() > test_enum_parameters(opts)
To test enum parameters To test enum parameters
@ -350,11 +351,19 @@ To test enum parameters
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
opts = {
enum_header_string_array: ['enum_header_string_array_example'], # Array<String> | Header parameter enum test (string array)
enum_header_string: 'enum_header_string_example', # String | Header parameter enum test (string)
enum_query_string_array: ['enum_query_string_array_example'], # Array<String> | Query parameter enum test (string array)
enum_query_string: 'enum_query_string_example', # String | Query parameter enum test (string)
enum_query_integer: 56, # Integer | Query parameter enum test (double)
enum_query_double: 1.2, # Float | Query parameter enum test (double)
UNKNOWN_PARAM_NAME: Petstore::null.new # |
}
begin begin
#To test enum parameters #To test enum parameters
api_instance.test_enum_parameters() api_instance.test_enum_parameters(opts)
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling FakeApi->test_enum_parameters: #{e}" puts "Exception when calling FakeApi->test_enum_parameters: #{e}"
end end
@ -398,10 +407,8 @@ test inline additionalProperties
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
UNKNOWN_PARAM_NAME = Petstore::null.new # | request body UNKNOWN_PARAM_NAME = Petstore::null.new # | request body
begin begin
#test inline additionalProperties #test inline additionalProperties
api_instance.test_inline_additional_properties(UNKNOWN_PARAM_NAME) api_instance.test_inline_additional_properties(UNKNOWN_PARAM_NAME)
@ -442,10 +449,8 @@ test json serialization of form data
require 'petstore' require 'petstore'
api_instance = Petstore::FakeApi.new api_instance = Petstore::FakeApi.new
UNKNOWN_PARAM_NAME = Petstore::null.new # | UNKNOWN_PARAM_NAME = Petstore::null.new # |
begin begin
#test json serialization of form data #test json serialization of form data
api_instance.test_json_form_data(UNKNOWN_PARAM_NAME) api_instance.test_json_form_data(UNKNOWN_PARAM_NAME)

View File

@ -27,10 +27,8 @@ Petstore.configure do |config|
end end
api_instance = Petstore::FakeClassnameTags123Api.new api_instance = Petstore::FakeClassnameTags123Api.new
client = Petstore::Client.new # Client | client model client = Petstore::Client.new # Client | client model
begin begin
#To test class name in snake case #To test class name in snake case
result = api_instance.test_classname(client) result = api_instance.test_classname(client)

View File

@ -30,10 +30,8 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
begin begin
#Add a new pet to the store #Add a new pet to the store
api_instance.add_pet(pet) api_instance.add_pet(pet)
@ -64,7 +62,7 @@ nil (empty response body)
# **delete_pet** # **delete_pet**
> delete_pet(pet_id) > delete_pet(pet_id, opts)
Deletes a pet Deletes a pet
@ -79,13 +77,14 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | Pet id to delete pet_id = 789 # Integer | Pet id to delete
opts = {
api_key: 'api_key_example' # String |
}
begin begin
#Deletes a pet #Deletes a pet
api_instance.delete_pet(pet_id) api_instance.delete_pet(pet_id, opts)
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling PetApi->delete_pet: #{e}" puts "Exception when calling PetApi->delete_pet: #{e}"
end end
@ -131,10 +130,8 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
status = ['status_example'] # Array<String> | Status values that need to be considered for filter status = ['status_example'] # Array<String> | Status values that need to be considered for filter
begin begin
#Finds Pets by status #Finds Pets by status
result = api_instance.find_pets_by_status(status) result = api_instance.find_pets_by_status(status)
@ -183,10 +180,8 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
tags = ['tags_example'] # Array<String> | Tags to filter by tags = ['tags_example'] # Array<String> | Tags to filter by
begin begin
#Finds Pets by tags #Finds Pets by tags
result = api_instance.find_pets_by_tags(tags) result = api_instance.find_pets_by_tags(tags)
@ -237,10 +232,8 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | ID of pet to return pet_id = 789 # Integer | ID of pet to return
begin begin
#Find pet by ID #Find pet by ID
result = api_instance.get_pet_by_id(pet_id) result = api_instance.get_pet_by_id(pet_id)
@ -287,10 +280,8 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store pet = Petstore::Pet.new # Pet | Pet object that needs to be added to the store
begin begin
#Update an existing pet #Update an existing pet
api_instance.update_pet(pet) api_instance.update_pet(pet)
@ -321,7 +312,7 @@ nil (empty response body)
# **update_pet_with_form** # **update_pet_with_form**
> update_pet_with_form(pet_id) > update_pet_with_form(pet_id, opts)
Updates a pet in the store with form data Updates a pet in the store with form data
@ -336,13 +327,15 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | ID of pet that needs to be updated pet_id = 789 # Integer | 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 begin
#Updates a pet in the store with form data #Updates a pet in the store with form data
api_instance.update_pet_with_form(pet_id) api_instance.update_pet_with_form(pet_id, opts)
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling PetApi->update_pet_with_form: #{e}" puts "Exception when calling PetApi->update_pet_with_form: #{e}"
end end
@ -372,7 +365,7 @@ nil (empty response body)
# **upload_file** # **upload_file**
> ApiResponse upload_file(pet_id) > ApiResponse upload_file(pet_id, opts)
uploads an image uploads an image
@ -387,13 +380,15 @@ Petstore.configure do |config|
end end
api_instance = Petstore::PetApi.new api_instance = Petstore::PetApi.new
pet_id = 789 # Integer | ID of pet to update pet_id = 789 # Integer | ID of pet to update
opts = {
additional_metadata: 'additional_metadata_example', # String | Additional data to pass to server
file: File.new('/path/to/file') # File | file to upload
}
begin begin
#uploads an image #uploads an image
result = api_instance.upload_file(pet_id) result = api_instance.upload_file(pet_id, opts)
p result p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling PetApi->upload_file: #{e}" puts "Exception when calling PetApi->upload_file: #{e}"

View File

@ -23,10 +23,8 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
require 'petstore' require 'petstore'
api_instance = Petstore::StoreApi.new api_instance = Petstore::StoreApi.new
order_id = 'order_id_example' # String | ID of the order that needs to be deleted order_id = 'order_id_example' # String | ID of the order that needs to be deleted
begin begin
#Delete purchase order by ID #Delete purchase order by ID
api_instance.delete_order(order_id) api_instance.delete_order(order_id)
@ -117,10 +115,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
require 'petstore' require 'petstore'
api_instance = Petstore::StoreApi.new api_instance = Petstore::StoreApi.new
order_id = 789 # Integer | ID of pet that needs to be fetched order_id = 789 # Integer | ID of pet that needs to be fetched
begin begin
#Find purchase order by ID #Find purchase order by ID
result = api_instance.get_order_by_id(order_id) result = api_instance.get_order_by_id(order_id)
@ -162,10 +158,8 @@ Place an order for a pet
require 'petstore' require 'petstore'
api_instance = Petstore::StoreApi.new api_instance = Petstore::StoreApi.new
order = Petstore::Order.new # Order | order placed for purchasing the pet order = Petstore::Order.new # Order | order placed for purchasing the pet
begin begin
#Place an order for a pet #Place an order for a pet
result = api_instance.place_order(order) result = api_instance.place_order(order)

View File

@ -27,10 +27,8 @@ This can only be done by the logged in user.
require 'petstore' require 'petstore'
api_instance = Petstore::UserApi.new api_instance = Petstore::UserApi.new
user = Petstore::User.new # User | Created user object user = Petstore::User.new # User | Created user object
begin begin
#Create user #Create user
api_instance.create_user(user) api_instance.create_user(user)
@ -71,10 +69,8 @@ Creates list of users with given input array
require 'petstore' require 'petstore'
api_instance = Petstore::UserApi.new api_instance = Petstore::UserApi.new
user = [Petstore::User.new] # Array<User> | List of user object user = [Petstore::User.new] # Array<User> | List of user object
begin begin
#Creates list of users with given input array #Creates list of users with given input array
api_instance.create_users_with_array_input(user) api_instance.create_users_with_array_input(user)
@ -115,10 +111,8 @@ Creates list of users with given input array
require 'petstore' require 'petstore'
api_instance = Petstore::UserApi.new api_instance = Petstore::UserApi.new
user = [Petstore::User.new] # Array<User> | List of user object user = [Petstore::User.new] # Array<User> | List of user object
begin begin
#Creates list of users with given input array #Creates list of users with given input array
api_instance.create_users_with_list_input(user) api_instance.create_users_with_list_input(user)
@ -161,10 +155,8 @@ This can only be done by the logged in user.
require 'petstore' require 'petstore'
api_instance = Petstore::UserApi.new api_instance = Petstore::UserApi.new
username = 'username_example' # String | The name that needs to be deleted username = 'username_example' # String | The name that needs to be deleted
begin begin
#Delete user #Delete user
api_instance.delete_user(username) api_instance.delete_user(username)
@ -205,10 +197,8 @@ Get user by user name
require 'petstore' require 'petstore'
api_instance = Petstore::UserApi.new api_instance = Petstore::UserApi.new
username = 'username_example' # String | The name that needs to be fetched. Use user1 for testing. username = 'username_example' # String | The name that needs to be fetched. Use user1 for testing.
begin begin
#Get user by user name #Get user by user name
result = api_instance.get_user_by_name(username) result = api_instance.get_user_by_name(username)
@ -250,12 +240,9 @@ Logs user into the system
require 'petstore' require 'petstore'
api_instance = Petstore::UserApi.new api_instance = Petstore::UserApi.new
username = 'username_example' # String | The user name for login username = 'username_example' # String | The user name for login
password = 'password_example' # String | The password for login in clear text password = 'password_example' # String | The password for login in clear text
begin begin
#Logs user into the system #Logs user into the system
result = api_instance.login_user(username, password) result = api_instance.login_user(username, password)
@ -338,12 +325,9 @@ This can only be done by the logged in user.
require 'petstore' require 'petstore'
api_instance = Petstore::UserApi.new api_instance = Petstore::UserApi.new
username = 'username_example' # String | name that need to be deleted username = 'username_example' # String | name that need to be deleted
user = Petstore::User.new # User | Updated user object user = Petstore::User.new # User | Updated user object
begin begin
#Updated user #Updated user
api_instance.update_user(username, user) api_instance.update_user(username, user)