forked from loafle/openapi-generator-original
Update security samples for Ruby-Client. (#5287)
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
*.gem
|
||||
*.rbc
|
||||
|
||||
7
samples/client/petstore-security-test/ruby/Gemfile
Normal file
7
samples/client/petstore-security-test/ruby/Gemfile
Normal file
@@ -0,0 +1,7 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gemspec
|
||||
|
||||
group :development, :test do
|
||||
gem 'rake', '~> 12.0.0'
|
||||
end
|
||||
@@ -8,8 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
|
||||
|
||||
- API version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-08-29T14:24:34.432-07:00
|
||||
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
|
||||
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -87,6 +86,12 @@ Class | Method | HTTP request | Description
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
|
||||
- **Location**: HTTP header
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
@@ -96,9 +101,3 @@ Class | Method | HTTP request | Description
|
||||
- write:pets: modify pets in your account */ ' \" =_end -- \\r\\n \\n \\r
|
||||
- read:pets: read your pets */ ' \" =_end -- \\r\\n \\n \\r
|
||||
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
|
||||
- **Location**: HTTP header
|
||||
|
||||
|
||||
8
samples/client/petstore-security-test/ruby/Rakefile
Normal file
8
samples/client/petstore-security-test/ruby/Rakefile
Normal file
@@ -0,0 +1,8 @@
|
||||
begin
|
||||
require 'rspec/core/rake_task'
|
||||
|
||||
RSpec::Core::RakeTask.new(:spec)
|
||||
task default: :spec
|
||||
rescue LoadError
|
||||
# no rspec available
|
||||
end
|
||||
@@ -2,18 +2,6 @@
|
||||
#
|
||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# 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"
|
||||
|
||||
@@ -7,18 +7,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
# Common files
|
||||
|
||||
@@ -7,18 +7,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
@@ -51,21 +39,17 @@ module Petstore
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_code_inject____end__rn_n_r ..."
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake".sub('{format}','json')
|
||||
local_var_path = "/fake"
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
local_header_accept = ['application/json', '*/ \" =_end -- ']
|
||||
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
||||
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/ \" =_end -- '])
|
||||
# HTTP header 'Content-Type'
|
||||
local_header_content_type = ['application/json', '*/ \" =_end -- ']
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', '*/ \" =_end -- '])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
|
||||
@@ -7,18 +7,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
@@ -142,10 +130,11 @@ module Petstore
|
||||
# application/json
|
||||
# application/json; charset=UTF8
|
||||
# APPLICATION/JSON
|
||||
# */*
|
||||
# @param [String] mime MIME
|
||||
# @return [Boolean] True if the MIME is application/json
|
||||
def json_mime?(mime)
|
||||
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
(mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
||||
end
|
||||
|
||||
# Deserialize the response to the given return type.
|
||||
|
||||
@@ -7,18 +7,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
module Petstore
|
||||
@@ -32,12 +20,14 @@ module Petstore
|
||||
# ApiError.new(:code => 404, :message => "Not Found")
|
||||
def initialize(arg = nil)
|
||||
if arg.is_a? Hash
|
||||
if arg.key?(:message) || arg.key?('message')
|
||||
super(arg[:message] || arg['message'])
|
||||
else
|
||||
super arg
|
||||
end
|
||||
|
||||
arg.each do |k, v|
|
||||
if k.to_s == 'message'
|
||||
super v
|
||||
else
|
||||
instance_variable_set "@#{k}", v
|
||||
end
|
||||
instance_variable_set "@#{k}", v
|
||||
end
|
||||
else
|
||||
super arg
|
||||
|
||||
@@ -7,18 +7,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
@@ -201,13 +189,6 @@ module Petstore
|
||||
# Returns Auth Settings hash for api client.
|
||||
def auth_settings
|
||||
{
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
'api_key' =>
|
||||
{
|
||||
type: 'api_key',
|
||||
@@ -215,6 +196,13 @@ module Petstore
|
||||
key: 'api_key */ ' " =end -- \r\n \n \r',
|
||||
value: api_key_with_prefix('api_key */ ' " =end -- \r\n \n \r')
|
||||
},
|
||||
'petstore_auth' =>
|
||||
{
|
||||
type: 'oauth2',
|
||||
in: 'header',
|
||||
key: 'Authorization',
|
||||
value: "Bearer #{access_token}"
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,18 +7,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
@@ -97,7 +85,7 @@ module Petstore
|
||||
def build_from_hash(attributes)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.swagger_types.each_pair do |key, type|
|
||||
if type =~ /^Array<(.*)>/i
|
||||
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)
|
||||
@@ -128,7 +116,7 @@ module Petstore
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
@@ -139,7 +127,7 @@ module Petstore
|
||||
when /\AArray<(?<inner_type>.+)>\z/
|
||||
inner_type = Regexp.last_match[:inner_type]
|
||||
value.map { |v| _deserialize(inner_type, v) }
|
||||
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
|
||||
@@ -7,18 +7,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
module Petstore
|
||||
|
||||
@@ -9,18 +9,6 @@ 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
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=end
|
||||
|
||||
$:.push File.expand_path("../lib", __FILE__)
|
||||
@@ -35,7 +23,9 @@ Gem::Specification.new do |s|
|
||||
s.homepage = "https://github.com/swagger-api/swagger-codegen"
|
||||
s.summary = "Swagger 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.license = "Apache 2.0 */ ' \" =_end -- \\r\\n \\n \\r"
|
||||
# TODO uncommnet and update below with a proper license
|
||||
#s.license = "Apache 2.0"
|
||||
s.required_ruby_version = ">= 1.9"
|
||||
|
||||
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
||||
s.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
|
||||
|
||||
Reference in New Issue
Block a user