Merge branch 'update-ruby-sample' of https://github.com/chadrosen/swagger-codegen into chadrosen-update-ruby-sample

Conflicts:
	samples/client/petstore/ruby/README.md
	samples/client/petstore/ruby/docs/ArrayTest.md
	samples/client/petstore/ruby/lib/petstore/models/array_test.rb
This commit is contained in:
wing328 2016-06-30 11:20:28 +08:00
commit 3b022496cd
4 changed files with 18 additions and 64 deletions

View File

@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-06-28T17:36:56.204+08:00
- Build date: 2016-06-29T13:19:03.533-07:00
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
## Installation
@ -134,12 +134,6 @@ Class | Method | HTTP request | Description
## Documentation for Authorization
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
### petstore_auth
- **Type**: OAuth
@ -149,3 +143,9 @@ Class | Method | HTTP request | Description
- write:pets: modify pets in your account
- read:pets: read your pets
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

View File

@ -6,6 +6,5 @@ Name | Type | Description | Notes
**array_of_string** | **Array<String>** | | [optional]
**array_array_of_integer** | **Array<Array<Integer>>** | | [optional]
**array_array_of_model** | **Array<Array<ReadOnlyFirst>>** | | [optional]
**array_of_enum** | **Array<String>** | | [optional]

View File

@ -188,13 +188,6 @@ module Petstore
# Returns Auth Settings hash for api client.
def auth_settings
{
'api_key' =>
{
type: 'api_key',
in: 'header',
key: 'api_key',
value: api_key_with_prefix('api_key')
},
'petstore_auth' =>
{
type: 'oauth2',
@ -202,6 +195,13 @@ module Petstore
key: 'Authorization',
value: "Bearer #{access_token}"
},
'api_key' =>
{
type: 'api_key',
in: 'header',
key: 'api_key',
value: api_key_with_prefix('api_key')
},
}
end
end

View File

@ -32,37 +32,12 @@ module Petstore
attr_accessor :array_array_of_model
attr_accessor :array_of_enum
class EnumAttributeValidator
attr_reader :datatype
attr_reader :allowable_values
def initialize(datatype, allowable_values)
@allowable_values = allowable_values.map do |value|
case datatype.to_s
when /Integer/i
value.to_i
when /Float/i
value.to_f
else
value
end
end
end
def valid?(value)
!value || allowable_values.include?(value)
end
end
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'array_of_string' => :'array_of_string',
:'array_array_of_integer' => :'array_array_of_integer',
:'array_array_of_model' => :'array_array_of_model',
:'array_of_enum' => :'array_of_enum'
:'array_array_of_model' => :'array_array_of_model'
}
end
@ -71,8 +46,7 @@ module Petstore
{
:'array_of_string' => :'Array<String>',
:'array_array_of_integer' => :'Array<Array<Integer>>',
:'array_array_of_model' => :'Array<Array<ReadOnlyFirst>>',
:'array_of_enum' => :'Array<String>'
:'array_array_of_model' => :'Array<Array<ReadOnlyFirst>>'
}
end
@ -102,12 +76,6 @@ module Petstore
end
end
if attributes.has_key?(:'array_of_enum')
if (value = attributes[:'array_of_enum']).is_a?(Array)
self.array_of_enum = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
@ -120,21 +88,9 @@ module Petstore
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
array_of_enum_validator = EnumAttributeValidator.new('Array<String>', [])
return false unless array_of_enum_validator.valid?(@array_of_enum)
return true
end
# Custom attribute writer method checking allowed values (enum).
# @param [Object] array_of_enum Object to be assigned
def array_of_enum=(array_of_enum)
validator = EnumAttributeValidator.new('Array<String>', [])
unless validator.valid?(array_of_enum)
fail ArgumentError, "invalid value for 'array_of_enum', must be one of #{validator.allowable_values}."
end
@array_of_enum = array_of_enum
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
@ -142,8 +98,7 @@ module Petstore
self.class == o.class &&
array_of_string == o.array_of_string &&
array_array_of_integer == o.array_array_of_integer &&
array_array_of_model == o.array_array_of_model &&
array_of_enum == o.array_of_enum
array_array_of_model == o.array_array_of_model
end
# @see the `==` method
@ -155,7 +110,7 @@ module Petstore
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
def hash
[array_of_string, array_array_of_integer, array_array_of_model, array_of_enum].hash
[array_of_string, array_array_of_integer, array_array_of_model].hash
end
# Builds the object from hash