From 02283fae46fdae768fb0f61a1ea0f5aa2fb3ffbb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 19 Mar 2015 17:09:27 +0800 Subject: [PATCH] udpate ruby api client to support user-agent --- .../src/main/resources/ruby/swagger/configuration.mustache | 6 +++--- .../src/main/resources/ruby/swagger/request.mustache | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/ruby/swagger/configuration.mustache b/modules/swagger-codegen/src/main/resources/ruby/swagger/configuration.mustache index c0b3c46268c..1cf6e0dfa0e 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/swagger/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/swagger/configuration.mustache @@ -3,7 +3,7 @@ module Swagger class Configuration require 'swagger/version' - attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params + attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params, :user_agent # Defaults go in here.. def initialize @@ -11,7 +11,7 @@ module Swagger @scheme = 'http' @host = 'api.wordnik.com' @base_path = '/v4' - @user_agent = "ruby-#{Swagger::VERSION}" + @user_agent = "ruby-swagger-#{Swagger::VERSION}" @inject_format = true @force_ending_format = false @camelize_params = true @@ -19,4 +19,4 @@ module Swagger end -end \ No newline at end of file +end diff --git a/modules/swagger-codegen/src/main/resources/ruby/swagger/request.mustache b/modules/swagger-codegen/src/main/resources/ruby/swagger/request.mustache index 92b5cba810a..34401827982 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/swagger/request.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/swagger/request.mustache @@ -19,7 +19,8 @@ module Swagger # Set default headers default_headers = { 'Content-Type' => "application/#{attributes[:format].downcase}", - :api_key => Swagger.configuration.api_key + :api_key => Swagger.configuration.api_key, + 'User-Agent' => Swagger.configuration.user_agent } # api_key from headers hash trumps the default, even if its value is blank