diff --git a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java index c44088473e6..8c7beab502b 100644 --- a/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java +++ b/modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/cmd/Generate.java @@ -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 diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java index a43c8f8c986..1d97fe829b8 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java @@ -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}'"; } diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache index d13ad44e5a2..e6e9ccc7fd6 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache @@ -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 diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index f708fabd397..7cbfdadfc67 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -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 diff --git a/samples/client/petstore/ruby/docs/InlineResponse200.md b/samples/client/petstore/ruby/docs/InlineResponse200.md index d06f729f2f8..c3b0d978c07 100644 --- a/samples/client/petstore/ruby/docs/InlineResponse200.md +++ b/samples/client/petstore/ruby/docs/InlineResponse200.md @@ -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] diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index d1ce71a0e06..8dd272ccd37 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -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 diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index f3bab7e3d69..0b38f5b6fed 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -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 diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index c629e696410..284c5e3a314 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -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 diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index bb99e08be70..7ec9de18a3e 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -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 diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index a5c37d54e9c..94a1b566a1e 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -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', diff --git a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb index 241a2ded1d1..858b6504908 100644 --- a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb +++ b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb @@ -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,7 +66,7 @@ describe 'InlineResponse200' do end end - describe 'test attribute "tags"' do + describe 'test attribute "status"' do it 'should work' do # assertion here # should be_a() @@ -86,7 +76,17 @@ describe 'InlineResponse200' do end end - describe 'test attribute "status"' do + 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()