mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 02:55:19 +00:00
[Ruby] Add auto-generated rubocop config file (#7637)
* add rubocop to ruby api client * add new files * fix ruby generator test case
This commit is contained in:
parent
86697fedb2
commit
aa6b217bb9
@ -252,6 +252,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("Rakefile.mustache", "", "Rakefile"));
|
||||
supportingFiles.add(new SupportingFile("Gemfile.mustache", "", "Gemfile"));
|
||||
supportingFiles.add(new SupportingFile("rubocop.mustache", "", ".rubocop.yml"));
|
||||
|
||||
// test files should not be overwritten
|
||||
writeOptional(outputFolder, new SupportingFile("rspec.mustache", "", ".rspec"));
|
||||
@ -411,7 +412,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
} else if (p instanceof StringProperty) {
|
||||
StringProperty sp = (StringProperty) p;
|
||||
if (sp.getDefault() != null) {
|
||||
return "\"" + escapeText(sp.getDefault()) + "\"";
|
||||
return "'" + escapeText(sp.getDefault()) + "'";
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,7 +566,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if ("Integer".equals(datatype) || "Float".equals(datatype)) {
|
||||
return value;
|
||||
} else {
|
||||
return "\"" + escapeText(value) + "\"";
|
||||
return "'" + escapeText(value) + "'";
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +659,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
example = "'" + escapeText(example) + "'";
|
||||
} else if ("Integer".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
@ -675,17 +676,17 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (example == null) {
|
||||
example = "/path/to/file";
|
||||
}
|
||||
example = "File.new(\"" + escapeText(example) + "\")";
|
||||
example = "File.new('" + escapeText(example) + "')";
|
||||
} else if ("Date".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20";
|
||||
}
|
||||
example = "Date.parse(\"" + escapeText(example) + "\")";
|
||||
example = "Date.parse('" + escapeText(example) + "')";
|
||||
} else if ("DateTime".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20T19:20:30+01:00";
|
||||
}
|
||||
example = "DateTime.parse(\"" + escapeText(example) + "\")";
|
||||
example = "DateTime.parse('" + escapeText(example) + "')";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = moduleName + "::" + type + ".new";
|
||||
|
@ -2,7 +2,7 @@
|
||||
{{> api_info}}
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
require 'uri'
|
||||
|
||||
module {{moduleName}}
|
||||
{{#operations}}
|
||||
@ -13,27 +13,34 @@ module {{moduleName}}
|
||||
@api_client = api_client
|
||||
end
|
||||
{{#operation}}
|
||||
{{newline}}
|
||||
{{#summary}}
|
||||
# {{{summary}}}
|
||||
{{/summary}}
|
||||
{{#notes}}
|
||||
# {{{notes}}}
|
||||
{{/notes}}
|
||||
{{#allParams}}{{#required}} # @param {{paramName}} {{description}}
|
||||
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
|
||||
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}]
|
||||
def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
||||
{{#returnType}}data, _status_code, _headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts)
|
||||
{{#returnType}}return data{{/returnType}}{{^returnType}}return nil{{/returnType}}
|
||||
{{#returnType}}data{{/returnType}}{{^returnType}}nil{{/returnType}}
|
||||
end
|
||||
|
||||
{{#summary}}
|
||||
# {{summary}}
|
||||
{{/summary}}
|
||||
{{#notes}}
|
||||
# {{notes}}
|
||||
{{/notes}}
|
||||
{{#allParams}}{{#required}} # @param {{paramName}} {{description}}
|
||||
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
|
||||
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
|
||||
{{/required}}{{/allParams}} # @return [Array<({{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}, Fixnum, Hash)>] {{#returnType}}{{{returnType}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}, response status code and response headers
|
||||
def {{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: {{classname}}.{{operationId}} ..."
|
||||
@api_client.config.logger.debug 'Calling API: {{classname}}.{{operationId}} ...'
|
||||
end
|
||||
{{#allParams}}
|
||||
{{#required}}
|
||||
@ -53,7 +60,7 @@ module {{moduleName}}
|
||||
{{^required}}
|
||||
{{#isEnum}}
|
||||
{{#collectionFormat}}
|
||||
if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && !opts[:'{{{paramName}}}'].all?{|item| [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(item)}
|
||||
if @api_client.config.client_side_validation && opts[:'{{{paramName}}}'] && !opts[:'{{{paramName}}}'].all? { |item| [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}].include?(item) }
|
||||
fail ArgumentError, 'invalid value for "{{{paramName}}}", must include one of {{#allowableValues}}{{#values}}{{{this}}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}'
|
||||
end
|
||||
{{/collectionFormat}}
|
||||
@ -110,7 +117,7 @@ module {{moduleName}}
|
||||
{{/hasValidation}}
|
||||
{{/allParams}}
|
||||
# resource path
|
||||
local_var_path = "{{{path}}}"{{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}}
|
||||
local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', {{paramName}}.to_s){{/pathParams}}
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -150,12 +157,12 @@ module {{moduleName}}
|
||||
form_params = {}
|
||||
{{#formParams}}
|
||||
{{#required}}
|
||||
form_params["{{baseName}}"] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
|
||||
form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}
|
||||
{{/required}}
|
||||
{{/formParams}}
|
||||
{{#formParams}}
|
||||
{{^required}}
|
||||
form_params["{{baseName}}"] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{paramName}}'].nil?
|
||||
form_params['{{baseName}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if !opts[:'{{paramName}}'].nil?
|
||||
{{/required}}
|
||||
{{/formParams}}
|
||||
|
||||
|
@ -25,7 +25,7 @@ module {{moduleName}}
|
||||
@config = config
|
||||
@user_agent = "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/#{VERSION}/ruby{{/httpUserAgent}}"
|
||||
@default_headers = {
|
||||
'Content-Type' => "application/json",
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => @user_agent
|
||||
}
|
||||
end
|
||||
@ -131,7 +131,7 @@ module {{moduleName}}
|
||||
# @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.
|
||||
@ -195,12 +195,12 @@ module {{moduleName}}
|
||||
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
|
||||
@ -222,7 +222,7 @@ module {{moduleName}}
|
||||
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
|
||||
@ -321,7 +321,7 @@ module {{moduleName}}
|
||||
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.
|
||||
@ -332,7 +332,7 @@ module {{moduleName}}
|
||||
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.
|
||||
@ -342,7 +342,7 @@ module {{moduleName}}
|
||||
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
|
||||
|
@ -43,11 +43,11 @@ describe {{moduleName}}::ApiClient do
|
||||
end
|
||||
end
|
||||
|
||||
describe "params_encoding in #build_request" do
|
||||
describe 'params_encoding in #build_request' do
|
||||
let(:config) { {{moduleName}}::Configuration.new }
|
||||
let(:api_client) { {{moduleName}}::ApiClient.new(config) }
|
||||
|
||||
it "defaults to nil" do
|
||||
it 'defaults to nil' do
|
||||
expect({{moduleName}}::Configuration.default.params_encoding).to eq(nil)
|
||||
expect(config.params_encoding).to eq(nil)
|
||||
|
||||
@ -55,18 +55,18 @@ describe {{moduleName}}::ApiClient do
|
||||
expect(request.options[:params_encoding]).to eq(nil)
|
||||
end
|
||||
|
||||
it "can be customized" do
|
||||
it 'can be customized' do
|
||||
config.params_encoding = :multi
|
||||
request = api_client.build_request(:get, '/test')
|
||||
expect(request.options[:params_encoding]).to eq(:multi)
|
||||
end
|
||||
end
|
||||
|
||||
describe "timeout in #build_request" do
|
||||
describe 'timeout in #build_request' do
|
||||
let(:config) { {{moduleName}}::Configuration.new }
|
||||
let(:api_client) { {{moduleName}}::ApiClient.new(config) }
|
||||
|
||||
it "defaults to 0" do
|
||||
it 'defaults to 0' do
|
||||
expect({{moduleName}}::Configuration.default.timeout).to eq(0)
|
||||
expect(config.timeout).to eq(0)
|
||||
|
||||
@ -74,88 +74,88 @@ describe {{moduleName}}::ApiClient do
|
||||
expect(request.options[:timeout]).to eq(0)
|
||||
end
|
||||
|
||||
it "can be customized" do
|
||||
it 'can be customized' do
|
||||
config.timeout = 100
|
||||
request = api_client.build_request(:get, '/test')
|
||||
expect(request.options[:timeout]).to eq(100)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#deserialize" do
|
||||
describe '#deserialize' do
|
||||
it "handles Array<Integer>" do
|
||||
api_client = {{moduleName}}::ApiClient.new
|
||||
headers = {'Content-Type' => 'application/json'}
|
||||
headers = { 'Content-Type' => 'application/json' }
|
||||
response = double('response', headers: headers, body: '[12, 34]')
|
||||
data = api_client.deserialize(response, 'Array<Integer>')
|
||||
expect(data).to be_instance_of(Array)
|
||||
expect(data).to eq([12, 34])
|
||||
end
|
||||
|
||||
it "handles Array<Array<Integer>>" do
|
||||
it 'handles Array<Array<Integer>>' do
|
||||
api_client = {{moduleName}}::ApiClient.new
|
||||
headers = {'Content-Type' => 'application/json'}
|
||||
headers = { 'Content-Type' => 'application/json' }
|
||||
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
||||
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
||||
expect(data).to be_instance_of(Array)
|
||||
expect(data).to eq([[12, 34], [56]])
|
||||
end
|
||||
|
||||
it "handles Hash<String, String>" do
|
||||
it 'handles Hash<String, String>' do
|
||||
api_client = {{moduleName}}::ApiClient.new
|
||||
headers = {'Content-Type' => 'application/json'}
|
||||
headers = { 'Content-Type' => 'application/json' }
|
||||
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
||||
data = api_client.deserialize(response, 'Hash<String, String>')
|
||||
expect(data).to be_instance_of(Hash)
|
||||
expect(data).to eq({:message => 'Hello'})
|
||||
expect(data).to eq(:message => 'Hello')
|
||||
end
|
||||
end
|
||||
|
||||
describe "#object_to_hash" do
|
||||
it "ignores nils and includes empty arrays" do
|
||||
it 'ignores nils and includes empty arrays' do
|
||||
# uncomment below to test object_to_hash for model
|
||||
#api_client = {{moduleName}}::ApiClient.new
|
||||
#_model = {{moduleName}}::ModelName.new
|
||||
# api_client = {{moduleName}}::ApiClient.new
|
||||
# _model = {{moduleName}}::ModelName.new
|
||||
# update the model attribute below
|
||||
#_model.id = 1
|
||||
# _model.id = 1
|
||||
# update the expected value (hash) below
|
||||
#expected = {id: 1, name: '', tags: []}
|
||||
#expect(api_client.object_to_hash(_model)).to eq(expected)
|
||||
# expected = {id: 1, name: '', tags: []}
|
||||
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#build_collection_param" do
|
||||
describe '#build_collection_param' do
|
||||
let(:param) { ['aa', 'bb', 'cc'] }
|
||||
let(:api_client) { {{moduleName}}::ApiClient.new }
|
||||
|
||||
it "works for csv" do
|
||||
it 'works for csv' do
|
||||
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
||||
end
|
||||
|
||||
it "works for ssv" do
|
||||
it 'works for ssv' do
|
||||
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
||||
end
|
||||
|
||||
it "works for tsv" do
|
||||
it 'works for tsv' do
|
||||
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
||||
end
|
||||
|
||||
it "works for pipes" do
|
||||
it 'works for pipes' do
|
||||
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
||||
end
|
||||
|
||||
it "works for multi" do
|
||||
it 'works for multi' do
|
||||
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
||||
end
|
||||
|
||||
it "fails for invalid collection format" do
|
||||
it 'fails for invalid collection format' do
|
||||
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
||||
end
|
||||
end
|
||||
|
||||
describe "#json_mime?" do
|
||||
describe '#json_mime?' do
|
||||
let(:api_client) { {{moduleName}}::ApiClient.new }
|
||||
|
||||
it "works" do
|
||||
it 'works' do
|
||||
expect(api_client.json_mime?(nil)).to eq false
|
||||
expect(api_client.json_mime?('')).to eq false
|
||||
|
||||
@ -169,10 +169,10 @@ describe {{moduleName}}::ApiClient do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#select_header_accept" do
|
||||
describe '#select_header_accept' do
|
||||
let(:api_client) { {{moduleName}}::ApiClient.new }
|
||||
|
||||
it "works" do
|
||||
it 'works' do
|
||||
expect(api_client.select_header_accept(nil)).to be_nil
|
||||
expect(api_client.select_header_accept([])).to be_nil
|
||||
|
||||
@ -185,10 +185,10 @@ describe {{moduleName}}::ApiClient do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#select_header_content_type" do
|
||||
describe '#select_header_content_type' do
|
||||
let(:api_client) { {{moduleName}}::ApiClient.new }
|
||||
|
||||
it "works" do
|
||||
it 'works' do
|
||||
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
||||
expect(api_client.select_header_content_type([])).to eq('application/json')
|
||||
|
||||
@ -200,10 +200,10 @@ describe {{moduleName}}::ApiClient do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#sanitize_filename" do
|
||||
describe '#sanitize_filename' do
|
||||
let(:api_client) { {{moduleName}}::ApiClient.new }
|
||||
|
||||
it "works" do
|
||||
it 'works' do
|
||||
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
||||
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
||||
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
||||
|
@ -26,14 +26,18 @@ require 'json'
|
||||
|
||||
{{#operation}}
|
||||
# unit tests for {{operationId}}
|
||||
{{#summary}}
|
||||
# {{summary}}
|
||||
{{/summary}}
|
||||
{{#notes}}
|
||||
# {{notes}}
|
||||
{{/notes}}
|
||||
{{#allParams}}{{#required}} # @param {{paramName}} {{description}}
|
||||
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
|
||||
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
|
||||
{{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}]
|
||||
describe '{{operationId}} test' do
|
||||
it "should work" do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,7 @@
|
||||
# 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]]))
|
||||
@ -90,7 +90,7 @@
|
||||
# @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) }
|
||||
@ -100,4 +100,4 @@
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
@ -162,7 +162,7 @@ module {{moduleName}}
|
||||
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
|
||||
|
@ -9,25 +9,25 @@ describe {{moduleName}}::Configuration do
|
||||
|
||||
before(:each) do
|
||||
# uncomment below to setup host and base_path
|
||||
#require 'URI'
|
||||
#uri = URI.parse("{{{basePath}}}")
|
||||
#{{moduleName}}.configure do |c|
|
||||
# c.host = uri.host
|
||||
# c.base_path = uri.path
|
||||
#end
|
||||
# require 'URI'
|
||||
# uri = URI.parse("{{{basePath}}}")
|
||||
# {{moduleName}}.configure do |c|
|
||||
# c.host = uri.host
|
||||
# c.base_path = uri.path
|
||||
# end
|
||||
end
|
||||
|
||||
describe '#base_url' do
|
||||
it 'should have the default value' do
|
||||
# uncomment below to test default value of the base path
|
||||
#expect(config.base_url).to eq("{{{basePath}}}")
|
||||
# expect(config.base_url).to eq("{{{basePath}}}")
|
||||
end
|
||||
|
||||
it 'should remove trailing slashes' do
|
||||
[nil, '', '/', '//'].each do |base_path|
|
||||
config.base_path = base_path
|
||||
# uncomment below to test trailing slashes
|
||||
#expect(config.base_url).to eq("{{{basePath}}}")
|
||||
# expect(config.base_url).to eq("{{{basePath}}}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
#
|
||||
|
||||
=begin
|
||||
{{> api_info}}
|
||||
=end
|
||||
@ -17,11 +17,10 @@ Gem::Specification.new do |s|
|
||||
s.summary = "{{gemSummary}}{{^gemSummary}}{{{appName}}} Ruby Gem{{/gemSummary}}"
|
||||
s.description = "{{gemDescription}}{{^gemDescription}}{{{appDescription}}}{{^appDescription}}{{{appName}}} Ruby Gem{{/appDescription}}{{/gemDescription}}"
|
||||
{{#gemLicense}}
|
||||
s.license = "{{{gemLicense}}}"
|
||||
s.license = '{{{gemLicense}}}'
|
||||
{{/gemLicense}}
|
||||
{{^gemLicense}}
|
||||
# TODO uncomment and update below with a proper license
|
||||
#s.license = "Apache 2.0"
|
||||
s.license = "Unlicense"
|
||||
{{/gemLicense}}
|
||||
s.required_ruby_version = "{{{gemRequiredRubyVersion}}}{{^gemRequiredRubyVersion}}>= 1.9{{/gemRequiredRubyVersion}}"
|
||||
|
||||
@ -36,7 +35,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"]
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
#
|
||||
#
|
||||
|
||||
*.gem
|
||||
*.rbc
|
||||
|
@ -5,5 +5,14 @@
|
||||
require 'date'
|
||||
|
||||
module {{moduleName}}
|
||||
{{#models}}{{#model}}{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}{{/model}}{{/models}}
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#isEnum}}
|
||||
{{>partial_model_enum_class}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{>partial_model_generic}}
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
end
|
||||
|
@ -9,7 +9,9 @@ require 'date'
|
||||
# Unit tests for {{moduleName}}::{{classname}}
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
{{#models}}{{#model}}describe '{{classname}}' do
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
describe '{{classname}}' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = {{moduleName}}::{{classname}}.new
|
||||
@ -27,19 +29,20 @@ require 'date'
|
||||
{{#vars}}
|
||||
describe 'test attribute "{{{name}}}"' do
|
||||
it 'should work' do
|
||||
{{#isEnum}}
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
#validator = Petstore::EnumTest::EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}])
|
||||
#validator.allowable_values.each do |value|
|
||||
# expect { @instance.{{name}} = value }.not_to raise_error
|
||||
#end
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
{{/isEnum}}
|
||||
{{#isEnum}}
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
# validator = Petstore::EnumTest::EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}])
|
||||
# validator.allowable_values.each do |value|
|
||||
# expect { @instance.{{name}} = value }.not_to raise_error
|
||||
# end
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
{{/isEnum}}
|
||||
end
|
||||
end
|
||||
|
||||
{{/vars}}
|
||||
end
|
||||
{{/model}}{{/models}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -6,8 +6,8 @@
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def build_from_hash(value)
|
||||
constantValues = {{classname}}.constants.select{|c| {{classname}}::const_get(c) == value}
|
||||
constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value }
|
||||
raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty?
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
@ -1,9 +1,14 @@
|
||||
{{#description}} # {{{description}}}{{/description}}
|
||||
class {{classname}}{{#vars}}{{#description}}
|
||||
# {{{description}}}{{/description}}
|
||||
{{#description}}
|
||||
# {{{description}}}
|
||||
{{/description}}
|
||||
class {{classname}}
|
||||
{{#vars}}
|
||||
{{#description}}
|
||||
# {{{description}}}
|
||||
{{/description}}
|
||||
attr_accessor :{{{name}}}
|
||||
{{/vars}}
|
||||
|
||||
{{/vars}}
|
||||
{{#hasEnums}}
|
||||
class EnumAttributeValidator
|
||||
attr_reader :datatype
|
||||
@ -26,8 +31,8 @@
|
||||
!value || allowable_values.include?(value)
|
||||
end
|
||||
end
|
||||
{{/hasEnums}}
|
||||
|
||||
{{/hasEnums}}
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -52,9 +57,9 @@
|
||||
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 }
|
||||
{{#vars}}
|
||||
|
||||
if attributes.has_key?(:'{{{baseName}}}')
|
||||
{{#isListContainer}}
|
||||
if (value = attributes[:'{{{baseName}}}']).is_a?(Array)
|
||||
@ -74,7 +79,6 @@
|
||||
self.{{{name}}} = {{{defaultValue}}}
|
||||
{{/defaultValue}}
|
||||
end
|
||||
|
||||
{{/vars}}
|
||||
end
|
||||
|
||||
@ -85,56 +89,56 @@
|
||||
{{#vars}}
|
||||
{{#required}}
|
||||
if @{{{name}}}.nil?
|
||||
invalid_properties.push("invalid value for '{{{name}}}', {{{name}}} cannot be nil.")
|
||||
invalid_properties.push('invalid value for "{{{name}}}", {{{name}}} cannot be nil.')
|
||||
end
|
||||
|
||||
{{/required}}
|
||||
{{#hasValidation}}
|
||||
{{#maxLength}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
|
||||
invalid_properties.push("invalid value for '{{{name}}}', the character length must be smaller than or equal to {{{maxLength}}}.")
|
||||
invalid_properties.push('invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.')
|
||||
end
|
||||
|
||||
{{/maxLength}}
|
||||
{{#minLength}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}}
|
||||
invalid_properties.push("invalid value for '{{{name}}}', the character length must be great than or equal to {{{minLength}}}.")
|
||||
invalid_properties.push('invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.')
|
||||
end
|
||||
|
||||
{{/minLength}}
|
||||
{{#maximum}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
|
||||
invalid_properties.push("invalid value for '{{{name}}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.")
|
||||
invalid_properties.push('invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.')
|
||||
end
|
||||
|
||||
{{/maximum}}
|
||||
{{#minimum}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
|
||||
invalid_properties.push("invalid value for '{{{name}}}', must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.")
|
||||
invalid_properties.push('invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.')
|
||||
end
|
||||
|
||||
{{/minimum}}
|
||||
{{#pattern}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ Regexp.new({{{pattern}}})
|
||||
invalid_properties.push("invalid value for '{{{name}}}', must conform to the pattern {{{pattern}}}.")
|
||||
invalid_properties.push('invalid value for "{{{name}}}", must conform to the pattern {{{pattern}}}.')
|
||||
end
|
||||
|
||||
{{/pattern}}
|
||||
{{#maxItems}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}}
|
||||
invalid_properties.push("invalid value for '{{{name}}}', number of items must be less than or equal to {{{maxItems}}}."
|
||||
invalid_properties.push('invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.'
|
||||
end
|
||||
|
||||
{{/maxItems}}
|
||||
{{#minItems}}
|
||||
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}}
|
||||
invalid_properties.push("invalid value for '{{{name}}}', number of items must be greater than or equal to {{{minItems}}}."
|
||||
invalid_properties.push('invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.'
|
||||
end
|
||||
|
||||
{{/minItems}}
|
||||
{{/hasValidation}}
|
||||
{{/vars}}
|
||||
return invalid_properties
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
# Check to see if the all the properties in the model are valid
|
||||
@ -146,7 +150,7 @@
|
||||
{{/required}}
|
||||
{{#isEnum}}
|
||||
{{^isContainer}}
|
||||
{{{name}}}_validator = EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}])
|
||||
{{{name}}}_validator = EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}])
|
||||
return false unless {{{name}}}_validator.valid?(@{{{name}}})
|
||||
{{/isContainer}}
|
||||
{{/isEnum}}
|
||||
@ -174,7 +178,7 @@
|
||||
{{/minItems}}
|
||||
{{/hasValidation}}
|
||||
{{/vars}}
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
{{#vars}}
|
||||
@ -183,9 +187,9 @@
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] {{{name}}} Object to be assigned
|
||||
def {{{name}}}=({{{name}}})
|
||||
validator = EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}])
|
||||
validator = EnumAttributeValidator.new('{{{datatype}}}', [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}])
|
||||
unless validator.valid?({{{name}}})
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', must be one of #{validator.allowable_values}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", must be one of #{validator.allowable_values}.'
|
||||
end
|
||||
@{{{name}}} = {{{name}}}
|
||||
end
|
||||
@ -199,49 +203,49 @@
|
||||
def {{{name}}}=({{{name}}})
|
||||
{{#required}}
|
||||
if {{{name}}}.nil?
|
||||
fail ArgumentError, "{{{name}}} cannot be nil"
|
||||
fail ArgumentError, '{{{name}}} cannot be nil'
|
||||
end
|
||||
{{/required}}
|
||||
|
||||
{{/required}}
|
||||
{{#maxLength}}
|
||||
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.length > {{{maxLength}}}
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', the character length must be smaller than or equal to {{{maxLength}}}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.'
|
||||
end
|
||||
|
||||
{{/maxLength}}
|
||||
{{#minLength}}
|
||||
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.length < {{{minLength}}}
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', the character length must be great than or equal to {{{minLength}}}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.'
|
||||
end
|
||||
|
||||
{{/minLength}}
|
||||
{{#maximum}}
|
||||
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.'
|
||||
end
|
||||
|
||||
{{/maximum}}
|
||||
{{#minimum}}
|
||||
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.'
|
||||
end
|
||||
|
||||
{{/minimum}}
|
||||
{{#pattern}}
|
||||
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} !~ Regexp.new({{{pattern}}})
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', must conform to the pattern {{{pattern}}}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", must conform to the pattern {{{pattern}}}.'
|
||||
end
|
||||
|
||||
{{/pattern}}
|
||||
{{#maxItems}}
|
||||
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.length > {{{maxItems}}}
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', number of items must be less than or equal to {{{maxItems}}}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.'
|
||||
end
|
||||
|
||||
{{/maxItems}}
|
||||
{{#minItems}}
|
||||
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.length < {{{minItems}}}
|
||||
fail ArgumentError, "invalid value for '{{{name}}}', number of items must be greater than or equal to {{{minItems}}}."
|
||||
fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.'
|
||||
end
|
||||
|
||||
{{/minItems}}
|
||||
@ -272,4 +276,4 @@
|
||||
end
|
||||
|
||||
{{> base_object}}
|
||||
end
|
||||
end
|
154
modules/swagger-codegen/src/main/resources/ruby/rubocop.mustache
Normal file
154
modules/swagger-codegen/src/main/resources/ruby/rubocop.mustache
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 Swagger Codegen (https://github.com/swagger-api/swagger-codegen)
|
||||
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
|
@ -3,5 +3,5 @@
|
||||
=end
|
||||
|
||||
module {{moduleName}}
|
||||
VERSION = "{{gemVersion}}"
|
||||
VERSION = '{{gemVersion}}'
|
||||
end
|
||||
|
@ -55,7 +55,7 @@ public class RubyClientCodegenTest {
|
||||
if (file.getName().equals("default_api.rb")) {
|
||||
apiFileGenerated = true;
|
||||
// Ruby client should set the path unescaped in the api file
|
||||
assertTrue(FileUtils.readFileToString(file, StandardCharsets.UTF_8).contains("local_var_path = \"/foo=bar\""));
|
||||
assertTrue(FileUtils.readFileToString(file, StandardCharsets.UTF_8).contains("local_var_path = '/foo=bar'"));
|
||||
}
|
||||
}
|
||||
if (!apiFileGenerated) {
|
||||
|
@ -501,7 +501,7 @@ paths:
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: 'The name that needs to be fetched. Use user1 for testing. '
|
||||
description: 'The name that needs to be fetched. Use user1 for testing.'
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
|
@ -501,7 +501,7 @@ paths:
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: 'The name that needs to be fetched. Use user1 for testing. '
|
||||
description: 'The name that needs to be fetched. Use user1 for testing.'
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
|
2
samples/client/petstore/ruby/.gitignore
vendored
2
samples/client/petstore/ruby/.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
#
|
||||
#
|
||||
|
||||
*.gem
|
||||
*.rbc
|
||||
|
153
samples/client/petstore/ruby/.rubocop.yml
Normal file
153
samples/client/petstore/ruby/.rubocop.yml
Normal file
@ -0,0 +1,153 @@
|
||||
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:
|
||||
- '**/spec/**/*'
|
||||
- '**/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 +1 @@
|
||||
2.3.0-SNAPSHOT
|
||||
2.4.0-SNAPSHOT
|
@ -4,6 +4,6 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **String** | |
|
||||
**color** | **String** | | [optional] [default to "red"]
|
||||
**color** | **String** | | [optional] [default to 'red']
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **String** | |
|
||||
**color** | **String** | | [optional] [default to "red"]
|
||||
**color** | **String** | | [optional] [default to 'red']
|
||||
**declawed** | **BOOLEAN** | | [optional]
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **String** | |
|
||||
**color** | **String** | | [optional] [default to "red"]
|
||||
**color** | **String** | | [optional] [default to 'red']
|
||||
**breed** | **String** | | [optional]
|
||||
|
||||
|
||||
|
@ -274,21 +274,21 @@ number = 8.14 # Float | None
|
||||
|
||||
double = 1.2 # Float | None
|
||||
|
||||
pattern_without_delimiter = "pattern_without_delimiter_example" # String | None
|
||||
pattern_without_delimiter = 'pattern_without_delimiter_example' # String | None
|
||||
|
||||
byte = "B" # String | None
|
||||
byte = 'B' # String | None
|
||||
|
||||
opts = {
|
||||
integer: 56, # Integer | None
|
||||
int32: 56, # Integer | None
|
||||
int64: 789, # Integer | None
|
||||
float: 3.4, # Float | None
|
||||
string: "string_example", # String | None
|
||||
binary: "B", # String | None
|
||||
date: Date.parse("2013-10-20"), # Date | None
|
||||
date_time: DateTime.parse("2013-10-20T19:20:30+01:00"), # DateTime | None
|
||||
password: "password_example", # String | None
|
||||
callback: "callback_example" # String | None
|
||||
string: 'string_example', # String | None
|
||||
binary: 'B', # String | None
|
||||
date: Date.parse('2013-10-20'), # Date | None
|
||||
date_time: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | None
|
||||
password: 'password_example', # String | None
|
||||
callback: 'callback_example' # String | None
|
||||
}
|
||||
|
||||
begin
|
||||
@ -348,12 +348,12 @@ require 'petstore'
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
opts = {
|
||||
enum_form_string_array: ["enum_form_string_array_example"], # Array<String> | Form parameter enum test (string array)
|
||||
enum_form_string: "-efg", # String | Form parameter enum test (string)
|
||||
enum_header_string_array: ["enum_header_string_array_example"], # Array<String> | Header parameter enum test (string array)
|
||||
enum_header_string: "-efg", # String | Header parameter enum test (string)
|
||||
enum_query_string_array: ["enum_query_string_array_example"], # Array<String> | Query parameter enum test (string array)
|
||||
enum_query_string: "-efg", # String | Query parameter enum test (string)
|
||||
enum_form_string_array: ['enum_form_string_array_example'], # Array<String> | Form parameter enum test (string array)
|
||||
enum_form_string: '-efg', # String | Form parameter enum test (string)
|
||||
enum_header_string_array: ['enum_header_string_array_example'], # Array<String> | Header parameter enum test (string array)
|
||||
enum_header_string: '-efg', # String | Header parameter enum test (string)
|
||||
enum_query_string_array: ['enum_query_string_array_example'], # Array<String> | Query parameter enum test (string array)
|
||||
enum_query_string: '-efg', # String | Query parameter enum test (string)
|
||||
enum_query_integer: 56, # Integer | Query parameter enum test (double)
|
||||
enum_query_double: 1.2 # Float | Query parameter enum test (double)
|
||||
}
|
||||
@ -454,9 +454,9 @@ require 'petstore'
|
||||
|
||||
api_instance = Petstore::FakeApi.new
|
||||
|
||||
param = "param_example" # String | field1
|
||||
param = 'param_example' # String | field1
|
||||
|
||||
param2 = "param2_example" # String | field2
|
||||
param2 = 'param2_example' # String | field2
|
||||
|
||||
|
||||
begin
|
||||
|
@ -87,7 +87,7 @@ api_instance = Petstore::PetApi.new
|
||||
pet_id = 789 # Integer | Pet id to delete
|
||||
|
||||
opts = {
|
||||
api_key: "api_key_example" # String |
|
||||
api_key: 'api_key_example' # String |
|
||||
}
|
||||
|
||||
begin
|
||||
@ -139,7 +139,7 @@ end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
status = ["status_example"] # Array<String> | Status values that need to be considered for filter
|
||||
status = ['status_example'] # Array<String> | Status values that need to be considered for filter
|
||||
|
||||
|
||||
begin
|
||||
@ -191,7 +191,7 @@ end
|
||||
|
||||
api_instance = Petstore::PetApi.new
|
||||
|
||||
tags = ["tags_example"] # Array<String> | Tags to filter by
|
||||
tags = ['tags_example'] # Array<String> | Tags to filter by
|
||||
|
||||
|
||||
begin
|
||||
@ -351,8 +351,8 @@ api_instance = Petstore::PetApi.new
|
||||
pet_id = 789 # Integer | ID of pet that needs to be updated
|
||||
|
||||
opts = {
|
||||
name: "name_example", # String | Updated name of the pet
|
||||
status: "status_example" # String | Updated status of the pet
|
||||
name: 'name_example', # String | Updated name of the pet
|
||||
status: 'status_example' # String | Updated status of the pet
|
||||
}
|
||||
|
||||
begin
|
||||
@ -408,8 +408,8 @@ api_instance = Petstore::PetApi.new
|
||||
pet_id = 789 # Integer | ID of pet to update
|
||||
|
||||
opts = {
|
||||
additional_metadata: "additional_metadata_example", # String | Additional data to pass to server
|
||||
file: File.new("/path/to/file.txt") # File | file to upload
|
||||
additional_metadata: 'additional_metadata_example', # String | Additional data to pass to server
|
||||
file: File.new('/path/to/file.txt') # File | file to upload
|
||||
}
|
||||
|
||||
begin
|
||||
|
@ -24,7 +24,7 @@ require 'petstore'
|
||||
|
||||
api_instance = Petstore::StoreApi.new
|
||||
|
||||
order_id = "order_id_example" # String | ID of the order that needs to be deleted
|
||||
order_id = 'order_id_example' # String | ID of the order that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
|
@ -166,7 +166,7 @@ require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # String | The name that needs to be deleted
|
||||
username = 'username_example' # String | The name that needs to be deleted
|
||||
|
||||
|
||||
begin
|
||||
@ -212,7 +212,7 @@ require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # String | The name that needs to be fetched. Use user1 for testing.
|
||||
username = 'username_example' # String | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
|
||||
begin
|
||||
@ -228,7 +228,7 @@ end
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
**username** | **String**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -259,9 +259,9 @@ require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # String | The user name for login
|
||||
username = 'username_example' # String | The user name for login
|
||||
|
||||
password = "password_example" # String | The password for login in clear text
|
||||
password = 'password_example' # String | The password for login in clear text
|
||||
|
||||
|
||||
begin
|
||||
@ -349,7 +349,7 @@ require 'petstore'
|
||||
|
||||
api_instance = Petstore::UserApi.new
|
||||
|
||||
username = "username_example" # String | name that need to be deleted
|
||||
username = 'username_example' # String | name that need to be deleted
|
||||
|
||||
body = Petstore::User.new # User | Updated user object
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
require 'uri'
|
||||
|
||||
module Petstore
|
||||
class AnotherFakeApi
|
||||
@ -19,7 +19,6 @@ module Petstore
|
||||
def initialize(api_client = ApiClient.default)
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# To test special tags
|
||||
# To test special tags
|
||||
# @param body client model
|
||||
@ -27,7 +26,7 @@ module Petstore
|
||||
# @return [Client]
|
||||
def test_special_tags(body, opts = {})
|
||||
data, _status_code, _headers = test_special_tags_with_http_info(body, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# To test special tags
|
||||
@ -37,14 +36,14 @@ module Petstore
|
||||
# @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers
|
||||
def test_special_tags_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: AnotherFakeApi.test_special_tags ..."
|
||||
@api_client.config.logger.debug 'Calling API: AnotherFakeApi.test_special_tags ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling AnotherFakeApi.test_special_tags"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/another-fake/dummy"
|
||||
local_var_path = '/another-fake/dummy'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
@ -6,11 +6,11 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
require 'uri'
|
||||
|
||||
module Petstore
|
||||
class FakeApi
|
||||
@ -19,28 +19,25 @@ module Petstore
|
||||
def initialize(api_client = ApiClient.default)
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of outer boolean types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterBoolean] :body Input boolean as post body
|
||||
# @return [OuterBoolean]
|
||||
def fake_outer_boolean_serialize(opts = {})
|
||||
data, _status_code, _headers = fake_outer_boolean_serialize_with_http_info(opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of outer boolean types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterBoolean] :body Input boolean as post body
|
||||
# @return [Array<(OuterBoolean, Fixnum, Hash)>] OuterBoolean data, response status code and response headers
|
||||
def fake_outer_boolean_serialize_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.fake_outer_boolean_serialize ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.fake_outer_boolean_serialize ...'
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake/outer/boolean"
|
||||
local_var_path = '/fake/outer/boolean'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -66,28 +63,25 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of object with outer number type
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterComposite] :body Input composite as post body
|
||||
# @return [OuterComposite]
|
||||
def fake_outer_composite_serialize(opts = {})
|
||||
data, _status_code, _headers = fake_outer_composite_serialize_with_http_info(opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of object with outer number type
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterComposite] :body Input composite as post body
|
||||
# @return [Array<(OuterComposite, Fixnum, Hash)>] OuterComposite data, response status code and response headers
|
||||
def fake_outer_composite_serialize_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.fake_outer_composite_serialize ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.fake_outer_composite_serialize ...'
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake/outer/composite"
|
||||
local_var_path = '/fake/outer/composite'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -113,28 +107,25 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of outer number types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterNumber] :body Input number as post body
|
||||
# @return [OuterNumber]
|
||||
def fake_outer_number_serialize(opts = {})
|
||||
data, _status_code, _headers = fake_outer_number_serialize_with_http_info(opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of outer number types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterNumber] :body Input number as post body
|
||||
# @return [Array<(OuterNumber, Fixnum, Hash)>] OuterNumber data, response status code and response headers
|
||||
def fake_outer_number_serialize_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.fake_outer_number_serialize ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.fake_outer_number_serialize ...'
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake/outer/number"
|
||||
local_var_path = '/fake/outer/number'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -160,28 +151,25 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of outer string types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterString] :body Input string as post body
|
||||
# @return [OuterString]
|
||||
def fake_outer_string_serialize(opts = {})
|
||||
data, _status_code, _headers = fake_outer_string_serialize_with_http_info(opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
#
|
||||
# Test serialization of outer string types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterString] :body Input string as post body
|
||||
# @return [Array<(OuterString, Fixnum, Hash)>] OuterString data, response status code and response headers
|
||||
def fake_outer_string_serialize_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.fake_outer_string_serialize ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.fake_outer_string_serialize ...'
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake/outer/string"
|
||||
local_var_path = '/fake/outer/string'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -207,7 +195,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# To test \"client\" model
|
||||
# To test \"client\" model
|
||||
# @param body client model
|
||||
@ -215,7 +202,7 @@ module Petstore
|
||||
# @return [Client]
|
||||
def test_client_model(body, opts = {})
|
||||
data, _status_code, _headers = test_client_model_with_http_info(body, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# To test \"client\" model
|
||||
@ -225,14 +212,14 @@ module Petstore
|
||||
# @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers
|
||||
def test_client_model_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_client_model ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_client_model ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling FakeApi.test_client_model"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake"
|
||||
local_var_path = '/fake'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -262,7 +249,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# @param number None
|
||||
@ -283,7 +269,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def test_endpoint_parameters(number, double, pattern_without_delimiter, byte, opts = {})
|
||||
test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@ -306,7 +292,7 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_endpoint_parameters ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_endpoint_parameters ...'
|
||||
end
|
||||
# verify the required parameter 'number' is set
|
||||
if @api_client.config.client_side_validation && number.nil?
|
||||
@ -377,7 +363,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# resource path
|
||||
local_var_path = "/fake"
|
||||
local_var_path = '/fake'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -391,20 +377,20 @@ module Petstore
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["number"] = number
|
||||
form_params["double"] = double
|
||||
form_params["pattern_without_delimiter"] = pattern_without_delimiter
|
||||
form_params["byte"] = byte
|
||||
form_params["integer"] = opts[:'integer'] if !opts[:'integer'].nil?
|
||||
form_params["int32"] = opts[:'int32'] if !opts[:'int32'].nil?
|
||||
form_params["int64"] = opts[:'int64'] if !opts[:'int64'].nil?
|
||||
form_params["float"] = opts[:'float'] if !opts[:'float'].nil?
|
||||
form_params["string"] = opts[:'string'] if !opts[:'string'].nil?
|
||||
form_params["binary"] = opts[:'binary'] if !opts[:'binary'].nil?
|
||||
form_params["date"] = opts[:'date'] if !opts[:'date'].nil?
|
||||
form_params["dateTime"] = opts[:'date_time'] if !opts[:'date_time'].nil?
|
||||
form_params["password"] = opts[:'password'] if !opts[:'password'].nil?
|
||||
form_params["callback"] = opts[:'callback'] if !opts[:'callback'].nil?
|
||||
form_params['number'] = number
|
||||
form_params['double'] = double
|
||||
form_params['pattern_without_delimiter'] = pattern_without_delimiter
|
||||
form_params['byte'] = byte
|
||||
form_params['integer'] = opts[:'integer'] if !opts[:'integer'].nil?
|
||||
form_params['int32'] = opts[:'int32'] if !opts[:'int32'].nil?
|
||||
form_params['int64'] = opts[:'int64'] if !opts[:'int64'].nil?
|
||||
form_params['float'] = opts[:'float'] if !opts[:'float'].nil?
|
||||
form_params['string'] = opts[:'string'] if !opts[:'string'].nil?
|
||||
form_params['binary'] = opts[:'binary'] if !opts[:'binary'].nil?
|
||||
form_params['date'] = opts[:'date'] if !opts[:'date'].nil?
|
||||
form_params['dateTime'] = opts[:'date_time'] if !opts[:'date_time'].nil?
|
||||
form_params['password'] = opts[:'password'] if !opts[:'password'].nil?
|
||||
form_params['callback'] = opts[:'callback'] if !opts[:'callback'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
@ -420,7 +406,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# To test enum parameters
|
||||
# To test enum parameters
|
||||
# @param [Hash] opts the optional parameters
|
||||
@ -435,7 +420,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def test_enum_parameters(opts = {})
|
||||
test_enum_parameters_with_http_info(opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# To test enum parameters
|
||||
@ -452,21 +437,21 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_enum_parameters_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_enum_parameters ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_enum_parameters ...'
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_form_string_array'] && !opts[:'enum_form_string_array'].all?{|item| ['>', '$'].include?(item)}
|
||||
if @api_client.config.client_side_validation && opts[:'enum_form_string_array'] && !opts[:'enum_form_string_array'].all? { |item| ['>', '$'].include?(item) }
|
||||
fail ArgumentError, 'invalid value for "enum_form_string_array", must include one of >, $'
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_form_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_form_string'])
|
||||
fail ArgumentError, 'invalid value for "enum_form_string", must be one of _abc, -efg, (xyz)'
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all?{|item| ['>', '$'].include?(item)}
|
||||
if @api_client.config.client_side_validation && opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all? { |item| ['>', '$'].include?(item) }
|
||||
fail ArgumentError, 'invalid value for "enum_header_string_array", must include one of >, $'
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_header_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_header_string'])
|
||||
fail ArgumentError, 'invalid value for "enum_header_string", must be one of _abc, -efg, (xyz)'
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all?{|item| ['>', '$'].include?(item)}
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all? { |item| ['>', '$'].include?(item) }
|
||||
fail ArgumentError, 'invalid value for "enum_query_string_array", must include one of >, $'
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string'])
|
||||
@ -479,7 +464,7 @@ module Petstore
|
||||
fail ArgumentError, 'invalid value for "enum_query_double", must be one of 1.1, -1.2'
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake"
|
||||
local_var_path = '/fake'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -498,9 +483,9 @@ module Petstore
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["enum_form_string_array"] = @api_client.build_collection_param(opts[:'enum_form_string_array'], :csv) if !opts[:'enum_form_string_array'].nil?
|
||||
form_params["enum_form_string"] = opts[:'enum_form_string'] if !opts[:'enum_form_string'].nil?
|
||||
form_params["enum_query_double"] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil?
|
||||
form_params['enum_form_string_array'] = @api_client.build_collection_param(opts[:'enum_form_string_array'], :csv) if !opts[:'enum_form_string_array'].nil?
|
||||
form_params['enum_form_string'] = opts[:'enum_form_string'] if !opts[:'enum_form_string'].nil?
|
||||
form_params['enum_query_double'] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
@ -516,7 +501,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# test inline additionalProperties
|
||||
#
|
||||
# @param param request body
|
||||
@ -524,7 +508,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def test_inline_additional_properties(param, opts = {})
|
||||
test_inline_additional_properties_with_http_info(param, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# test inline additionalProperties
|
||||
@ -534,14 +518,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_inline_additional_properties_with_http_info(param, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_inline_additional_properties ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_inline_additional_properties ...'
|
||||
end
|
||||
# verify the required parameter 'param' is set
|
||||
if @api_client.config.client_side_validation && param.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'param' when calling FakeApi.test_inline_additional_properties"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake/inline-additionalProperties"
|
||||
local_var_path = '/fake/inline-additionalProperties'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -568,7 +552,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# test json serialization of form data
|
||||
#
|
||||
# @param param field1
|
||||
@ -577,7 +560,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def test_json_form_data(param, param2, opts = {})
|
||||
test_json_form_data_with_http_info(param, param2, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# test json serialization of form data
|
||||
@ -588,7 +571,7 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_json_form_data_with_http_info(param, param2, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeApi.test_json_form_data ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_json_form_data ...'
|
||||
end
|
||||
# verify the required parameter 'param' is set
|
||||
if @api_client.config.client_side_validation && param.nil?
|
||||
@ -599,7 +582,7 @@ module Petstore
|
||||
fail ArgumentError, "Missing the required parameter 'param2' when calling FakeApi.test_json_form_data"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake/jsonFormData"
|
||||
local_var_path = '/fake/jsonFormData'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -611,8 +594,8 @@ module Petstore
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["param"] = param
|
||||
form_params["param2"] = param2
|
||||
form_params['param'] = param
|
||||
form_params['param2'] = param2
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
@ -6,11 +6,11 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
require 'uri'
|
||||
|
||||
module Petstore
|
||||
class FakeClassnameTags123Api
|
||||
@ -19,32 +19,29 @@ module Petstore
|
||||
def initialize(api_client = ApiClient.default)
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# To test class name in snake case
|
||||
#
|
||||
# @param body client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Client]
|
||||
def test_classname(body, opts = {})
|
||||
data, _status_code, _headers = test_classname_with_http_info(body, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# To test class name in snake case
|
||||
#
|
||||
# @param body client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers
|
||||
def test_classname_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: FakeClassnameTags123Api.test_classname ..."
|
||||
@api_client.config.logger.debug 'Calling API: FakeClassnameTags123Api.test_classname ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling FakeClassnameTags123Api.test_classname"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/fake_classname_test"
|
||||
local_var_path = '/fake_classname_test'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
@ -6,11 +6,11 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
require 'uri'
|
||||
|
||||
module Petstore
|
||||
class PetApi
|
||||
@ -19,7 +19,6 @@ module Petstore
|
||||
def initialize(api_client = ApiClient.default)
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# Add a new pet to the store
|
||||
#
|
||||
# @param body Pet object that needs to be added to the store
|
||||
@ -27,7 +26,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def add_pet(body, opts = {})
|
||||
add_pet_with_http_info(body, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Add a new pet to the store
|
||||
@ -37,14 +36,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def add_pet_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.add_pet ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.add_pet ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.add_pet"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet"
|
||||
local_var_path = '/pet'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -73,7 +72,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
@ -82,7 +80,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def delete_pet(pet_id, opts = {})
|
||||
delete_pet_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
@ -93,14 +91,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_pet_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.delete_pet ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.delete_pet ...'
|
||||
end
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if @api_client.config.client_side_validation && pet_id.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}".sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -128,7 +126,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Finds Pets by status
|
||||
# Multiple status values can be provided with comma separated strings
|
||||
# @param status Status values that need to be considered for filter
|
||||
@ -136,7 +133,7 @@ module Petstore
|
||||
# @return [Array<Pet>]
|
||||
def find_pets_by_status(status, opts = {})
|
||||
data, _status_code, _headers = find_pets_by_status_with_http_info(status, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Finds Pets by status
|
||||
@ -146,14 +143,14 @@ module Petstore
|
||||
# @return [Array<(Array<Pet>, Fixnum, Hash)>] Array<Pet> data, response status code and response headers
|
||||
def find_pets_by_status_with_http_info(status, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.find_pets_by_status ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_status ...'
|
||||
end
|
||||
# verify the required parameter 'status' is set
|
||||
if @api_client.config.client_side_validation && status.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'status' when calling PetApi.find_pets_by_status"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet/findByStatus"
|
||||
local_var_path = '/pet/findByStatus'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -182,7 +179,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Finds Pets by tags
|
||||
# Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
# @param tags Tags to filter by
|
||||
@ -190,7 +186,7 @@ module Petstore
|
||||
# @return [Array<Pet>]
|
||||
def find_pets_by_tags(tags, opts = {})
|
||||
data, _status_code, _headers = find_pets_by_tags_with_http_info(tags, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Finds Pets by tags
|
||||
@ -200,14 +196,14 @@ module Petstore
|
||||
# @return [Array<(Array<Pet>, Fixnum, Hash)>] Array<Pet> data, response status code and response headers
|
||||
def find_pets_by_tags_with_http_info(tags, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.find_pets_by_tags ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_tags ...'
|
||||
end
|
||||
# verify the required parameter 'tags' is set
|
||||
if @api_client.config.client_side_validation && tags.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet/findByTags"
|
||||
local_var_path = '/pet/findByTags'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -236,7 +232,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Find pet by ID
|
||||
# Returns a single pet
|
||||
# @param pet_id ID of pet to return
|
||||
@ -244,7 +239,7 @@ module Petstore
|
||||
# @return [Pet]
|
||||
def get_pet_by_id(pet_id, opts = {})
|
||||
data, _status_code, _headers = get_pet_by_id_with_http_info(pet_id, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Find pet by ID
|
||||
@ -254,14 +249,14 @@ module Petstore
|
||||
# @return [Array<(Pet, Fixnum, Hash)>] Pet data, response status code and response headers
|
||||
def get_pet_by_id_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.get_pet_by_id ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.get_pet_by_id ...'
|
||||
end
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if @api_client.config.client_side_validation && pet_id.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}".sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -289,7 +284,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param body Pet object that needs to be added to the store
|
||||
@ -297,7 +291,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def update_pet(body, opts = {})
|
||||
update_pet_with_http_info(body, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Update an existing pet
|
||||
@ -307,14 +301,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_pet_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.update_pet ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.update_pet ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling PetApi.update_pet"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet"
|
||||
local_var_path = '/pet'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -343,7 +337,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
@ -353,7 +346,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def update_pet_with_form(pet_id, opts = {})
|
||||
update_pet_with_form_with_http_info(pet_id, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
@ -365,14 +358,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_pet_with_form_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.update_pet_with_form ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.update_pet_with_form ...'
|
||||
end
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if @api_client.config.client_side_validation && pet_id.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}".sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -386,8 +379,8 @@ module Petstore
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["name"] = opts[:'name'] if !opts[:'name'].nil?
|
||||
form_params["status"] = opts[:'status'] if !opts[:'status'].nil?
|
||||
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
|
||||
form_params['status'] = opts[:'status'] if !opts[:'status'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
@ -403,7 +396,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
@ -413,7 +405,7 @@ module Petstore
|
||||
# @return [ApiResponse]
|
||||
def upload_file(pet_id, opts = {})
|
||||
data, _status_code, _headers = upload_file_with_http_info(pet_id, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
@ -425,14 +417,14 @@ module Petstore
|
||||
# @return [Array<(ApiResponse, Fixnum, Hash)>] ApiResponse data, response status code and response headers
|
||||
def upload_file_with_http_info(pet_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: PetApi.upload_file ..."
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.upload_file ...'
|
||||
end
|
||||
# verify the required parameter 'pet_id' is set
|
||||
if @api_client.config.client_side_validation && pet_id.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/pet/{petId}/uploadImage".sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -446,8 +438,8 @@ module Petstore
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params["additionalMetadata"] = opts[:'additional_metadata'] if !opts[:'additional_metadata'].nil?
|
||||
form_params["file"] = opts[:'file'] if !opts[:'file'].nil?
|
||||
form_params['additionalMetadata'] = opts[:'additional_metadata'] if !opts[:'additional_metadata'].nil?
|
||||
form_params['file'] = opts[:'file'] if !opts[:'file'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
|
@ -6,11 +6,11 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
require 'uri'
|
||||
|
||||
module Petstore
|
||||
class StoreApi
|
||||
@ -19,7 +19,6 @@ module Petstore
|
||||
def initialize(api_client = ApiClient.default)
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# Delete purchase order by ID
|
||||
# For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
# @param order_id ID of the order that needs to be deleted
|
||||
@ -27,7 +26,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def delete_order(order_id, opts = {})
|
||||
delete_order_with_http_info(order_id, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Delete purchase order by ID
|
||||
@ -37,14 +36,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_order_with_http_info(order_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: StoreApi.delete_order ..."
|
||||
@api_client.config.logger.debug 'Calling API: StoreApi.delete_order ...'
|
||||
end
|
||||
# verify the required parameter 'order_id' is set
|
||||
if @api_client.config.client_side_validation && order_id.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.delete_order"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/store/order/{order_id}".sub('{' + 'order_id' + '}', order_id.to_s)
|
||||
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -71,14 +70,13 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Returns pet inventories by status
|
||||
# Returns a map of status codes to quantities
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Hash<String, Integer>]
|
||||
def get_inventory(opts = {})
|
||||
data, _status_code, _headers = get_inventory_with_http_info(opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Returns pet inventories by status
|
||||
@ -87,10 +85,10 @@ module Petstore
|
||||
# @return [Array<(Hash<String, Integer>, Fixnum, Hash)>] Hash<String, Integer> data, response status code and response headers
|
||||
def get_inventory_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: StoreApi.get_inventory ..."
|
||||
@api_client.config.logger.debug 'Calling API: StoreApi.get_inventory ...'
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/store/inventory"
|
||||
local_var_path = '/store/inventory'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -118,7 +116,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Find purchase order by ID
|
||||
# For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
# @param order_id ID of pet that needs to be fetched
|
||||
@ -126,7 +123,7 @@ module Petstore
|
||||
# @return [Order]
|
||||
def get_order_by_id(order_id, opts = {})
|
||||
data, _status_code, _headers = get_order_by_id_with_http_info(order_id, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Find purchase order by ID
|
||||
@ -136,7 +133,7 @@ module Petstore
|
||||
# @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers
|
||||
def get_order_by_id_with_http_info(order_id, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: StoreApi.get_order_by_id ..."
|
||||
@api_client.config.logger.debug 'Calling API: StoreApi.get_order_by_id ...'
|
||||
end
|
||||
# verify the required parameter 'order_id' is set
|
||||
if @api_client.config.client_side_validation && order_id.nil?
|
||||
@ -151,7 +148,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# resource path
|
||||
local_var_path = "/store/order/{order_id}".sub('{' + 'order_id' + '}', order_id.to_s)
|
||||
local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -179,7 +176,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param body order placed for purchasing the pet
|
||||
@ -187,7 +183,7 @@ module Petstore
|
||||
# @return [Order]
|
||||
def place_order(body, opts = {})
|
||||
data, _status_code, _headers = place_order_with_http_info(body, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Place an order for a pet
|
||||
@ -197,14 +193,14 @@ module Petstore
|
||||
# @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers
|
||||
def place_order_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: StoreApi.place_order ..."
|
||||
@api_client.config.logger.debug 'Calling API: StoreApi.place_order ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling StoreApi.place_order"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/store/order"
|
||||
local_var_path = '/store/order'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
@ -6,11 +6,11 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require "uri"
|
||||
require 'uri'
|
||||
|
||||
module Petstore
|
||||
class UserApi
|
||||
@ -19,7 +19,6 @@ module Petstore
|
||||
def initialize(api_client = ApiClient.default)
|
||||
@api_client = api_client
|
||||
end
|
||||
|
||||
# Create user
|
||||
# This can only be done by the logged in user.
|
||||
# @param body Created user object
|
||||
@ -27,7 +26,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def create_user(body, opts = {})
|
||||
create_user_with_http_info(body, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Create user
|
||||
@ -37,14 +36,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def create_user_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.create_user ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.create_user ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_user"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user"
|
||||
local_var_path = '/user'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -71,7 +70,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param body List of user object
|
||||
@ -79,7 +77,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def create_users_with_array_input(body, opts = {})
|
||||
create_users_with_array_input_with_http_info(body, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
@ -89,14 +87,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def create_users_with_array_input_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.create_users_with_array_input ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.create_users_with_array_input ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_array_input"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user/createWithArray"
|
||||
local_var_path = '/user/createWithArray'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -123,7 +121,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param body List of user object
|
||||
@ -131,7 +128,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def create_users_with_list_input(body, opts = {})
|
||||
create_users_with_list_input_with_http_info(body, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
@ -141,14 +138,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def create_users_with_list_input_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.create_users_with_list_input ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.create_users_with_list_input ...'
|
||||
end
|
||||
# verify the required parameter 'body' is set
|
||||
if @api_client.config.client_side_validation && body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.create_users_with_list_input"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user/createWithList"
|
||||
local_var_path = '/user/createWithList'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -175,7 +172,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
@ -183,7 +179,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def delete_user(username, opts = {})
|
||||
delete_user_with_http_info(username, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Delete user
|
||||
@ -193,14 +189,14 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def delete_user_with_http_info(username, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.delete_user ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.delete_user ...'
|
||||
end
|
||||
# verify the required parameter 'username' is set
|
||||
if @api_client.config.client_side_validation && username.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user/{username}".sub('{' + 'username' + '}', username.to_s)
|
||||
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -227,32 +223,31 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
def get_user_by_name(username, opts = {})
|
||||
data, _status_code, _headers = get_user_by_name_with_http_info(username, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(User, Fixnum, Hash)>] User data, response status code and response headers
|
||||
def get_user_by_name_with_http_info(username, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.get_user_by_name ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.get_user_by_name ...'
|
||||
end
|
||||
# verify the required parameter 'username' is set
|
||||
if @api_client.config.client_side_validation && username.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user/{username}".sub('{' + 'username' + '}', username.to_s)
|
||||
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -280,7 +275,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Logs user into the system
|
||||
#
|
||||
# @param username The user name for login
|
||||
@ -289,7 +283,7 @@ module Petstore
|
||||
# @return [String]
|
||||
def login_user(username, password, opts = {})
|
||||
data, _status_code, _headers = login_user_with_http_info(username, password, opts)
|
||||
return data
|
||||
data
|
||||
end
|
||||
|
||||
# Logs user into the system
|
||||
@ -300,7 +294,7 @@ module Petstore
|
||||
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
||||
def login_user_with_http_info(username, password, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.login_user ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.login_user ...'
|
||||
end
|
||||
# verify the required parameter 'username' is set
|
||||
if @api_client.config.client_side_validation && username.nil?
|
||||
@ -311,7 +305,7 @@ module Petstore
|
||||
fail ArgumentError, "Missing the required parameter 'password' when calling UserApi.login_user"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user/login"
|
||||
local_var_path = '/user/login'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -341,14 +335,13 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Logs out current logged in user session
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def logout_user(opts = {})
|
||||
logout_user_with_http_info(opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Logs out current logged in user session
|
||||
@ -357,10 +350,10 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def logout_user_with_http_info(opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.logout_user ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.logout_user ...'
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user/logout"
|
||||
local_var_path = '/user/logout'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
@ -387,7 +380,6 @@ module Petstore
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Updated user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username name that need to be deleted
|
||||
@ -396,7 +388,7 @@ module Petstore
|
||||
# @return [nil]
|
||||
def update_user(username, body, opts = {})
|
||||
update_user_with_http_info(username, body, opts)
|
||||
return nil
|
||||
nil
|
||||
end
|
||||
|
||||
# Updated user
|
||||
@ -407,7 +399,7 @@ module Petstore
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_user_with_http_info(username, body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "Calling API: UserApi.update_user ..."
|
||||
@api_client.config.logger.debug 'Calling API: UserApi.update_user ...'
|
||||
end
|
||||
# verify the required parameter 'username' is set
|
||||
if @api_client.config.client_side_validation && username.nil?
|
||||
@ -418,7 +410,7 @@ module Petstore
|
||||
fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.update_user"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = "/user/{username}".sub('{' + 'username' + '}', username.to_s)
|
||||
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s)
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -33,7 +33,7 @@ module Petstore
|
||||
@config = config
|
||||
@user_agent = "Swagger-Codegen/#{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
|
||||
@ -248,7 +248,7 @@ module Petstore
|
||||
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
||||
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
||||
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
||||
"explicitly with `tempfile.delete`"
|
||||
'explicitly with `tempfile.delete`'
|
||||
end
|
||||
end
|
||||
|
||||
@ -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
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -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
|
||||
|
@ -6,20 +6,18 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class AdditionalPropertiesClass
|
||||
attr_accessor :map_property
|
||||
|
||||
attr_accessor :map_of_map_property
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +40,7 @@ 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?(:'map_property')
|
||||
if (value = attributes[:'map_property']).is_a?(Hash)
|
||||
@ -55,20 +53,19 @@ module Petstore
|
||||
self.map_of_map_property = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -102,7 +99,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -184,7 +181,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) }
|
||||
@ -195,7 +192,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,20 +6,18 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Animal
|
||||
attr_accessor :class_name
|
||||
|
||||
attr_accessor :color
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +40,7 @@ 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?(:'className')
|
||||
self.class_name = attributes[:'className']
|
||||
@ -51,9 +49,8 @@ module Petstore
|
||||
if attributes.has_key?(:'color')
|
||||
self.color = attributes[:'color']
|
||||
else
|
||||
self.color = "red"
|
||||
self.color = 'red'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -61,17 +58,17 @@ module Petstore
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if @class_name.nil?
|
||||
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
|
||||
invalid_properties.push('invalid value for "class_name", class_name cannot be nil.')
|
||||
end
|
||||
|
||||
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 false if @class_name.nil?
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
@ -105,7 +102,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -187,7 +184,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) }
|
||||
@ -198,7 +195,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,16 +6,14 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class AnimalFarm
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -34,21 +32,20 @@ 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 }
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -80,7 +77,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -162,7 +159,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) }
|
||||
@ -173,7 +170,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class ApiResponse
|
||||
attr_accessor :code
|
||||
|
||||
@ -21,7 +20,6 @@ module Petstore
|
||||
|
||||
attr_accessor :message
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -46,7 +44,7 @@ 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?(:'code')
|
||||
self.code = attributes[:'code']
|
||||
@ -59,20 +57,19 @@ module Petstore
|
||||
if attributes.has_key?(:'message')
|
||||
self.message = attributes[:'message']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -107,7 +104,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -189,7 +186,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) }
|
||||
@ -200,7 +197,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,18 +6,16 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class ArrayOfArrayOfNumberOnly
|
||||
attr_accessor :array_array_number
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,27 +36,26 @@ 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?(:'ArrayArrayNumber')
|
||||
if (value = attributes[:'ArrayArrayNumber']).is_a?(Array)
|
||||
self.array_array_number = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -91,7 +88,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -173,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) }
|
||||
@ -184,7 +181,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,18 +6,16 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class ArrayOfNumberOnly
|
||||
attr_accessor :array_number
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,27 +36,26 @@ 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?(:'ArrayNumber')
|
||||
if (value = attributes[:'ArrayNumber']).is_a?(Array)
|
||||
self.array_number = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -91,7 +88,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -173,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) }
|
||||
@ -184,7 +181,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class ArrayTest
|
||||
attr_accessor :array_of_string
|
||||
|
||||
@ -21,7 +20,6 @@ module Petstore
|
||||
|
||||
attr_accessor :array_array_of_model
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -46,7 +44,7 @@ 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?(:'array_of_string')
|
||||
if (value = attributes[:'array_of_string']).is_a?(Array)
|
||||
@ -65,20 +63,19 @@ module Petstore
|
||||
self.array_array_of_model = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -113,7 +110,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -195,7 +192,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) }
|
||||
@ -206,7 +203,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Capitalization
|
||||
attr_accessor :small_camel
|
||||
|
||||
@ -28,7 +27,6 @@ module Petstore
|
||||
# Name of the pet
|
||||
attr_accessor :att_name
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -59,7 +57,7 @@ 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?(:'smallCamel')
|
||||
self.small_camel = attributes[:'smallCamel']
|
||||
@ -84,20 +82,19 @@ module Petstore
|
||||
if attributes.has_key?(:'ATT_NAME')
|
||||
self.att_name = attributes[:'ATT_NAME']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -135,7 +132,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -217,7 +214,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) }
|
||||
@ -228,7 +225,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Cat
|
||||
attr_accessor :class_name
|
||||
|
||||
@ -21,7 +20,6 @@ module Petstore
|
||||
|
||||
attr_accessor :declawed
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -46,7 +44,7 @@ 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?(:'className')
|
||||
self.class_name = attributes[:'className']
|
||||
@ -55,13 +53,12 @@ module Petstore
|
||||
if attributes.has_key?(:'color')
|
||||
self.color = attributes[:'color']
|
||||
else
|
||||
self.color = "red"
|
||||
self.color = 'red'
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'declawed')
|
||||
self.declawed = attributes[:'declawed']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -69,17 +66,17 @@ module Petstore
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if @class_name.nil?
|
||||
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
|
||||
invalid_properties.push('invalid value for "class_name", class_name cannot be nil.')
|
||||
end
|
||||
|
||||
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 false if @class_name.nil?
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
@ -114,7 +111,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -196,7 +193,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) }
|
||||
@ -207,7 +204,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,20 +6,18 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Category
|
||||
attr_accessor :id
|
||||
|
||||
attr_accessor :name
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +40,7 @@ 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?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
@ -51,20 +49,19 @@ module Petstore
|
||||
if attributes.has_key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -98,7 +95,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -180,7 +177,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) }
|
||||
@ -191,7 +188,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,7 +17,6 @@ module Petstore
|
||||
class ClassModel
|
||||
attr_accessor :_class
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,25 +37,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?(:'_class')
|
||||
self._class = attributes[:'_class']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -89,7 +87,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -171,7 +169,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) }
|
||||
@ -182,7 +180,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,18 +6,16 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Client
|
||||
attr_accessor :client
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,25 +36,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?(:'client')
|
||||
self.client = attributes[:'client']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -89,7 +86,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -171,7 +168,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) }
|
||||
@ -182,7 +179,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Dog
|
||||
attr_accessor :class_name
|
||||
|
||||
@ -21,7 +20,6 @@ module Petstore
|
||||
|
||||
attr_accessor :breed
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -46,7 +44,7 @@ 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?(:'className')
|
||||
self.class_name = attributes[:'className']
|
||||
@ -55,13 +53,12 @@ module Petstore
|
||||
if attributes.has_key?(:'color')
|
||||
self.color = attributes[:'color']
|
||||
else
|
||||
self.color = "red"
|
||||
self.color = 'red'
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'breed')
|
||||
self.breed = attributes[:'breed']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -69,17 +66,17 @@ module Petstore
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if @class_name.nil?
|
||||
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
|
||||
invalid_properties.push('invalid value for "class_name", class_name cannot be nil.')
|
||||
end
|
||||
|
||||
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 false if @class_name.nil?
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
@ -114,7 +111,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -196,7 +193,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) }
|
||||
@ -207,7 +204,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class EnumArrays
|
||||
attr_accessor :just_symbol
|
||||
|
||||
@ -63,7 +62,7 @@ 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?(:'just_symbol')
|
||||
self.just_symbol = attributes[:'just_symbol']
|
||||
@ -74,30 +73,29 @@ module Petstore
|
||||
self.array_enum = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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?
|
||||
just_symbol_validator = EnumAttributeValidator.new('String', [">=", "$"])
|
||||
just_symbol_validator = EnumAttributeValidator.new('String', ['>=', '$'])
|
||||
return false unless just_symbol_validator.valid?(@just_symbol)
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] just_symbol Object to be assigned
|
||||
def just_symbol=(just_symbol)
|
||||
validator = EnumAttributeValidator.new('String', [">=", "$"])
|
||||
validator = EnumAttributeValidator.new('String', ['>=', '$'])
|
||||
unless validator.valid?(just_symbol)
|
||||
fail ArgumentError, "invalid value for 'just_symbol', must be one of #{validator.allowable_values}."
|
||||
fail ArgumentError, 'invalid value for "just_symbol", must be one of #{validator.allowable_values}.'
|
||||
end
|
||||
@just_symbol = just_symbol
|
||||
end
|
||||
@ -133,7 +131,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -215,7 +213,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) }
|
||||
@ -226,7 +224,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -15,18 +15,17 @@ require 'date'
|
||||
module Petstore
|
||||
class EnumClass
|
||||
|
||||
ABC = "_abc".freeze
|
||||
EFG = "-efg".freeze
|
||||
XYZ = "(xyz)".freeze
|
||||
ABC = '_abc'.freeze
|
||||
EFG = '-efg'.freeze
|
||||
XYZ = '(xyz)'.freeze
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def build_from_hash(value)
|
||||
constantValues = EnumClass.constants.select{|c| EnumClass::const_get(c) == value}
|
||||
constantValues = EnumClass.constants.select { |c| EnumClass::const_get(c) == value }
|
||||
raise "Invalid ENUM value #{value} for class #EnumClass" if constantValues.empty?
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class EnumTest
|
||||
attr_accessor :enum_string
|
||||
|
||||
@ -71,7 +70,7 @@ 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?(:'enum_string')
|
||||
self.enum_string = attributes[:'enum_string']
|
||||
@ -88,34 +87,33 @@ module Petstore
|
||||
if attributes.has_key?(:'outerEnum')
|
||||
self.outer_enum = attributes[:'outerEnum']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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?
|
||||
enum_string_validator = EnumAttributeValidator.new('String', ["UPPER", "lower", ""])
|
||||
enum_string_validator = EnumAttributeValidator.new('String', ['UPPER', 'lower', ''])
|
||||
return false unless enum_string_validator.valid?(@enum_string)
|
||||
enum_integer_validator = EnumAttributeValidator.new('Integer', ["1", "-1"])
|
||||
enum_integer_validator = EnumAttributeValidator.new('Integer', ['1', '-1'])
|
||||
return false unless enum_integer_validator.valid?(@enum_integer)
|
||||
enum_number_validator = EnumAttributeValidator.new('Float', ["1.1", "-1.2"])
|
||||
enum_number_validator = EnumAttributeValidator.new('Float', ['1.1', '-1.2'])
|
||||
return false unless enum_number_validator.valid?(@enum_number)
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] enum_string Object to be assigned
|
||||
def enum_string=(enum_string)
|
||||
validator = EnumAttributeValidator.new('String', ["UPPER", "lower", ""])
|
||||
validator = EnumAttributeValidator.new('String', ['UPPER', 'lower', ''])
|
||||
unless validator.valid?(enum_string)
|
||||
fail ArgumentError, "invalid value for 'enum_string', must be one of #{validator.allowable_values}."
|
||||
fail ArgumentError, 'invalid value for "enum_string", must be one of #{validator.allowable_values}.'
|
||||
end
|
||||
@enum_string = enum_string
|
||||
end
|
||||
@ -123,9 +121,9 @@ module Petstore
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] enum_integer Object to be assigned
|
||||
def enum_integer=(enum_integer)
|
||||
validator = EnumAttributeValidator.new('Integer', ["1", "-1"])
|
||||
validator = EnumAttributeValidator.new('Integer', ['1', '-1'])
|
||||
unless validator.valid?(enum_integer)
|
||||
fail ArgumentError, "invalid value for 'enum_integer', must be one of #{validator.allowable_values}."
|
||||
fail ArgumentError, 'invalid value for "enum_integer", must be one of #{validator.allowable_values}.'
|
||||
end
|
||||
@enum_integer = enum_integer
|
||||
end
|
||||
@ -133,9 +131,9 @@ module Petstore
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] enum_number Object to be assigned
|
||||
def enum_number=(enum_number)
|
||||
validator = EnumAttributeValidator.new('Float', ["1.1", "-1.2"])
|
||||
validator = EnumAttributeValidator.new('Float', ['1.1', '-1.2'])
|
||||
unless validator.valid?(enum_number)
|
||||
fail ArgumentError, "invalid value for 'enum_number', must be one of #{validator.allowable_values}."
|
||||
fail ArgumentError, 'invalid value for "enum_number", must be one of #{validator.allowable_values}.'
|
||||
end
|
||||
@enum_number = enum_number
|
||||
end
|
||||
@ -173,7 +171,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -255,7 +253,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) }
|
||||
@ -266,7 +264,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class FormatTest
|
||||
attr_accessor :integer
|
||||
|
||||
@ -41,7 +40,6 @@ module Petstore
|
||||
|
||||
attr_accessor :password
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -86,7 +84,7 @@ 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?(:'integer')
|
||||
self.integer = attributes[:'integer']
|
||||
@ -139,7 +137,6 @@ module Petstore
|
||||
if attributes.has_key?(:'password')
|
||||
self.password = attributes[:'password']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -147,78 +144,78 @@ module Petstore
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if !@integer.nil? && @integer > 100
|
||||
invalid_properties.push("invalid value for 'integer', must be smaller than or equal to 100.")
|
||||
invalid_properties.push('invalid value for "integer", must be smaller than or equal to 100.')
|
||||
end
|
||||
|
||||
if !@integer.nil? && @integer < 10
|
||||
invalid_properties.push("invalid value for 'integer', must be greater than or equal to 10.")
|
||||
invalid_properties.push('invalid value for "integer", must be greater than or equal to 10.')
|
||||
end
|
||||
|
||||
if !@int32.nil? && @int32 > 200
|
||||
invalid_properties.push("invalid value for 'int32', must be smaller than or equal to 200.")
|
||||
invalid_properties.push('invalid value for "int32", must be smaller than or equal to 200.')
|
||||
end
|
||||
|
||||
if !@int32.nil? && @int32 < 20
|
||||
invalid_properties.push("invalid value for 'int32', must be greater than or equal to 20.")
|
||||
invalid_properties.push('invalid value for "int32", must be greater than or equal to 20.')
|
||||
end
|
||||
|
||||
if @number.nil?
|
||||
invalid_properties.push("invalid value for 'number', number cannot be nil.")
|
||||
invalid_properties.push('invalid value for "number", number cannot be nil.')
|
||||
end
|
||||
|
||||
if @number > 543.2
|
||||
invalid_properties.push("invalid value for 'number', must be smaller than or equal to 543.2.")
|
||||
invalid_properties.push('invalid value for "number", must be smaller than or equal to 543.2.')
|
||||
end
|
||||
|
||||
if @number < 32.1
|
||||
invalid_properties.push("invalid value for 'number', must be greater than or equal to 32.1.")
|
||||
invalid_properties.push('invalid value for "number", must be greater than or equal to 32.1.')
|
||||
end
|
||||
|
||||
if !@float.nil? && @float > 987.6
|
||||
invalid_properties.push("invalid value for 'float', must be smaller than or equal to 987.6.")
|
||||
invalid_properties.push('invalid value for "float", must be smaller than or equal to 987.6.')
|
||||
end
|
||||
|
||||
if !@float.nil? && @float < 54.3
|
||||
invalid_properties.push("invalid value for 'float', must be greater than or equal to 54.3.")
|
||||
invalid_properties.push('invalid value for "float", must be greater than or equal to 54.3.')
|
||||
end
|
||||
|
||||
if !@double.nil? && @double > 123.4
|
||||
invalid_properties.push("invalid value for 'double', must be smaller than or equal to 123.4.")
|
||||
invalid_properties.push('invalid value for "double", must be smaller than or equal to 123.4.')
|
||||
end
|
||||
|
||||
if !@double.nil? && @double < 67.8
|
||||
invalid_properties.push("invalid value for 'double', must be greater than or equal to 67.8.")
|
||||
invalid_properties.push('invalid value for "double", must be greater than or equal to 67.8.')
|
||||
end
|
||||
|
||||
if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
|
||||
invalid_properties.push("invalid value for 'string', must conform to the pattern /[a-z]/i.")
|
||||
invalid_properties.push('invalid value for "string", must conform to the pattern /[a-z]/i.')
|
||||
end
|
||||
|
||||
if @byte.nil?
|
||||
invalid_properties.push("invalid value for 'byte', byte cannot be nil.")
|
||||
invalid_properties.push('invalid value for "byte", byte cannot be nil.')
|
||||
end
|
||||
|
||||
if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
||||
invalid_properties.push("invalid value for 'byte', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.")
|
||||
invalid_properties.push('invalid value for "byte", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
|
||||
end
|
||||
|
||||
if @date.nil?
|
||||
invalid_properties.push("invalid value for 'date', date cannot be nil.")
|
||||
invalid_properties.push('invalid value for "date", date cannot be nil.')
|
||||
end
|
||||
|
||||
if @password.nil?
|
||||
invalid_properties.push("invalid value for 'password', password cannot be nil.")
|
||||
invalid_properties.push('invalid value for "password", password cannot be nil.')
|
||||
end
|
||||
|
||||
if @password.to_s.length > 64
|
||||
invalid_properties.push("invalid value for 'password', the character length must be smaller than or equal to 64.")
|
||||
invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 64.')
|
||||
end
|
||||
|
||||
if @password.to_s.length < 10
|
||||
invalid_properties.push("invalid value for 'password', the character length must be great than or equal to 10.")
|
||||
invalid_properties.push('invalid value for "password", the character length must be great than or equal to 10.')
|
||||
end
|
||||
|
||||
return invalid_properties
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
# Check to see if the all the properties in the model are valid
|
||||
@ -242,19 +239,18 @@ module Petstore
|
||||
return false if @password.nil?
|
||||
return false if @password.to_s.length > 64
|
||||
return false if @password.to_s.length < 10
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] integer Value to be assigned
|
||||
def integer=(integer)
|
||||
|
||||
if !integer.nil? && integer > 100
|
||||
fail ArgumentError, "invalid value for 'integer', must be smaller than or equal to 100."
|
||||
fail ArgumentError, 'invalid value for "integer", must be smaller than or equal to 100.'
|
||||
end
|
||||
|
||||
if !integer.nil? && integer < 10
|
||||
fail ArgumentError, "invalid value for 'integer', must be greater than or equal to 10."
|
||||
fail ArgumentError, 'invalid value for "integer", must be greater than or equal to 10.'
|
||||
end
|
||||
|
||||
@integer = integer
|
||||
@ -263,13 +259,12 @@ module Petstore
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] int32 Value to be assigned
|
||||
def int32=(int32)
|
||||
|
||||
if !int32.nil? && int32 > 200
|
||||
fail ArgumentError, "invalid value for 'int32', must be smaller than or equal to 200."
|
||||
fail ArgumentError, 'invalid value for "int32", must be smaller than or equal to 200.'
|
||||
end
|
||||
|
||||
if !int32.nil? && int32 < 20
|
||||
fail ArgumentError, "invalid value for 'int32', must be greater than or equal to 20."
|
||||
fail ArgumentError, 'invalid value for "int32", must be greater than or equal to 20.'
|
||||
end
|
||||
|
||||
@int32 = int32
|
||||
@ -279,15 +274,15 @@ module Petstore
|
||||
# @param [Object] number Value to be assigned
|
||||
def number=(number)
|
||||
if number.nil?
|
||||
fail ArgumentError, "number cannot be nil"
|
||||
fail ArgumentError, 'number cannot be nil'
|
||||
end
|
||||
|
||||
if number > 543.2
|
||||
fail ArgumentError, "invalid value for 'number', must be smaller than or equal to 543.2."
|
||||
fail ArgumentError, 'invalid value for "number", must be smaller than or equal to 543.2.'
|
||||
end
|
||||
|
||||
if number < 32.1
|
||||
fail ArgumentError, "invalid value for 'number', must be greater than or equal to 32.1."
|
||||
fail ArgumentError, 'invalid value for "number", must be greater than or equal to 32.1.'
|
||||
end
|
||||
|
||||
@number = number
|
||||
@ -296,13 +291,12 @@ module Petstore
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] float Value to be assigned
|
||||
def float=(float)
|
||||
|
||||
if !float.nil? && float > 987.6
|
||||
fail ArgumentError, "invalid value for 'float', must be smaller than or equal to 987.6."
|
||||
fail ArgumentError, 'invalid value for "float", must be smaller than or equal to 987.6.'
|
||||
end
|
||||
|
||||
if !float.nil? && float < 54.3
|
||||
fail ArgumentError, "invalid value for 'float', must be greater than or equal to 54.3."
|
||||
fail ArgumentError, 'invalid value for "float", must be greater than or equal to 54.3.'
|
||||
end
|
||||
|
||||
@float = float
|
||||
@ -311,13 +305,12 @@ module Petstore
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] double Value to be assigned
|
||||
def double=(double)
|
||||
|
||||
if !double.nil? && double > 123.4
|
||||
fail ArgumentError, "invalid value for 'double', must be smaller than or equal to 123.4."
|
||||
fail ArgumentError, 'invalid value for "double", must be smaller than or equal to 123.4.'
|
||||
end
|
||||
|
||||
if !double.nil? && double < 67.8
|
||||
fail ArgumentError, "invalid value for 'double', must be greater than or equal to 67.8."
|
||||
fail ArgumentError, 'invalid value for "double", must be greater than or equal to 67.8.'
|
||||
end
|
||||
|
||||
@double = double
|
||||
@ -326,9 +319,8 @@ module Petstore
|
||||
# Custom attribute writer method with validation
|
||||
# @param [Object] string Value to be assigned
|
||||
def string=(string)
|
||||
|
||||
if !string.nil? && string !~ Regexp.new(/[a-z]/i)
|
||||
fail ArgumentError, "invalid value for 'string', must conform to the pattern /[a-z]/i."
|
||||
fail ArgumentError, 'invalid value for "string", must conform to the pattern /[a-z]/i.'
|
||||
end
|
||||
|
||||
@string = string
|
||||
@ -338,11 +330,11 @@ module Petstore
|
||||
# @param [Object] byte Value to be assigned
|
||||
def byte=(byte)
|
||||
if byte.nil?
|
||||
fail ArgumentError, "byte cannot be nil"
|
||||
fail ArgumentError, 'byte cannot be nil'
|
||||
end
|
||||
|
||||
if byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
||||
fail ArgumentError, "invalid value for 'byte', must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."
|
||||
fail ArgumentError, 'invalid value for "byte", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
|
||||
end
|
||||
|
||||
@byte = byte
|
||||
@ -352,15 +344,15 @@ module Petstore
|
||||
# @param [Object] password Value to be assigned
|
||||
def password=(password)
|
||||
if password.nil?
|
||||
fail ArgumentError, "password cannot be nil"
|
||||
fail ArgumentError, 'password cannot be nil'
|
||||
end
|
||||
|
||||
if password.to_s.length > 64
|
||||
fail ArgumentError, "invalid value for 'password', the character length must be smaller than or equal to 64."
|
||||
fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 64.'
|
||||
end
|
||||
|
||||
if password.to_s.length < 10
|
||||
fail ArgumentError, "invalid value for 'password', the character length must be great than or equal to 10."
|
||||
fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 10.'
|
||||
end
|
||||
|
||||
@password = password
|
||||
@ -408,7 +400,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -490,7 +482,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) }
|
||||
@ -501,7 +493,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,20 +6,18 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class HasOnlyReadOnly
|
||||
attr_accessor :bar
|
||||
|
||||
attr_accessor :foo
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +40,7 @@ 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?(:'bar')
|
||||
self.bar = attributes[:'bar']
|
||||
@ -51,20 +49,19 @@ module Petstore
|
||||
if attributes.has_key?(:'foo')
|
||||
self.foo = attributes[:'foo']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -98,7 +95,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -180,7 +177,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) }
|
||||
@ -191,7 +188,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,230 +0,0 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class InlineResponse200
|
||||
attr_accessor :tags
|
||||
|
||||
attr_accessor :id
|
||||
|
||||
attr_accessor :category
|
||||
|
||||
# pet status in the store
|
||||
attr_accessor :status
|
||||
|
||||
attr_accessor :name
|
||||
|
||||
attr_accessor :photo_urls
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'tags' => :'tags',
|
||||
:'id' => :'id',
|
||||
:'category' => :'category',
|
||||
:'status' => :'status',
|
||||
:'name' => :'name',
|
||||
:'photo_urls' => :'photoUrls'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.swagger_types
|
||||
{
|
||||
:'tags' => :'Array<Tag>',
|
||||
:'id' => :'Integer',
|
||||
:'category' => :'Object',
|
||||
:'status' => :'String',
|
||||
:'name' => :'String',
|
||||
:'photo_urls' => :'Array<String>'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
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}
|
||||
|
||||
if attributes[:'tags']
|
||||
if (value = attributes[:'tags']).is_a?(Array)
|
||||
self.tags = value
|
||||
end
|
||||
end
|
||||
if attributes[:'id']
|
||||
self.id = attributes[:'id']
|
||||
end
|
||||
if attributes[:'category']
|
||||
self.category = attributes[:'category']
|
||||
end
|
||||
if attributes[:'status']
|
||||
self.status = attributes[:'status']
|
||||
end
|
||||
if attributes[:'name']
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
if attributes[:'photoUrls']
|
||||
if (value = attributes[:'photoUrls']).is_a?(Array)
|
||||
self.photo_urls = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] status Object to be assigned
|
||||
def status=(status)
|
||||
allowed_values = ["available", "pending", "sold"]
|
||||
if status && !allowed_values.include?(status)
|
||||
fail "invalid value for 'status', must be one of #{allowed_values}"
|
||||
end
|
||||
@status = status
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
# @param [Object] Object to be compared
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
tags == o.tags &&
|
||||
id == o.id &&
|
||||
category == o.category &&
|
||||
status == o.status &&
|
||||
name == o.name &&
|
||||
photo_urls == o.photo_urls
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
def hash
|
||||
[tags, id, category, status, name, photo_urls].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @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|
|
||||
if type =~ /^Array<(.*)>/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) } )
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
# Deserializes the data based on type
|
||||
# @param string type Data type
|
||||
# @param string value Value to be deserialized
|
||||
# @return [Object] Deserialized data
|
||||
def _deserialize(type, value)
|
||||
case type.to_sym
|
||||
when :DateTime
|
||||
DateTime.parse(value)
|
||||
when :Date
|
||||
Date.parse(value)
|
||||
when :String
|
||||
value.to_s
|
||||
when :Integer
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
when :Object
|
||||
# generic object (usually a Hash), return directly
|
||||
value
|
||||
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/
|
||||
k_type = Regexp.last_match[:k_type]
|
||||
v_type = Regexp.last_match[:v_type]
|
||||
{}.tap do |hash|
|
||||
value.each do |k, v|
|
||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
next if value.nil?
|
||||
hash[param] = _to_hash(value)
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @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) }
|
||||
elsif value.is_a?(Hash)
|
||||
{}.tap do |hash|
|
||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
||||
end
|
||||
elsif value.respond_to? :to_hash
|
||||
value.to_hash
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -6,18 +6,16 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class List
|
||||
attr_accessor :_123_list
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,25 +36,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?(:'123-list')
|
||||
self._123_list = attributes[:'123-list']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -89,7 +86,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -171,7 +168,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) }
|
||||
@ -182,7 +179,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class MapTest
|
||||
attr_accessor :map_map_of_string
|
||||
|
||||
@ -63,7 +62,7 @@ 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?(:'map_map_of_string')
|
||||
if (value = attributes[:'map_map_of_string']).is_a?(Hash)
|
||||
@ -76,20 +75,19 @@ module Petstore
|
||||
self.map_of_enum_string = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -123,7 +121,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -205,7 +203,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) }
|
||||
@ -216,7 +214,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class MixedPropertiesAndAdditionalPropertiesClass
|
||||
attr_accessor :uuid
|
||||
|
||||
@ -21,7 +20,6 @@ module Petstore
|
||||
|
||||
attr_accessor :map
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -46,7 +44,7 @@ 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?(:'uuid')
|
||||
self.uuid = attributes[:'uuid']
|
||||
@ -61,20 +59,19 @@ module Petstore
|
||||
self.map = value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -109,7 +106,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -191,7 +188,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) }
|
||||
@ -202,7 +199,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -19,7 +19,6 @@ module Petstore
|
||||
|
||||
attr_accessor :_class
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +41,7 @@ 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?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
@ -51,20 +50,19 @@ module Petstore
|
||||
if attributes.has_key?(:'class')
|
||||
self._class = attributes[:'class']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -98,7 +96,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -180,7 +178,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) }
|
||||
@ -191,7 +189,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -17,7 +17,6 @@ module Petstore
|
||||
class ModelReturn
|
||||
attr_accessor :_return
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,25 +37,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 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.
|
||||
@ -89,7 +87,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -171,7 +169,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) }
|
||||
@ -182,7 +180,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -23,7 +23,6 @@ module Petstore
|
||||
|
||||
attr_accessor :_123_number
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -50,7 +49,7 @@ 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?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
@ -67,7 +66,6 @@ module Petstore
|
||||
if attributes.has_key?(:'123Number')
|
||||
self._123_number = attributes[:'123Number']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -75,17 +73,17 @@ module Petstore
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if @name.nil?
|
||||
invalid_properties.push("invalid value for 'name', name cannot be nil.")
|
||||
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
||||
end
|
||||
|
||||
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 false if @name.nil?
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
@ -121,7 +119,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -203,7 +201,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) }
|
||||
@ -214,7 +212,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,18 +6,16 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class NumberOnly
|
||||
attr_accessor :just_number
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,25 +36,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?(:'JustNumber')
|
||||
self.just_number = attributes[:'JustNumber']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -89,7 +86,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -171,7 +168,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) }
|
||||
@ -182,7 +179,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Order
|
||||
attr_accessor :id
|
||||
|
||||
@ -80,7 +79,7 @@ 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?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
@ -107,30 +106,29 @@ module Petstore
|
||||
else
|
||||
self.complete = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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?
|
||||
status_validator = EnumAttributeValidator.new('String', ["placed", "approved", "delivered"])
|
||||
status_validator = EnumAttributeValidator.new('String', ['placed', 'approved', 'delivered'])
|
||||
return false unless status_validator.valid?(@status)
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] status Object to be assigned
|
||||
def status=(status)
|
||||
validator = EnumAttributeValidator.new('String', ["placed", "approved", "delivered"])
|
||||
validator = EnumAttributeValidator.new('String', ['placed', 'approved', 'delivered'])
|
||||
unless validator.valid?(status)
|
||||
fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
|
||||
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
||||
end
|
||||
@status = status
|
||||
end
|
||||
@ -170,7 +168,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -252,7 +250,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) }
|
||||
@ -263,7 +261,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,16 +6,14 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class OuterBoolean
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -34,21 +32,20 @@ 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 }
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -80,7 +77,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -162,7 +159,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) }
|
||||
@ -173,7 +170,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class OuterComposite
|
||||
attr_accessor :my_number
|
||||
|
||||
@ -21,7 +20,6 @@ module Petstore
|
||||
|
||||
attr_accessor :my_boolean
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -46,7 +44,7 @@ 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?(:'my_number')
|
||||
self.my_number = attributes[:'my_number']
|
||||
@ -59,20 +57,19 @@ module Petstore
|
||||
if attributes.has_key?(:'my_boolean')
|
||||
self.my_boolean = attributes[:'my_boolean']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -107,7 +104,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -189,7 +186,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) }
|
||||
@ -200,7 +197,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,7 +6,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@ -15,18 +15,17 @@ require 'date'
|
||||
module Petstore
|
||||
class OuterEnum
|
||||
|
||||
PLACED = "placed".freeze
|
||||
APPROVED = "approved".freeze
|
||||
DELIVERED = "delivered".freeze
|
||||
PLACED = 'placed'.freeze
|
||||
APPROVED = 'approved'.freeze
|
||||
DELIVERED = 'delivered'.freeze
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
# @return [String] The enum value
|
||||
def build_from_hash(value)
|
||||
constantValues = OuterEnum.constants.select{|c| OuterEnum::const_get(c) == value}
|
||||
constantValues = OuterEnum.constants.select { |c| OuterEnum::const_get(c) == value }
|
||||
raise "Invalid ENUM value #{value} for class #OuterEnum" if constantValues.empty?
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,16 +6,14 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class OuterNumber
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -34,21 +32,20 @@ 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 }
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -80,7 +77,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -162,7 +159,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) }
|
||||
@ -173,7 +170,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,16 +6,14 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class OuterString
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -34,21 +32,20 @@ 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 }
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -80,7 +77,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -162,7 +159,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) }
|
||||
@ -173,7 +170,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Pet
|
||||
attr_accessor :id
|
||||
|
||||
@ -80,7 +79,7 @@ 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?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
@ -109,7 +108,6 @@ module Petstore
|
||||
if attributes.has_key?(:'status')
|
||||
self.status = attributes[:'status']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@ -117,14 +115,14 @@ module Petstore
|
||||
def list_invalid_properties
|
||||
invalid_properties = Array.new
|
||||
if @name.nil?
|
||||
invalid_properties.push("invalid value for 'name', name cannot be nil.")
|
||||
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
||||
end
|
||||
|
||||
if @photo_urls.nil?
|
||||
invalid_properties.push("invalid value for 'photo_urls', photo_urls cannot be nil.")
|
||||
invalid_properties.push('invalid value for "photo_urls", photo_urls cannot be nil.')
|
||||
end
|
||||
|
||||
return invalid_properties
|
||||
invalid_properties
|
||||
end
|
||||
|
||||
# Check to see if the all the properties in the model are valid
|
||||
@ -132,17 +130,17 @@ module Petstore
|
||||
def valid?
|
||||
return false if @name.nil?
|
||||
return false if @photo_urls.nil?
|
||||
status_validator = EnumAttributeValidator.new('String', ["available", "pending", "sold"])
|
||||
status_validator = EnumAttributeValidator.new('String', ['available', 'pending', 'sold'])
|
||||
return false unless status_validator.valid?(@status)
|
||||
return true
|
||||
true
|
||||
end
|
||||
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] status Object to be assigned
|
||||
def status=(status)
|
||||
validator = EnumAttributeValidator.new('String', ["available", "pending", "sold"])
|
||||
validator = EnumAttributeValidator.new('String', ['available', 'pending', 'sold'])
|
||||
unless validator.valid?(status)
|
||||
fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
|
||||
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
||||
end
|
||||
@status = status
|
||||
end
|
||||
@ -182,7 +180,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -264,7 +262,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) }
|
||||
@ -275,7 +273,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,20 +6,18 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class ReadOnlyFirst
|
||||
attr_accessor :bar
|
||||
|
||||
attr_accessor :baz
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +40,7 @@ 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?(:'bar')
|
||||
self.bar = attributes[:'bar']
|
||||
@ -51,20 +49,19 @@ module Petstore
|
||||
if attributes.has_key?(:'baz')
|
||||
self.baz = attributes[:'baz']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -98,7 +95,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -180,7 +177,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) }
|
||||
@ -191,7 +188,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,18 +6,16 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class SpecialModelName
|
||||
attr_accessor :special_property_name
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -38,25 +36,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?(:'$special[property.name]')
|
||||
self.special_property_name = attributes[:'$special[property.name]']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -89,7 +86,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -171,7 +168,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) }
|
||||
@ -182,7 +179,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,20 +6,18 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class Tag
|
||||
attr_accessor :id
|
||||
|
||||
attr_accessor :name
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -42,7 +40,7 @@ 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?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
@ -51,20 +49,19 @@ module Petstore
|
||||
if attributes.has_key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -98,7 +95,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -180,7 +177,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) }
|
||||
@ -191,7 +188,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,14 +6,13 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
|
||||
class User
|
||||
attr_accessor :id
|
||||
|
||||
@ -32,7 +31,6 @@ module Petstore
|
||||
# User Status
|
||||
attr_accessor :user_status
|
||||
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
@ -67,7 +65,7 @@ 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?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
@ -100,20 +98,19 @@ module Petstore
|
||||
if attributes.has_key?(:'userStatus')
|
||||
self.user_status = attributes[:'userStatus']
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
# @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.
|
||||
@ -153,7 +150,7 @@ module Petstore
|
||||
# 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]]))
|
||||
@ -235,7 +232,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) }
|
||||
@ -246,7 +243,5 @@ module Petstore
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -6,10 +6,10 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
module Petstore
|
||||
VERSION = "1.0.0"
|
||||
VERSION = '1.0.0'
|
||||
end
|
||||
|
@ -8,7 +8,7 @@
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
Swagger Codegen version: 2.4.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user