Merge pull request #2375 from xhh/ruby-doc

[Ruby] Add require and print statements to Ruby client docs
This commit is contained in:
wing328 2016-03-15 11:34:25 +08:00
commit 3c997ea743
14 changed files with 180 additions and 89 deletions

View File

@ -18,7 +18,10 @@ Method | HTTP request | Description
{{notes}}{{/notes}} {{notes}}{{/notes}}
### Example ### Example
```ruby{{#hasAuthMethods}} ```ruby
require '{{{gemName}}}'
{{#hasAuthMethods}}
{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}} {{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}
# Configure HTTP basic authorization: {{{name}}} # Configure HTTP basic authorization: {{{name}}}
config.username = 'YOUR USERNAME' config.username = 'YOUR USERNAME'
@ -41,7 +44,8 @@ opts = { {{#allParams}}{{^required}}
}{{/hasOptionalParams}}{{/hasParams}} }{{/hasOptionalParams}}{{/hasParams}}
begin begin
{{#returnType}}result = {{/returnType}}api.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}} {{#returnType}}result = {{/returnType}}api.{{{operationId}}}{{#hasParams}}({{#allParams}}{{#required}}{{{paramName}}}{{#vendorExtensions.x-codegen-hasMoreRequired}}, {{/vendorExtensions.x-codegen-hasMoreRequired}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{{#vendorExtensions.x-codegen-hasRequiredParams}}, {{/vendorExtensions.x-codegen-hasRequiredParams}}opts{{/hasOptionalParams}}){{/hasParams}}{{#returnType}}
p result{{/returnType}}
rescue {{{moduleName}}}::ApiError => e rescue {{{moduleName}}}::ApiError => e
puts "Exception when calling {{{operationId}}}: #{e}" puts "Exception when calling {{{operationId}}}: #{e}"
end end

View File

@ -6,7 +6,7 @@ Version: 1.0.0
Automatically generated by the Ruby Swagger Codegen project: Automatically generated by the Ruby Swagger Codegen project:
- Build date: 2016-03-11T18:59:01.854+08:00 - Build date: 2016-03-14T15:33:44.953+08:00
- Build package: class io.swagger.codegen.languages.RubyClientCodegen - Build package: class io.swagger.codegen.languages.RubyClientCodegen
## Installation ## Installation
@ -108,6 +108,7 @@ Class | Method | HTTP request | Description
- [Petstore::Category](docs/Category.md) - [Petstore::Category](docs/Category.md)
- [Petstore::InlineResponse200](docs/InlineResponse200.md) - [Petstore::InlineResponse200](docs/InlineResponse200.md)
- [Petstore::ModelReturn](docs/ModelReturn.md) - [Petstore::ModelReturn](docs/ModelReturn.md)
- [Petstore::Name](docs/Name.md)
- [Petstore::Order](docs/Order.md) - [Petstore::Order](docs/Order.md)
- [Petstore::Pet](docs/Pet.md) - [Petstore::Pet](docs/Pet.md)
- [Petstore::SpecialModelName](docs/SpecialModelName.md) - [Petstore::SpecialModelName](docs/SpecialModelName.md)
@ -145,6 +146,10 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key - **API key parameter name**: api_key
- **Location**: HTTP header - **Location**: HTTP header
### test_http_basic
- **Type**: HTTP basic authentication
### test_api_key_query ### test_api_key_query
- **Type**: API key - **Type**: API key

View File

@ -0,0 +1,8 @@
# Petstore::Name
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **Integer** | | [optional]

View File

@ -26,6 +26,8 @@ Add a new pet to the store
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -74,6 +76,8 @@ Fake endpoint to test byte array in body parameter for adding a new pet to the s
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -122,6 +126,8 @@ Deletes a pet
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -173,6 +179,8 @@ Multiple status values can be provided with comma separated strings
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -186,6 +194,7 @@ opts = {
begin begin
result = api.find_pets_by_status(opts) result = api.find_pets_by_status(opts)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling find_pets_by_status: #{e}" puts "Exception when calling find_pets_by_status: #{e}"
end end
@ -221,6 +230,8 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -234,6 +245,7 @@ opts = {
begin begin
result = api.find_pets_by_tags(opts) result = api.find_pets_by_tags(opts)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling find_pets_by_tags: #{e}" puts "Exception when calling find_pets_by_tags: #{e}"
end end
@ -269,6 +281,8 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -286,6 +300,7 @@ pet_id = 789 # [Integer] ID of pet that needs to be fetched
begin begin
result = api.get_pet_by_id(pet_id) result = api.get_pet_by_id(pet_id)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling get_pet_by_id: #{e}" puts "Exception when calling get_pet_by_id: #{e}"
end end
@ -321,6 +336,8 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -338,6 +355,7 @@ pet_id = 789 # [Integer] ID of pet that needs to be fetched
begin begin
result = api.get_pet_by_id_in_object(pet_id) result = api.get_pet_by_id_in_object(pet_id)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling get_pet_by_id_in_object: #{e}" puts "Exception when calling get_pet_by_id_in_object: #{e}"
end end
@ -373,6 +391,8 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -390,6 +410,7 @@ pet_id = 789 # [Integer] ID of pet that needs to be fetched
begin begin
result = api.pet_pet_idtesting_byte_arraytrue_get(pet_id) result = api.pet_pet_idtesting_byte_arraytrue_get(pet_id)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling pet_pet_idtesting_byte_arraytrue_get: #{e}" puts "Exception when calling pet_pet_idtesting_byte_arraytrue_get: #{e}"
end end
@ -425,6 +446,8 @@ Update an existing pet
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -473,6 +496,8 @@ Updates a pet in the store with form data
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"
@ -526,6 +551,8 @@ uploads an image
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth # Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN" config.access_token = "YOUR ACCESS TOKEN"

View File

@ -21,6 +21,8 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::StoreApi.new api = Petstore::StoreApi.new
order_id = "order_id_example" # [String] ID of the order that needs to be deleted order_id = "order_id_example" # [String] ID of the order that needs to be deleted
@ -63,6 +65,8 @@ A single status value can be provided as a string
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure API key authorization: test_api_client_id # Configure API key authorization: test_api_client_id
config.api_key['x-test_api_client_id'] = "YOUR API KEY" config.api_key['x-test_api_client_id'] = "YOUR API KEY"
@ -83,6 +87,7 @@ opts = {
begin begin
result = api.find_orders_by_status(opts) result = api.find_orders_by_status(opts)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling find_orders_by_status: #{e}" puts "Exception when calling find_orders_by_status: #{e}"
end end
@ -118,6 +123,8 @@ Returns a map of status codes to quantities
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure API key authorization: api_key # Configure API key authorization: api_key
config.api_key['api_key'] = "YOUR API KEY" config.api_key['api_key'] = "YOUR API KEY"
@ -129,6 +136,7 @@ api = Petstore::StoreApi.new
begin begin
result = api.get_inventory result = api.get_inventory
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling get_inventory: #{e}" puts "Exception when calling get_inventory: #{e}"
end end
@ -161,6 +169,8 @@ Returns an arbitrary object which is actually a map of status codes to quantitie
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure API key authorization: api_key # Configure API key authorization: api_key
config.api_key['api_key'] = "YOUR API KEY" config.api_key['api_key'] = "YOUR API KEY"
@ -172,6 +182,7 @@ api = Petstore::StoreApi.new
begin begin
result = api.get_inventory_in_object result = api.get_inventory_in_object
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling get_inventory_in_object: #{e}" puts "Exception when calling get_inventory_in_object: #{e}"
end end
@ -204,6 +215,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values w
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure API key authorization: test_api_key_query # Configure API key authorization: test_api_key_query
config.api_key['test_api_key_query'] = "YOUR API KEY" config.api_key['test_api_key_query'] = "YOUR API KEY"
@ -223,6 +236,7 @@ order_id = "order_id_example" # [String] ID of pet that needs to be fetched
begin begin
result = api.get_order_by_id(order_id) result = api.get_order_by_id(order_id)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling get_order_by_id: #{e}" puts "Exception when calling get_order_by_id: #{e}"
end end
@ -258,6 +272,8 @@ Place an order for a pet
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config| Petstore.configure do |config|
# Configure API key authorization: test_api_client_id # Configure API key authorization: test_api_client_id
config.api_key['x-test_api_client_id'] = "YOUR API KEY" config.api_key['x-test_api_client_id'] = "YOUR API KEY"
@ -278,6 +294,7 @@ opts = {
begin begin
result = api.place_order(opts) result = api.place_order(opts)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling place_order: #{e}" puts "Exception when calling place_order: #{e}"
end end

View File

@ -23,6 +23,8 @@ This can only be done by the logged in user.
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::UserApi.new api = Petstore::UserApi.new
opts = { opts = {
@ -66,6 +68,8 @@ Creates list of users with given input array
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::UserApi.new api = Petstore::UserApi.new
opts = { opts = {
@ -109,6 +113,8 @@ Creates list of users with given input array
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::UserApi.new api = Petstore::UserApi.new
opts = { opts = {
@ -152,6 +158,14 @@ This can only be done by the logged in user.
### Example ### Example
```ruby ```ruby
require 'petstore'
Petstore.configure do |config|
# Configure HTTP basic authorization: test_http_basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api = Petstore::UserApi.new api = Petstore::UserApi.new
username = "username_example" # [String] The name that needs to be deleted username = "username_example" # [String] The name that needs to be deleted
@ -176,7 +190,7 @@ nil (empty response body)
### Authorization ### Authorization
No authorization required [test_http_basic](../README.md#test_http_basic)
### HTTP reuqest headers ### HTTP reuqest headers
@ -194,6 +208,8 @@ Get user by user name
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::UserApi.new api = Petstore::UserApi.new
username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing. username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing.
@ -201,6 +217,7 @@ username = "username_example" # [String] The name that needs to be fetched. Use
begin begin
result = api.get_user_by_name(username) result = api.get_user_by_name(username)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling get_user_by_name: #{e}" puts "Exception when calling get_user_by_name: #{e}"
end end
@ -236,6 +253,8 @@ Logs user into the system
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::UserApi.new api = Petstore::UserApi.new
opts = { opts = {
@ -245,6 +264,7 @@ opts = {
begin begin
result = api.login_user(opts) result = api.login_user(opts)
p result
rescue Petstore::ApiError => e rescue Petstore::ApiError => e
puts "Exception when calling login_user: #{e}" puts "Exception when calling login_user: #{e}"
end end
@ -281,6 +301,8 @@ Logs out current logged in user session
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::UserApi.new api = Petstore::UserApi.new
begin begin
@ -317,6 +339,8 @@ This can only be done by the logged in user.
### Example ### Example
```ruby ```ruby
require 'petstore'
api = Petstore::UserApi.new api = Petstore::UserApi.new
username = "username_example" # [String] name that need to be deleted username = "username_example" # [String] name that need to be deleted

View File

@ -8,17 +8,17 @@ git_repo_id=$2
release_note=$3 release_note=$3
if [ "$git_user_id" = "" ]; then if [ "$git_user_id" = "" ]; then
git_user_id="YOUR_GIT_USR_ID" git_user_id=""
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi fi
if [ "$git_repo_id" = "" ]; then if [ "$git_repo_id" = "" ]; then
git_repo_id="YOUR_GIT_REPO_ID" git_repo_id=""
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi fi
if [ "$release_note" = "" ]; then if [ "$release_note" = "" ]; then
release_note="Minor update" release_note=""
echo "[INFO] No command line input provided. Set \$release_note to $release_note" echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi fi

View File

@ -360,7 +360,7 @@ module Petstore
# http body (model) # http body (model)
post_body = nil post_body = nil
auth_names = ['api_key', 'petstore_auth'] auth_names = ['petstore_auth', 'api_key']
data, status_code, headers = @api_client.call_api(:GET, local_var_path, data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params, :header_params => header_params,
:query_params => query_params, :query_params => query_params,
@ -420,7 +420,7 @@ module Petstore
# http body (model) # http body (model)
post_body = nil post_body = nil
auth_names = ['api_key', 'petstore_auth'] auth_names = ['petstore_auth', 'api_key']
data, status_code, headers = @api_client.call_api(:GET, local_var_path, data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params, :header_params => header_params,
:query_params => query_params, :query_params => query_params,
@ -480,7 +480,7 @@ module Petstore
# http body (model) # http body (model)
post_body = nil post_body = nil
auth_names = ['api_key', 'petstore_auth'] auth_names = ['petstore_auth', 'api_key']
data, status_code, headers = @api_client.call_api(:GET, local_var_path, data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params, :header_params => header_params,
:query_params => query_params, :query_params => query_params,

View File

@ -301,7 +301,7 @@ module Petstore
# http body (model) # http body (model)
post_body = nil post_body = nil
auth_names = ['test_api_key_header', 'test_api_key_query'] auth_names = ['test_api_key_query', 'test_api_key_header']
data, status_code, headers = @api_client.call_api(:GET, local_var_path, data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params, :header_params => header_params,
:query_params => query_params, :query_params => query_params,

View File

@ -238,7 +238,7 @@ module Petstore
# http body (model) # http body (model)
post_body = nil post_body = nil
auth_names = [] auth_names = ['test_http_basic']
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
:header_params => header_params, :header_params => header_params,
:query_params => query_params, :query_params => query_params,

View File

@ -157,26 +157,12 @@ module Petstore
# Returns Auth Settings hash for api client. # Returns Auth Settings hash for api client.
def auth_settings def auth_settings
{ {
'test_api_key_header' => 'petstore_auth' =>
{ {
type: 'api_key', type: 'oauth2',
in: 'header', in: 'header',
key: 'test_api_key_header', key: 'Authorization',
value: api_key_with_prefix('test_api_key_header') value: "Bearer #{access_token}"
},
'api_key' =>
{
type: 'api_key',
in: 'header',
key: 'api_key',
value: api_key_with_prefix('api_key')
},
'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' => 'test_api_client_id' =>
{ {
@ -185,6 +171,27 @@ module Petstore
key: 'x-test_api_client_id', key: 'x-test_api_client_id',
value: api_key_with_prefix('x-test_api_client_id') value: api_key_with_prefix('x-test_api_client_id')
}, },
'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')
},
'api_key' =>
{
type: 'api_key',
in: 'header',
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_key_query' => 'test_api_key_query' =>
{ {
type: 'api_key', type: 'api_key',
@ -192,12 +199,12 @@ module Petstore
key: 'test_api_key_query', key: 'test_api_key_query',
value: api_key_with_prefix('test_api_key_query') value: api_key_with_prefix('test_api_key_query')
}, },
'petstore_auth' => 'test_api_key_header' =>
{ {
type: 'oauth2', type: 'api_key',
in: 'header', in: 'header',
key: 'Authorization', key: 'test_api_key_header',
value: "Bearer #{access_token}" value: api_key_with_prefix('test_api_key_header')
}, },
} }
end end

View File

@ -18,34 +18,34 @@ require 'date'
module Petstore module Petstore
class InlineResponse200 class InlineResponse200
attr_accessor :tags attr_accessor :photo_urls
attr_accessor :name
attr_accessor :id attr_accessor :id
attr_accessor :category attr_accessor :category
attr_accessor :tags
# pet status in the store # pet status in the store
attr_accessor :status attr_accessor :status
attr_accessor :name
attr_accessor :photo_urls
# Attribute mapping from ruby-style variable name to JSON key. # Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map def self.attribute_map
{ {
:'tags' => :'tags', :'photo_urls' => :'photoUrls',
:'name' => :'name',
:'id' => :'id', :'id' => :'id',
:'category' => :'category', :'category' => :'category',
:'status' => :'status', :'tags' => :'tags',
:'name' => :'name', :'status' => :'status'
:'photo_urls' => :'photoUrls'
} }
end end
@ -53,12 +53,12 @@ module Petstore
# Attribute type mapping. # Attribute type mapping.
def self.swagger_types def self.swagger_types
{ {
:'tags' => :'Array<Tag>', :'photo_urls' => :'Array<String>',
:'name' => :'String',
:'id' => :'Integer', :'id' => :'Integer',
:'category' => :'Object', :'category' => :'Object',
:'status' => :'String', :'tags' => :'Array<Tag>',
:'name' => :'String', :'status' => :'String'
:'photo_urls' => :'Array<String>'
} }
end end
@ -70,12 +70,16 @@ module Petstore
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
if attributes[:'tags'] if attributes[:'photoUrls']
if (value = attributes[:'tags']).is_a?(Array) if (value = attributes[:'photoUrls']).is_a?(Array)
self.tags = value self.photo_urls = value
end end
end end
if attributes[:'name']
self.name = attributes[:'name']
end
if attributes[:'id'] if attributes[:'id']
self.id = attributes[:'id'] self.id = attributes[:'id']
end end
@ -84,20 +88,16 @@ module Petstore
self.category = attributes[:'category'] self.category = attributes[:'category']
end end
if attributes[:'tags']
if (value = attributes[:'tags']).is_a?(Array)
self.tags = value
end
end
if attributes[:'status'] if attributes[:'status']
self.status = attributes[:'status'] self.status = attributes[:'status']
end end
if attributes[:'name']
self.name = attributes[:'name']
end
if attributes[:'photoUrls']
if (value = attributes[:'photoUrls']).is_a?(Array)
self.photo_urls = value
end
end
end end
# Custom attribute writer method checking allowed values (enum). # Custom attribute writer method checking allowed values (enum).
@ -113,12 +113,12 @@ module Petstore
def ==(o) def ==(o)
return true if self.equal?(o) return true if self.equal?(o)
self.class == o.class && self.class == o.class &&
tags == o.tags && photo_urls == o.photo_urls &&
name == o.name &&
id == o.id && id == o.id &&
category == o.category && category == o.category &&
status == o.status && tags == o.tags &&
name == o.name && status == o.status
photo_urls == o.photo_urls
end end
# @see the `==` method # @see the `==` method
@ -128,7 +128,7 @@ module Petstore
# Calculate hash code according to all attributes. # Calculate hash code according to all attributes.
def hash def hash
[tags, id, category, status, name, photo_urls].hash [photo_urls, name, id, category, tags, status].hash
end end
# build the object from hash # build the object from hash

View File

@ -36,8 +36,17 @@ describe 'InlineResponse200' do
@instance.should be_a(Petstore::InlineResponse200) @instance.should be_a(Petstore::InlineResponse200)
end end
end end
describe 'test attribute "photo_urls"' do
describe 'test attribute "tags"' do it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
describe 'test attribute "name"' do
it 'should work' do it 'should work' do
# assertion here # assertion here
# should be_a() # should be_a()
@ -67,6 +76,16 @@ describe 'InlineResponse200' do
end end
end end
describe 'test attribute "tags"' do
it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
describe 'test attribute "status"' do describe 'test attribute "status"' do
it 'should work' do it 'should work' do
# assertion here # assertion here
@ -77,25 +96,5 @@ describe 'InlineResponse200' do
end end
end end
describe 'test attribute "name"' do
it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
describe 'test attribute "photo_urls"' do
it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
end end

View File

@ -18,7 +18,7 @@ require 'spec_helper'
require 'json' require 'json'
require 'date' require 'date'
# Unit tests for Petstore:: # Unit tests for Petstore::ModelReturn
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
# Please update as you see appropriate # Please update as you see appropriate
describe 'ModelReturn' do describe 'ModelReturn' do