Skip to content

Commit 183af97

Browse files
committed
Merge branch 'chadrosen-update-ruby-sample'
2 parents 90857e8 + 3b02249 commit 183af97

File tree

4 files changed

+18
-64
lines changed

4 files changed

+18
-64
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-06-28T17:36:56.204+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
@@ -134,12 +134,6 @@ Class | Method | HTTP request | Description
134134
## Documentation for Authorization
135135

136136

137-
### api_key
138-
139-
- **Type**: API key
140-
- **API key parameter name**: api_key
141-
- **Location**: HTTP header
142-
143137
### petstore_auth
144138

145139
- **Type**: OAuth
@@ -149,3 +143,9 @@ Class | Method | HTTP request | Description
149143
- write:pets: modify pets in your account
150144
- read:pets: read your pets
151145

146+
### api_key
147+
148+
- **Type**: API key
149+
- **API key parameter name**: api_key
150+
- **Location**: HTTP header
151+

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ Name | Type | Description | Notes
66
**array_of_string** | **Array<String>** | | [optional]
77
**array_array_of_integer** | **Array<Array<Integer>>** | | [optional]
88
**array_array_of_model** | **Array<Array<ReadOnlyFirst>>** | | [optional]
9-
**array_of_enum** | **Array<String>** | | [optional]
109

1110

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,20 @@ def basic_auth_token
188188
# Returns Auth Settings hash for api client.
189189
def auth_settings
190190
{
191-
'api_key' =>
192-
{
193-
type: 'api_key',
194-
in: 'header',
195-
key: 'api_key',
196-
value: api_key_with_prefix('api_key')
197-
},
198191
'petstore_auth' =>
199192
{
200193
type: 'oauth2',
201194
in: 'header',
202195
key: 'Authorization',
203196
value: "Bearer #{access_token}"
204197
},
198+
'api_key' =>
199+
{
200+
type: 'api_key',
201+
in: 'header',
202+
key: 'api_key',
203+
value: api_key_with_prefix('api_key')
204+
},
205205
}
206206
end
207207
end

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

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,12 @@ class ArrayTest
3232

3333
attr_accessor :array_array_of_model
3434

35-
attr_accessor :array_of_enum
36-
37-
class EnumAttributeValidator
38-
attr_reader :datatype
39-
attr_reader :allowable_values
40-
41-
def initialize(datatype, allowable_values)
42-
@allowable_values = allowable_values.map do |value|
43-
case datatype.to_s
44-
when /Integer/i
45-
value.to_i
46-
when /Float/i
47-
value.to_f
48-
else
49-
value
50-
end
51-
end
52-
end
53-
54-
def valid?(value)
55-
!value || allowable_values.include?(value)
56-
end
57-
end
58-
5935
# Attribute mapping from ruby-style variable name to JSON key.
6036
def self.attribute_map
6137
{
6238
:'array_of_string' => :'array_of_string',
6339
:'array_array_of_integer' => :'array_array_of_integer',
64-
:'array_array_of_model' => :'array_array_of_model',
65-
:'array_of_enum' => :'array_of_enum'
40+
:'array_array_of_model' => :'array_array_of_model'
6641
}
6742
end
6843

@@ -71,8 +46,7 @@ def self.swagger_types
7146
{
7247
:'array_of_string' => :'Array<String>',
7348
:'array_array_of_integer' => :'Array<Array<Integer>>',
74-
:'array_array_of_model' => :'Array<Array<ReadOnlyFirst>>',
75-
:'array_of_enum' => :'Array<String>'
49+
:'array_array_of_model' => :'Array<Array<ReadOnlyFirst>>'
7650
}
7751
end
7852

@@ -102,12 +76,6 @@ def initialize(attributes = {})
10276
end
10377
end
10478

105-
if attributes.has_key?(:'array_of_enum')
106-
if (value = attributes[:'array_of_enum']).is_a?(Array)
107-
self.array_of_enum = value
108-
end
109-
end
110-
11179
end
11280

11381
# Show invalid properties with the reasons. Usually used together with valid?
@@ -120,30 +88,17 @@ def list_invalid_properties
12088
# Check to see if the all the properties in the model are valid
12189
# @return true if the model is valid
12290
def valid?
123-
array_of_enum_validator = EnumAttributeValidator.new('Array<String>', [])
124-
return false unless array_of_enum_validator.valid?(@array_of_enum)
12591
return true
12692
end
12793

128-
# Custom attribute writer method checking allowed values (enum).
129-
# @param [Object] array_of_enum Object to be assigned
130-
def array_of_enum=(array_of_enum)
131-
validator = EnumAttributeValidator.new('Array<String>', [])
132-
unless validator.valid?(array_of_enum)
133-
fail ArgumentError, "invalid value for 'array_of_enum', must be one of #{validator.allowable_values}."
134-
end
135-
@array_of_enum = array_of_enum
136-
end
137-
13894
# Checks equality by comparing each attribute.
13995
# @param [Object] Object to be compared
14096
def ==(o)
14197
return true if self.equal?(o)
14298
self.class == o.class &&
14399
array_of_string == o.array_of_string &&
144100
array_array_of_integer == o.array_array_of_integer &&
145-
array_array_of_model == o.array_array_of_model &&
146-
array_of_enum == o.array_of_enum
101+
array_array_of_model == o.array_array_of_model
147102
end
148103

149104
# @see the `==` method
@@ -155,7 +110,7 @@ def eql?(o)
155110
# Calculates hash code according to all attributes.
156111
# @return [Fixnum] Hash code
157112
def hash
158-
[array_of_string, array_array_of_integer, array_array_of_model, array_of_enum].hash
113+
[array_of_string, array_array_of_integer, array_array_of_model].hash
159114
end
160115

161116
# Builds the object from hash

0 commit comments

Comments
 (0)