forked from loafle/openapi-generator-original
[Ruby] Make rake tasks required to publish gem available (#424)
* Make tasks reuired to publish gem available https://github.com/OpenAPITools/openapi-generator/issues/423 * Update samples - bin/ruby-petstore.sh - bin/security/ruby-petstore.sh
This commit is contained in:
parent
a02b313b89
commit
8bddf12e05
@ -1,3 +1,5 @@
|
|||||||
|
require "bundler/gem_tasks"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'rspec/core/rake_task'
|
require 'rspec/core/rake_task'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
# Generated by: https://openapi-generator.tech
|
||||||
#
|
#
|
||||||
|
|
||||||
*.gem
|
*.gem
|
||||||
|
@ -1 +1 @@
|
|||||||
2.3.0-SNAPSHOT
|
3.1.0-SNAPSHOT
|
154
samples/client/petstore-security-test/ruby/.rubocop.yml
Normal file
154
samples/client/petstore-security-test/ruby/.rubocop.yml
Normal file
@ -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
|
@ -1,14 +1,14 @@
|
|||||||
# petstore
|
# 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 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
|
- API version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
- Package version: 1.0.0
|
- Package version: 1.0.0
|
||||||
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -55,9 +55,8 @@ Please follow the [installation](#installation) procedure and then run the follo
|
|||||||
require 'petstore'
|
require 'petstore'
|
||||||
|
|
||||||
api_instance = Petstore::FakeApi.new
|
api_instance = Petstore::FakeApi.new
|
||||||
|
|
||||||
opts = {
|
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
|
unknown_base_type: Petstore::UNKNOWN_BASE_TYPE.new # Object |
|
||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -71,7 +70,7 @@ end
|
|||||||
|
|
||||||
## Documentation for API Endpoints
|
## 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
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
require "bundler/gem_tasks"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'rspec/core/rake_task'
|
require 'rspec/core/rake_task'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Petstore::FakeApi
|
# 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
|
Method | HTTP request | Description
|
||||||
------------- | ------------- | -------------
|
------------- | ------------- | -------------
|
||||||
@ -18,9 +18,8 @@ To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
|||||||
require 'petstore'
|
require 'petstore'
|
||||||
|
|
||||||
api_instance = Petstore::FakeApi.new
|
api_instance = Petstore::FakeApi.new
|
||||||
|
|
||||||
opts = {
|
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
|
unknown_base_type: Petstore::UNKNOWN_BASE_TYPE.new # Object |
|
||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -35,7 +34,7 @@ end
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
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
|
### Return type
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ No authorization required
|
|||||||
### HTTP request headers
|
### HTTP request headers
|
||||||
|
|
||||||
- **Content-Type**: application/json, */ \" =_end --
|
- **Content-Type**: application/json, */ \" =_end --
|
||||||
- **Accept**: application/json, */ \" =_end --
|
- **Accept**: Not defined
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/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/
|
# 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_user_id=$1
|
||||||
git_repo_id=$2
|
git_repo_id=$2
|
||||||
@ -39,7 +39,7 @@ git_remote=`git remote`
|
|||||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
if [ "$GIT_TOKEN" = "" ]; then
|
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
|
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
||||||
else
|
else
|
||||||
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
require "uri"
|
require 'uri'
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
class FakeApi
|
class FakeApi
|
||||||
@ -19,45 +19,39 @@ module Petstore
|
|||||||
def initialize(api_client = ApiClient.default)
|
def initialize(api_client = ApiClient.default)
|
||||||
@api_client = api_client
|
@api_client = api_client
|
||||||
end
|
end
|
||||||
|
|
||||||
# To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
# To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
#
|
|
||||||
# @param [Hash] opts the optional parameters
|
# @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]
|
# @return [nil]
|
||||||
def test_code_inject____end__rn_n_r(opts = {})
|
def test_code_inject____end__rn_n_r(opts = {})
|
||||||
test_code_inject____end__rn_n_r_with_http_info(opts)
|
test_code_inject____end__rn_n_r_with_http_info(opts)
|
||||||
return nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
# To test code injection */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
#
|
|
||||||
# @param [Hash] opts the optional parameters
|
# @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
|
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||||
def test_code_inject____end__rn_n_r_with_http_info(opts = {})
|
def test_code_inject____end__rn_n_r_with_http_info(opts = {})
|
||||||
if @api_client.config.debugging
|
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
|
end
|
||||||
# resource path
|
# resource path
|
||||||
local_var_path = "/fake"
|
local_var_path = '/fake'
|
||||||
|
|
||||||
# query parameters
|
# query parameters
|
||||||
query_params = {}
|
query_params = {}
|
||||||
|
|
||||||
# header parameters
|
# header parameters
|
||||||
header_params = {}
|
header_params = {}
|
||||||
# HTTP header 'Accept' (if needed)
|
|
||||||
header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/ \" =_end -- '])
|
|
||||||
# HTTP header 'Content-Type'
|
# HTTP header 'Content-Type'
|
||||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', '*/ \" =_end -- '])
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', '*/ \" =_end -- '])
|
||||||
|
|
||||||
# form parameters
|
# form parameters
|
||||||
form_params = {}
|
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)
|
# http body (model)
|
||||||
post_body = nil
|
post_body = @api_client.object_to_http_body(opts[:'unknown_base_type'])
|
||||||
auth_names = []
|
auth_names = []
|
||||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
@ -31,9 +31,9 @@ module Petstore
|
|||||||
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
||||||
def initialize(config = Configuration.default)
|
def initialize(config = Configuration.default)
|
||||||
@config = config
|
@config = config
|
||||||
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
|
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
||||||
@default_headers = {
|
@default_headers = {
|
||||||
'Content-Type' => "application/json",
|
'Content-Type' => 'application/json',
|
||||||
'User-Agent' => @user_agent
|
'User-Agent' => @user_agent
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -137,7 +137,7 @@ module Petstore
|
|||||||
# @param [String] mime MIME
|
# @param [String] mime MIME
|
||||||
# @return [Boolean] True if the MIME is application/json
|
# @return [Boolean] True if the MIME is application/json
|
||||||
def json_mime?(mime)
|
def json_mime?(mime)
|
||||||
(mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Deserialize the response to the given return type.
|
# Deserialize the response to the given return type.
|
||||||
@ -201,12 +201,12 @@ module Petstore
|
|||||||
when /\AArray<(.+)>\z/
|
when /\AArray<(.+)>\z/
|
||||||
# e.g. Array<Pet>
|
# e.g. Array<Pet>
|
||||||
sub_type = $1
|
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/
|
when /\AHash\<String, (.+)\>\z/
|
||||||
# e.g. Hash<String, Integer>
|
# e.g. Hash<String, Integer>
|
||||||
sub_type = $1
|
sub_type = $1
|
||||||
{}.tap do |hash|
|
{}.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
|
end
|
||||||
else
|
else
|
||||||
# models, e.g. Pet
|
# models, e.g. Pet
|
||||||
@ -228,7 +228,7 @@ module Petstore
|
|||||||
encoding = nil
|
encoding = nil
|
||||||
request.on_headers do |response|
|
request.on_headers do |response|
|
||||||
content_disposition = response.headers['Content-Disposition']
|
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]
|
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
||||||
prefix = sanitize_filename(filename)
|
prefix = sanitize_filename(filename)
|
||||||
else
|
else
|
||||||
@ -314,7 +314,7 @@ module Petstore
|
|||||||
|
|
||||||
# Sets user agent in HTTP header
|
# 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)
|
def user_agent=(user_agent)
|
||||||
@user_agent = user_agent
|
@user_agent = user_agent
|
||||||
@default_headers['User-Agent'] = @user_agent
|
@default_headers['User-Agent'] = @user_agent
|
||||||
@ -327,7 +327,7 @@ module Petstore
|
|||||||
return nil if accepts.nil? || accepts.empty?
|
return nil if accepts.nil? || accepts.empty?
|
||||||
# use JSON when present, otherwise use all of the provided
|
# use JSON when present, otherwise use all of the provided
|
||||||
json_accept = accepts.find { |s| json_mime?(s) }
|
json_accept = accepts.find { |s| json_mime?(s) }
|
||||||
return json_accept || accepts.join(',')
|
json_accept || accepts.join(',')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return Content-Type header based on an array of content types provided.
|
# 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?
|
return 'application/json' if content_types.nil? || content_types.empty?
|
||||||
# use JSON when present, otherwise use the first one
|
# use JSON when present, otherwise use the first one
|
||||||
json_content_type = content_types.find { |s| json_mime?(s) }
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
||||||
return json_content_type || content_types.first
|
json_content_type || content_types.first
|
||||||
end
|
end
|
||||||
|
|
||||||
# Convert object (array, hash, object, etc) to JSON string.
|
# Convert object (array, hash, object, etc) to JSON string.
|
||||||
@ -348,7 +348,7 @@ module Petstore
|
|||||||
return model if model.nil? || model.is_a?(String)
|
return model if model.nil? || model.is_a?(String)
|
||||||
local_body = nil
|
local_body = nil
|
||||||
if model.is_a?(Array)
|
if model.is_a?(Array)
|
||||||
local_body = model.map{|m| object_to_hash(m) }
|
local_body = model.map { |m| object_to_hash(m) }
|
||||||
else
|
else
|
||||||
local_body = object_to_hash(model)
|
local_body = object_to_hash(model)
|
||||||
end
|
end
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
@ -128,9 +128,9 @@ module Petstore
|
|||||||
attr_accessor :force_ending_format
|
attr_accessor :force_ending_format
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@scheme = 'https'
|
@scheme = 'http'
|
||||||
@host = 'petstore.swagger.io */ ' " =end -- \r\n \n \r'
|
@host = 'localhost'
|
||||||
@base_path = '/v2 */ ' \" =_end -- \\r\\n \\n \\r'
|
@base_path = ''
|
||||||
@api_key = {}
|
@api_key = {}
|
||||||
@api_key_prefix = {}
|
@api_key_prefix = {}
|
||||||
@timeout = 0
|
@timeout = 0
|
||||||
@ -170,7 +170,7 @@ module Petstore
|
|||||||
def base_path=(base_path)
|
def base_path=(base_path)
|
||||||
# Add leading and trailing slashes to base_path
|
# Add leading and trailing slashes to base_path
|
||||||
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
||||||
@base_path = "" if @base_path == "/"
|
@base_path = '' if @base_path == '/'
|
||||||
end
|
end
|
||||||
|
|
||||||
def base_url
|
def base_url
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
@ -18,7 +18,6 @@ module Petstore
|
|||||||
# property description */ ' \" =_end -- \\r\\n \\n \\r
|
# property description */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
attr_accessor :_return
|
attr_accessor :_return
|
||||||
|
|
||||||
|
|
||||||
# Attribute mapping from ruby-style variable name to JSON key.
|
# Attribute mapping from ruby-style variable name to JSON key.
|
||||||
def self.attribute_map
|
def self.attribute_map
|
||||||
{
|
{
|
||||||
@ -27,7 +26,7 @@ module Petstore
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Attribute type mapping.
|
# Attribute type mapping.
|
||||||
def self.swagger_types
|
def self.openapi_types
|
||||||
{
|
{
|
||||||
:'_return' => :'Integer'
|
:'_return' => :'Integer'
|
||||||
}
|
}
|
||||||
@ -39,25 +38,24 @@ module Petstore
|
|||||||
return unless attributes.is_a?(Hash)
|
return unless attributes.is_a?(Hash)
|
||||||
|
|
||||||
# convert string to symbol for hash key
|
# 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')
|
if attributes.has_key?(:'return')
|
||||||
self._return = attributes[:'return']
|
self._return = attributes[:'return']
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Show invalid properties with the reasons. Usually used together with valid?
|
# 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
|
def list_invalid_properties
|
||||||
invalid_properties = Array.new
|
invalid_properties = Array.new
|
||||||
return invalid_properties
|
invalid_properties
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check to see if the all the properties in the model are valid
|
# Check to see if the all the properties in the model are valid
|
||||||
# @return true if the model is valid
|
# @return true if the model is valid
|
||||||
def valid?
|
def valid?
|
||||||
return true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks equality by comparing each attribute.
|
# Checks equality by comparing each attribute.
|
||||||
@ -85,12 +83,12 @@ module Petstore
|
|||||||
# @return [Object] Returns the model itself
|
# @return [Object] Returns the model itself
|
||||||
def build_from_hash(attributes)
|
def build_from_hash(attributes)
|
||||||
return nil unless attributes.is_a?(Hash)
|
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
|
if type =~ /\AArray<(.*)>/i
|
||||||
# check to ensure the input is an array given that the the attribute
|
# check to ensure the input is an array given that the the attribute
|
||||||
# is documented as an array but the input is not
|
# is documented as an array but the input is not
|
||||||
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
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
|
end
|
||||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
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
|
# @return [Hash] Returns the value in the form of hash
|
||||||
def _to_hash(value)
|
def _to_hash(value)
|
||||||
if value.is_a?(Array)
|
if value.is_a?(Array)
|
||||||
value.compact.map{ |v| _to_hash(v) }
|
value.compact.map { |v| _to_hash(v) }
|
||||||
elsif value.is_a?(Hash)
|
elsif value.is_a?(Hash)
|
||||||
{}.tap do |hash|
|
{}.tap do |hash|
|
||||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||||
@ -183,7 +181,5 @@ module Petstore
|
|||||||
value
|
value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
VERSION = "1.0.0"
|
VERSION = '1.0.0'
|
||||||
end
|
end
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
#
|
|
||||||
=begin
|
=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 --
|
#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
|
OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
|
Contact: something@something.abc */ ' \" =_end -- \\r\\n \\n \\r
|
||||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
Generated by: https://openapi-generator.tech
|
||||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
OpenAPI Generator version: 3.1.0-SNAPSHOT
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
@ -19,13 +19,12 @@ Gem::Specification.new do |s|
|
|||||||
s.name = "petstore"
|
s.name = "petstore"
|
||||||
s.version = Petstore::VERSION
|
s.version = Petstore::VERSION
|
||||||
s.platform = Gem::Platform::RUBY
|
s.platform = Gem::Platform::RUBY
|
||||||
s.authors = ["Swagger-Codegen"]
|
s.authors = ["OpenAPI-Generator"]
|
||||||
s.email = ["apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r"]
|
s.email = ["something@something.abc */ ' \" =_end -- \\r\\n \\n \\r"]
|
||||||
s.homepage = "https://github.com/swagger-api/swagger-codegen"
|
s.homepage = "https://openapi-generator.tech"
|
||||||
s.summary = "Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r Ruby Gem"
|
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 -- "
|
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 = "Unlicense"
|
||||||
#s.license = "Apache 2.0"
|
|
||||||
s.required_ruby_version = ">= 1.9"
|
s.required_ruby_version = ">= 1.9"
|
||||||
|
|
||||||
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
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-growl', '~> 0.2', '>= 0.2.16'
|
||||||
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
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.test_files = `find spec/*`.split("\n")
|
||||||
s.executables = []
|
s.executables = []
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
require "bundler/gem_tasks"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'rspec/core/rake_task'
|
require 'rspec/core/rake_task'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user