Skip to content

Commit 4a4151a

Browse files
committed
update ruby samples by running the bin/ruby-petstore.sh
1 parent 851f2ef commit 4a4151a

9 files changed

+102
-22
lines changed

samples/client/petstore/ruby/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
88

99
- API version: 1.0.0
1010
- Package version: 1.0.0
11-
- Build date: 2016-05-25T01:17:54.676+08:00
11+
- Build date: 2016-06-29T13:19:03.533-07:00
1212
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
1313

1414
## Installation
@@ -142,12 +142,6 @@ Class | Method | HTTP request | Description
142142
## Documentation for Authorization
143143

144144

145-
### api_key
146-
147-
- **Type**: API key
148-
- **API key parameter name**: api_key
149-
- **Location**: HTTP header
150-
151145
### petstore_auth
152146

153147
- **Type**: OAuth
@@ -157,3 +151,9 @@ Class | Method | HTTP request | Description
157151
- write:pets: modify pets in your account
158152
- read:pets: read your pets
159153

154+
### api_key
155+
156+
- **Type**: API key
157+
- **API key parameter name**: api_key
158+
- **Location**: HTTP header
159+

samples/client/petstore/ruby/docs/AdditionalPropertiesClass.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6+
**map_property** | **Hash<String, String>** | | [optional]
7+
**map_of_map_property** | **Hash<String, Hash<String, String>>** | | [optional]
68

79

samples/client/petstore/ruby/docs/ArrayTest.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6+
**array_of_string** | **Array<String>** | | [optional]
7+
**array_array_of_integer** | **Array<Array<Integer>>** | | [optional]
8+
**array_array_of_model** | **Array<Array<ReadOnlyFirst>>** | | [optional]
69

710

samples/client/petstore/ruby/docs/MixedPropertiesAndAdditionalPropertiesClass.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**uuid** | **String** | | [optional]
77
**date_time** | **DateTime** | | [optional]
8+
**map** | [**Hash<String, Animal>**](Animal.md) | | [optional]
89

910

samples/client/petstore/ruby/lib/petstore/configuration.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,20 @@ def basic_auth_token
180180
# Returns Auth Settings hash for api client.
181181
def auth_settings
182182
{
183-
'api_key' =>
184-
{
185-
type: 'api_key',
186-
in: 'header',
187-
key: 'api_key',
188-
value: api_key_with_prefix('api_key')
189-
},
190183
'petstore_auth' =>
191184
{
192185
type: 'oauth2',
193186
in: 'header',
194187
key: 'Authorization',
195188
value: "Bearer #{access_token}"
196189
},
190+
'api_key' =>
191+
{
192+
type: 'api_key',
193+
in: 'header',
194+
key: 'api_key',
195+
value: api_key_with_prefix('api_key')
196+
},
197197
}
198198
end
199199
end

samples/client/petstore/ruby/lib/petstore/models/additional_properties_class.rb

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@
2626
module Petstore
2727

2828
class AdditionalPropertiesClass
29+
attr_accessor :map_property
30+
31+
attr_accessor :map_of_map_property
32+
33+
2934
# Attribute mapping from ruby-style variable name to JSON key.
3035
def self.attribute_map
3136
{
37+
:'map_property' => :'map_property',
38+
:'map_of_map_property' => :'map_of_map_property'
3239
}
3340
end
3441

3542
# Attribute type mapping.
3643
def self.swagger_types
3744
{
45+
:'map_property' => :'Hash<String, String>',
46+
:'map_of_map_property' => :'Hash<String, Hash<String, String>>'
3847
}
3948
end
4049

@@ -46,6 +55,18 @@ def initialize(attributes = {})
4655
# convert string to symbol for hash key
4756
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
4857

58+
if attributes.has_key?(:'map_property')
59+
if (value = attributes[:'map_property']).is_a?(Array)
60+
self.map_property = value
61+
end
62+
end
63+
64+
if attributes.has_key?(:'map_of_map_property')
65+
if (value = attributes[:'map_of_map_property']).is_a?(Array)
66+
self.map_of_map_property = value
67+
end
68+
end
69+
4970
end
5071

5172
# Show invalid properties with the reasons. Usually used together with valid?
@@ -58,13 +79,16 @@ def list_invalid_properties
5879
# Check to see if the all the properties in the model are valid
5980
# @return true if the model is valid
6081
def valid?
82+
return true
6183
end
6284

6385
# Checks equality by comparing each attribute.
6486
# @param [Object] Object to be compared
6587
def ==(o)
6688
return true if self.equal?(o)
67-
self.class == o.class
89+
self.class == o.class &&
90+
map_property == o.map_property &&
91+
map_of_map_property == o.map_of_map_property
6892
end
6993

7094
# @see the `==` method
@@ -76,7 +100,7 @@ def eql?(o)
76100
# Calculates hash code according to all attributes.
77101
# @return [Fixnum] Hash code
78102
def hash
79-
[].hash
103+
[map_property, map_of_map_property].hash
80104
end
81105

82106
# Builds the object from hash

samples/client/petstore/ruby/lib/petstore/models/array_test.rb

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,28 @@
2626
module Petstore
2727

