update ruby test case

This commit is contained in:
wing328 2016-04-13 22:20:38 +08:00
parent d19ed8a89b
commit 8f70230906
48 changed files with 327 additions and 1021 deletions

View File

@ -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

View File

@ -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 <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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&#x3D;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&#x3D;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&#x3D;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&#x3D;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

View File

@ -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]

View File

@ -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]

View File

@ -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&#x3D;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&#x3D;inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by &#39;Find pet by ID&#39;
[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array&#x3D;true | Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
[**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&lt;Pet&gt; find_pets_by_status(opts)
> Array&lt;Pet&gt; find_pets_by_status(status)
Finds Pets by status
@ -195,13 +139,12 @@ end
api_instance = Petstore::PetApi.new
opts = {
status: ["available"] # Array<String> | Status values that need to be considered for query
}
status = ["status_example"] # Array<String> | 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&lt;String&gt;**](String.md)| Status values that need to be considered for query | [optional] [default to available]
**status** | [**Array&lt;String&gt;**](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&lt;Pet&gt; find_pets_by_tags(opts)
> Array&lt;Pet&gt; 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<String> | Tags to filter by
}
tags = ["tags_example"] # Array<String> | 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&lt;String&gt;**](String.md)| Tags to filter by | [optional]
**tags** | [**Array&lt;String&gt;**](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

View File

@ -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&#x3D;arbitrary_object | Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
[**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&lt;Order&gt; 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&lt;Order&gt;**](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

View File

@ -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<User> | List of user object
}
body = [Petstore::User.new] # Array<User> | 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&lt;User&gt;**](User.md)| List of user object | [optional]
**body** | [**Array&lt;User&gt;**](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<User> | List of user object
}
body = [Petstore::User.new] # Array<User> | 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&lt;User&gt;**](User.md)| List of user object | [optional]
**body** | [**Array&lt;User&gt;**](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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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'

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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&#x3D;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<String>] :status Status values that need to be considered for query (default to available)
# @return [Array<Pet>]
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<String>] :status Status values that need to be considered for query
# @return [Array<(Array<Pet>, Fixnum, Hash)>] Array<Pet> 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<String>] :tags Tags to filter by
# @return [Array<Pet>]
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<String>] :tags Tags to filter by
# @return [Array<(Array<Pet>, Fixnum, Hash)>] Array<Pet> 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 &lt; 10. ID &gt; 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 &#39;Find pet by ID&#39;
# Returns a pet when ID &lt; 10. ID &gt; 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&#x3D;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 &#39;Find pet by ID&#39;
# Returns a pet when ID &lt; 10. ID &gt; 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&#x3D;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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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<Order>]
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<Order>, Fixnum, Hash)>] Array<Order> 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<Order>')
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 &#39;Get inventory&#39;
# 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&#x3D;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,

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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<User>] :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<User>] :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<User>] :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<User>] :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,

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -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',

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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<String>] :status Status values that need to be considered for query
# @return [Array<Pet>]
describe 'find_pets_by_status test' do
it "should work" do
@ -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<String>] :tags Tags to filter by
# @return [Array<Pet>]
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 &lt; 10. ID &gt; 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 &#39;Find pet by ID&#39;
# Returns a pet when ID &lt; 10. ID &gt; 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 &#39;Find pet by ID&#39;
# Returns a pet when ID &lt; 10. ID &gt; 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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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<Order>]
describe 'find_orders_by_status test' do
it "should work" do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
# unit tests for get_inventory
# Returns pet inventories by status
# Returns a map of status codes to quantities
@ -83,21 +67,6 @@ describe 'StoreApi' do
end
end
# unit tests for get_inventory_in_object
# Fake endpoint to test arbitrary object return by &#39;Get inventory&#39;
# 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 &lt;&#x3D; 5 or &gt; 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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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<User>] :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<User>] :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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -1,7 +1,7 @@
=begin
Swagger Petstore
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
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

View File

@ -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

View File

@ -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

View File

@ -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