From 8f70230906e8dc77873f70f0822d96b3347cd7a4 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 13 Apr 2016 22:20:38 +0800 Subject: [PATCH] update ruby test case --- bin/ruby-petstore.sh | 2 +- samples/client/petstore/ruby/README.md | 46 +-- .../client/petstore/ruby/docs/FormatTest.md | 3 +- samples/client/petstore/ruby/docs/Order.md | 2 +- samples/client/petstore/ruby/docs/PetApi.md | 253 +++------------- samples/client/petstore/ruby/docs/StoreApi.md | 161 +--------- samples/client/petstore/ruby/docs/UserApi.md | 84 +++--- samples/client/petstore/ruby/lib/petstore.rb | 4 +- .../petstore/ruby/lib/petstore/api/pet_api.rb | 276 ++++-------------- .../ruby/lib/petstore/api/store_api.rb | 144 +-------- .../ruby/lib/petstore/api/user_api.rb | 104 ++++--- .../petstore/ruby/lib/petstore/api_client.rb | 2 +- .../petstore/ruby/lib/petstore/api_error.rb | 2 +- .../ruby/lib/petstore/configuration.rb | 35 --- .../ruby/lib/petstore/models/animal.rb | 2 +- .../petstore/ruby/lib/petstore/models/cat.rb | 2 +- .../ruby/lib/petstore/models/category.rb | 2 +- .../petstore/ruby/lib/petstore/models/dog.rb | 2 +- .../ruby/lib/petstore/models/format_test.rb | 18 +- .../lib/petstore/models/model_200_response.rb | 2 +- .../ruby/lib/petstore/models/model_return.rb | 2 +- .../petstore/ruby/lib/petstore/models/name.rb | 2 +- .../ruby/lib/petstore/models/order.rb | 4 +- .../petstore/ruby/lib/petstore/models/pet.rb | 2 +- .../lib/petstore/models/special_model_name.rb | 2 +- .../petstore/ruby/lib/petstore/models/tag.rb | 2 +- .../petstore/ruby/lib/petstore/models/user.rb | 2 +- .../petstore/ruby/lib/petstore/version.rb | 2 +- .../petstore/ruby/spec/api/pet_api_spec.rb | 66 +---- .../petstore/ruby/spec/api/store_api_spec.rb | 35 +-- .../petstore/ruby/spec/api/user_api_spec.rb | 14 +- .../petstore/ruby/spec/models/animal_spec.rb | 2 +- .../petstore/ruby/spec/models/cat_spec.rb | 2 +- .../ruby/spec/models/category_spec.rb | 2 +- .../petstore/ruby/spec/models/dog_spec.rb | 2 +- .../ruby/spec/models/format_test_spec.rb | 12 +- .../spec/models/inline_response_200_spec.rb | 2 +- .../spec/models/model_200_response_spec.rb | 2 +- .../ruby/spec/models/model_return_spec.rb | 2 +- .../petstore/ruby/spec/models/name_spec.rb | 2 +- .../petstore/ruby/spec/models/order_spec.rb | 2 +- .../petstore/ruby/spec/models/pet_spec.rb | 2 +- .../spec/models/special_model_name_spec.rb | 2 +- .../petstore/ruby/spec/models/tag_spec.rb | 2 +- .../petstore/ruby/spec/models/user_spec.rb | 2 +- samples/client/petstore/ruby/spec/pet_spec.rb | 23 +- .../client/petstore/ruby/spec/spec_helper.rb | 4 +- .../client/petstore/ruby/spec/store_spec.rb | 4 +- 48 files changed, 327 insertions(+), 1021 deletions(-) diff --git a/bin/ruby-petstore.sh b/bin/ruby-petstore.sh index 05cf1ee995e..f1c87e32028 100755 --- a/bin/ruby-petstore.sh +++ b/bin/ruby-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby" java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index a3a02dd1169..90622ef668a 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -2,13 +2,13 @@ Petstore - the Ruby gem for the Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T17:03:41.311+08:00 +- Build date: 2016-04-13T17:44:36.129+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -62,13 +62,12 @@ end api_instance = Petstore::PetApi.new -opts = { - body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store -} +body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store + begin #Add a new pet to the store - api_instance.add_pet(opts) + api_instance.add_pet(body) rescue Petstore::ApiError => e puts "Exception when calling PetApi->add_pet: #{e}" end @@ -82,20 +81,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -*Petstore::PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *Petstore::PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *Petstore::PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -*Petstore::PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*Petstore::PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *Petstore::PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *Petstore::PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *Petstore::PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image *Petstore::StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*Petstore::StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status *Petstore::StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -*Petstore::StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *Petstore::StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *Petstore::StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet *Petstore::UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user @@ -111,11 +105,11 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Petstore::Animal](docs/Animal.md) + - [Petstore::ApiResponse](docs/ApiResponse.md) - [Petstore::Cat](docs/Cat.md) - [Petstore::Category](docs/Category.md) - [Petstore::Dog](docs/Dog.md) - [Petstore::FormatTest](docs/FormatTest.md) - - [Petstore::InlineResponse200](docs/InlineResponse200.md) - [Petstore::Model200Response](docs/Model200Response.md) - [Petstore::ModelReturn](docs/ModelReturn.md) - [Petstore::Name](docs/Name.md) @@ -129,40 +123,12 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - ### api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -### test_http_basic - -- **Type**: HTTP basic authentication - -### test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -### test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -### test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - ### petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/ruby/docs/FormatTest.md b/samples/client/petstore/ruby/docs/FormatTest.md index 02c44df9b66..2b64ed317b2 100644 --- a/samples/client/petstore/ruby/docs/FormatTest.md +++ b/samples/client/petstore/ruby/docs/FormatTest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **byte** | **String** | | [optional] **binary** | **String** | | [optional] **date** | **Date** | | [optional] -**date_time** | **String** | | [optional] +**date_time** | **DateTime** | | [optional] +**password** | **String** | | [optional] diff --git a/samples/client/petstore/ruby/docs/Order.md b/samples/client/petstore/ruby/docs/Order.md index ed1b69874ee..52a832c5106 100644 --- a/samples/client/petstore/ruby/docs/Order.md +++ b/samples/client/petstore/ruby/docs/Order.md @@ -8,6 +8,6 @@ Name | Type | Description | Notes **quantity** | **Integer** | | [optional] **ship_date** | **DateTime** | | [optional] **status** | **String** | Order Status | [optional] -**complete** | **BOOLEAN** | | [optional] +**complete** | **BOOLEAN** | | [optional] [default to false] diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index f817316359b..4fcf59da24c 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -5,20 +5,17 @@ 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_pet(body) Add a new pet to the store @@ -36,13 +33,12 @@ end api_instance = Petstore::PetApi.new -opts = { - body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store -} +body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store + begin #Add a new pet to the store - api_instance.add_pet(opts) + api_instance.add_pet(body) rescue Petstore::ApiError => e puts "Exception when calling PetApi->add_pet: #{e}" end @@ -52,7 +48,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -65,59 +61,7 @@ nil (empty response body) ### 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 -# load the gem -require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = Petstore::PetApi.new - -opts = { - body: "B" # String | Pet object in the form of byte array -} - -begin - #Fake endpoint to test byte array in body parameter for adding a new pet to the store - api_instance.add_pet_using_byte_array(opts) -rescue Petstore::ApiError => e - puts "Exception when calling PetApi->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 + - **Accept**: application/xml, application/json @@ -172,12 +116,12 @@ nil (empty response body) ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **find_pets_by_status** -> Array<Pet> find_pets_by_status(opts) +> Array<Pet> find_pets_by_status(status) Finds Pets by status @@ -195,13 +139,12 @@ end api_instance = Petstore::PetApi.new -opts = { - status: ["available"] # Array | Status values that need to be considered for query -} +status = ["status_example"] # Array | Status values that need to be considered for filter + begin #Finds Pets by status - result = api_instance.find_pets_by_status(opts) + result = api_instance.find_pets_by_status(status) p result rescue Petstore::ApiError => e puts "Exception when calling PetApi->find_pets_by_status: #{e}" @@ -212,7 +155,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**Array<String>**](String.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**Array<String>**](String.md)| Status values that need to be considered for filter | ### Return type @@ -225,16 +168,16 @@ Name | Type | Description | Notes ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **find_pets_by_tags** -> Array<Pet> find_pets_by_tags(opts) +> Array<Pet> find_pets_by_tags(tags) Finds Pets by tags -Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```ruby @@ -248,13 +191,12 @@ end api_instance = Petstore::PetApi.new -opts = { - tags: ["tags_example"] # Array | Tags to filter by -} +tags = ["tags_example"] # Array | Tags to filter by + begin #Finds Pets by tags - result = api_instance.find_pets_by_tags(opts) + result = api_instance.find_pets_by_tags(tags) p result rescue Petstore::ApiError => e puts "Exception when calling PetApi->find_pets_by_tags: #{e}" @@ -265,7 +207,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**Array<String>**](String.md)| Tags to filter by | [optional] + **tags** | [**Array<String>**](String.md)| Tags to filter by | ### Return type @@ -278,7 +220,7 @@ Name | Type | Description | Notes ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -287,7 +229,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a single pet ### Example ```ruby @@ -299,14 +241,11 @@ Petstore.configure do |config| config.api_key['api_key'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) #config.api_key_prefix['api_key'] = 'BEARER' - - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Petstore::PetApi.new -pet_id = 789 # Integer | ID of pet that needs to be fetched +pet_id = 789 # Integer | ID of pet to return begin @@ -322,7 +261,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **Integer**| ID of pet that needs to be fetched | + **pet_id** | **Integer**| ID of pet to return | ### Return type @@ -330,131 +269,17 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[api_key](../README.md#api_key) ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - - -# **get_pet_by_id_in_object** -> InlineResponse200 get_pet_by_id_in_object(pet_id) - -Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```ruby -# load the gem -require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure API key authorization: api_key - config.api_key['api_key'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['api_key'] = 'BEARER' - - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = Petstore::PetApi.new - -pet_id = 789 # Integer | ID of pet that needs to be fetched - - -begin - #Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - result = api_instance.get_pet_by_id_in_object(pet_id) - p result -rescue Petstore::ApiError => e - puts "Exception when calling PetApi->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 - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - - -# **pet_pet_idtesting_byte_arraytrue_get** -> String pet_pet_idtesting_byte_arraytrue_get(pet_id) - -Fake endpoint to test byte array return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```ruby -# load the gem -require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure API key authorization: api_key - config.api_key['api_key'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['api_key'] = 'BEARER' - - # Configure OAuth2 access token for authorization: petstore_auth - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = Petstore::PetApi.new - -pet_id = 789 # Integer | ID of pet that needs to be fetched - - -begin - #Fake endpoint to test byte array return by 'Find pet by ID' - result = api_instance.pet_pet_idtesting_byte_arraytrue_get(pet_id) - p result -rescue Petstore::ApiError => e - puts "Exception when calling PetApi->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 - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **update_pet** -> update_pet(opts) +> update_pet(body) Update an existing pet @@ -472,13 +297,12 @@ end api_instance = Petstore::PetApi.new -opts = { - body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store -} +body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store + begin #Update an existing pet - api_instance.update_pet(opts) + api_instance.update_pet(body) rescue Petstore::ApiError => e puts "Exception when calling PetApi->update_pet: #{e}" end @@ -488,7 +312,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -501,7 +325,7 @@ nil (empty response body) ### HTTP reuqest headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -524,7 +348,7 @@ end api_instance = Petstore::PetApi.new -pet_id = "pet_id_example" # String | 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 @@ -543,7 +367,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **String**| ID of pet that needs to be updated | + **pet_id** | **Integer**| ID of pet that needs to be updated | **name** | **String**| Updated name of the pet | [optional] **status** | **String**| Updated status of the pet | [optional] @@ -558,12 +382,12 @@ nil (empty response body) ### HTTP reuqest headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **upload_file** -> upload_file(pet_id, opts) +> ApiResponse upload_file(pet_id, opts) uploads an image @@ -590,7 +414,8 @@ opts = { begin #uploads an image - api_instance.upload_file(pet_id, opts) + result = api_instance.upload_file(pet_id, opts) + p result rescue Petstore::ApiError => e puts "Exception when calling PetApi->upload_file: #{e}" end @@ -606,7 +431,7 @@ Name | Type | Description | Notes ### Return type -nil (empty response body) +[**ApiResponse**](ApiResponse.md) ### Authorization @@ -615,7 +440,7 @@ nil (empty response body) ### HTTP reuqest headers - **Content-Type**: multipart/form-data - - **Accept**: application/json, application/xml + - **Accept**: application/json diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 1ed9970698c..273f7f2ac2c 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -5,9 +5,7 @@ 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 @@ -54,67 +52,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - - -# **find_orders_by_status** -> Array<Order> find_orders_by_status(opts) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```ruby -# load the gem -require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure API key authorization: test_api_client_id - config.api_key['x-test_api_client_id'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['x-test_api_client_id'] = 'BEARER' - - # Configure API key authorization: test_api_client_secret - config.api_key['x-test_api_client_secret'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['x-test_api_client_secret'] = 'BEARER' -end - -api_instance = Petstore::StoreApi.new - -opts = { - status: "placed" # String | Status value that needs to be considered for query -} - -begin - #Finds orders by status - result = api_instance.find_orders_by_status(opts) - p result -rescue Petstore::ApiError => e - puts "Exception when calling StoreApi->find_orders_by_status: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**Array<Order>**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -162,55 +100,7 @@ This endpoint does not need any parameter. ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - - - -# **get_inventory_in_object** -> Object get_inventory_in_object - -Fake endpoint to test arbitrary object return by 'Get inventory' - -Returns an arbitrary object which is actually a map of status codes to quantities - -### Example -```ruby -# load the gem -require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure API key authorization: api_key - config.api_key['api_key'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['api_key'] = 'BEARER' -end - -api_instance = Petstore::StoreApi.new - -begin - #Fake endpoint to test arbitrary object return by 'Get inventory' - result = api_instance.get_inventory_in_object - p result -rescue Petstore::ApiError => e - puts "Exception when calling StoreApi->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 + - **Accept**: application/json @@ -225,22 +115,10 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```ruby # load the gem require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure API key authorization: test_api_key_header - config.api_key['test_api_key_header'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['test_api_key_header'] = 'BEARER' - - # Configure API key authorization: test_api_key_query - config.api_key['test_api_key_query'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['test_api_key_query'] = 'BEARER' -end api_instance = Petstore::StoreApi.new -order_id = "order_id_example" # String | ID of pet that needs to be fetched +order_id = 789 # Integer | ID of pet that needs to be fetched begin @@ -256,7 +134,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **String**| ID of pet that needs to be fetched | + **order_id** | **Integer**| ID of pet that needs to be fetched | ### Return type @@ -264,17 +142,17 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **place_order** -> Order place_order(opts) +> Order place_order(body) Place an order for a pet @@ -284,28 +162,15 @@ Place an order for a pet ```ruby # load the gem require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure API key authorization: test_api_client_id - config.api_key['x-test_api_client_id'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['x-test_api_client_id'] = 'BEARER' - - # Configure API key authorization: test_api_client_secret - config.api_key['x-test_api_client_secret'] = 'YOUR API KEY' - # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) - #config.api_key_prefix['x-test_api_client_secret'] = 'BEARER' -end api_instance = Petstore::StoreApi.new -opts = { - body: Petstore::Order.new # Order | order placed for purchasing the pet -} +body = Petstore::Order.new # Order | order placed for purchasing the pet + begin #Place an order for a pet - result = api_instance.place_order(opts) + result = api_instance.place_order(body) p result rescue Petstore::ApiError => e puts "Exception when calling StoreApi->place_order: #{e}" @@ -316,7 +181,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -324,12 +189,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 7b1e241f835..1c1ae32ac50 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -15,7 +15,7 @@ Method | HTTP request | Description # **create_user** -> create_user(opts) +> create_user(body) Create user @@ -28,13 +28,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - body: Petstore::User.new # User | Created user object -} +body = Petstore::User.new # User | Created user object + begin #Create user - api_instance.create_user(opts) + api_instance.create_user(body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_user: #{e}" end @@ -44,7 +43,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -57,12 +56,12 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **create_users_with_array_input** -> create_users_with_array_input(opts) +> create_users_with_array_input(body) Creates list of users with given input array @@ -75,13 +74,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - body: [Petstore::User.new] # Array | List of user object -} +body = [Petstore::User.new] # Array | List of user object + begin #Creates list of users with given input array - api_instance.create_users_with_array_input(opts) + api_instance.create_users_with_array_input(body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_users_with_array_input: #{e}" end @@ -91,7 +89,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](User.md)| List of user object | [optional] + **body** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -104,12 +102,12 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **create_users_with_list_input** -> create_users_with_list_input(opts) +> create_users_with_list_input(body) Creates list of users with given input array @@ -122,13 +120,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - body: [Petstore::User.new] # Array | List of user object -} +body = [Petstore::User.new] # Array | List of user object + begin #Creates list of users with given input array - api_instance.create_users_with_list_input(opts) + api_instance.create_users_with_list_input(body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_users_with_list_input: #{e}" end @@ -138,7 +135,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](User.md)| List of user object | [optional] + **body** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -151,7 +148,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -166,12 +163,6 @@ This can only be done by the logged in user. ```ruby # load the gem require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure HTTP basic authorization: test_http_basic - config.username = 'YOUR USERNAME' - config.password = 'YOUR PASSWORD' -end api_instance = Petstore::UserApi.new @@ -198,12 +189,12 @@ nil (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -250,12 +241,12 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **login_user** -> String login_user(opts) +> String login_user(username, password) Logs user into the system @@ -268,14 +259,14 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - username: "username_example", # String | The user name for login - password: "password_example" # String | The password for login in clear text -} +username = "username_example" # String | The user name for login + +password = "password_example" # String | The password for login in clear text + begin #Logs user into the system - result = api_instance.login_user(opts) + result = api_instance.login_user(username, password) p result rescue Petstore::ApiError => e puts "Exception when calling UserApi->login_user: #{e}" @@ -286,8 +277,8 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [optional] - **password** | **String**| The password for login in clear text | [optional] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -300,7 +291,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -340,12 +331,12 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **update_user** -> update_user(username, opts) +> update_user(username, body) Updated user @@ -360,13 +351,12 @@ api_instance = Petstore::UserApi.new username = "username_example" # String | name that need to be deleted -opts = { - body: Petstore::User.new # User | Updated user object -} +body = Petstore::User.new # User | Updated user object + begin #Updated user - api_instance.update_user(username, opts) + api_instance.update_user(username, body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->update_user: #{e}" end @@ -377,7 +367,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -390,7 +380,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index 2232f05e8ba..5964a522d9f 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -22,11 +22,11 @@ require 'petstore/configuration' # Models require 'petstore/models/animal' +require 'petstore/models/api_response' require 'petstore/models/cat' require 'petstore/models/category' require 'petstore/models/dog' require 'petstore/models/format_test' -require 'petstore/models/inline_response_200' require 'petstore/models/model_200_response' require 'petstore/models/model_return' require 'petstore/models/name' diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 3bff1eda69a..4355642fc58 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -26,24 +26,27 @@ module Petstore # Add a new pet to the store # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] - def add_pet(opts = {}) - add_pet_with_http_info(opts) + def add_pet(body, opts = {}) + add_pet_with_http_info(body, opts) return nil end # Add a new pet to the store # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def add_pet_with_http_info(opts = {}) + def add_pet_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#add_pet ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling add_pet" if body.nil? + # resource path local_var_path = "/pet".sub('{format}','json') @@ -54,7 +57,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -65,7 +68,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = ['petstore_auth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -79,61 +82,6 @@ module Petstore return data, status_code, headers end - # Fake endpoint to test byte array in body parameter for adding a new pet to the store - # - # @param [Hash] opts the optional parameters - # @option opts [String] :body Pet object in the form of byte array - # @return [nil] - def add_pet_using_byte_array(opts = {}) - add_pet_using_byte_array_with_http_info(opts) - return nil - end - - # Fake endpoint to test byte array in body parameter for adding a new pet to the store - # - # @param [Hash] opts the optional parameters - # @option opts [String] :body Pet object in the form of byte array - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def add_pet_using_byte_array_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PetApi#add_pet_using_byte_array ..." - end - - # resource path - local_var_path = "/pet?testing_byte_array=true".sub('{format}','json') - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = ['application/json', 'application/xml'] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) - auth_names = ['petstore_auth'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#add_pet_using_byte_array\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Deletes a pet # # @param pet_id Pet id to delete @@ -169,7 +117,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -197,36 +145,39 @@ module Petstore # Finds Pets by status # Multiple status values can be provided with comma separated strings + # @param status Status values that need to be considered for filter # @param [Hash] opts the optional parameters - # @option opts [Array] :status Status values that need to be considered for query (default to available) # @return [Array] - def find_pets_by_status(opts = {}) - data, _status_code, _headers = find_pets_by_status_with_http_info(opts) + def find_pets_by_status(status, opts = {}) + data, _status_code, _headers = find_pets_by_status_with_http_info(status, opts) return data end # Finds Pets by status # Multiple status values can be provided with comma separated strings + # @param status Status values that need to be considered for filter # @param [Hash] opts the optional parameters - # @option opts [Array] :status Status values that need to be considered for query # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers - def find_pets_by_status_with_http_info(opts = {}) + def find_pets_by_status_with_http_info(status, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#find_pets_by_status ..." end + # verify the required parameter 'status' is set + fail "Missing the required parameter 'status' when calling find_pets_by_status" if status.nil? + # resource path local_var_path = "/pet/findByStatus".sub('{format}','json') # query parameters query_params = {} - query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if opts[:'status'] + query_params[:'status'] = @api_client.build_collection_param(status, :csv) # header parameters header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -253,37 +204,40 @@ module Petstore end # Finds Pets by tags - # Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + # @param tags Tags to filter by # @param [Hash] opts the optional parameters - # @option opts [Array] :tags Tags to filter by # @return [Array] - def find_pets_by_tags(opts = {}) - data, _status_code, _headers = find_pets_by_tags_with_http_info(opts) + def find_pets_by_tags(tags, opts = {}) + data, _status_code, _headers = find_pets_by_tags_with_http_info(tags, opts) return data end # Finds Pets by tags - # Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + # @param tags Tags to filter by # @param [Hash] opts the optional parameters - # @option opts [Array] :tags Tags to filter by # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers - def find_pets_by_tags_with_http_info(opts = {}) + def find_pets_by_tags_with_http_info(tags, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#find_pets_by_tags ..." end + # verify the required parameter 'tags' is set + fail "Missing the required parameter 'tags' when calling find_pets_by_tags" if tags.nil? + # resource path local_var_path = "/pet/findByTags".sub('{format}','json') # query parameters query_params = {} - query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if opts[:'tags'] + query_params[:'tags'] = @api_client.build_collection_param(tags, :csv) # header parameters header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -310,8 +264,8 @@ module Petstore end # Find pet by ID - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched + # Returns a single pet + # @param pet_id ID of pet to return # @param [Hash] opts the optional parameters # @return [Pet] def get_pet_by_id(pet_id, opts = {}) @@ -320,8 +274,8 @@ module Petstore end # Find pet by ID - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched + # Returns a single pet + # @param pet_id ID of pet to return # @param [Hash] opts the optional parameters # @return [Array<(Pet, Fixnum, Hash)>] Pet data, response status code and response headers def get_pet_by_id_with_http_info(pet_id, opts = {}) @@ -342,7 +296,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -354,7 +308,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['api_key', 'petstore_auth'] + auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -368,144 +322,29 @@ module Petstore return data, status_code, headers end - # Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [InlineResponse200] - def get_pet_by_id_in_object(pet_id, opts = {}) - data, _status_code, _headers = get_pet_by_id_in_object_with_http_info(pet_id, opts) - return data - end - - # Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers - def get_pet_by_id_in_object_with_http_info(pet_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PetApi#get_pet_by_id_in_object ..." - end - - # verify the required parameter 'pet_id' is set - fail "Missing the required parameter 'pet_id' when calling get_pet_by_id_in_object" if pet_id.nil? - - # resource path - local_var_path = "/pet/{petId}?response=inline_arbitrary_object".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['api_key', 'petstore_auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'InlineResponse200') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#get_pet_by_id_in_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - - # Fake endpoint to test byte array return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [String] - def pet_pet_idtesting_byte_arraytrue_get(pet_id, opts = {}) - data, _status_code, _headers = pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, opts) - return data - end - - # Fake endpoint to test byte array return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers - def pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PetApi#pet_pet_idtesting_byte_arraytrue_get ..." - end - - # verify the required parameter 'pet_id' is set - fail "Missing the required parameter 'pet_id' when calling pet_pet_idtesting_byte_arraytrue_get" if pet_id.nil? - - # resource path - local_var_path = "/pet/{petId}?testing_byte_array=true".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['api_key', 'petstore_auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'String') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#pet_pet_idtesting_byte_arraytrue_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Update an existing pet # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] - def update_pet(opts = {}) - update_pet_with_http_info(opts) + def update_pet(body, opts = {}) + update_pet_with_http_info(body, opts) return nil end # Update an existing pet # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def update_pet_with_http_info(opts = {}) + def update_pet_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#update_pet ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling update_pet" if body.nil? + # resource path local_var_path = "/pet".sub('{format}','json') @@ -516,7 +355,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -527,7 +366,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = ['petstore_auth'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, @@ -578,7 +417,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -611,10 +450,10 @@ module Petstore # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server # @option opts [File] :file file to upload - # @return [nil] + # @return [ApiResponse] def upload_file(pet_id, opts = {}) - upload_file_with_http_info(pet_id, opts) - return nil + data, _status_code, _headers = upload_file_with_http_info(pet_id, opts) + return data end # uploads an image @@ -623,7 +462,7 @@ module Petstore # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server # @option opts [File] :file file to upload - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers + # @return [Array<(ApiResponse, Fixnum, Hash)>] ApiResponse data, response status code and response headers def upload_file_with_http_info(pet_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#upload_file ..." @@ -642,7 +481,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -662,7 +501,8 @@ module Petstore :query_params => query_params, :form_params => form_params, :body => post_body, - :auth_names => auth_names) + :auth_names => auth_names, + :return_type => 'ApiResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index 548b5a355e0..5a3c8efeb82 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -57,7 +57,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -82,67 +82,6 @@ module Petstore return data, status_code, headers end - # Finds orders by status - # A single status value can be provided as a string - # @param [Hash] opts the optional parameters - # @option opts [String] :status Status value that needs to be considered for query (default to placed) - # @return [Array] - def find_orders_by_status(opts = {}) - data, _status_code, _headers = find_orders_by_status_with_http_info(opts) - return data - end - - # Finds orders by status - # A single status value can be provided as a string - # @param [Hash] opts the optional parameters - # @option opts [String] :status Status value that needs to be considered for query - # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers - def find_orders_by_status_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: StoreApi#find_orders_by_status ..." - end - - if opts[:'status'] && !['placed', 'approved', 'delivered'].include?(opts[:'status']) - fail 'invalid value for "status", must be one of placed, approved, delivered' - end - - # resource path - local_var_path = "/store/findByStatus".sub('{format}','json') - - # query parameters - query_params = {} - query_params[:'status'] = opts[:'status'] if opts[:'status'] - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['test_api_client_id', 'test_api_client_secret'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Array') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: StoreApi#find_orders_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Returns pet inventories by status # Returns a map of status codes to quantities # @param [Hash] opts the optional parameters @@ -171,7 +110,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -197,60 +136,6 @@ module Petstore return data, status_code, headers end - # Fake endpoint to test arbitrary object return by 'Get inventory' - # Returns an arbitrary object which is actually a map of status codes to quantities - # @param [Hash] opts the optional parameters - # @return [Object] - def get_inventory_in_object(opts = {}) - data, _status_code, _headers = get_inventory_in_object_with_http_info(opts) - return data - end - - # Fake endpoint to test arbitrary object return by 'Get inventory' - # Returns an arbitrary object which is actually a map of status codes to quantities - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_inventory_in_object_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: StoreApi#get_inventory_in_object ..." - end - - # resource path - local_var_path = "/store/inventory?response=arbitrary_object".sub('{format}','json') - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['api_key'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: StoreApi#get_inventory_in_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Find purchase order by ID # For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # @param order_id ID of pet that needs to be fetched @@ -284,7 +169,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -296,7 +181,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['test_api_key_header', 'test_api_key_query'] + auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -312,24 +197,27 @@ module Petstore # Place an order for a pet # + # @param body order placed for purchasing the pet # @param [Hash] opts the optional parameters - # @option opts [Order] :body order placed for purchasing the pet # @return [Order] - def place_order(opts = {}) - data, _status_code, _headers = place_order_with_http_info(opts) + def place_order(body, opts = {}) + data, _status_code, _headers = place_order_with_http_info(body, opts) return data end # Place an order for a pet # + # @param body order placed for purchasing the pet # @param [Hash] opts the optional parameters - # @option opts [Order] :body order placed for purchasing the pet # @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers - def place_order_with_http_info(opts = {}) + def place_order_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: StoreApi#place_order ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling place_order" if body.nil? + # resource path local_var_path = "/store/order".sub('{format}','json') @@ -340,7 +228,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -351,8 +239,8 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) - auth_names = ['test_api_client_id', 'test_api_client_secret'] + post_body = @api_client.object_to_http_body(body) + auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 0f9af5bb7f0..d5535aac583 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -26,24 +26,27 @@ module Petstore # Create user # This can only be done by the logged in user. + # @param body Created user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Created user object # @return [nil] - def create_user(opts = {}) - create_user_with_http_info(opts) + def create_user(body, opts = {}) + create_user_with_http_info(body, opts) return nil end # Create user # This can only be done by the logged in user. + # @param body Created user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Created user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_user_with_http_info(opts = {}) + def create_user_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#create_user ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling create_user" if body.nil? + # resource path local_var_path = "/user".sub('{format}','json') @@ -54,7 +57,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -65,7 +68,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -81,24 +84,27 @@ module Petstore # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] - def create_users_with_array_input(opts = {}) - create_users_with_array_input_with_http_info(opts) + def create_users_with_array_input(body, opts = {}) + create_users_with_array_input_with_http_info(body, opts) return nil end # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_users_with_array_input_with_http_info(opts = {}) + def create_users_with_array_input_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#create_users_with_array_input ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling create_users_with_array_input" if body.nil? + # resource path local_var_path = "/user/createWithArray".sub('{format}','json') @@ -109,7 +115,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -120,7 +126,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -136,24 +142,27 @@ module Petstore # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] - def create_users_with_list_input(opts = {}) - create_users_with_list_input_with_http_info(opts) + def create_users_with_list_input(body, opts = {}) + create_users_with_list_input_with_http_info(body, opts) return nil end # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_users_with_list_input_with_http_info(opts = {}) + def create_users_with_list_input_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#create_users_with_list_input ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling create_users_with_list_input" if body.nil? + # resource path local_var_path = "/user/createWithList".sub('{format}','json') @@ -164,7 +173,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -175,7 +184,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -222,7 +231,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -234,7 +243,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['test_http_basic'] + auth_names = [] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, @@ -280,7 +289,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -308,39 +317,45 @@ module Petstore # Logs user into the system # + # @param username The user name for login + # @param password The password for login in clear text # @param [Hash] opts the optional parameters - # @option opts [String] :username The user name for login - # @option opts [String] :password The password for login in clear text # @return [String] - def login_user(opts = {}) - data, _status_code, _headers = login_user_with_http_info(opts) + def login_user(username, password, opts = {}) + data, _status_code, _headers = login_user_with_http_info(username, password, opts) return data end # Logs user into the system # + # @param username The user name for login + # @param password The password for login in clear text # @param [Hash] opts the optional parameters - # @option opts [String] :username The user name for login - # @option opts [String] :password The password for login in clear text # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers - def login_user_with_http_info(opts = {}) + def login_user_with_http_info(username, password, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#login_user ..." end + # verify the required parameter 'username' is set + fail "Missing the required parameter 'username' when calling login_user" if username.nil? + + # verify the required parameter 'password' is set + fail "Missing the required parameter 'password' when calling login_user" if password.nil? + # resource path local_var_path = "/user/login".sub('{format}','json') # query parameters query_params = {} - query_params[:'username'] = opts[:'username'] if opts[:'username'] - query_params[:'password'] = opts[:'password'] if opts[:'password'] + query_params[:'username'] = username + query_params[:'password'] = password # header parameters header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -394,7 +409,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -422,21 +437,21 @@ module Petstore # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted + # @param body Updated user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Updated user object # @return [nil] - def update_user(username, opts = {}) - update_user_with_http_info(username, opts) + def update_user(username, body, opts = {}) + update_user_with_http_info(username, body, opts) return nil end # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted + # @param body Updated user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Updated user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def update_user_with_http_info(username, opts = {}) + def update_user_with_http_info(username, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#update_user ..." end @@ -444,6 +459,9 @@ module Petstore # verify the required parameter 'username' is set fail "Missing the required parameter 'username' when calling update_user" if username.nil? + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling update_user" if body.nil? + # resource path local_var_path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s) @@ -454,7 +472,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -465,7 +483,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 70111d07438..ed1c501d71a 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api_error.rb b/samples/client/petstore/ruby/lib/petstore/api_error.rb index b05ca2fdaf6..e4c233b2e98 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_error.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_error.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 5125ebe5960..05973753287 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -157,13 +157,6 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { - 'test_api_key_header' => - { - type: 'api_key', - in: 'header', - key: 'test_api_key_header', - value: api_key_with_prefix('test_api_key_header') - }, 'api_key' => { type: 'api_key', @@ -171,34 +164,6 @@ module Petstore key: 'api_key', value: api_key_with_prefix('api_key') }, - 'test_http_basic' => - { - type: 'basic', - in: 'header', - key: 'Authorization', - value: basic_auth_token - }, - 'test_api_client_secret' => - { - type: 'api_key', - in: 'header', - key: 'x-test_api_client_secret', - value: api_key_with_prefix('x-test_api_client_secret') - }, - 'test_api_client_id' => - { - type: 'api_key', - in: 'header', - key: 'x-test_api_client_id', - value: api_key_with_prefix('x-test_api_client_id') - }, - 'test_api_key_query' => - { - type: 'api_key', - in: 'query', - key: 'test_api_key_query', - value: api_key_with_prefix('test_api_key_query') - }, 'petstore_auth' => { type: 'oauth2', diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index 325898c5676..342d3b2464d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb index abd167dfb6c..4489e6abb85 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index 69f4b039475..0f6d61d83af 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb index 04c88b9d768..5173f9a01ec 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index c688c1f7841..87b6d4e4695 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -40,6 +40,8 @@ module Petstore attr_accessor :date_time + attr_accessor :password + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -53,7 +55,8 @@ module Petstore :'byte' => :'byte', :'binary' => :'binary', :'date' => :'date', - :'date_time' => :'dateTime' + :'date_time' => :'dateTime', + :'password' => :'password' } end @@ -70,7 +73,8 @@ module Petstore :'byte' => :'String', :'binary' => :'String', :'date' => :'Date', - :'date_time' => :'String' + :'date_time' => :'DateTime', + :'password' => :'String' } end @@ -115,6 +119,9 @@ module Petstore if attributes[:'dateTime'] self.date_time = attributes[:'dateTime'] end + if attributes[:'password'] + self.password = attributes[:'password'] + end end # Checks equality by comparing each attribute. @@ -132,7 +139,8 @@ module Petstore byte == o.byte && binary == o.binary && date == o.date && - date_time == o.date_time + date_time == o.date_time && + password == o.password end # @see the `==` method @@ -144,7 +152,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [integer, int32, int64, number, float, double, string, byte, binary, date, date_time].hash + [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, password].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb index 4e198a489b3..9cacbdb1298 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb index f016ff32fe9..31adf497fa2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/name.rb b/samples/client/petstore/ruby/lib/petstore/models/name.rb index c0ebf37971b..9818aa41cc4 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/name.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/order.rb b/samples/client/petstore/ruby/lib/petstore/models/order.rb index 86bc4f16197..81f2601e9d9 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/order.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -80,6 +80,8 @@ module Petstore end if attributes[:'complete'] self.complete = attributes[:'complete'] + else + self.complete = false end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index 13c0291bb35..095f91ca7c3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb index b0509903ef2..4c859270d1b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/client/petstore/ruby/lib/petstore/models/tag.rb index 3a7bc3b53a7..e5c80ee2228 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/tag.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/user.rb b/samples/client/petstore/ruby/lib/petstore/models/user.rb index 2ef984493e9..e7ce160dfa2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/user.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/version.rb b/samples/client/petstore/ruby/lib/petstore/version.rb index 2c3d31c3399..e28b737d97c 100644 --- a/samples/client/petstore/ruby/lib/petstore/version.rb +++ b/samples/client/petstore/ruby/lib/petstore/version.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/api/pet_api_spec.rb b/samples/client/petstore/ruby/spec/api/pet_api_spec.rb index 12cdc70dc57..e903362291b 100644 --- a/samples/client/petstore/ruby/spec/api/pet_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/pet_api_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -39,8 +39,8 @@ describe 'PetApi' do # unit tests for add_pet # Add a new pet to the store # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] describe 'add_pet test' do it "should work" do @@ -52,22 +52,6 @@ describe 'PetApi' do end end - # unit tests for add_pet_using_byte_array - # Fake endpoint to test byte array in body parameter for adding a new pet to the store - # - # @param [Hash] opts the optional parameters - # @option opts [String] :body Pet object in the form of byte array - # @return [nil] - describe 'add_pet_using_byte_array test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for delete_pet # Deletes a pet # @@ -88,8 +72,8 @@ describe 'PetApi' do # unit tests for find_pets_by_status # Finds Pets by status # Multiple status values can be provided with comma separated strings + # @param status Status values that need to be considered for filter # @param [Hash] opts the optional parameters - # @option opts [Array] :status Status values that need to be considered for query # @return [Array] describe 'find_pets_by_status test' do it "should work" do @@ -103,9 +87,9 @@ describe 'PetApi' do # unit tests for find_pets_by_tags # Finds Pets by tags - # Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + # @param tags Tags to filter by # @param [Hash] opts the optional parameters - # @option opts [Array] :tags Tags to filter by # @return [Array] describe 'find_pets_by_tags test' do it "should work" do @@ -119,8 +103,8 @@ describe 'PetApi' do # unit tests for get_pet_by_id # Find pet by ID - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched + # Returns a single pet + # @param pet_id ID of pet to return # @param [Hash] opts the optional parameters # @return [Pet] describe 'get_pet_by_id test' do @@ -133,43 +117,11 @@ describe 'PetApi' do end end - # unit tests for get_pet_by_id_in_object - # Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [InlineResponse200] - describe 'get_pet_by_id_in_object test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - # unit tests for pet_pet_idtesting_byte_arraytrue_get - # Fake endpoint to test byte array return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [String] - describe 'pet_pet_idtesting_byte_arraytrue_get test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for update_pet # Update an existing pet # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] describe 'update_pet test' do it "should work" do @@ -206,7 +158,7 @@ describe 'PetApi' do # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server # @option opts [File] :file file to upload - # @return [nil] + # @return [ApiResponse] describe 'upload_file test' do it "should work" do # assertion here diff --git a/samples/client/petstore/ruby/spec/api/store_api_spec.rb b/samples/client/petstore/ruby/spec/api/store_api_spec.rb index 0952b075bf4..479891e9308 100644 --- a/samples/client/petstore/ruby/spec/api/store_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/store_api_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -52,22 +52,6 @@ describe 'StoreApi' do end end - # unit tests for find_orders_by_status - # Finds orders by status - # A single status value can be provided as a string - # @param [Hash] opts the optional parameters - # @option opts [String] :status Status value that needs to be considered for query - # @return [Array] - describe 'find_orders_by_status test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for get_inventory # Returns pet inventories by status # Returns a map of status codes to quantities @@ -83,21 +67,6 @@ describe 'StoreApi' do end end - # unit tests for get_inventory_in_object - # Fake endpoint to test arbitrary object return by 'Get inventory' - # Returns an arbitrary object which is actually a map of status codes to quantities - # @param [Hash] opts the optional parameters - # @return [Object] - describe 'get_inventory_in_object test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for get_order_by_id # Find purchase order by ID # For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -117,8 +86,8 @@ describe 'StoreApi' do # unit tests for place_order # Place an order for a pet # + # @param body order placed for purchasing the pet # @param [Hash] opts the optional parameters - # @option opts [Order] :body order placed for purchasing the pet # @return [Order] describe 'place_order test' do it "should work" do diff --git a/samples/client/petstore/ruby/spec/api/user_api_spec.rb b/samples/client/petstore/ruby/spec/api/user_api_spec.rb index 60f1dcda16f..4564491d507 100644 --- a/samples/client/petstore/ruby/spec/api/user_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/user_api_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -39,8 +39,8 @@ describe 'UserApi' do # unit tests for create_user # Create user # This can only be done by the logged in user. + # @param body Created user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Created user object # @return [nil] describe 'create_user test' do it "should work" do @@ -55,8 +55,8 @@ describe 'UserApi' do # unit tests for create_users_with_array_input # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] describe 'create_users_with_array_input test' do it "should work" do @@ -71,8 +71,8 @@ describe 'UserApi' do # unit tests for create_users_with_list_input # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] describe 'create_users_with_list_input test' do it "should work" do @@ -119,9 +119,9 @@ describe 'UserApi' do # unit tests for login_user # Logs user into the system # + # @param username The user name for login + # @param password The password for login in clear text # @param [Hash] opts the optional parameters - # @option opts [String] :username The user name for login - # @option opts [String] :password The password for login in clear text # @return [String] describe 'login_user test' do it "should work" do @@ -152,8 +152,8 @@ describe 'UserApi' do # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted + # @param body Updated user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Updated user object # @return [nil] describe 'update_user test' do it "should work" do diff --git a/samples/client/petstore/ruby/spec/models/animal_spec.rb b/samples/client/petstore/ruby/spec/models/animal_spec.rb index ddbfeca85f9..e35b12411be 100644 --- a/samples/client/petstore/ruby/spec/models/animal_spec.rb +++ b/samples/client/petstore/ruby/spec/models/animal_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/cat_spec.rb b/samples/client/petstore/ruby/spec/models/cat_spec.rb index 220a37dfebe..e9b20d57eb0 100644 --- a/samples/client/petstore/ruby/spec/models/cat_spec.rb +++ b/samples/client/petstore/ruby/spec/models/cat_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/category_spec.rb b/samples/client/petstore/ruby/spec/models/category_spec.rb index 745974cbabd..0e7001053f7 100644 --- a/samples/client/petstore/ruby/spec/models/category_spec.rb +++ b/samples/client/petstore/ruby/spec/models/category_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/dog_spec.rb b/samples/client/petstore/ruby/spec/models/dog_spec.rb index 23b1b9a83f7..20375338c7e 100644 --- a/samples/client/petstore/ruby/spec/models/dog_spec.rb +++ b/samples/client/petstore/ruby/spec/models/dog_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/format_test_spec.rb b/samples/client/petstore/ruby/spec/models/format_test_spec.rb index e59d956fd37..e44131192a3 100644 --- a/samples/client/petstore/ruby/spec/models/format_test_spec.rb +++ b/samples/client/petstore/ruby/spec/models/format_test_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -146,5 +146,15 @@ describe 'FormatTest' do end end + describe 'test attribute "password"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + end diff --git a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb index 858b6504908..36a4da3baaa 100644 --- a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb +++ b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb @@ -21,7 +21,7 @@ require 'date' # Unit tests for Petstore::InlineResponse200 # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate -describe 'InlineResponse200' do +describe 'InlineResponse200', pending: "Original spec does not have InlineResponse200 and we'll renable this after updating Petstore server" do before do # run before each test @instance = Petstore::InlineResponse200.new diff --git a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb index 4e2f92c5212..88045611d9c 100644 --- a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/model_return_spec.rb b/samples/client/petstore/ruby/spec/models/model_return_spec.rb index 018798b47e3..7b6f3a571c4 100644 --- a/samples/client/petstore/ruby/spec/models/model_return_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_return_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/name_spec.rb b/samples/client/petstore/ruby/spec/models/name_spec.rb index 5d66fd078f3..9eef65de2fa 100644 --- a/samples/client/petstore/ruby/spec/models/name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/name_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/order_spec.rb b/samples/client/petstore/ruby/spec/models/order_spec.rb index 698f3af9268..420cfea059c 100644 --- a/samples/client/petstore/ruby/spec/models/order_spec.rb +++ b/samples/client/petstore/ruby/spec/models/order_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/pet_spec.rb b/samples/client/petstore/ruby/spec/models/pet_spec.rb index cf18e1a5f3a..96ced2cd366 100644 --- a/samples/client/petstore/ruby/spec/models/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/models/pet_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb index e3201cb2e31..aa32e3fc7b2 100644 --- a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/tag_spec.rb b/samples/client/petstore/ruby/spec/models/tag_spec.rb index 4b3ff7ac611..55778d8fd67 100644 --- a/samples/client/petstore/ruby/spec/models/tag_spec.rb +++ b/samples/client/petstore/ruby/spec/models/tag_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/user_spec.rb b/samples/client/petstore/ruby/spec/models/user_spec.rb index 2c289705417..a6b872e834c 100644 --- a/samples/client/petstore/ruby/spec/models/user_spec.rb +++ b/samples/client/petstore/ruby/spec/models/user_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/pet_spec.rb b/samples/client/petstore/ruby/spec/pet_spec.rb index fc1f3087678..b05b2163353 100644 --- a/samples/client/petstore/ruby/spec/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/pet_spec.rb @@ -94,7 +94,9 @@ describe "Pet" do end end - it "should create and get pet with byte array (binary, string)" do + # skip the following as original petstore spec does not have endpoints for testing byte array + # we will re-enable this after updating the petstore server + xit "should create and get pet with byte array (binary, string)" do pet = @pet_api.get_pet_by_id(@pet_id) pet.id = @pet_id + 1 str = serialize_json(pet) @@ -111,7 +113,9 @@ describe "Pet" do @pet_api.delete_pet(pet.id) end - it "should get pet in bject" do + # skip the following as original petstore spec does not have endpoints for testing byte array + # we will re-enable this after updating the petstore server + xit "should get pet in object" do pet = @pet_api.get_pet_by_id_in_object(@pet_id) pet.should be_a(Petstore::InlineResponse200) pet.id.should == @pet_id @@ -136,7 +140,7 @@ describe "Pet" do end it "should find pets by status" do - pets = @pet_api.find_pets_by_status(:status => 'available') + pets = @pet_api.find_pets_by_status(['available']) pets.length.should >= 3 pets.each do |pet| pet.should be_a(Petstore::Pet) @@ -145,12 +149,12 @@ describe "Pet" do end it "should not find a pet with invalid status" do - pets = @pet_api.find_pets_by_status(:status => 'invalid-status') + pets = @pet_api.find_pets_by_status(['invalid-status']) pets.length.should == 0 end it "should find a pet by status" do - pets = @pet_api.find_pets_by_status(:status => "available,sold") + pets = @pet_api.find_pets_by_status(["available", "sold"]) pets.each do |pet| if pet.status != 'available' && pet.status != 'sold' raise "pet status wasn't right" @@ -162,7 +166,7 @@ describe "Pet" do id = @pet_id + 1 pet = Petstore::Pet.new('id' => id, 'name' => "RUBY UNIT TESTING") - result = @pet_api.add_pet(:body => pet) + result = @pet_api.add_pet(pet) # nothing is returned result.should be_nil @@ -175,13 +179,14 @@ describe "Pet" do it "should upload a file to a pet" do result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt')) - # nothing is returned - result.should be_nil + # ApiResponse is returned + result.should be_a(Petstore::ApiResponse) end it "should upload a file with form parameter to a pet" do result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt'), additional_metadata: 'metadata') - result.should be_nil + # ApiResponse is returned + result.should be_a(Petstore::ApiResponse) end it "should implement eql? and hash" do diff --git a/samples/client/petstore/ruby/spec/spec_helper.rb b/samples/client/petstore/ruby/spec/spec_helper.rb index 5382a3879ef..68147e76b72 100644 --- a/samples/client/petstore/ruby/spec/spec_helper.rb +++ b/samples/client/petstore/ruby/spec/spec_helper.rb @@ -49,7 +49,7 @@ def prepare_pet(pet_api) tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test') pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url', 'category' => category, 'tags' => [tag], 'status' => 'pending') - pet_api.add_pet(:'body'=> pet) + pet_api.add_pet(pet) return pet_id end @@ -62,7 +62,7 @@ def prepare_store(store_api) "shipDate" => "2015-04-06T23:42:01.678Z", "status" => "placed", "complete" => false) - store_api.place_order(:body => order) + store_api.place_order(order) return order_id end diff --git a/samples/client/petstore/ruby/spec/store_spec.rb b/samples/client/petstore/ruby/spec/store_spec.rb index 67b678575d0..229a9dfd40a 100644 --- a/samples/client/petstore/ruby/spec/store_spec.rb +++ b/samples/client/petstore/ruby/spec/store_spec.rb @@ -24,7 +24,9 @@ describe "Store" do end end - it "should featch the inventory in object" do + # mark as pending since original petstore does not return object + # will re-enable this after updating the petstore server + xit "should featch the inventory in object" do result = @api.get_inventory_in_object result.should be_a(Hash) result.should_not be_empty