From 4a4151a7512fe109ccd080aa91387e9535b2ac18 Mon Sep 17 00:00:00 2001 From: Chad Rosen Date: Wed, 29 Jun 2016 13:19:37 -0700 Subject: [PATCH] update ruby samples by running the bin/ruby-petstore.sh --- samples/client/petstore/ruby/README.md | 14 +++---- .../ruby/docs/AdditionalPropertiesClass.md | 2 + .../client/petstore/ruby/docs/ArrayTest.md | 3 ++ ...dPropertiesAndAdditionalPropertiesClass.md | 1 + .../ruby/lib/petstore/configuration.rb | 14 +++---- .../models/additional_properties_class.rb | 28 ++++++++++++- .../ruby/lib/petstore/models/array_test.rb | 39 ++++++++++++++++++- ...perties_and_additional_properties_class.rb | 21 ++++++++-- .../lib/petstore/models/read_only_first.rb | 2 + 9 files changed, 102 insertions(+), 22 deletions(-) diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 6038fb2cbc..b53151e559 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -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-05-25T01:17:54.676+08:00 +- Build date: 2016-06-29T13:19:03.533-07:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -142,12 +142,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 @@ -157,3 +151,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 + diff --git a/samples/client/petstore/ruby/docs/AdditionalPropertiesClass.md b/samples/client/petstore/ruby/docs/AdditionalPropertiesClass.md index 8c9c63a74a..c3ee2cdf63 100644 --- a/samples/client/petstore/ruby/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/ruby/docs/AdditionalPropertiesClass.md @@ -3,5 +3,7 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**map_property** | **Hash<String, String>** | | [optional] +**map_of_map_property** | **Hash<String, Hash<String, String>>** | | [optional] diff --git a/samples/client/petstore/ruby/docs/ArrayTest.md b/samples/client/petstore/ruby/docs/ArrayTest.md index aa084814f0..5fbfd67159 100644 --- a/samples/client/petstore/ruby/docs/ArrayTest.md +++ b/samples/client/petstore/ruby/docs/ArrayTest.md @@ -3,5 +3,8 @@ ## Properties 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] diff --git a/samples/client/petstore/ruby/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/ruby/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 973c03c839..dcb02e2ffa 100644 --- a/samples/client/petstore/ruby/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/ruby/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -5,5 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **uuid** | **String** | | [optional] **date_time** | **DateTime** | | [optional] +**map** | [**Hash<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 92aeb4010e..872e6b07b4 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -180,13 +180,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', @@ -194,6 +187,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 diff --git a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb index 6426f05839..9b4b1f129e 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb @@ -26,15 +26,24 @@ require 'date' module Petstore class AdditionalPropertiesClass + attr_accessor :map_property + + attr_accessor :map_of_map_property + + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'map_property' => :'map_property', + :'map_of_map_property' => :'map_of_map_property' } end # Attribute type mapping. def self.swagger_types { + :'map_property' => :'Hash', + :'map_of_map_property' => :'Hash>' } end @@ -46,6 +55,18 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + if attributes.has_key?(:'map_property') + if (value = attributes[:'map_property']).is_a?(Array) + self.map_property = value + end + end + + if attributes.has_key?(:'map_of_map_property') + if (value = attributes[:'map_of_map_property']).is_a?(Array) + self.map_of_map_property = value + end + end + end # Show invalid properties with the reasons. Usually used together with valid? @@ -58,13 +79,16 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + return true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) - self.class == o.class + self.class == o.class && + map_property == o.map_property && + map_of_map_property == o.map_of_map_property end # @see the `==` method @@ -76,7 +100,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [].hash + [map_property, map_of_map_property].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/array_test.rb b/samples/client/petstore/ruby/lib/petstore/models/array_test.rb index 35d498fc9a..58bc4b1ae2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/array_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/array_test.rb @@ -26,15 +26,28 @@ require 'date' module Petstore class ArrayTest + attr_accessor :array_of_string + + attr_accessor :array_array_of_integer + + attr_accessor :array_array_of_model + + # 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' } end # Attribute type mapping. def self.swagger_types { + :'array_of_string' => :'Array', + :'array_array_of_integer' => :'Array>', + :'array_array_of_model' => :'Array>' } end @@ -46,6 +59,24 @@ module Petstore # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + if attributes.has_key?(:'array_of_string') + if (value = attributes[:'array_of_string']).is_a?(Array) + self.array_of_string = value + end + end + + if attributes.has_key?(:'array_array_of_integer') + if (value = attributes[:'array_array_of_integer']).is_a?(Array) + self.array_array_of_integer = value + end + end + + if attributes.has_key?(:'array_array_of_model') + if (value = attributes[:'array_array_of_model']).is_a?(Array) + self.array_array_of_model = value + end + end + end # Show invalid properties with the reasons. Usually used together with valid? @@ -58,13 +89,17 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + return true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) - self.class == o.class + 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 end # @see the `==` method @@ -76,7 +111,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [].hash + [array_of_string, array_array_of_integer, array_array_of_model].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb index 8208fc6463..ccc988d1ae 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb @@ -30,11 +30,15 @@ module Petstore attr_accessor :date_time + attr_accessor :map + + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'uuid' => :'uuid', - :'date_time' => :'dateTime' + :'date_time' => :'dateTime', + :'map' => :'map' } end @@ -42,7 +46,8 @@ module Petstore def self.swagger_types { :'uuid' => :'String', - :'date_time' => :'DateTime' + :'date_time' => :'DateTime', + :'map' => :'Hash' } end @@ -62,6 +67,12 @@ module Petstore self.date_time = attributes[:'dateTime'] end + if attributes.has_key?(:'map') + if (value = attributes[:'map']).is_a?(Array) + self.map = value + end + end + end # Show invalid properties with the reasons. Usually used together with valid? @@ -74,6 +85,7 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + return true end # Checks equality by comparing each attribute. @@ -82,7 +94,8 @@ module Petstore return true if self.equal?(o) self.class == o.class && uuid == o.uuid && - date_time == o.date_time + date_time == o.date_time && + map == o.map end # @see the `==` method @@ -94,7 +107,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [uuid, date_time].hash + [uuid, date_time, map].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb b/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb index 4f8b79f225..aa10141206 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb @@ -30,6 +30,7 @@ module Petstore attr_accessor :baz + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -74,6 +75,7 @@ module Petstore # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + return true end # Checks equality by comparing each attribute.