diff --git a/modules/openapi-generator/src/main/resources/ruby/Rakefile.mustache b/modules/openapi-generator/src/main/resources/ruby/Rakefile.mustache index d52c3e31753908e47c66cf44d38282297a1faa72..c72ca30d454e1d9626eabe9afc37d197102c79cb 100644 --- a/modules/openapi-generator/src/main/resources/ruby/Rakefile.mustache +++ b/modules/openapi-generator/src/main/resources/ruby/Rakefile.mustache @@ -1,3 +1,5 @@ +require "bundler/gem_tasks" + begin require 'rspec/core/rake_task' diff --git a/samples/client/petstore-security-test/ruby/.gitignore b/samples/client/petstore-security-test/ruby/.gitignore index 4b91271a6d5cfe0c14f6a0387bc9d3be2a861057..05a17cb8f0a024108df9e50182cb6c1b647a6384 100644 --- a/samples/client/petstore-security-test/ruby/.gitignore +++ b/samples/client/petstore-security-test/ruby/.gitignore @@ -1,5 +1,5 @@ -# Generated by: https://github.com/swagger-api/swagger-codegen.git -# +# Generated by: https://openapi-generator.tech +# *.gem *.rbc diff --git a/samples/client/petstore-security-test/ruby/.openapi-generator/VERSION b/samples/client/petstore-security-test/ruby/.openapi-generator/VERSION index f9f7450d1359c082233b7926304d9af245dbc0ca..0628777500bdde84d037cbb2b618e44234116eb5 100644 --- a/samples/client/petstore-security-test/ruby/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/ruby/.openapi-generator/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +3.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/ruby/.rubocop.yml b/samples/client/petstore-security-test/ruby/.rubocop.yml new file mode 100644 index 0000000000000000000000000000000000000000..9bc9d341d8b6259762aed01db14e01631191f641 --- /dev/null +++ b/samples/client/petstore-security-test/ruby/.rubocop.yml @@ -0,0 +1,154 @@ +# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) +# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) +AllCops: + TargetRubyVersion: 2.2 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' + +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true + +# Do not use braces for hash literals when they are the last argument of a +# method call. +Style/BracesAroundHashParameters: + Enabled: true + EnforcedStyle: context_dependent + +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstParameterIndentation: + Enabled: true + +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: + Enabled: false + +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: rails + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: false + EnforcedStyle: always + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +# Check quotes usage according to lint rule below. +#Style/StringLiterals: +# Enabled: true +# EnforcedStyle: single_quotes + +# Detect hard tabs, no hard tabs. +Layout/Tab: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingBlankLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: + Enabled: false + +# Use quotes for string literals when they are enough. +Style/UnneededPercentQ: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Lint/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true diff --git a/samples/client/petstore-security-test/ruby/README.md b/samples/client/petstore-security-test/ruby/README.md index 02148d5025845451c327ad33ab25591780d63cdc..e6bda2db8899ec3116ed23e0ab5e998781485762 100644 --- a/samples/client/petstore-security-test/ruby/README.md +++ b/samples/client/petstore-security-test/ruby/README.md @@ -1,14 +1,14 @@ # petstore -Petstore - the Ruby gem for the Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +Petstore - the Ruby gem for the OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- -This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r - Package version: 1.0.0 -- Build package: io.swagger.codegen.languages.RubyClientCodegen +- Build package: org.openapitools.codegen.languages.RubyClientCodegen ## Installation @@ -55,9 +55,8 @@ Please follow the [installation](#installation) procedure and then run the follo require 'petstore' api_instance = Petstore::FakeApi.new - -opts = { - test_code_inject____end____rn_n_r: "test_code_inject____end____rn_n_r_example" # String | To test code injection */ ' \" =_end -- \\r\\n \\n \\r +opts = { + unknown_base_type: Petstore::UNKNOWN_BASE_TYPE.new # Object | } begin @@ -71,7 +70,7 @@ end ## Documentation for API Endpoints -All URIs are relative to *https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r* +All URIs are relative to *petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- diff --git a/samples/client/petstore-security-test/ruby/Rakefile b/samples/client/petstore-security-test/ruby/Rakefile index d52c3e31753908e47c66cf44d38282297a1faa72..c72ca30d454e1d9626eabe9afc37d197102c79cb 100644 --- a/samples/client/petstore-security-test/ruby/Rakefile +++ b/samples/client/petstore-security-test/ruby/Rakefile @@ -1,3 +1,5 @@ +require "bundler/gem_tasks" + begin require 'rspec/core/rake_task' diff --git a/samples/client/petstore-security-test/ruby/docs/FakeApi.md b/samples/client/petstore-security-test/ruby/docs/FakeApi.md index 43e3d617072de56b85134fe749653124f20d563d..8a1ba4a2894576711adc25d4052a4408fbbdcd6e 100644 --- a/samples/client/petstore-security-test/ruby/docs/FakeApi.md +++ b/samples/client/petstore-security-test/ruby/docs/FakeApi.md @@ -1,6 +1,6 @@ # Petstore::FakeApi -All URIs are relative to *https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r* +All URIs are relative to *petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -18,9 +18,8 @@ To test code injection */ ' \" =_end -- \\r\\n \\n \\r require 'petstore' api_instance = Petstore::FakeApi.new - -opts = { - test_code_inject____end____rn_n_r: "test_code_inject____end____rn_n_r_example" # String | To test code injection */ ' \" =_end -- \\r\\n \\n \\r +opts = { + unknown_base_type: Petstore::UNKNOWN_BASE_TYPE.new # Object | } begin @@ -35,7 +34,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **test_code_inject____end____rn_n_r** | **String**| To test code injection */ ' \" =_end -- \\r\\n \\n \\r | [optional] + **unknown_base_type** | [**Object**](UNKNOWN_BASE_TYPE.md)| | [optional] ### Return type @@ -48,7 +47,7 @@ No authorization required ### HTTP request headers - **Content-Type**: application/json, */ \" =_end -- - - **Accept**: application/json, */ \" =_end -- + - **Accept**: Not defined diff --git a/samples/client/petstore-security-test/ruby/git_push.sh b/samples/client/petstore-security-test/ruby/git_push.sh index 7cb1edb122bc077b8f763c1c16b87d355aca2649..b9fd6af8e0519cc68ca82dbb374cbfcb09ab6a1c 100644 --- a/samples/client/petstore-security-test/ruby/git_push.sh +++ b/samples/client/petstore-security-test/ruby/git_push.sh @@ -1,10 +1,10 @@ #!/bin/sh # -# Generated by: https://github.com/swagger-api/swagger-codegen.git +# Generated by: https://openapi-generator.tech # # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" git_user_id=$1 git_repo_id=$2 @@ -39,7 +39,7 @@ git_remote=`git remote` if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git else git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git diff --git a/samples/client/petstore-security-test/ruby/lib/petstore.rb b/samples/client/petstore-security-test/ruby/lib/petstore.rb index 5c6e14b6a4a8929f1a6233147b4c10ae54eb01e3..6a0ee148abf262bfc82f465d9769f6d43a87b61a 100644 --- a/samples/client/petstore-security-test/ruby/lib/petstore.rb +++ b/samples/client/petstore-security-test/ruby/lib/petstore.rb @@ -1,12 +1,12 @@ =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end diff --git a/samples/client/petstore-security-test/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore-security-test/ruby/lib/petstore/api/fake_api.rb index 62ba6e73b8faa705b3f3898704985fd2451c3f9d..ca46910658e35218672d5259f10f3196356d19bc 100644 --- a/samples/client/petstore-security-test/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore-security-test/ruby/lib/petstore/api/fake_api.rb @@ -1,16 +1,16 @@ =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end -require "uri" +require 'uri' module Petstore class FakeApi @@ -19,45 +19,39 @@ module Petstore def initialize(api_client = ApiClient.default) @api_client = api_client end - # To test code injection */ ' \" =_end -- \\r\\n \\n \\r - # # @param [Hash] opts the optional parameters - # @option opts [String] :test_code_inject____end____rn_n_r To test code injection */ ' \" =_end -- \\r\\n \\n \\r + # @option opts [Object] :unknown_base_type # @return [nil] def test_code_inject____end__rn_n_r(opts = {}) test_code_inject____end__rn_n_r_with_http_info(opts) - return nil + nil end # To test code injection */ ' \" =_end -- \\r\\n \\n \\r - # # @param [Hash] opts the optional parameters - # @option opts [String] :test_code_inject____end____rn_n_r To test code injection */ ' \" =_end -- \\r\\n \\n \\r + # @option opts [Object] :unknown_base_type # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def test_code_inject____end__rn_n_r_with_http_info(opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: FakeApi.test_code_inject____end__rn_n_r ..." + @api_client.config.logger.debug 'Calling API: FakeApi.test_code_inject____end__rn_n_r ...' end # resource path - local_var_path = "/fake" + local_var_path = '/fake' # query parameters query_params = {} # header parameters header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/ \" =_end -- ']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', '*/ \" =_end -- ']) # form parameters form_params = {} - form_params["test code inject */ ' " =end -- \r\n \n \r"] = opts[:'test_code_inject____end____rn_n_r'] if !opts[:'test_code_inject____end____rn_n_r'].nil? # http body (model) - post_body = nil + post_body = @api_client.object_to_http_body(opts[:'unknown_base_type']) auth_names = [] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, diff --git a/samples/client/petstore-security-test/ruby/lib/petstore/api_client.rb b/samples/client/petstore-security-test/ruby/lib/petstore/api_client.rb index 9c68cfea20d1f71dfac9af9d470c3cadd000ca4d..91ca28eba7960e4e4704685e8441ac818b9e656a 100644 --- a/samples/client/petstore-security-test/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore-security-test/ruby/lib/petstore/api_client.rb @@ -1,12 +1,12 @@ =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end @@ -31,9 +31,9 @@ module Petstore # @option config [Configuration] Configuration for initializing the object, default to Configuration.default def initialize(config = Configuration.default) @config = config - @user_agent = "Swagger-Codegen/#{VERSION}/ruby" + @user_agent = "OpenAPI-Generator/#{VERSION}/ruby" @default_headers = { - 'Content-Type' => "application/json", + 'Content-Type' => 'application/json', 'User-Agent' => @user_agent } end @@ -137,7 +137,7 @@ module Petstore # @param [String] mime MIME # @return [Boolean] True if the MIME is application/json def json_mime?(mime) - (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? end # Deserialize the response to the given return type. @@ -201,12 +201,12 @@ module Petstore when /\AArray<(.+)>\z/ # e.g. Array<Pet> sub_type = $1 - data.map {|item| convert_to_type(item, sub_type) } + data.map { |item| convert_to_type(item, sub_type) } when /\AHash\<String, (.+)\>\z/ # e.g. Hash<String, Integer> sub_type = $1 {}.tap do |hash| - data.each {|k, v| hash[k] = convert_to_type(v, sub_type) } + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else # models, e.g. Pet @@ -228,7 +228,7 @@ module Petstore encoding = nil request.on_headers do |response| content_disposition = response.headers['Content-Disposition'] - if content_disposition and content_disposition =~ /filename=/i + if content_disposition && content_disposition =~ /filename=/i filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] prefix = sanitize_filename(filename) else @@ -314,7 +314,7 @@ module Petstore # Sets user agent in HTTP header # - # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0) + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) def user_agent=(user_agent) @user_agent = user_agent @default_headers['User-Agent'] = @user_agent @@ -327,7 +327,7 @@ module Petstore return nil if accepts.nil? || accepts.empty? # use JSON when present, otherwise use all of the provided json_accept = accepts.find { |s| json_mime?(s) } - return json_accept || accepts.join(',') + json_accept || accepts.join(',') end # Return Content-Type header based on an array of content types provided. @@ -338,7 +338,7 @@ module Petstore return 'application/json' if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } - return json_content_type || content_types.first + json_content_type || content_types.first end # Convert object (array, hash, object, etc) to JSON string. @@ -348,7 +348,7 @@ module Petstore return model if model.nil? || model.is_a?(String) local_body = nil if model.is_a?(Array) - local_body = model.map{|m| object_to_hash(m) } + local_body = model.map { |m| object_to_hash(m) } else local_body = object_to_hash(model) end diff --git a/samples/client/petstore-security-test/ruby/lib/petstore/api_error.rb b/samples/client/petstore-security-test/ruby/lib/petstore/api_error.rb index 27fd7c1a8ef53d918409fa351c0f9eca2fb298c5..60ad3a2897125a707ed651e4b354885ec5a7d33c 100644 --- a/samples/client/petstore-security-test/ruby/lib/petstore/api_error.rb +++ b/samples/client/petstore-security-test/ruby/lib/petstore/api_error.rb @@ -1,12 +1,12 @@ =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end diff --git a/samples/client/petstore-security-test/ruby/lib/petstore/configuration.rb b/samples/client/petstore-security-test/ruby/lib/petstore/configuration.rb index 78fcfc160301aabcb3d47bb0957e535ef1e3da3d..443bc284566862daaf39941c722b51ada86acca7 100644 --- a/samples/client/petstore-security-test/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore-security-test/ruby/lib/petstore/configuration.rb @@ -1,12 +1,12 @@ =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end @@ -128,9 +128,9 @@ module Petstore attr_accessor :force_ending_format def initialize - @scheme = 'https' - @host = 'petstore.swagger.io */ ' " =end -- \r\n \n \r' - @base_path = '/v2 */ ' \" =_end -- \\r\\n \\n \\r' + @scheme = 'http' + @host = 'localhost' + @base_path = '' @api_key = {} @api_key_prefix = {} @timeout = 0 @@ -170,7 +170,7 @@ module Petstore def base_path=(base_path) # Add leading and trailing slashes to base_path @base_path = "/#{base_path}".gsub(/\/+/, '/') - @base_path = "" if @base_path == "/" + @base_path = '' if @base_path == '/' end def base_url diff --git a/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb index 9e6ffd465a7ea3e9b723b6eb3c7df7ce3c4c05ac..7d5376a453ceea9834f6162d097911d25fa70a92 100644 --- a/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore-security-test/ruby/lib/petstore/models/model_return.rb @@ -1,12 +1,12 @@ =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end @@ -18,7 +18,6 @@ module Petstore # property description */ ' \" =_end -- \\r\\n \\n \\r attr_accessor :_return - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -27,7 +26,7 @@ module Petstore end # Attribute type mapping. - def self.swagger_types + def self.openapi_types { :'_return' => :'Integer' } @@ -39,25 +38,24 @@ module Petstore return unless attributes.is_a?(Hash) # convert string to symbol for hash key - attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'return') self._return = attributes[:'return'] end - end # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properies with the reasons + # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new - return invalid_properties + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - return true + true end # Checks equality by comparing each attribute. @@ -85,12 +83,12 @@ module Petstore # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.swagger_types.each_pair do |key, type| + self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) @@ -172,7 +170,7 @@ module Petstore # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) - value.compact.map{ |v| _to_hash(v) } + value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } @@ -183,7 +181,5 @@ module Petstore value end end - end - end diff --git a/samples/client/petstore-security-test/ruby/lib/petstore/version.rb b/samples/client/petstore-security-test/ruby/lib/petstore/version.rb index c6ba3189c5229c52ca8405736041b1c53d4e1d3f..2eeee16e7113ad72ee0c0cf6e664a978d027e14c 100644 --- a/samples/client/petstore-security-test/ruby/lib/petstore/version.rb +++ b/samples/client/petstore-security-test/ruby/lib/petstore/version.rb @@ -1,15 +1,15 @@ =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end module Petstore - VERSION = "1.0.0" + VERSION = '1.0.0' end diff --git a/samples/client/petstore-security-test/ruby/petstore.gemspec b/samples/client/petstore-security-test/ruby/petstore.gemspec index b525d76e62c17e4aa07a8341ddac66ccde258dd0..8249b9d2537d041ce8dd2318eb663d538960b4d9 100644 --- a/samples/client/petstore-security-test/ruby/petstore.gemspec +++ b/samples/client/petstore-security-test/ruby/petstore.gemspec @@ -1,14 +1,14 @@ # -*- encoding: utf-8 -*- -# + =begin -#Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r +#OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r -Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.3.0-SNAPSHOT +Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 3.1.0-SNAPSHOT =end @@ -19,13 +19,12 @@ Gem::Specification.new do |s| s.name = "petstore" s.version = Petstore::VERSION s.platform = Gem::Platform::RUBY - s.authors = ["Swagger-Codegen"] - s.email = ["apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r"] - s.homepage = "https://github.com/swagger-api/swagger-codegen" - s.summary = "Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r Ruby Gem" + s.authors = ["OpenAPI-Generator"] + s.email = ["something@something.abc */ ' \" =_end -- \\r\\n \\n \\r"] + s.homepage = "https://openapi-generator.tech" + s.summary = "OpenAPI Petstore */ ' \" =_end -- \\r\\n \\n \\r Ruby Gem" s.description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end -- " - # TODO uncomment and update below with a proper license - #s.license = "Apache 2.0" + s.license = "Unlicense" s.required_ruby_version = ">= 1.9" s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' @@ -39,7 +38,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16' s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12' - s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? } + s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } s.test_files = `find spec/*`.split("\n") s.executables = [] s.require_paths = ["lib"] diff --git a/samples/client/petstore/ruby/Rakefile b/samples/client/petstore/ruby/Rakefile index d52c3e31753908e47c66cf44d38282297a1faa72..c72ca30d454e1d9626eabe9afc37d197102c79cb 100644 --- a/samples/client/petstore/ruby/Rakefile +++ b/samples/client/petstore/ruby/Rakefile @@ -1,3 +1,5 @@ +require "bundler/gem_tasks" + begin require 'rspec/core/rake_task'