2828
class ArrayTest
29+
attr_accessor :array_of_string
30+
31+
attr_accessor :array_array_of_integer
32+
33+
attr_accessor :array_array_of_model
34+
35+
2936
# Attribute mapping from ruby-style variable name to JSON key.
3037
def self.attribute_map
3138
{
39+
:'array_of_string' => :'array_of_string',
40+
:'array_array_of_integer' => :'array_array_of_integer',
41+
:'array_array_of_model' => :'array_array_of_model'
3242
}
3343
end
3444

3545
# Attribute type mapping.
3646
def self.swagger_types
3747
{
48+
:'array_of_string' => :'Array<String>',
49+
:'array_array_of_integer' => :'Array<Array<Integer>>',
50+
:'array_array_of_model' => :'Array<Array<ReadOnlyFirst>>'
3851
}
3952
end
4053

@@ -46,6 +59,24 @@ def initialize(attributes = {})
4659
# convert string to symbol for hash key
4760
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
4861

62+
if attributes.has_key?(:'array_of_string')
63+
if (value = attributes[:'array_of_string']).is_a?(Array)
64+
self.array_of_string = value
65+
end
66+
end
67+
68+
if attributes.has_key?(:'array_array_of_integer')
69+
if (value = attributes[:'array_array_of_integer']).is_a?(Array)
70+
self.array_array_of_integer = value
71+
end
72+
end
73+
74+
if attributes.has_key?(:'array_array_of_model')
75+
if (value = attributes[:'array_array_of_model']).is_a?(Array)
76+
self.array_array_of_model = value
77+
end
78+
end
79+
4980
end
5081

5182
# Show invalid properties with the reasons. Usually used together with valid?
@@ -58,13 +89,17 @@ def list_invalid_properties
5889
# Check to see if the all the properties in the model are valid
5990
# @return true if the model is valid
6091
def valid?
92+
return true
6193
end
6294

6395
# Checks equality by comparing each attribute.
6496
# @param [Object] Object to be compared
6597
def ==(o)
6698
return true if self.equal?(o)
67-
self.class == o.class
99+
self.class == o.class &&
100+
array_of_string == o.array_of_string &&
101+
array_array_of_integer == o.array_array_of_integer &&
102+
array_array_of_model == o.array_array_of_model
68103
end
69104

70105
# @see the `==` method
@@ -76,7 +111,7 @@ def eql?(o)
76111
# Calculates hash code according to all attributes.
77112
# @return [Fixnum] Hash code
78113
def hash
79-
[].hash
114+
[array_of_string, array_array_of_integer, array_array_of_model].hash
80115
end
81116

82117
# Builds the object from hash

samples/client/petstore/ruby/lib/petstore/models/mixed_properties_and_additional_properties_class.rb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,24 @@ class MixedPropertiesAndAdditionalPropertiesClass
3030

3131
attr_accessor :date_time
3232

33+
attr_accessor :map
34+
35+
3336
# Attribute mapping from ruby-style variable name to JSON key.
3437
def self.attribute_map
3538
{
3639
:'uuid' => :'uuid',
37-
:'date_time' => :'dateTime'
40+
:'date_time' => :'dateTime',
41+
:'map' => :'map'
3842
}
3943
end
4044

4145
# Attribute type mapping.
4246
def self.swagger_types
4347
{
4448
:'uuid' => :'String',
45-
:'date_time' => :'DateTime'
49+
:'date_time' => :'DateTime',
50+
:'map' => :'Hash<String, Animal>'
4651
}
4752
end
4853

@@ -62,6 +67,12 @@ def initialize(attributes = {})
6267
self.date_time = attributes[:'dateTime']
6368
end
6469

70+
if attributes.has_key?(:'map')
71+
if (value = attributes[:'map']).is_a?(Array)
72+
self.map = value
73+
end
74+
end
75+
6576
end
6677

6778
# Show invalid properties with the reasons. Usually used together with valid?
@@ -74,6 +85,7 @@ def list_invalid_properties
7485
# Check to see if the all the properties in the model are valid
7586
# @return true if the model is valid
7687
def valid?
88+
return true
7789
end
7890

7991
# Checks equality by comparing each attribute.
@@ -82,7 +94,8 @@ def ==(o)
8294
return true if self.equal?(o)
8395
self.class == o.class &&
8496
uuid == o.uuid &&
85-
date_time == o.date_time
97+
date_time == o.date_time &&
98+
map == o.map
8699
end
87100

88101
# @see the `==` method
@@ -94,7 +107,7 @@ def eql?(o)
94107
# Calculates hash code according to all attributes.
95108
# @return [Fixnum] Hash code
96109
def hash
97-
[uuid, date_time].hash
110+
[uuid, date_time, map].hash
98111
end
99112

100113
# Builds the object from hash

samples/client/petstore/ruby/lib/petstore/models/read_only_first.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ReadOnlyFirst
3030

3131
attr_accessor :baz
3232

33+
3334
# Attribute mapping from ruby-style variable name to JSON key.
3435
def self.attribute_map
3536
{
@@ -74,6 +75,7 @@ def list_invalid_properties
7475
# Check to see if the all the properties in the model are valid
7576
# @return true if the model is valid
7677
def valid?
78+
return true
7779
end
7880

7981
# Checks equality by comparing each attribute.

0 commit comments

Comments
 (0)