update user-agent for Ruby

This commit is contained in:
wing328 2016-03-14 21:57:51 +08:00
parent df8d4fd8b8
commit e10c28596c
11 changed files with 67 additions and 78 deletions

View File

@ -115,7 +115,7 @@ public class Generate implements Runnable {
@Option(name = {"--release-note"}, title = "release note", description = CodegenConstants.RELEASE_NOTE_DESC)
private String releaseNote;
@Option(name = {"--http-user-agent"}, title = "http user agent", description = CodegenConstants.HTTP_USER_AGENT)
@Option(name = {"--http-user-agent"}, title = "http user agent", description = CodegenConstants.HTTP_USER_AGENT_DESC)
private String httpUserAgent;
@Override

View File

@ -101,6 +101,6 @@ public class CodegenConstants {
public static final String RELEASE_NOTE_DESC = "Release note, default to 'Minor update'.";
public static final String HTTP_USER_AGENT = "httpUserAgent";
public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{releaseVersion}}/{language}'";
public static final String HTTP_USER_AGENT_DESC = "HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{packageVersion}}/{language}'";
}

View File

@ -21,7 +21,7 @@ module {{moduleName}}
def initialize(config = Configuration.default)
@config = config
@user_agent = "ruby-swagger-#{VERSION}"
@user_agent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/#{VERSION}/ruby{{/httpUserAgent}}"
@default_headers = {
'Content-Type' => "application/json",
'User-Agent' => @user_agent

View File

@ -6,7 +6,7 @@ Version: 1.0.0
Automatically generated by the Ruby Swagger Codegen project:
- Build date: 2016-03-14T15:33:44.953+08:00
- Build date: 2016-03-14T21:56:19.858+08:00
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
## Installation
@ -119,25 +119,10 @@ Class | Method | HTTP request | Description
## Documentation for Authorization
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
-- write:pets: modify pets in your account
-- read:pets: read your pets
### test_api_client_id
### test_api_key_header
- **Type**: API key
- **API key parameter name**: x-test_api_client_id
- **Location**: HTTP header
### test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **API key parameter name**: test_api_key_header
- **Location**: HTTP header
### api_key
@ -150,15 +135,30 @@ Class | Method | HTTP request | Description
- **Type**: HTTP basic authentication
### test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **Location**: HTTP header
### test_api_client_id
- **Type**: API key
- **API key parameter name**: x-test_api_client_id
- **Location**: HTTP header
### test_api_key_query
- **Type**: API key
- **API key parameter name**: test_api_key_query
- **Location**: URL query string
### test_api_key_header
### petstore_auth
- **Type**: API key
- **API key parameter name**: test_api_key_header
- **Location**: HTTP header
- **Type**: OAuth
- **Flow**: implicit
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
-- write:pets: modify pets in your account
-- read:pets: read your pets

View File

@ -3,11 +3,11 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**photo_urls** | **Array<String>** | | [optional]
**name** | **String** | | [optional]
**tags** | [**Array<Tag>**](Tag.md) | | [optional]
**id** | **Integer** | |
**category** | **Object** | | [optional]
**tags** | [**Array<Tag>**](Tag.md) | | [optional]
**status** | **String** | pet status in the store | [optional]
**name** | **String** | | [optional]
**photo_urls** | **Array<String>** | | [optional]

View File

@ -284,13 +284,13 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
require 'petstore'
Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN"
# Configure API key authorization: api_key
config.api_key['api_key'] = "YOUR API KEY"
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
#config.api_key_prefix['api_key'] = "Token"
# Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN"
end
api = Petstore::PetApi.new
@ -318,7 +318,7 @@ Name | Type | Description | Notes
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
@ -339,13 +339,13 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
require 'petstore'
Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN"
# Configure API key authorization: api_key
config.api_key['api_key'] = "YOUR API KEY"
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
#config.api_key_prefix['api_key'] = "Token"
# Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN"
end
api = Petstore::PetApi.new
@ -373,7 +373,7 @@ Name | Type | Description | Notes
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers
@ -394,13 +394,13 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API erro
require 'petstore'
Petstore.configure do |config|
# Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN"
# Configure API key authorization: api_key
config.api_key['api_key'] = "YOUR API KEY"
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
#config.api_key_prefix['api_key'] = "Token"
# Configure OAuth2 access token for authorization: petstore_auth
config.access_token = "YOUR ACCESS TOKEN"
end
api = Petstore::PetApi.new
@ -428,7 +428,7 @@ Name | Type | Description | Notes
### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key)
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers

View File

@ -218,15 +218,15 @@ For valid response try integer IDs with value <= 5 or > 10. Other values w
require 'petstore'
Petstore.configure do |config|
# Configure API key authorization: test_api_key_query
config.api_key['test_api_key_query'] = "YOUR API KEY"
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
#config.api_key_prefix['test_api_key_query'] = "Token"
# Configure API key authorization: test_api_key_header
config.api_key['test_api_key_header'] = "YOUR API KEY"
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
#config.api_key_prefix['test_api_key_header'] = "Token"
# Configure API key authorization: test_api_key_query
config.api_key['test_api_key_query'] = "YOUR API KEY"
# Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to nil)
#config.api_key_prefix['test_api_key_query'] = "Token"
end
api = Petstore::StoreApi.new
@ -254,7 +254,7 @@ Name | Type | Description | Notes
### Authorization
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header)
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
### HTTP reuqest headers

