Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@ module {{moduleName}}
end

unless response.success?
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_body => response.body),
response.status_message
if response.timed_out?
fail ApiError.new('Connection timed out')
elsif response.code == 0
# Errors from libcurl will be made visible here
fail ApiError.new(:code => 0,
:message => response.return_message)
else
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_body => response.body),
response.status_message
end
end

if opts[:return_type]
Expand Down
18 changes: 9 additions & 9 deletions samples/client/petstore-security-test/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/

- API version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
- Package version: 1.0.0
- Build date: 2016-07-14T18:21:54.437+08:00
- Build date: 2016-08-29T14:24:34.432-07:00
- Build package: class io.swagger.codegen.languages.RubyClientCodegen

## Installation
Expand Down Expand Up @@ -87,18 +87,18 @@ Class | Method | HTTP request | Description
## Documentation for Authorization


### api_key

- **Type**: API key
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header

### petstore_auth

- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account */ ' " =end -- \r\n \n \r
- read:pets: read your pets */ ' " =end -- \r\n \n \r
- write:pets: modify pets in your account */ ' \" =_end -- \\r\\n \\n \\r
- read:pets: read your pets */ ' \" =_end -- \\r\\n \\n \\r

### api_key

- **Type**: API key
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header

Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,18 @@ def call_api(http_method, path, opts = {})
end

unless response.success?
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_body => response.body),
response.status_message
if response.timed_out?
fail ApiError.new('Connection timed out')
elsif response.code == 0
# Errors from libcurl will be made visible here
fail ApiError.new(:code => 0,
:message => response.return_message)
else
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_body => response.body),
response.status_message
end
end

if opts[:return_type]
Expand Down Expand Up @@ -288,7 +296,7 @@ def build_request_body(header_params, form_params, body)
# Update hearder and query params based on authentication settings.
#
# @param [Hash] header_params Header parameters
# @param [Hash] form_params Query parameters
# @param [Hash] query_params Query parameters
# @param [String] auth_names Authentication scheme name
def update_params_for_auth!(header_params, query_params, auth_names)
Array(auth_names).each do |auth_name|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,20 @@ def basic_auth_token
# Returns Auth Settings hash for api client.
def auth_settings
{
'api_key' =>
{
type: 'api_key',
in: 'header',
key: 'api_key */ ' " =end -- \r\n \n \r',
value: api_key_with_prefix('api_key */ ' " =end -- \r\n \n \r')
},
'petstore_auth' =>
{
type: 'oauth2',
in: 'header',
key: 'Authorization',
value: "Bearer #{access_token}"
},
'api_key' =>
{
type: 'api_key',
in: 'header',
key: 'api_key */ ' " =end -- \r\n \n \r',
value: api_key_with_prefix('api_key */ ' " =end -- \r\n \n \r')
},
}
end
end
Expand Down
14 changes: 7 additions & 7 deletions samples/client/petstore/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-08-22T16:46:39.641+08:00
- Build date: 2016-08-29T14:24:29.182-07:00
- Build package: class io.swagger.codegen.languages.RubyClientCodegen

## Installation
Expand Down Expand Up @@ -137,12 +137,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
Expand All @@ -156,3 +150,9 @@ Class | Method | HTTP request | Description

- **Type**: HTTP basic authentication

### api_key

- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header

16 changes: 12 additions & 4 deletions samples/client/petstore/ruby/lib/petstore/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,18 @@ def call_api(http_method, path, opts = {})
end

unless response.success?
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_body => response.body),
response.status_message
if response.timed_out?
fail ApiError.new('Connection timed out')
elsif response.code == 0
# Errors from libcurl will be made visible here
fail ApiError.new(:code => 0,
:message => response.return_message)
else
fail ApiError.new(:code => response.code,
:response_headers => response.headers,
:response_body => response.body),
response.status_message
end
end

if opts[:return_type]
Expand Down
14 changes: 7 additions & 7 deletions samples/client/petstore/ruby/lib/petstore/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,6 @@ def basic_auth_token
# 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',
Expand All @@ -222,6 +215,13 @@ def auth_settings
key: 'Authorization',
value: basic_auth_token
},
'api_key' =>
{
type: 'api_key',
in: 'header',
key: 'api_key',
value: api_key_with_prefix('api_key')
},
}
end
end
Expand Down