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 485bcb3cf81..5ed22afb151 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/swagger/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/swagger/configuration.mustache @@ -7,6 +7,14 @@ module {{moduleName}} :scheme, :host, :base_path, :user_agent, :debug, :logger, :inject_format, :force_ending_format, :camelize_params, :user_agent, :verify_ssl + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + # Defaults go in here.. def initialize @format = 'json' 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 ef2103766e4..c05167c7fdc 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/swagger/request.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/swagger/request.mustache @@ -166,6 +166,7 @@ module {{moduleName}} def make request_options = { :ssl_verifypeer => Swagger.configuration.verify_ssl, + :cainfo => Swagger.configuration.ssl_ca_cert, :headers => self.headers.stringify_keys, :verbose => Swagger.configuration.debug } diff --git a/samples/client/petstore/ruby/lib/swagger_client/swagger/configuration.rb b/samples/client/petstore/ruby/lib/swagger_client/swagger/configuration.rb index b4d8b33d90d..9ed1673eff1 100644 --- a/samples/client/petstore/ruby/lib/swagger_client/swagger/configuration.rb +++ b/samples/client/petstore/ruby/lib/swagger_client/swagger/configuration.rb @@ -7,6 +7,14 @@ module SwaggerClient :scheme, :host, :base_path, :user_agent, :debug, :logger, :inject_format, :force_ending_format, :camelize_params, :user_agent, :verify_ssl + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + # Defaults go in here.. def initialize @format = 'json' diff --git a/samples/client/petstore/ruby/lib/swagger_client/swagger/request.rb b/samples/client/petstore/ruby/lib/swagger_client/swagger/request.rb index 4cc88016500..df0987b0d22 100644 --- a/samples/client/petstore/ruby/lib/swagger_client/swagger/request.rb +++ b/samples/client/petstore/ruby/lib/swagger_client/swagger/request.rb @@ -165,6 +165,7 @@ module SwaggerClient def make request_options = { :ssl_verifypeer => Swagger.configuration.verify_ssl, + :cainfo => Swagger.configuration.ssl_ca_cert, :headers => self.headers.stringify_keys, :verbose => Swagger.configuration.debug }