View File

@ -23,8 +23,6 @@ This can only be done by the logged in user.
### Example
```ruby
require 'petstore'
api = Petstore::UserApi.new
opts = {
@ -68,8 +66,6 @@ Creates list of users with given input array
### Example
```ruby
require 'petstore'
api = Petstore::UserApi.new
opts = {
@ -113,8 +109,6 @@ Creates list of users with given input array
### Example
```ruby
require 'petstore'
api = Petstore::UserApi.new
opts = {
@ -158,8 +152,6 @@ This can only be done by the logged in user.
### Example
```ruby
require 'petstore'
Petstore.configure do |config|
# Configure HTTP basic authorization: test_http_basic
config.username = 'YOUR USERNAME'
@ -208,8 +200,6 @@ Get user by user name
### Example
```ruby
require 'petstore'
api = Petstore::UserApi.new
username = "username_example" # [String] The name that needs to be fetched. Use user1 for testing.
@ -217,7 +207,6 @@ username = "username_example" # [String] The name that needs to be fetched. Use
begin
result = api.get_user_by_name(username)
p result
rescue Petstore::ApiError => e
puts "Exception when calling get_user_by_name: #{e}"
end
@ -253,8 +242,6 @@ Logs user into the system
### Example
```ruby
require 'petstore'
api = Petstore::UserApi.new
opts = {
@ -264,7 +251,6 @@ opts = {
begin
result = api.login_user(opts)
p result
rescue Petstore::ApiError => e
puts "Exception when calling login_user: #{e}"
end
@ -301,8 +287,6 @@ Logs out current logged in user session
### Example
```ruby
require 'petstore'
api = Petstore::UserApi.new
begin
@ -339,8 +323,6 @@ This can only be done by the logged in user.
### Example
```ruby
require 'petstore'
api = Petstore::UserApi.new
username = "username_example" # [String] name that need to be deleted

View File

@ -33,7 +33,7 @@ module Petstore
def initialize(config = Configuration.default)
@config = config
@user_agent = "ruby-swagger-#{VERSION}"
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
@default_headers = {
'Content-Type' => "application/json",
'User-Agent' => @user_agent

View File

@ -171,6 +171,13 @@ module Petstore
key: 'x-test_api_client_id',
value: api_key_with_prefix('x-test_api_client_id')
},
'test_http_basic' =>
{
type: 'basic',
in: 'header',
key: 'Authorization',
value: basic_auth_token
},
'test_api_client_secret' =>
{
type: 'api_key',

View File

@ -36,17 +36,7 @@ describe 'InlineResponse200' do
@instance.should be_a(Petstore::InlineResponse200)
end
end
describe 'test attribute "photo_urls"' do
it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
describe 'test attribute "name"' do
describe 'test attribute "tags"' do
it 'should work' do
# assertion here
# should be_a()
@ -76,16 +66,6 @@ describe 'InlineResponse200' do
end
end
describe 'test attribute "tags"' do
it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
describe 'test attribute "status"' do
it 'should work' do
# assertion here
@ -96,5 +76,25 @@ describe 'InlineResponse200' do
end
end
describe 'test attribute "name"' do
it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
describe 'test attribute "photo_urls"' do
it 'should work' do
# assertion here
# should be_a()
# should be_nil
# should ==
# should_not ==
end
end
end