forked from loafle/openapi-generator-original
[Ruby][Faraday] Various improvements (#3520)
* update ruby faraday oas v2 samples * skip some default tests in faraday * add ruby faraday oas v3 client * add tests, fix url * add tests to CI * fix file upload * undo changes to ruby-client-petstore.sh * test faraday first * combine gemspec tempaltes * test ruby faraday in drone.io * use smaller image * update bundler * use official ruby image * skip bundler installation * skip autotest * install make * use different image * skip ruby tests in drone.io
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -17,19 +17,27 @@ require 'petstore/version'
|
||||
require 'petstore/configuration'
|
||||
|
||||
# Models
|
||||
require 'petstore/models/additional_properties_any_type'
|
||||
require 'petstore/models/additional_properties_array'
|
||||
require 'petstore/models/additional_properties_boolean'
|
||||
require 'petstore/models/additional_properties_class'
|
||||
require 'petstore/models/additional_properties_integer'
|
||||
require 'petstore/models/additional_properties_number'
|
||||
require 'petstore/models/additional_properties_object'
|
||||
require 'petstore/models/additional_properties_string'
|
||||
require 'petstore/models/animal'
|
||||
require 'petstore/models/animal_farm'
|
||||
require 'petstore/models/api_response'
|
||||
require 'petstore/models/array_of_array_of_number_only'
|
||||
require 'petstore/models/array_of_number_only'
|
||||
require 'petstore/models/array_test'
|
||||
require 'petstore/models/capitalization'
|
||||
require 'petstore/models/cat'
|
||||
require 'petstore/models/cat_all_of'
|
||||
require 'petstore/models/category'
|
||||
require 'petstore/models/class_model'
|
||||
require 'petstore/models/client'
|
||||
require 'petstore/models/dog'
|
||||
require 'petstore/models/dog_all_of'
|
||||
require 'petstore/models/enum_arrays'
|
||||
require 'petstore/models/enum_class'
|
||||
require 'petstore/models/enum_test'
|
||||
@@ -50,9 +58,11 @@ require 'petstore/models/outer_enum'
|
||||
require 'petstore/models/pet'
|
||||
require 'petstore/models/read_only_first'
|
||||
require 'petstore/models/special_model_name'
|
||||
require 'petstore/models/string_boolean_map'
|
||||
require 'petstore/models/tag'
|
||||
require 'petstore/models/type_holder_default'
|
||||
require 'petstore/models/type_holder_example'
|
||||
require 'petstore/models/user'
|
||||
require 'petstore/models/xml_item'
|
||||
|
||||
# APIs
|
||||
require 'petstore/api/another_fake_api'
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
module Petstore
|
||||
class AnotherFakeApi
|
||||
@@ -21,58 +21,66 @@ module Petstore
|
||||
end
|
||||
# To test special tags
|
||||
# To test special tags and operation ID starting with number
|
||||
# @param client client model
|
||||
# @param body [Client] client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Client]
|
||||
def call_123_test_special_tags(client, opts = {})
|
||||
data, _status_code, _headers = call_123_test_special_tags_with_http_info(client, opts)
|
||||
def call_123_test_special_tags(body, opts = {})
|
||||
data, _status_code, _headers = call_123_test_special_tags_with_http_info(body, opts)
|
||||
data
|
||||
end
|
||||
|
||||
# To test special tags
|
||||
# To test special tags and operation ID starting with number
|
||||
# @param client client model
|
||||
# @param body [Client] client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers
|
||||
def call_123_test_special_tags_with_http_info(client, opts = {})
|
||||
# @return [Array<(Client, Integer, Hash)>] Client data, response status code and response headers
|
||||
def call_123_test_special_tags_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: AnotherFakeApi.call_123_test_special_tags ...'
|
||||
end
|
||||
# verify the required parameter 'client' is set
|
||||
if @api_client.config.client_side_validation && client.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'client' when calling AnotherFakeApi.call_123_test_special_tags"
|
||||
# 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.call_123_test_special_tags"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/another-fake/dummy'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(client)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Client'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Client')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: AnotherFakeApi#call_123_test_special_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
module Petstore
|
||||
class FakeApi
|
||||
@@ -19,10 +19,72 @@ module Petstore
|
||||
def initialize(api_client = ApiClient.default)
|
||||
@api_client = api_client
|
||||
end
|
||||
# creates an XmlItem
|
||||
# this route creates an XmlItem
|
||||
# @param xml_item [XmlItem] XmlItem Body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def create_xml_item(xml_item, opts = {})
|
||||
create_xml_item_with_http_info(xml_item, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# creates an XmlItem
|
||||
# this route creates an XmlItem
|
||||
# @param xml_item [XmlItem] XmlItem Body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
||||
def create_xml_item_with_http_info(xml_item, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.create_xml_item ...'
|
||||
end
|
||||
# verify the required parameter 'xml_item' is set
|
||||
if @api_client.config.client_side_validation && xml_item.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'xml_item' when calling FakeApi.create_xml_item"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/fake/create_xml_item'
|
||||
|
||||
# query parameters
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/xml', 'application/xml; charset=utf-8', 'application/xml; charset=utf-16', 'text/xml', 'text/xml; charset=utf-8', 'text/xml; charset=utf-16'])
|
||||
|
||||
# form parameters
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(xml_item)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#create_xml_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# Test serialization of outer boolean types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [BOOLEAN] :body Input boolean as post body
|
||||
# @return [BOOLEAN]
|
||||
# @option opts [Boolean] :body Input boolean as post body
|
||||
# @return [Boolean]
|
||||
def fake_outer_boolean_serialize(opts = {})
|
||||
data, _status_code, _headers = fake_outer_boolean_serialize_with_http_info(opts)
|
||||
data
|
||||
@@ -30,8 +92,8 @@ module Petstore
|
||||
|
||||
# Test serialization of outer boolean types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [BOOLEAN] :body Input boolean as post body
|
||||
# @return [Array<(BOOLEAN, Fixnum, Hash)>] BOOLEAN data, response status code and response headers
|
||||
# @option opts [Boolean] :body Input boolean as post body
|
||||
# @return [Array<(Boolean, Integer, Hash)>] Boolean 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 ...'
|
||||
@@ -40,26 +102,35 @@ module Petstore
|
||||
local_var_path = '/fake/outer/boolean'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Boolean'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'BOOLEAN')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#fake_outer_boolean_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -68,7 +139,7 @@ module Petstore
|
||||
|
||||
# Test serialization of object with outer number type
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterComposite] :outer_composite Input composite as post body
|
||||
# @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)
|
||||
@@ -77,8 +148,8 @@ module Petstore
|
||||
|
||||
# Test serialization of object with outer number type
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [OuterComposite] :outer_composite Input composite as post body
|
||||
# @return [Array<(OuterComposite, Fixnum, Hash)>] OuterComposite data, response status code and response headers
|
||||
# @option opts [OuterComposite] :body Input composite as post body
|
||||
# @return [Array<(OuterComposite, Integer, 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 ...'
|
||||
@@ -87,26 +158,35 @@ module Petstore
|
||||
local_var_path = '/fake/outer/composite'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'outer_composite'])
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'OuterComposite'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'OuterComposite')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#fake_outer_composite_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -125,7 +205,7 @@ module Petstore
|
||||
# Test serialization of outer number types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Float] :body Input number as post body
|
||||
# @return [Array<(Float, Fixnum, Hash)>] Float data, response status code and response headers
|
||||
# @return [Array<(Float, Integer, Hash)>] Float 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 ...'
|
||||
@@ -134,26 +214,35 @@ module Petstore
|
||||
local_var_path = '/fake/outer/number'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Float'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Float')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#fake_outer_number_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -172,7 +261,7 @@ module Petstore
|
||||
# Test serialization of outer string types
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :body Input string as post body
|
||||
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
||||
# @return [Array<(String, Integer, Hash)>] String 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 ...'
|
||||
@@ -181,26 +270,35 @@ module Petstore
|
||||
local_var_path = '/fake/outer/string'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(opts[:'body'])
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body'])
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'String'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'String')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#fake_outer_string_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -208,69 +306,79 @@ module Petstore
|
||||
end
|
||||
|
||||
# For this test, the body for this request much reference a schema named `File`.
|
||||
# @param file_schema_test_class
|
||||
# @param body [FileSchemaTestClass]
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def test_body_with_file_schema(file_schema_test_class, opts = {})
|
||||
test_body_with_file_schema_with_http_info(file_schema_test_class, opts)
|
||||
def test_body_with_file_schema(body, opts = {})
|
||||
test_body_with_file_schema_with_http_info(body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# For this test, the body for this request much reference a schema named `File`.
|
||||
# @param file_schema_test_class
|
||||
# @param body [FileSchemaTestClass]
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_body_with_file_schema_with_http_info(file_schema_test_class, opts = {})
|
||||
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
||||
def test_body_with_file_schema_with_http_info(body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_file_schema ...'
|
||||
end
|
||||
# verify the required parameter 'file_schema_test_class' is set
|
||||
if @api_client.config.client_side_validation && file_schema_test_class.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'file_schema_test_class' when calling FakeApi.test_body_with_file_schema"
|
||||
# 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_body_with_file_schema"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/fake/body-with-file-schema'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(file_schema_test_class)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_body_with_file_schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
# @param query
|
||||
# @param user
|
||||
# @param query [String]
|
||||
# @param body [User]
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def test_body_with_query_params(query, user, opts = {})
|
||||
test_body_with_query_params_with_http_info(query, user, opts)
|
||||
def test_body_with_query_params(query, body, opts = {})
|
||||
test_body_with_query_params_with_http_info(query, body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# @param query
|
||||
# @param user
|
||||
# @param query [String]
|
||||
# @param body [User]
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_body_with_query_params_with_http_info(query, user, opts = {})
|
||||
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
||||
def test_body_with_query_params_with_http_info(query, body, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_body_with_query_params ...'
|
||||
end
|
||||
@@ -278,34 +386,44 @@ module Petstore
|
||||
if @api_client.config.client_side_validation && query.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'query' when calling FakeApi.test_body_with_query_params"
|
||||
end
|
||||
# verify the required parameter 'user' is set
|
||||
if @api_client.config.client_side_validation && user.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'user' when calling FakeApi.test_body_with_query_params"
|
||||
# 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_body_with_query_params"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/fake/body-with-query-params'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
query_params[:'query'] = query
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(user)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_body_with_query_params\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -314,53 +432,62 @@ module Petstore
|
||||
|
||||
# To test \"client\" model
|
||||
# To test \"client\" model
|
||||
# @param client client model
|
||||
# @param body [Client] client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Client]
|
||||
def test_client_model(client, opts = {})
|
||||
data, _status_code, _headers = test_client_model_with_http_info(client, opts)
|
||||
def test_client_model(body, opts = {})
|
||||
data, _status_code, _headers = test_client_model_with_http_info(body, opts)
|
||||
data
|
||||
end
|
||||
|
||||
# To test \"client\" model
|
||||
# To test \"client\" model
|
||||
# @param client client model
|
||||
# @param body [Client] client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers
|
||||
def test_client_model_with_http_info(client, opts = {})
|
||||
# @return [Array<(Client, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'client' is set
|
||||
if @api_client.config.client_side_validation && client.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'client' when calling FakeApi.test_client_model"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(client)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Client'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Client')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_client_model\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -369,10 +496,10 @@ module Petstore
|
||||
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# @param number None
|
||||
# @param double None
|
||||
# @param pattern_without_delimiter None
|
||||
# @param byte None
|
||||
# @param number [Float] None
|
||||
# @param double [Float] None
|
||||
# @param pattern_without_delimiter [String] None
|
||||
# @param byte [String] None
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Integer] :integer None
|
||||
# @option opts [Integer] :int32 None
|
||||
@@ -392,10 +519,10 @@ module Petstore
|
||||
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# @param number None
|
||||
# @param double None
|
||||
# @param pattern_without_delimiter None
|
||||
# @param byte None
|
||||
# @param number [Float] None
|
||||
# @param double [Float] None
|
||||
# @param pattern_without_delimiter [String] None
|
||||
# @param byte [String] None
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Integer] :integer None
|
||||
# @option opts [Integer] :int32 None
|
||||
@@ -407,7 +534,7 @@ module Petstore
|
||||
# @option opts [DateTime] :date_time None
|
||||
# @option opts [String] :password None
|
||||
# @option opts [String] :callback None
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
@@ -440,8 +567,9 @@ module Petstore
|
||||
if @api_client.config.client_side_validation && pattern_without_delimiter.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters"
|
||||
end
|
||||
if @api_client.config.client_side_validation && pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/)
|
||||
fail ArgumentError, "invalid value for 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters, must conform to the pattern /^[A-Z].*/."
|
||||
pattern = Regexp.new(/^[A-Z].*/)
|
||||
if @api_client.config.client_side_validation && pattern_without_delimiter !~ pattern
|
||||
fail ArgumentError, "invalid value for 'pattern_without_delimiter' when calling FakeApi.test_endpoint_parameters, must conform to the pattern #{pattern}."
|
||||
end
|
||||
|
||||
# verify the required parameter 'byte' is set
|
||||
@@ -468,8 +596,9 @@ module Petstore
|
||||
fail ArgumentError, 'invalid value for "opts[:"float"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 987.6.'
|
||||
end
|
||||
|
||||
if @api_client.config.client_side_validation && !opts[:'string'].nil? && opts[:'string'] !~ Regexp.new(/[a-z]/i)
|
||||
fail ArgumentError, "invalid value for 'opts[:\"string\"]' when calling FakeApi.test_endpoint_parameters, must conform to the pattern /[a-z]/i."
|
||||
pattern = Regexp.new(/[a-z]/i)
|
||||
if @api_client.config.client_side_validation && !opts[:'string'].nil? && opts[:'string'] !~ pattern
|
||||
fail ArgumentError, "invalid value for 'opts[:\"string\"]' when calling FakeApi.test_endpoint_parameters, must conform to the pattern #{pattern}."
|
||||
end
|
||||
|
||||
if @api_client.config.client_side_validation && !opts[:'password'].nil? && opts[:'password'].to_s.length > 64
|
||||
@@ -484,15 +613,15 @@ module Petstore
|
||||
local_var_path = '/fake'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
form_params['number'] = number
|
||||
form_params['double'] = double
|
||||
form_params['pattern_without_delimiter'] = pattern_without_delimiter
|
||||
@@ -509,14 +638,24 @@ module Petstore
|
||||
form_params['callback'] = opts[:'callback'] if !opts[:'callback'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['http_basic_test']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['http_basic_test']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_endpoint_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -551,66 +690,84 @@ module Petstore
|
||||
# @option opts [Float] :enum_query_double Query parameter enum test (double)
|
||||
# @option opts [Array<String>] :enum_form_string_array Form parameter enum test (string array)
|
||||
# @option opts [String] :enum_form_string Form parameter enum test (string)
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
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 >, $'
|
||||
allowable_values = [">", "$"]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_header_string_array'] && !opts[:'enum_header_string_array'].all? { |item| allowable_values.include?(item) }
|
||||
fail ArgumentError, "invalid value for \"enum_header_string_array\", must include one of #{allowable_values}"
|
||||
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)'
|
||||
allowable_values = ["_abc", "-efg", "(xyz)"]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_header_string'] && !allowable_values.include?(opts[:'enum_header_string'])
|
||||
fail ArgumentError, "invalid value for \"enum_header_string\", must be one of #{allowable_values}"
|
||||
end
|
||||
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 >, $'
|
||||
allowable_values = [">", "$"]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_string_array'] && !opts[:'enum_query_string_array'].all? { |item| allowable_values.include?(item) }
|
||||
fail ArgumentError, "invalid value for \"enum_query_string_array\", must include one of #{allowable_values}"
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string'])
|
||||
fail ArgumentError, 'invalid value for "enum_query_string", must be one of _abc, -efg, (xyz)'
|
||||
allowable_values = ["_abc", "-efg", "(xyz)"]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_string'] && !allowable_values.include?(opts[:'enum_query_string'])
|
||||
fail ArgumentError, "invalid value for \"enum_query_string\", must be one of #{allowable_values}"
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_integer'] && !['1', '-2'].include?(opts[:'enum_query_integer'])
|
||||
fail ArgumentError, 'invalid value for "enum_query_integer", must be one of 1, -2'
|
||||
allowable_values = [1, -2]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_integer'] && !allowable_values.include?(opts[:'enum_query_integer'])
|
||||
fail ArgumentError, "invalid value for \"enum_query_integer\", must be one of #{allowable_values}"
|
||||
end
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_double'] && !['1.1', '-1.2'].include?(opts[:'enum_query_double'])
|
||||
fail ArgumentError, 'invalid value for "enum_query_double", must be one of 1.1, -1.2'
|
||||
allowable_values = [1.1, -1.2]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_query_double'] && !allowable_values.include?(opts[:'enum_query_double'])
|
||||
fail ArgumentError, "invalid value for \"enum_query_double\", must be one of #{allowable_values}"
|
||||
end
|
||||
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 >, $'
|
||||
allowable_values = [">", "$"]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_form_string_array'] && !opts[:'enum_form_string_array'].all? { |item| allowable_values.include?(item) }
|
||||
fail ArgumentError, "invalid value for \"enum_form_string_array\", must include one of #{allowable_values}"
|
||||
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)'
|
||||
allowable_values = ["_abc", "-efg", "(xyz)"]
|
||||
if @api_client.config.client_side_validation && opts[:'enum_form_string'] && !allowable_values.include?(opts[:'enum_form_string'])
|
||||
fail ArgumentError, "invalid value for \"enum_form_string\", must be one of #{allowable_values}"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/fake'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
query_params[:'enum_query_string_array'] = @api_client.build_collection_param(opts[:'enum_query_string_array'], :csv) if !opts[:'enum_query_string_array'].nil?
|
||||
query_params[:'enum_query_string'] = opts[:'enum_query_string'] if !opts[:'enum_query_string'].nil?
|
||||
query_params[:'enum_query_integer'] = opts[:'enum_query_integer'] if !opts[:'enum_query_integer'].nil?
|
||||
query_params[:'enum_query_double'] = opts[:'enum_query_double'] if !opts[:'enum_query_double'].nil?
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
||||
header_params[:'enum_header_string_array'] = @api_client.build_collection_param(opts[:'enum_header_string_array'], :csv) if !opts[:'enum_header_string_array'].nil?
|
||||
header_params[:'enum_header_string'] = opts[:'enum_header_string'] if !opts[:'enum_header_string'].nil?
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[: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?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_enum_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -619,12 +776,12 @@ module Petstore
|
||||
|
||||
# Fake endpoint to test group parameters (optional)
|
||||
# Fake endpoint to test group parameters (optional)
|
||||
# @param required_string_group Required String in group parameters
|
||||
# @param required_boolean_group Required Boolean in group parameters
|
||||
# @param required_int64_group Required Integer in group parameters
|
||||
# @param required_string_group [Integer] Required String in group parameters
|
||||
# @param required_boolean_group [Boolean] Required Boolean in group parameters
|
||||
# @param required_int64_group [Integer] Required Integer in group parameters
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Integer] :string_group String in group parameters
|
||||
# @option opts [BOOLEAN] :boolean_group Boolean in group parameters
|
||||
# @option opts [Boolean] :boolean_group Boolean in group parameters
|
||||
# @option opts [Integer] :int64_group Integer in group parameters
|
||||
# @return [nil]
|
||||
def test_group_parameters(required_string_group, required_boolean_group, required_int64_group, opts = {})
|
||||
@@ -634,14 +791,14 @@ module Petstore
|
||||
|
||||
# Fake endpoint to test group parameters (optional)
|
||||
# Fake endpoint to test group parameters (optional)
|
||||
# @param required_string_group Required String in group parameters
|
||||
# @param required_boolean_group Required Boolean in group parameters
|
||||
# @param required_int64_group Required Integer in group parameters
|
||||
# @param required_string_group [Integer] Required String in group parameters
|
||||
# @param required_boolean_group [Boolean] Required Boolean in group parameters
|
||||
# @param required_int64_group [Integer] Required Integer in group parameters
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Integer] :string_group String in group parameters
|
||||
# @option opts [BOOLEAN] :boolean_group Boolean in group parameters
|
||||
# @option opts [Boolean] :boolean_group Boolean in group parameters
|
||||
# @option opts [Integer] :int64_group Integer in group parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
||||
def test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: FakeApi.test_group_parameters ...'
|
||||
@@ -662,29 +819,39 @@ module Petstore
|
||||
local_var_path = '/fake'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
query_params[:'required_string_group'] = required_string_group
|
||||
query_params[:'required_int64_group'] = required_int64_group
|
||||
query_params[:'string_group'] = opts[:'string_group'] if !opts[:'string_group'].nil?
|
||||
query_params[:'int64_group'] = opts[:'int64_group'] if !opts[:'int64_group'].nil?
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
header_params[:'required_boolean_group'] = required_boolean_group
|
||||
header_params[:'boolean_group'] = opts[:'boolean_group'] if !opts[:'boolean_group'].nil?
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_group_parameters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -692,49 +859,59 @@ module Petstore
|
||||
end
|
||||
|
||||
# test inline additionalProperties
|
||||
# @param request_body request body
|
||||
# @param param [Hash<String, String>] request body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def test_inline_additional_properties(request_body, opts = {})
|
||||
test_inline_additional_properties_with_http_info(request_body, opts)
|
||||
def test_inline_additional_properties(param, opts = {})
|
||||
test_inline_additional_properties_with_http_info(param, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# test inline additionalProperties
|
||||
# @param request_body request body
|
||||
# @param param [Hash<String, String>] request body
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def test_inline_additional_properties_with_http_info(request_body, opts = {})
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'request_body' is set
|
||||
if @api_client.config.client_side_validation && request_body.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'request_body' when calling FakeApi.test_inline_additional_properties"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(request_body)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(param)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_inline_additional_properties\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -742,8 +919,8 @@ module Petstore
|
||||
end
|
||||
|
||||
# test json serialization of form data
|
||||
# @param param field1
|
||||
# @param param2 field2
|
||||
# @param param [String] field1
|
||||
# @param param2 [String] field2
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def test_json_form_data(param, param2, opts = {})
|
||||
@@ -752,10 +929,10 @@ module Petstore
|
||||
end
|
||||
|
||||
# test json serialization of form data
|
||||
# @param param field1
|
||||
# @param param2 field2
|
||||
# @param param [String] field1
|
||||
# @param param2 [String] field2
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
@@ -772,32 +949,41 @@ module Petstore
|
||||
local_var_path = '/fake/jsonFormData'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
form_params['param'] = param
|
||||
form_params['param2'] = param2
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeApi#test_json_form_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
module Petstore
|
||||
class FakeClassnameTags123Api
|
||||
@@ -21,58 +21,66 @@ module Petstore
|
||||
end
|
||||
# To test class name in snake case
|
||||
# To test class name in snake case
|
||||
# @param client client model
|
||||
# @param body [Client] client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Client]
|
||||
def test_classname(client, opts = {})
|
||||
data, _status_code, _headers = test_classname_with_http_info(client, opts)
|
||||
def test_classname(body, opts = {})
|
||||
data, _status_code, _headers = test_classname_with_http_info(body, opts)
|
||||
data
|
||||
end
|
||||
|
||||
# To test class name in snake case
|
||||
# To test class name in snake case
|
||||
# @param client client model
|
||||
# @param body [Client] 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(client, opts = {})
|
||||
# @return [Array<(Client, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'client' is set
|
||||
if @api_client.config.client_side_validation && client.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'client' when calling FakeClassnameTags123Api.test_classname"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(client)
|
||||
auth_names = ['api_key_query']
|
||||
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Client'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['api_key_query']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Client')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: FakeClassnameTags123Api#test_classname\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
module Petstore
|
||||
class PetApi
|
||||
@@ -20,49 +20,59 @@ module Petstore
|
||||
@api_client = api_client
|
||||
end
|
||||
# Add a new pet to the store
|
||||
# @param pet Pet object that needs to be added to the store
|
||||
# @param body [Pet] Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def add_pet(pet, opts = {})
|
||||
add_pet_with_http_info(pet, opts)
|
||||
def add_pet(body, opts = {})
|
||||
add_pet_with_http_info(body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# Add a new pet to the store
|
||||
# @param pet Pet object that needs to be added to the store
|
||||
# @param body [Pet] Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def add_pet_with_http_info(pet, opts = {})
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'pet' is set
|
||||
if @api_client.config.client_side_validation && pet.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pet' when calling PetApi.add_pet"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(pet)
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#add_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -70,7 +80,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
# @param pet_id Pet id to delete
|
||||
# @param pet_id [Integer] Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
@@ -80,10 +90,10 @@ module Petstore
|
||||
end
|
||||
|
||||
# Deletes a pet
|
||||
# @param pet_id Pet id to delete
|
||||
# @param pet_id [Integer] Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
@@ -93,27 +103,37 @@ module Petstore
|
||||
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' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
header_params[:'api_key'] = opts[:'api_key'] if !opts[:'api_key'].nil?
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#delete_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -122,7 +142,7 @@ module Petstore
|
||||
|
||||
# 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
|
||||
# @param status [Array<String>] Status values that need to be considered for filter
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<Pet>]
|
||||
def find_pets_by_status(status, opts = {})
|
||||
@@ -132,9 +152,9 @@ module Petstore
|
||||
|
||||
# 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
|
||||
# @param status [Array<String>] Status values that need to be considered for filter
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Array<Pet>, Fixnum, Hash)>] Array<Pet> data, response status code and response headers
|
||||
# @return [Array<(Array<Pet>, Integer, 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 ...'
|
||||
@@ -147,27 +167,36 @@ module Petstore
|
||||
local_var_path = '/pet/findByStatus'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
query_params[:'status'] = @api_client.build_collection_param(status, :csv)
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Array<Pet>'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Array<Pet>')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#find_pets_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -176,7 +205,7 @@ module Petstore
|
||||
|
||||
# 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
|
||||
# @param tags [Array<String>] Tags to filter by
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<Pet>]
|
||||
def find_pets_by_tags(tags, opts = {})
|
||||
@@ -186,9 +215,9 @@ module Petstore
|
||||
|
||||
# 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
|
||||
# @param tags [Array<String>] Tags to filter by
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Array<Pet>, Fixnum, Hash)>] Array<Pet> data, response status code and response headers
|
||||
# @return [Array<(Array<Pet>, Integer, 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 ...'
|
||||
@@ -201,27 +230,36 @@ module Petstore
|
||||
local_var_path = '/pet/findByTags'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Array<Pet>'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Array<Pet>')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#find_pets_by_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -230,7 +268,7 @@ module Petstore
|
||||
|
||||
# Find pet by ID
|
||||
# Returns a single pet
|
||||
# @param pet_id ID of pet to return
|
||||
# @param pet_id [Integer] ID of pet to return
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Pet]
|
||||
def get_pet_by_id(pet_id, opts = {})
|
||||
@@ -240,9 +278,9 @@ module Petstore
|
||||
|
||||
# Find pet by ID
|
||||
# Returns a single pet
|
||||
# @param pet_id ID of pet to return
|
||||
# @param pet_id [Integer] ID of pet to return
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Pet, Fixnum, Hash)>] Pet data, response status code and response headers
|
||||
# @return [Array<(Pet, Integer, 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 ...'
|
||||
@@ -252,29 +290,38 @@ module Petstore
|
||||
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' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['api_key']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Pet'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['api_key']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Pet')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#get_pet_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -282,49 +329,59 @@ module Petstore
|
||||
end
|
||||
|
||||
# Update an existing pet
|
||||
# @param pet Pet object that needs to be added to the store
|
||||
# @param body [Pet] Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def update_pet(pet, opts = {})
|
||||
update_pet_with_http_info(pet, opts)
|
||||
def update_pet(body, opts = {})
|
||||
update_pet_with_http_info(body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# Update an existing pet
|
||||
# @param pet Pet object that needs to be added to the store
|
||||
# @param body [Pet] Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_pet_with_http_info(pet, opts = {})
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'pet' is set
|
||||
if @api_client.config.client_side_validation && pet.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'pet' when calling PetApi.update_pet"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(pet)
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#update_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -332,7 +389,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param pet_id [Integer] ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
@@ -343,11 +400,11 @@ module Petstore
|
||||
end
|
||||
|
||||
# Updates a pet in the store with form data
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param pet_id [Integer] ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
@@ -357,30 +414,40 @@ module Petstore
|
||||
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' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
form_params['name'] = opts[:'name'] if !opts[:'name'].nil?
|
||||
form_params['status'] = opts[:'status'] if !opts[:'status'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#update_pet_with_form\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -388,7 +455,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
# @param pet_id ID of pet to update
|
||||
# @param pet_id [Integer] ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
@@ -399,11 +466,11 @@ module Petstore
|
||||
end
|
||||
|
||||
# uploads an image
|
||||
# @param pet_id ID of pet to update
|
||||
# @param pet_id [Integer] ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [Array<(ApiResponse, Fixnum, Hash)>] ApiResponse data, response status code and response headers
|
||||
# @return [Array<(ApiResponse, Integer, 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 ...'
|
||||
@@ -413,33 +480,42 @@ module Petstore
|
||||
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' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
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
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'ApiResponse'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'ApiResponse')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -447,8 +523,8 @@ module Petstore
|
||||
end
|
||||
|
||||
# uploads an image (required)
|
||||
# @param pet_id ID of pet to update
|
||||
# @param required_file file to upload
|
||||
# @param pet_id [Integer] ID of pet to update
|
||||
# @param required_file [File] file to upload
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @return [ApiResponse]
|
||||
@@ -458,11 +534,11 @@ module Petstore
|
||||
end
|
||||
|
||||
# uploads an image (required)
|
||||
# @param pet_id ID of pet to update
|
||||
# @param required_file file to upload
|
||||
# @param pet_id [Integer] ID of pet to update
|
||||
# @param required_file [File] file to upload
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @return [Array<(ApiResponse, Fixnum, Hash)>] ApiResponse data, response status code and response headers
|
||||
# @return [Array<(ApiResponse, Integer, Hash)>] ApiResponse data, response status code and response headers
|
||||
def upload_file_with_required_file_with_http_info(pet_id, required_file, opts = {})
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug 'Calling API: PetApi.upload_file_with_required_file ...'
|
||||
@@ -476,38 +552,46 @@ module Petstore
|
||||
fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', pet_id.to_s)
|
||||
local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
||||
# HTTP header 'Content-Type'
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
form_params['requiredFile'] = required_file
|
||||
form_params['additionalMetadata'] = opts[:'additional_metadata'] if !opts[:'additional_metadata'].nil?
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['petstore_auth']
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'ApiResponse'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['petstore_auth']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'ApiResponse')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: PetApi#upload_file_with_required_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
module Petstore
|
||||
class StoreApi
|
||||
@@ -21,7 +21,7 @@ module Petstore
|
||||
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
|
||||
# @param order_id [String] ID of the order that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def delete_order(order_id, opts = {})
|
||||
@@ -31,9 +31,9 @@ module Petstore
|
||||
|
||||
# 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
|
||||
# @param order_id [String] ID of the order that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
@@ -43,26 +43,36 @@ module Petstore
|
||||
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' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: StoreApi#delete_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -81,7 +91,7 @@ module Petstore
|
||||
# Returns pet inventories by status
|
||||
# Returns a map of status codes to quantities
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Hash<String, Integer>, Fixnum, Hash)>] Hash<String, Integer> data, response status code and response headers
|
||||
# @return [Array<(Hash<String, Integer>, Integer, 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 ...'
|
||||
@@ -90,26 +100,35 @@ module Petstore
|
||||
local_var_path = '/store/inventory'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = ['api_key']
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Hash<String, Integer>'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || ['api_key']
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Hash<String, Integer>')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: StoreApi#get_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -118,7 +137,7 @@ module Petstore
|
||||
|
||||
# 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
|
||||
# @param order_id [Integer] ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Order]
|
||||
def get_order_by_id(order_id, opts = {})
|
||||
@@ -128,9 +147,9 @@ module Petstore
|
||||
|
||||
# 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
|
||||
# @param order_id [Integer] ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers
|
||||
# @return [Array<(Order, Integer, 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 ...'
|
||||
@@ -148,29 +167,38 @@ 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' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Order'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Order')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: StoreApi#get_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -178,55 +206,63 @@ module Petstore
|
||||
end
|
||||
|
||||
# Place an order for a pet
|
||||
# @param order order placed for purchasing the pet
|
||||
# @param body [Order] order placed for purchasing the pet
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Order]
|
||||
def place_order(order, opts = {})
|
||||
data, _status_code, _headers = place_order_with_http_info(order, opts)
|
||||
def place_order(body, opts = {})
|
||||
data, _status_code, _headers = place_order_with_http_info(body, opts)
|
||||
data
|
||||
end
|
||||
|
||||
# Place an order for a pet
|
||||
# @param order order placed for purchasing the pet
|
||||
# @param body [Order] order placed for purchasing the pet
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers
|
||||
def place_order_with_http_info(order, opts = {})
|
||||
# @return [Array<(Order, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'order' is set
|
||||
if @api_client.config.client_side_validation && order.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'order' when calling StoreApi.place_order"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(order)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'Order'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'Order')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: StoreApi#place_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
require 'cgi'
|
||||
|
||||
module Petstore
|
||||
class UserApi
|
||||
@@ -21,48 +21,58 @@ module Petstore
|
||||
end
|
||||
# Create user
|
||||
# This can only be done by the logged in user.
|
||||
# @param user Created user object
|
||||
# @param body [User] Created user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def create_user(user, opts = {})
|
||||
create_user_with_http_info(user, opts)
|
||||
def create_user(body, opts = {})
|
||||
create_user_with_http_info(body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# Create user
|
||||
# This can only be done by the logged in user.
|
||||
# @param user Created user object
|
||||
# @param body [User] Created user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def create_user_with_http_info(user, opts = {})
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'user' is set
|
||||
if @api_client.config.client_side_validation && user.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_user"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(user)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -70,47 +80,57 @@ module Petstore
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
# @param user List of user object
|
||||
# @param body [Array<User>] List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def create_users_with_array_input(user, opts = {})
|
||||
create_users_with_array_input_with_http_info(user, opts)
|
||||
def create_users_with_array_input(body, opts = {})
|
||||
create_users_with_array_input_with_http_info(body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
# @param user List of user object
|
||||
# @param body [Array<User>] List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def create_users_with_array_input_with_http_info(user, opts = {})
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'user' is set
|
||||
if @api_client.config.client_side_validation && user.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_users_with_array_input"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(user)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#create_users_with_array_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -118,47 +138,57 @@ module Petstore
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
# @param user List of user object
|
||||
# @param body [Array<User>] List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def create_users_with_list_input(user, opts = {})
|
||||
create_users_with_list_input_with_http_info(user, opts)
|
||||
def create_users_with_list_input(body, opts = {})
|
||||
create_users_with_list_input_with_http_info(body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# Creates list of users with given input array
|
||||
# @param user List of user object
|
||||
# @param body [Array<User>] List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def create_users_with_list_input_with_http_info(user, opts = {})
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
# verify the required parameter 'user' is set
|
||||
if @api_client.config.client_side_validation && user.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.create_users_with_list_input"
|
||||
# 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'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(user)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#create_users_with_list_input\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -167,7 +197,7 @@ module Petstore
|
||||
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param username [String] The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def delete_user(username, opts = {})
|
||||
@@ -177,9 +207,9 @@ module Petstore
|
||||
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param username [String] The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
@@ -189,26 +219,36 @@ module Petstore
|
||||
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' + '}', CGI.escape(username.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -216,7 +256,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param username [String] 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 = {})
|
||||
@@ -225,9 +265,9 @@ module Petstore
|
||||
end
|
||||
|
||||
# Get user by user name
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param username [String] 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
|
||||
# @return [Array<(User, Integer, 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 ...'
|
||||
@@ -237,29 +277,38 @@ module Petstore
|
||||
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' + '}', CGI.escape(username.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'User'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'User')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#get_user_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -267,8 +316,8 @@ module Petstore
|
||||
end
|
||||
|
||||
# Logs user into the system
|
||||
# @param username The user name for login
|
||||
# @param password The password for login in clear text
|
||||
# @param username [String] The user name for login
|
||||
# @param password [String] The password for login in clear text
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [String]
|
||||
def login_user(username, password, opts = {})
|
||||
@@ -277,10 +326,10 @@ module Petstore
|
||||
end
|
||||
|
||||
# Logs user into the system
|
||||
# @param username The user name for login
|
||||
# @param password The password for login in clear text
|
||||
# @param username [String] The user name for login
|
||||
# @param password [String] The password for login in clear text
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
||||
# @return [Array<(String, Integer, 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 ...'
|
||||
@@ -297,28 +346,37 @@ module Petstore
|
||||
local_var_path = '/user/login'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
query_params[:'username'] = username
|
||||
query_params[:'password'] = password
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
# HTTP header 'Accept' (if needed)
|
||||
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type] || 'String'
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names,
|
||||
:return_type => 'String')
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#login_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -335,7 +393,7 @@ module Petstore
|
||||
|
||||
# Logs out current logged in user session
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
@@ -344,23 +402,33 @@ module Petstore
|
||||
local_var_path = '/user/logout'
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = nil
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
||||
post_body = opts[:body]
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#logout_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
@@ -369,22 +437,22 @@ module Petstore
|
||||
|
||||
# Updated user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username name that need to be deleted
|
||||
# @param user Updated user object
|
||||
# @param username [String] name that need to be deleted
|
||||
# @param body [User] Updated user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
def update_user(username, user, opts = {})
|
||||
update_user_with_http_info(username, user, opts)
|
||||
def update_user(username, body, opts = {})
|
||||
update_user_with_http_info(username, body, opts)
|
||||
nil
|
||||
end
|
||||
|
||||
# Updated user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username name that need to be deleted
|
||||
# @param user Updated user object
|
||||
# @param username [String] name that need to be deleted
|
||||
# @param body [User] Updated user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
|
||||
def update_user_with_http_info(username, user, opts = {})
|
||||
# @return [Array<(nil, Integer, 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 ...'
|
||||
end
|
||||
@@ -392,36 +460,45 @@ module Petstore
|
||||
if @api_client.config.client_side_validation && username.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.update_user"
|
||||
end
|
||||
# verify the required parameter 'user' is set
|
||||
if @api_client.config.client_side_validation && user.nil?
|
||||
fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user"
|
||||
# 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.update_user"
|
||||
end
|
||||
# resource path
|
||||
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', username.to_s)
|
||||
local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/'))
|
||||
|
||||
# query parameters
|
||||
query_params = {}
|
||||
query_params = opts[:query_params] || {}
|
||||
|
||||
# header parameters
|
||||
header_params = {}
|
||||
header_params = opts[:header_params] || {}
|
||||
|
||||
# form parameters
|
||||
form_params = {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
# http body (model)
|
||||
post_body = @api_client.object_to_http_body(user)
|
||||
auth_names = []
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
||||
post_body = opts[:body] || @api_client.object_to_http_body(body)
|
||||
|
||||
# return_type
|
||||
return_type = opts[:return_type]
|
||||
|
||||
# auth_names
|
||||
auth_names = opts[:auth_names] || []
|
||||
|
||||
new_options = opts.merge(
|
||||
:header_params => header_params,
|
||||
:query_params => query_params,
|
||||
:form_params => form_params,
|
||||
:body => post_body,
|
||||
:auth_names => auth_names)
|
||||
:auth_names => auth_names,
|
||||
:return_type => return_type
|
||||
)
|
||||
|
||||
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
||||
if @api_client.config.debugging
|
||||
@api_client.config.logger.debug "API called: UserApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
||||
end
|
||||
return data, status_code, headers
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,132 +3,155 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
require 'faraday'
|
||||
require 'json'
|
||||
require 'logger'
|
||||
require 'faraday'
|
||||
require 'tempfile'
|
||||
|
||||
module Petstore
|
||||
class ApiClient
|
||||
# The Configuration object holding settings to be used in the API client.
|
||||
attr_accessor :config
|
||||
|
||||
# Defines the headers to be used in HTTP requests of all API calls by default.
|
||||
#
|
||||
# @return [Hash]
|
||||
attr_accessor :default_headers
|
||||
|
||||
# Initializes the ApiClient
|
||||
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
||||
def initialize(config = Configuration.default)
|
||||
@config = config
|
||||
@user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
|
||||
@default_headers = {
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => @user_agent
|
||||
}
|
||||
end
|
||||
|
||||
def self.default
|
||||
@@default ||= ApiClient.new
|
||||
end
|
||||
|
||||
def initialize(config = Configuration.default)
|
||||
@config = config
|
||||
end
|
||||
|
||||
attr_reader :config
|
||||
|
||||
# Call an API with given options.
|
||||
#
|
||||
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
||||
# the data deserialized from response body (could be nil), response status code and response headers.
|
||||
def call_api(http_method, path, opts = {})
|
||||
normalized_path = ::File.join(config.base_path, path)
|
||||
|
||||
@last_response = connection.public_send(http_method.to_sym.downcase) do |req|
|
||||
req.url(normalized_path)
|
||||
|
||||
req.headers = default_headers.merge(opts[:header_params] || {})
|
||||
req.body = opts[:body]
|
||||
|
||||
query_params = opts[:query_params] || {}
|
||||
form_params = opts[:form_params] || {}
|
||||
req.params = query_params.merge(form_params)
|
||||
connection = Faraday.new(:url => config.base_url) do |conn|
|
||||
conn.basic_auth(config.username, config.password)
|
||||
if opts[:header_params]["Content-Type"] == "multipart/form-data"
|
||||
conn.request :multipart
|
||||
conn.request :url_encoded
|
||||
end
|
||||
conn.adapter(Faraday.default_adapter)
|
||||
end
|
||||
begin
|
||||
response = connection.public_send(http_method.to_sym.downcase) do |req|
|
||||
build_request(http_method, path, req, opts)
|
||||
end
|
||||
|
||||
if @config.debugging
|
||||
@config.logger.debug "HTTP response body ~BEGIN~\n#{@last_response.body}\n~END~\n"
|
||||
if @config.debugging
|
||||
@config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
||||
end
|
||||
|
||||
unless response.success?
|
||||
if response.status == 0
|
||||
# Errors from libcurl will be made visible here
|
||||
fail ApiError.new(:code => 0,
|
||||
:message => response.return_message)
|
||||
else
|
||||
fail ApiError.new(:code => response.status,
|
||||
:response_headers => response.headers,
|
||||
:response_body => response.body),
|
||||
response.reason_phrase
|
||||
end
|
||||
end
|
||||
rescue Faraday::TimeoutError
|
||||
fail ApiError.new('Connection timed out')
|
||||
end
|
||||
|
||||
if opts[:return_type]
|
||||
data = deserialize(@last_response, opts[:return_type])
|
||||
data = deserialize(response, opts[:return_type])
|
||||
else
|
||||
data = nil
|
||||
end
|
||||
|
||||
return data, @last_response.status, @last_response.headers
|
||||
return data, response.status, response.headers
|
||||
end
|
||||
|
||||
attr_reader :last_response
|
||||
# Builds the HTTP request
|
||||
#
|
||||
# @param [String] http_method HTTP method/verb (e.g. POST)
|
||||
# @param [String] path URL path (e.g. /account/new)
|
||||
# @option opts [Hash] :header_params Header parameters
|
||||
# @option opts [Hash] :query_params Query parameters
|
||||
# @option opts [Hash] :form_params Query parameters
|
||||
# @option opts [Object] :body HTTP body (JSON/XML)
|
||||
# @return [Typhoeus::Request] A Typhoeus Request
|
||||
def build_request(http_method, path, request, opts = {})
|
||||
url = build_request_url(path)
|
||||
http_method = http_method.to_sym.downcase
|
||||
|
||||
# Convert object (array, hash, object, etc) to JSON string.
|
||||
# @param [Object] model object to be converted into JSON string
|
||||
# @return [String] JSON string representation of the object
|
||||
def object_to_http_body(model)
|
||||
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) }
|
||||
else
|
||||
local_body = object_to_hash(model)
|
||||
header_params = @default_headers.merge(opts[:header_params] || {})
|
||||
query_params = opts[:query_params] || {}
|
||||
form_params = opts[:form_params] || {}
|
||||
|
||||
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
||||
|
||||
# set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
|
||||
_verify_ssl_host = @config.verify_ssl_host ? 2 : 0
|
||||
|
||||
req_opts = {
|
||||
:method => http_method,
|
||||
:headers => header_params,
|
||||
:params => query_params,
|
||||
:params_encoding => @config.params_encoding,
|
||||
:timeout => @config.timeout,
|
||||
:ssl_verifypeer => @config.verify_ssl,
|
||||
:ssl_verifyhost => _verify_ssl_host,
|
||||
:sslcert => @config.cert_file,
|
||||
:sslkey => @config.key_file,
|
||||
:verbose => @config.debugging
|
||||
}
|
||||
|
||||
# set custom cert, if provided
|
||||
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
||||
|
||||
if [:post, :patch, :put, :delete].include?(http_method)
|
||||
req_body = build_request_body(header_params, form_params, opts[:body])
|
||||
req_opts.update :body => req_body
|
||||
if @config.debugging
|
||||
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
||||
end
|
||||
end
|
||||
local_body.to_json
|
||||
end
|
||||
|
||||
# Convert object(non-array) to hash.
|
||||
# @param [Object] obj object to be converted into JSON string
|
||||
# @return [String] JSON string representation of the object
|
||||
def object_to_hash(obj)
|
||||
if obj.respond_to?(:to_hash)
|
||||
obj.to_hash
|
||||
else
|
||||
obj
|
||||
end
|
||||
end
|
||||
|
||||
# Return Accept header based on an array of accepts provided.
|
||||
# @param [Array] accepts array for Accept
|
||||
# @return [String] the Accept header (e.g. application/json)
|
||||
def select_header_accept(accepts)
|
||||
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) }
|
||||
json_accept || accepts.join(',')
|
||||
end
|
||||
|
||||
# Return Content-Type header based on an array of content types provided.
|
||||
# @param [Array] content_types array for Content-Type
|
||||
# @return [String] the Content-Type header (e.g. application/json)
|
||||
def select_header_content_type(content_types)
|
||||
# use application/json by default
|
||||
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) }
|
||||
json_content_type || content_types.first
|
||||
request.headers = header_params
|
||||
request.body = req_body
|
||||
request.url path
|
||||
request.params = query_params
|
||||
download_file(request) if opts[:return_type] == 'File'
|
||||
request
|
||||
end
|
||||
|
||||
# Check if the given MIME is a JSON MIME.
|
||||
# JSON MIME examples:
|
||||
# application/json
|
||||
# application/json; charset=UTF8
|
||||
# APPLICATION/JSON
|
||||
# */*
|
||||
# @param [String] mime MIME
|
||||
# @return [Boolean] True if the MIME is application/json
|
||||
def json_mime?(mime)
|
||||
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def connection
|
||||
@connection ||= bulid_connection
|
||||
end
|
||||
|
||||
def bulid_connection
|
||||
Faraday.new(:url => config.base_url) do |builder|
|
||||
builder.adapter(Faraday.default_adapter)
|
||||
end
|
||||
end
|
||||
|
||||
def user_agent
|
||||
@user_agent ||= "OpenAPI-Generator/#{VERSION}/ruby"
|
||||
end
|
||||
|
||||
def default_headers
|
||||
{
|
||||
'Content-Type' => 'application/json',
|
||||
'User-Agent' => user_agent
|
||||
}
|
||||
end
|
||||
|
||||
# Deserialize the response to the given return type.
|
||||
#
|
||||
# @param [Response] response HTTP response
|
||||
@@ -136,6 +159,10 @@ module Petstore
|
||||
def deserialize(response, return_type)
|
||||
body = response.body
|
||||
|
||||
# handle file downloading - return the File instance processed in request callbacks
|
||||
# note that response body is empty when the file is written in chunks in request on_body callback
|
||||
return @tempfile if return_type == 'File'
|
||||
|
||||
return nil if body.nil? || body.empty?
|
||||
|
||||
# return response body directly for String return type
|
||||
@@ -172,7 +199,7 @@ module Petstore
|
||||
data.to_i
|
||||
when 'Float'
|
||||
data.to_f
|
||||
when 'BOOLEAN'
|
||||
when 'Boolean'
|
||||
data == true
|
||||
when 'DateTime'
|
||||
# parse date time (expecting ISO 8601 format)
|
||||
@@ -195,9 +222,179 @@ module Petstore
|
||||
end
|
||||
else
|
||||
# models, e.g. Pet
|
||||
Petstore.const_get(return_type).new.tap do |model|
|
||||
model.build_from_hash data
|
||||
Petstore.const_get(return_type).build_from_hash(data)
|
||||
end
|
||||
end
|
||||
|
||||
# Save response body into a file in (the defined) temporary folder, using the filename
|
||||
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
||||
# The response body is written to the file in chunks in order to handle files which
|
||||
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
||||
# process can use.
|
||||
#
|
||||
# @see Configuration#temp_folder_path
|
||||
def download_file(request)
|
||||
tempfile = nil
|
||||
encoding = nil
|
||||
request.on_headers do |response|
|
||||
content_disposition = response.headers['Content-Disposition']
|
||||
if content_disposition && content_disposition =~ /filename=/i
|
||||
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
||||
prefix = sanitize_filename(filename)
|
||||
else
|
||||
prefix = 'download-'
|
||||
end
|
||||
prefix = prefix + '-' unless prefix.end_with?('-')
|
||||
encoding = response.body.encoding
|
||||
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
||||
@tempfile = tempfile
|
||||
end
|
||||
request.on_body do |chunk|
|
||||
chunk.force_encoding(encoding)
|
||||
tempfile.write(chunk)
|
||||
end
|
||||
request.on_complete do |response|
|
||||
tempfile.close if tempfile
|
||||
@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`"
|
||||
end
|
||||
end
|
||||
|
||||
# Sanitize filename by removing path.
|
||||
# e.g. ../../sun.gif becomes sun.gif
|
||||
#
|
||||
# @param [String] filename the filename to be sanitized
|
||||
# @return [String] the sanitized filename
|
||||
def sanitize_filename(filename)
|
||||
filename.gsub(/.*[\/\\]/, '')
|
||||
end
|
||||
|
||||
def build_request_url(path)
|
||||
# Add leading and trailing slashes to path
|
||||
path = "/#{path}".gsub(/\/+/, '/')
|
||||
@config.base_url + path
|
||||
end
|
||||
|
||||
# Builds the HTTP request body
|
||||
#
|
||||
# @param [Hash] header_params Header parameters
|
||||
# @param [Hash] form_params Query parameters
|
||||
# @param [Object] body HTTP body (JSON/XML)
|
||||
# @return [String] HTTP body data in the form of string
|
||||
def build_request_body(header_params, form_params, body)
|
||||
# http form
|
||||
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
||||
header_params['Content-Type'] == 'multipart/form-data'
|
||||
data = {}
|
||||
form_params.each do |key, value|
|
||||
case value
|
||||
when ::File, ::Tempfile
|
||||
data[key] = Faraday::UploadIO.new(value.path, '')
|
||||
when ::Array, nil
|
||||
# let Faraday handle Array and nil parameters
|
||||
data[key] = value
|
||||
else
|
||||
data[key] = value.to_s
|
||||
end
|
||||
end
|
||||
elsif body
|
||||
data = body.is_a?(String) ? body : body.to_json
|
||||
else
|
||||
data = nil
|
||||
end
|
||||
data
|
||||
end
|
||||
|
||||
# Update hearder and query params based on authentication settings.
|
||||
#
|
||||
# @param [Hash] header_params Header parameters
|
||||
# @param [Hash] query_params Query parameters
|
||||
# @param [String] auth_names Authentication scheme name
|
||||
def update_params_for_auth!(header_params, query_params, auth_names)
|
||||
Array(auth_names).each do |auth_name|
|
||||
auth_setting = @config.auth_settings[auth_name]
|
||||
next unless auth_setting
|
||||
case auth_setting[:in]
|
||||
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
||||
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
||||
else fail ArgumentError, 'Authentication token must be in `query` of `header`'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Sets user agent in HTTP header
|
||||
#
|
||||
# @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
|
||||
def user_agent=(user_agent)
|
||||
@user_agent = user_agent
|
||||
@default_headers['User-Agent'] = @user_agent
|
||||
end
|
||||
|
||||
# Return Accept header based on an array of accepts provided.
|
||||
# @param [Array] accepts array for Accept
|
||||
# @return [String] the Accept header (e.g. application/json)
|
||||
def select_header_accept(accepts)
|
||||
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) }
|
||||
json_accept || accepts.join(',')
|
||||
end
|
||||
|
||||
# Return Content-Type header based on an array of content types provided.
|
||||
# @param [Array] content_types array for Content-Type
|
||||
# @return [String] the Content-Type header (e.g. application/json)
|
||||
def select_header_content_type(content_types)
|
||||
# use application/json by default
|
||||
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) }
|
||||
json_content_type || content_types.first
|
||||
end
|
||||
|
||||
# Convert object (array, hash, object, etc) to JSON string.
|
||||
# @param [Object] model object to be converted into JSON string
|
||||
# @return [String] JSON string representation of the object
|
||||
def object_to_http_body(model)
|
||||
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) }
|
||||
else
|
||||
local_body = object_to_hash(model)
|
||||
end
|
||||
local_body.to_json
|
||||
end
|
||||
|
||||
# Convert object(non-array) to hash.
|
||||
# @param [Object] obj object to be converted into JSON string
|
||||
# @return [String] JSON string representation of the object
|
||||
def object_to_hash(obj)
|
||||
if obj.respond_to?(:to_hash)
|
||||
obj.to_hash
|
||||
else
|
||||
obj
|
||||
end
|
||||
end
|
||||
|
||||
# Build parameter value according to the given collection format.
|
||||
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
||||
def build_collection_param(param, collection_format)
|
||||
case collection_format
|
||||
when :csv
|
||||
param.join(',')
|
||||
when :ssv
|
||||
param.join(' ')
|
||||
when :tsv
|
||||
param.join("\t")
|
||||
when :pipes
|
||||
param.join('|')
|
||||
when :multi
|
||||
# return the array directly as typhoeus will handle it as expected
|
||||
param
|
||||
else
|
||||
fail "unknown collection format: #{collection_format.inspect}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -34,5 +34,24 @@ module Petstore
|
||||
super arg
|
||||
end
|
||||
end
|
||||
|
||||
# Override to_s to display a friendly error message
|
||||
def to_s
|
||||
message
|
||||
end
|
||||
|
||||
def message
|
||||
if @message.nil?
|
||||
msg = "Error message: the server returns an error"
|
||||
else
|
||||
msg = @message
|
||||
end
|
||||
|
||||
msg += "\nHTTP status code: #{code}" if code
|
||||
msg += "\nResponse headers: #{response_headers}" if response_headers
|
||||
msg += "\nResponse body: #{response_body}" if response_body
|
||||
|
||||
msg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,15 +3,13 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'uri'
|
||||
|
||||
module Petstore
|
||||
class Configuration
|
||||
# Defines url scheme
|
||||
@@ -128,7 +126,7 @@ module Petstore
|
||||
attr_accessor :force_ending_format
|
||||
|
||||
def initialize
|
||||
@scheme = 'https'
|
||||
@scheme = 'http'
|
||||
@host = 'petstore.swagger.io'
|
||||
@base_path = '/v2'
|
||||
@api_key = {}
|
||||
@@ -174,8 +172,7 @@ module Petstore
|
||||
end
|
||||
|
||||
def base_url
|
||||
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
||||
URI.encode(url)
|
||||
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
||||
end
|
||||
|
||||
# Gets API key (with prefix if set).
|
||||
@@ -245,8 +242,8 @@ module Petstore
|
||||
servers = server_settings
|
||||
|
||||
# check array index out of bound
|
||||
if (index < 0 || index > servers.size)
|
||||
fail ArgumentError "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
||||
if (index < 0 || index >= servers.size)
|
||||
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
||||
end
|
||||
|
||||
server = servers[index]
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesAnyType
|
||||
attr_accessor :name
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesAnyType` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesAnyType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesArray
|
||||
attr_accessor :name
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesArray` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesArray`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesBoolean
|
||||
attr_accessor :name
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesBoolean` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesBoolean`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -14,45 +14,136 @@ require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesClass
|
||||
attr_accessor :map_property
|
||||
attr_accessor :map_string
|
||||
|
||||
attr_accessor :map_of_map_property
|
||||
attr_accessor :map_number
|
||||
|
||||
attr_accessor :map_integer
|
||||
|
||||
attr_accessor :map_boolean
|
||||
|
||||
attr_accessor :map_array_integer
|
||||
|
||||
attr_accessor :map_array_anytype
|
||||
|
||||
attr_accessor :map_map_string
|
||||
|
||||
attr_accessor :map_map_anytype
|
||||
|
||||
attr_accessor :anytype_1
|
||||
|
||||
attr_accessor :anytype_2
|
||||
|
||||
attr_accessor :anytype_3
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'map_property' => :'map_property',
|
||||
:'map_of_map_property' => :'map_of_map_property'
|
||||
:'map_string' => :'map_string',
|
||||
:'map_number' => :'map_number',
|
||||
:'map_integer' => :'map_integer',
|
||||
:'map_boolean' => :'map_boolean',
|
||||
:'map_array_integer' => :'map_array_integer',
|
||||
:'map_array_anytype' => :'map_array_anytype',
|
||||
:'map_map_string' => :'map_map_string',
|
||||
:'map_map_anytype' => :'map_map_anytype',
|
||||
:'anytype_1' => :'anytype_1',
|
||||
:'anytype_2' => :'anytype_2',
|
||||
:'anytype_3' => :'anytype_3'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'map_property' => :'Hash<String, String>',
|
||||
:'map_of_map_property' => :'Hash<String, Hash<String, String>>'
|
||||
:'map_string' => :'Hash<String, String>',
|
||||
:'map_number' => :'Hash<String, Float>',
|
||||
:'map_integer' => :'Hash<String, Integer>',
|
||||
:'map_boolean' => :'Hash<String, Boolean>',
|
||||
:'map_array_integer' => :'Hash<String, Array<Integer>>',
|
||||
:'map_array_anytype' => :'Hash<String, Array<Object>>',
|
||||
:'map_map_string' => :'Hash<String, Hash<String, String>>',
|
||||
:'map_map_anytype' => :'Hash<String, Hash<String, Object>>',
|
||||
:'anytype_1' => :'Object',
|
||||
:'anytype_2' => :'Object',
|
||||
:'anytype_3' => :'Object'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesClass` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'map_property')
|
||||
if (value = attributes[:'map_property']).is_a?(Hash)
|
||||
self.map_property = value
|
||||
if attributes.key?(:'map_string')
|
||||
if (value = attributes[:'map_string']).is_a?(Hash)
|
||||
self.map_string = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'map_of_map_property')
|
||||
if (value = attributes[:'map_of_map_property']).is_a?(Hash)
|
||||
self.map_of_map_property = value
|
||||
if attributes.key?(:'map_number')
|
||||
if (value = attributes[:'map_number']).is_a?(Hash)
|
||||
self.map_number = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'map_integer')
|
||||
if (value = attributes[:'map_integer']).is_a?(Hash)
|
||||
self.map_integer = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'map_boolean')
|
||||
if (value = attributes[:'map_boolean']).is_a?(Hash)
|
||||
self.map_boolean = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'map_array_integer')
|
||||
if (value = attributes[:'map_array_integer']).is_a?(Hash)
|
||||
self.map_array_integer = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'map_array_anytype')
|
||||
if (value = attributes[:'map_array_anytype']).is_a?(Hash)
|
||||
self.map_array_anytype = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'map_map_string')
|
||||
if (value = attributes[:'map_map_string']).is_a?(Hash)
|
||||
self.map_map_string = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'map_map_anytype')
|
||||
if (value = attributes[:'map_map_anytype']).is_a?(Hash)
|
||||
self.map_map_anytype = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'anytype_1')
|
||||
self.anytype_1 = attributes[:'anytype_1']
|
||||
end
|
||||
|
||||
if attributes.key?(:'anytype_2')
|
||||
self.anytype_2 = attributes[:'anytype_2']
|
||||
end
|
||||
|
||||
if attributes.key?(:'anytype_3')
|
||||
self.anytype_3 = attributes[:'anytype_3']
|
||||
end
|
||||
end
|
||||
|
||||
# Show invalid properties with the reasons. Usually used together with valid?
|
||||
@@ -73,8 +164,17 @@ module Petstore
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
map_property == o.map_property &&
|
||||
map_of_map_property == o.map_of_map_property
|
||||
map_string == o.map_string &&
|
||||
map_number == o.map_number &&
|
||||
map_integer == o.map_integer &&
|
||||
map_boolean == o.map_boolean &&
|
||||
map_array_integer == o.map_array_integer &&
|
||||
map_array_anytype == o.map_array_anytype &&
|
||||
map_map_string == o.map_map_string &&
|
||||
map_map_anytype == o.map_map_anytype &&
|
||||
anytype_1 == o.anytype_1 &&
|
||||
anytype_2 == o.anytype_2 &&
|
||||
anytype_3 == o.anytype_3
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@@ -84,9 +184,16 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[map_property, map_of_map_property].hash
|
||||
[map_string, map_number, map_integer, map_boolean, map_array_integer, map_array_anytype, map_map_string, map_map_anytype, anytype_1, anytype_2, anytype_3].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
@@ -96,7 +203,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -125,7 +232,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -146,8 +253,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesInteger
|
||||
attr_accessor :name
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesInteger` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesInteger`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesNumber
|
||||
attr_accessor :name
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesNumber` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesNumber`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesObject
|
||||
attr_accessor :name
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesObject` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class AdditionalPropertiesString
|
||||
attr_accessor :name
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'name' => :'name'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'name' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesString` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesString`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
name == o.name
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -34,19 +34,31 @@ module Petstore
|
||||
}
|
||||
end
|
||||
|
||||
# discriminator's property name in OpenAPI v3
|
||||
def self.openapi_discriminator_name
|
||||
:'class_name'
|
||||
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.has_key?(:'className')
|
||||
self.class_name = attributes[:'className']
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Animal` initialize method"
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'color')
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Animal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'class_name')
|
||||
self.class_name = attributes[:'class_name']
|
||||
end
|
||||
|
||||
if attributes.key?(:'color')
|
||||
self.color = attributes[:'color']
|
||||
else
|
||||
self.color = 'red'
|
||||
@@ -87,11 +99,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[class_name, color].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -99,7 +118,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -128,7 +147,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -149,8 +168,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -41,20 +41,27 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ApiResponse` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ApiResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'code')
|
||||
if attributes.key?(:'code')
|
||||
self.code = attributes[:'code']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'type')
|
||||
if attributes.key?(:'type')
|
||||
self.type = attributes[:'type']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'message')
|
||||
if attributes.key?(:'message')
|
||||
self.message = attributes[:'message']
|
||||
end
|
||||
end
|
||||
@@ -89,11 +96,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[code, type, message].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -101,7 +115,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -130,7 +144,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -151,8 +165,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -33,13 +33,20 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ArrayOfArrayOfNumberOnly` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'ArrayArrayNumber')
|
||||
if (value = attributes[:'ArrayArrayNumber']).is_a?(Array)
|
||||
if attributes.key?(:'array_array_number')
|
||||
if (value = attributes[:'array_array_number']).is_a?(Array)
|
||||
self.array_array_number = value
|
||||
end
|
||||
end
|
||||
@@ -73,11 +80,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[array_array_number].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -85,7 +99,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -114,7 +128,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -135,8 +149,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -33,13 +33,20 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ArrayOfNumberOnly` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'ArrayNumber')
|
||||
if (value = attributes[:'ArrayNumber']).is_a?(Array)
|
||||
if attributes.key?(:'array_number')
|
||||
if (value = attributes[:'array_number']).is_a?(Array)
|
||||
self.array_number = value
|
||||
end
|
||||
end
|
||||
@@ -73,11 +80,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[array_number].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -85,7 +99,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -114,7 +128,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -135,8 +149,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -41,24 +41,31 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ArrayTest` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'array_of_string')
|
||||
if attributes.key?(:'array_of_string')
|
||||
if (value = attributes[:'array_of_string']).is_a?(Array)
|
||||
self.array_of_string = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'array_array_of_integer')
|
||||
if attributes.key?(:'array_array_of_integer')
|
||||
if (value = attributes[:'array_array_of_integer']).is_a?(Array)
|
||||
self.array_array_of_integer = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'array_array_of_model')
|
||||
if attributes.key?(:'array_array_of_model')
|
||||
if (value = attributes[:'array_array_of_model']).is_a?(Array)
|
||||
self.array_array_of_model = value
|
||||
end
|
||||
@@ -95,11 +102,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[array_of_string, array_array_of_integer, array_array_of_model].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -107,7 +121,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -136,7 +150,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -157,8 +171,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -54,33 +54,40 @@ module Petstore
|
||||
# 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.has_key?(:'smallCamel')
|
||||
self.small_camel = attributes[:'smallCamel']
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Capitalization` initialize method"
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'CapitalCamel')
|
||||
self.capital_camel = attributes[:'CapitalCamel']
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Capitalization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'small_camel')
|
||||
self.small_camel = attributes[:'small_camel']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'small_Snake')
|
||||
self.small_snake = attributes[:'small_Snake']
|
||||
if attributes.key?(:'capital_camel')
|
||||
self.capital_camel = attributes[:'capital_camel']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'Capital_Snake')
|
||||
self.capital_snake = attributes[:'Capital_Snake']
|
||||
if attributes.key?(:'small_snake')
|
||||
self.small_snake = attributes[:'small_snake']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'SCA_ETH_Flow_Points')
|
||||
self.sca_eth_flow_points = attributes[:'SCA_ETH_Flow_Points']
|
||||
if attributes.key?(:'capital_snake')
|
||||
self.capital_snake = attributes[:'capital_snake']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'ATT_NAME')
|
||||
self.att_name = attributes[:'ATT_NAME']
|
||||
if attributes.key?(:'sca_eth_flow_points')
|
||||
self.sca_eth_flow_points = attributes[:'sca_eth_flow_points']
|
||||
end
|
||||
|
||||
if attributes.key?(:'att_name')
|
||||
self.att_name = attributes[:'att_name']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -117,11 +124,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -129,7 +143,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -158,7 +172,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -179,8 +193,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,28 +3,22 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class Cat
|
||||
attr_accessor :class_name
|
||||
|
||||
attr_accessor :color
|
||||
|
||||
class Cat < Animal
|
||||
attr_accessor :declawed
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'class_name' => :'className',
|
||||
:'color' => :'color',
|
||||
:'declawed' => :'declawed'
|
||||
}
|
||||
end
|
||||
@@ -32,31 +26,37 @@ module Petstore
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'class_name' => :'String',
|
||||
:'color' => :'String',
|
||||
:'declawed' => :'BOOLEAN'
|
||||
:'declawed' => :'Boolean'
|
||||
}
|
||||
end
|
||||
|
||||
# List of class defined in allOf (OpenAPI v3)
|
||||
def self.openapi_all_of
|
||||
[
|
||||
:'Animal',
|
||||
:'CatAllOf'
|
||||
]
|
||||
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.has_key?(:'className')
|
||||
self.class_name = attributes[:'className']
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Cat` initialize method"
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'color')
|
||||
self.color = attributes[:'color']
|
||||
else
|
||||
self.color = 'red'
|
||||
end
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Cat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'declawed')
|
||||
# call parent's initialize
|
||||
super(attributes)
|
||||
|
||||
if attributes.key?(:'declawed')
|
||||
self.declawed = attributes[:'declawed']
|
||||
end
|
||||
end
|
||||
@@ -64,19 +64,14 @@ module Petstore
|
||||
# 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
|
||||
if @class_name.nil?
|
||||
invalid_properties.push('invalid value for "class_name", class_name cannot be nil.')
|
||||
end
|
||||
|
||||
invalid_properties = super
|
||||
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?
|
||||
true
|
||||
true && super
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
@@ -84,9 +79,7 @@ module Petstore
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
class_name == o.class_name &&
|
||||
color == o.color &&
|
||||
declawed == o.declawed
|
||||
declawed == o.declawed && super(o)
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@@ -96,9 +89,16 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[class_name, color, declawed].hash
|
||||
[declawed].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
@@ -106,9 +106,10 @@ module Petstore
|
||||
# @return [Object] Returns the model itself
|
||||
def build_from_hash(attributes)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
super(attributes)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -137,7 +138,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -158,8 +159,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -178,7 +178,7 @@ module Petstore
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
hash = super
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
next if value.nil?
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class CatAllOf
|
||||
attr_accessor :declawed
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'declawed' => :'declawed'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'declawed' => :'Boolean'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::CatAllOf` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::CatAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'declawed')
|
||||
self.declawed = attributes[:'declawed']
|
||||
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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
declawed == o.declawed
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[declawed].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -37,16 +37,23 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Category` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'id')
|
||||
if attributes.key?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'name')
|
||||
if attributes.key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
else
|
||||
self.name = 'default-name'
|
||||
@@ -87,11 +94,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[id, name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -99,7 +113,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -128,7 +142,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -149,8 +163,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -34,12 +34,19 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ClassModel` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ClassModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'_class')
|
||||
if attributes.key?(:'_class')
|
||||
self._class = attributes[:'_class']
|
||||
end
|
||||
end
|
||||
@@ -72,11 +79,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[_class].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -84,7 +98,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -113,7 +127,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -134,8 +148,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -33,12 +33,19 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Client` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Client`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'client')
|
||||
if attributes.key?(:'client')
|
||||
self.client = attributes[:'client']
|
||||
end
|
||||
end
|
||||
@@ -71,11 +78,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[client].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -83,7 +97,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -112,7 +126,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -133,8 +147,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,28 +3,22 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class Dog
|
||||
attr_accessor :class_name
|
||||
|
||||
attr_accessor :color
|
||||
|
||||
class Dog < Animal
|
||||
attr_accessor :breed
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'class_name' => :'className',
|
||||
:'color' => :'color',
|
||||
:'breed' => :'breed'
|
||||
}
|
||||
end
|
||||
@@ -32,31 +26,37 @@ module Petstore
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'class_name' => :'String',
|
||||
:'color' => :'String',
|
||||
:'breed' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# List of class defined in allOf (OpenAPI v3)
|
||||
def self.openapi_all_of
|
||||
[
|
||||
:'Animal',
|
||||
:'DogAllOf'
|
||||
]
|
||||
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.has_key?(:'className')
|
||||
self.class_name = attributes[:'className']
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Dog` initialize method"
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'color')
|
||||
self.color = attributes[:'color']
|
||||
else
|
||||
self.color = 'red'
|
||||
end
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Dog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'breed')
|
||||
# call parent's initialize
|
||||
super(attributes)
|
||||
|
||||
if attributes.key?(:'breed')
|
||||
self.breed = attributes[:'breed']
|
||||
end
|
||||
end
|
||||
@@ -64,19 +64,14 @@ module Petstore
|
||||
# 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
|
||||
if @class_name.nil?
|
||||
invalid_properties.push('invalid value for "class_name", class_name cannot be nil.')
|
||||
end
|
||||
|
||||
invalid_properties = super
|
||||
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?
|
||||
true
|
||||
true && super
|
||||
end
|
||||
|
||||
# Checks equality by comparing each attribute.
|
||||
@@ -84,9 +79,7 @@ module Petstore
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class &&
|
||||
class_name == o.class_name &&
|
||||
color == o.color &&
|
||||
breed == o.breed
|
||||
breed == o.breed && super(o)
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
@@ -96,9 +89,16 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[class_name, color, breed].hash
|
||||
[breed].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
@@ -106,9 +106,10 @@ module Petstore
|
||||
# @return [Object] Returns the model itself
|
||||
def build_from_hash(attributes)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
super(attributes)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -137,7 +138,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -158,8 +159,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -178,7 +178,7 @@ module Petstore
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
hash = super
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
value = self.send(attr)
|
||||
next if value.nil?
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class DogAllOf
|
||||
attr_accessor :breed
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'breed' => :'breed'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'breed' => :'String'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::DogAllOf` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::DogAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'breed')
|
||||
self.breed = attributes[:'breed']
|
||||
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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
breed == o.breed
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[breed].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -59,16 +59,23 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::EnumArrays` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumArrays`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'just_symbol')
|
||||
if attributes.key?(:'just_symbol')
|
||||
self.just_symbol = attributes[:'just_symbol']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'array_enum')
|
||||
if attributes.key?(:'array_enum')
|
||||
if (value = attributes[:'array_enum']).is_a?(Array)
|
||||
self.array_enum = value
|
||||
end
|
||||
@@ -85,7 +92,7 @@ module Petstore
|
||||
# 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)
|
||||
true
|
||||
end
|
||||
@@ -93,9 +100,9 @@ module Petstore
|
||||
# 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
|
||||
@@ -116,11 +123,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[just_symbol, array_enum].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -128,7 +142,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -157,7 +171,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -178,8 +192,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -14,10 +14,16 @@ 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 self.build_from_hash(value)
|
||||
new.build_from_hash(value)
|
||||
end
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -71,29 +71,36 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::EnumTest` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::EnumTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'enum_string')
|
||||
if attributes.key?(:'enum_string')
|
||||
self.enum_string = attributes[:'enum_string']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'enum_string_required')
|
||||
if attributes.key?(:'enum_string_required')
|
||||
self.enum_string_required = attributes[:'enum_string_required']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'enum_integer')
|
||||
if attributes.key?(:'enum_integer')
|
||||
self.enum_integer = attributes[:'enum_integer']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'enum_number')
|
||||
if attributes.key?(:'enum_number')
|
||||
self.enum_number = attributes[:'enum_number']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'outerEnum')
|
||||
self.outer_enum = attributes[:'outerEnum']
|
||||
if attributes.key?(:'outer_enum')
|
||||
self.outer_enum = attributes[:'outer_enum']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -111,14 +118,14 @@ module Petstore
|
||||
# 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)
|
||||
return false if @enum_string_required.nil?
|
||||
enum_string_required_validator = EnumAttributeValidator.new('String', ['UPPER', 'lower', ''])
|
||||
enum_string_required_validator = EnumAttributeValidator.new('String', ["UPPER", "lower", ""])
|
||||
return false unless enum_string_required_validator.valid?(@enum_string_required)
|
||||
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)
|
||||
true
|
||||
end
|
||||
@@ -126,9 +133,9 @@ module Petstore
|
||||
# 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
|
||||
@@ -136,9 +143,9 @@ module Petstore
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] enum_string_required Object to be assigned
|
||||
def enum_string_required=(enum_string_required)
|
||||
validator = EnumAttributeValidator.new('String', ['UPPER', 'lower', ''])
|
||||
validator = EnumAttributeValidator.new('String', ["UPPER", "lower", ""])
|
||||
unless validator.valid?(enum_string_required)
|
||||
fail ArgumentError, 'invalid value for "enum_string_required", must be one of #{validator.allowable_values}.'
|
||||
fail ArgumentError, "invalid value for \"enum_string_required\", must be one of #{validator.allowable_values}."
|
||||
end
|
||||
@enum_string_required = enum_string_required
|
||||
end
|
||||
@@ -146,9 +153,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
|
||||
@@ -156,9 +163,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
|
||||
@@ -182,11 +189,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -194,7 +208,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -223,7 +237,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -244,8 +258,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -35,13 +35,20 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::File` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::File`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'sourceURI')
|
||||
self.source_uri = attributes[:'sourceURI']
|
||||
if attributes.key?(:'source_uri')
|
||||
self.source_uri = attributes[:'source_uri']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -73,11 +80,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[source_uri].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -85,7 +99,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -114,7 +128,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -135,8 +149,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -37,16 +37,23 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::FileSchemaTestClass` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FileSchemaTestClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'file')
|
||||
if attributes.key?(:'file')
|
||||
self.file = attributes[:'file']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'files')
|
||||
if attributes.key?(:'files')
|
||||
if (value = attributes[:'files']).is_a?(Array)
|
||||
self.files = value
|
||||
end
|
||||
@@ -82,11 +89,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[file, files].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -94,7 +108,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -123,7 +137,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -144,8 +158,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -81,60 +81,67 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::FormatTest` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FormatTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'integer')
|
||||
if attributes.key?(:'integer')
|
||||
self.integer = attributes[:'integer']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'int32')
|
||||
if attributes.key?(:'int32')
|
||||
self.int32 = attributes[:'int32']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'int64')
|
||||
if attributes.key?(:'int64')
|
||||
self.int64 = attributes[:'int64']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'number')
|
||||
if attributes.key?(:'number')
|
||||
self.number = attributes[:'number']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'float')
|
||||
if attributes.key?(:'float')
|
||||
self.float = attributes[:'float']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'double')
|
||||
if attributes.key?(:'double')
|
||||
self.double = attributes[:'double']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'string')
|
||||
if attributes.key?(:'string')
|
||||
self.string = attributes[:'string']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'byte')
|
||||
if attributes.key?(:'byte')
|
||||
self.byte = attributes[:'byte']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'binary')
|
||||
if attributes.key?(:'binary')
|
||||
self.binary = attributes[:'binary']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'date')
|
||||
if attributes.key?(:'date')
|
||||
self.date = attributes[:'date']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'dateTime')
|
||||
self.date_time = attributes[:'dateTime']
|
||||
if attributes.key?(:'date_time')
|
||||
self.date_time = attributes[:'date_time']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'uuid')
|
||||
if attributes.key?(:'uuid')
|
||||
self.uuid = attributes[:'uuid']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'password')
|
||||
if attributes.key?(:'password')
|
||||
self.password = attributes[:'password']
|
||||
end
|
||||
end
|
||||
@@ -187,16 +194,18 @@ module Petstore
|
||||
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.')
|
||||
pattern = Regexp.new(/[a-z]/i)
|
||||
if !@string.nil? && @string !~ pattern
|
||||
invalid_properties.push("invalid value for \"string\", must conform to the pattern #{pattern}.")
|
||||
end
|
||||
|
||||
if @byte.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}=)?$.')
|
||||
pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
||||
if @byte !~ pattern
|
||||
invalid_properties.push("invalid value for \"byte\", must conform to the pattern #{pattern}.")
|
||||
end
|
||||
|
||||
if @date.nil?
|
||||
@@ -234,7 +243,7 @@ module Petstore
|
||||
return false if !@double.nil? && @double < 67.8
|
||||
return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
|
||||
return false if @byte.nil?
|
||||
return false if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$)
|
||||
return false if @byte !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
||||
return false if @date.nil?
|
||||
return false if @password.nil?
|
||||
return false if @password.to_s.length > 64
|
||||
@@ -319,8 +328,9 @@ 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.'
|
||||
pattern = Regexp.new(/[a-z]/i)
|
||||
if !string.nil? && string !~ pattern
|
||||
fail ArgumentError, "invalid value for \"string\", must conform to the pattern #{pattern}."
|
||||
end
|
||||
|
||||
@string = string
|
||||
@@ -333,8 +343,9 @@ module Petstore
|
||||
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}=)?$.'
|
||||
pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
|
||||
if byte !~ pattern
|
||||
fail ArgumentError, "invalid value for \"byte\", must conform to the pattern #{pattern}."
|
||||
end
|
||||
|
||||
@byte = byte
|
||||
@@ -385,11 +396,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -397,7 +415,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -426,7 +444,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -447,8 +465,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -37,16 +37,23 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::HasOnlyReadOnly` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::HasOnlyReadOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'bar')
|
||||
if attributes.key?(:'bar')
|
||||
self.bar = attributes[:'bar']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'foo')
|
||||
if attributes.key?(:'foo')
|
||||
self.foo = attributes[:'foo']
|
||||
end
|
||||
end
|
||||
@@ -80,11 +87,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[bar, foo].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -92,7 +106,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -121,7 +135,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -142,8 +156,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -33,13 +33,20 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::List` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::List`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'123-list')
|
||||
self._123_list = attributes[:'123-list']
|
||||
if attributes.key?(:'_123_list')
|
||||
self._123_list = attributes[:'_123_list']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,11 +78,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[_123_list].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -83,7 +97,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -112,7 +126,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -133,8 +147,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -59,38 +59,45 @@ module Petstore
|
||||
{
|
||||
:'map_map_of_string' => :'Hash<String, Hash<String, String>>',
|
||||
:'map_of_enum_string' => :'Hash<String, String>',
|
||||
:'direct_map' => :'Hash<String, BOOLEAN>',
|
||||
:'indirect_map' => :'Hash<String, BOOLEAN>'
|
||||
:'direct_map' => :'Hash<String, Boolean>',
|
||||
:'indirect_map' => :'Hash<String, Boolean>'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::MapTest` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MapTest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'map_map_of_string')
|
||||
if attributes.key?(:'map_map_of_string')
|
||||
if (value = attributes[:'map_map_of_string']).is_a?(Hash)
|
||||
self.map_map_of_string = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'map_of_enum_string')
|
||||
if attributes.key?(:'map_of_enum_string')
|
||||
if (value = attributes[:'map_of_enum_string']).is_a?(Hash)
|
||||
self.map_of_enum_string = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'direct_map')
|
||||
if attributes.key?(:'direct_map')
|
||||
if (value = attributes[:'direct_map']).is_a?(Hash)
|
||||
self.direct_map = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'indirect_map')
|
||||
if attributes.key?(:'indirect_map')
|
||||
if (value = attributes[:'indirect_map']).is_a?(Hash)
|
||||
self.indirect_map = value
|
||||
end
|
||||
@@ -128,11 +135,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[map_map_of_string, map_of_enum_string, direct_map, indirect_map].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -140,7 +154,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -169,7 +183,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -190,8 +204,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -41,20 +41,27 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::MixedPropertiesAndAdditionalPropertiesClass` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::MixedPropertiesAndAdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'uuid')
|
||||
if attributes.key?(:'uuid')
|
||||
self.uuid = attributes[:'uuid']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'dateTime')
|
||||
self.date_time = attributes[:'dateTime']
|
||||
if attributes.key?(:'date_time')
|
||||
self.date_time = attributes[:'date_time']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'map')
|
||||
if attributes.key?(:'map')
|
||||
if (value = attributes[:'map']).is_a?(Hash)
|
||||
self.map = value
|
||||
end
|
||||
@@ -91,11 +98,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[uuid, date_time, map].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -103,7 +117,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -132,7 +146,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -153,8 +167,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -38,17 +38,24 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Model200Response` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Model200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'name')
|
||||
if attributes.key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'class')
|
||||
self._class = attributes[:'class']
|
||||
if attributes.key?(:'_class')
|
||||
self._class = attributes[:'_class']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -81,11 +88,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name, _class].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -93,7 +107,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -122,7 +136,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -143,8 +157,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -34,13 +34,20 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ModelReturn` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ModelReturn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'return')
|
||||
self._return = attributes[:'return']
|
||||
if attributes.key?(:'_return')
|
||||
self._return = attributes[:'_return']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -72,11 +79,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[_return].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -84,7 +98,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -113,7 +127,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -134,8 +148,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -46,25 +46,32 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Name` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Name`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'name')
|
||||
if attributes.key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'snake_case')
|
||||
if attributes.key?(:'snake_case')
|
||||
self.snake_case = attributes[:'snake_case']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'property')
|
||||
if attributes.key?(:'property')
|
||||
self.property = attributes[:'property']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'123Number')
|
||||
self._123_number = attributes[:'123Number']
|
||||
if attributes.key?(:'_123_number')
|
||||
self._123_number = attributes[:'_123_number']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -104,11 +111,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[name, snake_case, property, _123_number].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -116,7 +130,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -145,7 +159,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -166,8 +180,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -33,13 +33,20 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::NumberOnly` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::NumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'JustNumber')
|
||||
self.just_number = attributes[:'JustNumber']
|
||||
if attributes.key?(:'just_number')
|
||||
self.just_number = attributes[:'just_number']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,11 +78,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[just_number].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -83,7 +97,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -112,7 +126,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -133,8 +147,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -69,39 +69,46 @@ module Petstore
|
||||
:'quantity' => :'Integer',
|
||||
:'ship_date' => :'DateTime',
|
||||
:'status' => :'String',
|
||||
:'complete' => :'BOOLEAN'
|
||||
:'complete' => :'Boolean'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Order` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'id')
|
||||
if attributes.key?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'petId')
|
||||
self.pet_id = attributes[:'petId']
|
||||
if attributes.key?(:'pet_id')
|
||||
self.pet_id = attributes[:'pet_id']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'quantity')
|
||||
if attributes.key?(:'quantity')
|
||||
self.quantity = attributes[:'quantity']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'shipDate')
|
||||
self.ship_date = attributes[:'shipDate']
|
||||
if attributes.key?(:'ship_date')
|
||||
self.ship_date = attributes[:'ship_date']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'status')
|
||||
if attributes.key?(:'status')
|
||||
self.status = attributes[:'status']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'complete')
|
||||
if attributes.key?(:'complete')
|
||||
self.complete = attributes[:'complete']
|
||||
else
|
||||
self.complete = false
|
||||
@@ -118,7 +125,7 @@ module Petstore
|
||||
# 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)
|
||||
true
|
||||
end
|
||||
@@ -126,9 +133,9 @@ module Petstore
|
||||
# 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
|
||||
@@ -153,11 +160,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[id, pet_id, quantity, ship_date, status, complete].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -165,7 +179,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -194,7 +208,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -215,8 +229,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -34,27 +34,34 @@ module Petstore
|
||||
{
|
||||
:'my_number' => :'Float',
|
||||
:'my_string' => :'String',
|
||||
:'my_boolean' => :'BOOLEAN'
|
||||
:'my_boolean' => :'Boolean'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::OuterComposite` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterComposite`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'my_number')
|
||||
if attributes.key?(:'my_number')
|
||||
self.my_number = attributes[:'my_number']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'my_string')
|
||||
if attributes.key?(:'my_string')
|
||||
self.my_string = attributes[:'my_string']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'my_boolean')
|
||||
if attributes.key?(:'my_boolean')
|
||||
self.my_boolean = attributes[:'my_boolean']
|
||||
end
|
||||
end
|
||||
@@ -89,11 +96,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[my_number, my_string, my_boolean].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -101,7 +115,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -130,7 +144,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -151,8 +165,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -14,10 +14,16 @@ 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 self.build_from_hash(value)
|
||||
new.build_from_hash(value)
|
||||
end
|
||||
|
||||
# Builds the enum from string
|
||||
# @param [String] The enum value in the form of the string
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -76,36 +76,43 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Pet` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'id')
|
||||
if attributes.key?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'category')
|
||||
if attributes.key?(:'category')
|
||||
self.category = attributes[:'category']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'name')
|
||||
if attributes.key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'photoUrls')
|
||||
if (value = attributes[:'photoUrls']).is_a?(Array)
|
||||
if attributes.key?(:'photo_urls')
|
||||
if (value = attributes[:'photo_urls']).is_a?(Array)
|
||||
self.photo_urls = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'tags')
|
||||
if attributes.key?(:'tags')
|
||||
if (value = attributes[:'tags']).is_a?(Array)
|
||||
self.tags = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'status')
|
||||
if attributes.key?(:'status')
|
||||
self.status = attributes[:'status']
|
||||
end
|
||||
end
|
||||
@@ -130,7 +137,7 @@ 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)
|
||||
true
|
||||
end
|
||||
@@ -138,9 +145,9 @@ module Petstore
|
||||
# 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
|
||||
@@ -165,11 +172,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[id, category, name, photo_urls, tags, status].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -177,7 +191,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -206,7 +220,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -227,8 +241,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -37,16 +37,23 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ReadOnlyFirst` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ReadOnlyFirst`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'bar')
|
||||
if attributes.key?(:'bar')
|
||||
self.bar = attributes[:'bar']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'baz')
|
||||
if attributes.key?(:'baz')
|
||||
self.baz = attributes[:'baz']
|
||||
end
|
||||
end
|
||||
@@ -80,11 +87,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[bar, baz].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -92,7 +106,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -121,7 +135,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -142,8 +156,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -33,13 +33,20 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::SpecialModelName` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::SpecialModelName`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'$special[property.name]')
|
||||
self.special_property_name = attributes[:'$special[property.name]']
|
||||
if attributes.key?(:'special_property_name')
|
||||
self.special_property_name = attributes[:'special_property_name']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -71,11 +78,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[special_property_name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -83,7 +97,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -112,7 +126,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -133,8 +147,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -37,16 +37,23 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::Tag` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'id')
|
||||
if attributes.key?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'name')
|
||||
if attributes.key?(:'name')
|
||||
self.name = attributes[:'name']
|
||||
end
|
||||
end
|
||||
@@ -80,11 +87,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[id, name].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -92,7 +106,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -121,7 +135,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -142,8 +156,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class TypeHolderDefault
|
||||
attr_accessor :string_item
|
||||
|
||||
attr_accessor :number_item
|
||||
|
||||
attr_accessor :integer_item
|
||||
|
||||
attr_accessor :bool_item
|
||||
|
||||
attr_accessor :array_item
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'string_item' => :'string_item',
|
||||
:'number_item' => :'number_item',
|
||||
:'integer_item' => :'integer_item',
|
||||
:'bool_item' => :'bool_item',
|
||||
:'array_item' => :'array_item'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'string_item' => :'String',
|
||||
:'number_item' => :'Float',
|
||||
:'integer_item' => :'Integer',
|
||||
:'bool_item' => :'Boolean',
|
||||
:'array_item' => :'Array<Integer>'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::TypeHolderDefault` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TypeHolderDefault`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'string_item')
|
||||
self.string_item = attributes[:'string_item']
|
||||
else
|
||||
self.string_item = 'what'
|
||||
end
|
||||
|
||||
if attributes.key?(:'number_item')
|
||||
self.number_item = attributes[:'number_item']
|
||||
end
|
||||
|
||||
if attributes.key?(:'integer_item')
|
||||
self.integer_item = attributes[:'integer_item']
|
||||
end
|
||||
|
||||
if attributes.key?(:'bool_item')
|
||||
self.bool_item = attributes[:'bool_item']
|
||||
else
|
||||
self.bool_item = true
|
||||
end
|
||||
|
||||
if attributes.key?(:'array_item')
|
||||
if (value = attributes[:'array_item']).is_a?(Array)
|
||||
self.array_item = 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
|
||||
if @string_item.nil?
|
||||
invalid_properties.push('invalid value for "string_item", string_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @number_item.nil?
|
||||
invalid_properties.push('invalid value for "number_item", number_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @integer_item.nil?
|
||||
invalid_properties.push('invalid value for "integer_item", integer_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @bool_item.nil?
|
||||
invalid_properties.push('invalid value for "bool_item", bool_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @array_item.nil?
|
||||
invalid_properties.push('invalid value for "array_item", array_item cannot be nil.')
|
||||
end
|
||||
|
||||
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 @string_item.nil?
|
||||
return false if @number_item.nil?
|
||||
return false if @integer_item.nil?
|
||||
return false if @bool_item.nil?
|
||||
return false if @array_item.nil?
|
||||
true
|
||||
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 &&
|
||||
string_item == o.string_item &&
|
||||
number_item == o.number_item &&
|
||||
integer_item == o.integer_item &&
|
||||
bool_item == o.bool_item &&
|
||||
array_item == o.array_item
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[string_item, number_item, integer_item, bool_item, array_item].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -0,0 +1,259 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class TypeHolderExample
|
||||
attr_accessor :string_item
|
||||
|
||||
attr_accessor :number_item
|
||||
|
||||
attr_accessor :integer_item
|
||||
|
||||
attr_accessor :bool_item
|
||||
|
||||
attr_accessor :array_item
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'string_item' => :'string_item',
|
||||
:'number_item' => :'number_item',
|
||||
:'integer_item' => :'integer_item',
|
||||
:'bool_item' => :'bool_item',
|
||||
:'array_item' => :'array_item'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'string_item' => :'String',
|
||||
:'number_item' => :'Float',
|
||||
:'integer_item' => :'Integer',
|
||||
:'bool_item' => :'Boolean',
|
||||
:'array_item' => :'Array<Integer>'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::TypeHolderExample` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::TypeHolderExample`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'string_item')
|
||||
self.string_item = attributes[:'string_item']
|
||||
end
|
||||
|
||||
if attributes.key?(:'number_item')
|
||||
self.number_item = attributes[:'number_item']
|
||||
end
|
||||
|
||||
if attributes.key?(:'integer_item')
|
||||
self.integer_item = attributes[:'integer_item']
|
||||
end
|
||||
|
||||
if attributes.key?(:'bool_item')
|
||||
self.bool_item = attributes[:'bool_item']
|
||||
end
|
||||
|
||||
if attributes.key?(:'array_item')
|
||||
if (value = attributes[:'array_item']).is_a?(Array)
|
||||
self.array_item = 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
|
||||
if @string_item.nil?
|
||||
invalid_properties.push('invalid value for "string_item", string_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @number_item.nil?
|
||||
invalid_properties.push('invalid value for "number_item", number_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @integer_item.nil?
|
||||
invalid_properties.push('invalid value for "integer_item", integer_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @bool_item.nil?
|
||||
invalid_properties.push('invalid value for "bool_item", bool_item cannot be nil.')
|
||||
end
|
||||
|
||||
if @array_item.nil?
|
||||
invalid_properties.push('invalid value for "array_item", array_item cannot be nil.')
|
||||
end
|
||||
|
||||
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 @string_item.nil?
|
||||
return false if @number_item.nil?
|
||||
return false if @integer_item.nil?
|
||||
return false if @bool_item.nil?
|
||||
return false if @array_item.nil?
|
||||
true
|
||||
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 &&
|
||||
string_item == o.string_item &&
|
||||
number_item == o.number_item &&
|
||||
integer_item == o.integer_item &&
|
||||
bool_item == o.bool_item &&
|
||||
array_item == o.array_item
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[string_item, number_item, integer_item, bool_item, array_item].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
@@ -62,41 +62,48 @@ module Petstore
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::User` initialize method"
|
||||
end
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::User`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.has_key?(:'id')
|
||||
if attributes.key?(:'id')
|
||||
self.id = attributes[:'id']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'username')
|
||||
if attributes.key?(:'username')
|
||||
self.username = attributes[:'username']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'firstName')
|
||||
self.first_name = attributes[:'firstName']
|
||||
if attributes.key?(:'first_name')
|
||||
self.first_name = attributes[:'first_name']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'lastName')
|
||||
self.last_name = attributes[:'lastName']
|
||||
if attributes.key?(:'last_name')
|
||||
self.last_name = attributes[:'last_name']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'email')
|
||||
if attributes.key?(:'email')
|
||||
self.email = attributes[:'email']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'password')
|
||||
if attributes.key?(:'password')
|
||||
self.password = attributes[:'password']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'phone')
|
||||
if attributes.key?(:'phone')
|
||||
self.phone = attributes[:'phone']
|
||||
end
|
||||
|
||||
if attributes.has_key?(:'userStatus')
|
||||
self.user_status = attributes[:'userStatus']
|
||||
if attributes.key?(:'user_status')
|
||||
self.user_status = attributes[:'user_status']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -135,11 +142,18 @@ module Petstore
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[id, username, first_name, last_name, email, password, phone, user_status].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
@@ -147,7 +161,7 @@ module Petstore
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# check to ensure the input is an array given that 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) })
|
||||
@@ -176,7 +190,7 @@ module Petstore
|
||||
value.to_i
|
||||
when :Float
|
||||
value.to_f
|
||||
when :BOOLEAN
|
||||
when :Boolean
|
||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
||||
true
|
||||
else
|
||||
@@ -197,8 +211,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
else # model
|
||||
temp_model = Petstore.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
Petstore.const_get(type).build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,466 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'date'
|
||||
|
||||
module Petstore
|
||||
class XmlItem
|
||||
attr_accessor :attribute_string
|
||||
|
||||
attr_accessor :attribute_number
|
||||
|
||||
attr_accessor :attribute_integer
|
||||
|
||||
attr_accessor :attribute_boolean
|
||||
|
||||
attr_accessor :wrapped_array
|
||||
|
||||
attr_accessor :name_string
|
||||
|
||||
attr_accessor :name_number
|
||||
|
||||
attr_accessor :name_integer
|
||||
|
||||
attr_accessor :name_boolean
|
||||
|
||||
attr_accessor :name_array
|
||||
|
||||
attr_accessor :name_wrapped_array
|
||||
|
||||
attr_accessor :prefix_string
|
||||
|
||||
attr_accessor :prefix_number
|
||||
|
||||
attr_accessor :prefix_integer
|
||||
|
||||
attr_accessor :prefix_boolean
|
||||
|
||||
attr_accessor :prefix_array
|
||||
|
||||
attr_accessor :prefix_wrapped_array
|
||||
|
||||
attr_accessor :namespace_string
|
||||
|
||||
attr_accessor :namespace_number
|
||||
|
||||
attr_accessor :namespace_integer
|
||||
|
||||
attr_accessor :namespace_boolean
|
||||
|
||||
attr_accessor :namespace_array
|
||||
|
||||
attr_accessor :namespace_wrapped_array
|
||||
|
||||
attr_accessor :prefix_ns_string
|
||||
|
||||
attr_accessor :prefix_ns_number
|
||||
|
||||
attr_accessor :prefix_ns_integer
|
||||
|
||||
attr_accessor :prefix_ns_boolean
|
||||
|
||||
attr_accessor :prefix_ns_array
|
||||
|
||||
attr_accessor :prefix_ns_wrapped_array
|
||||
|
||||
# Attribute mapping from ruby-style variable name to JSON key.
|
||||
def self.attribute_map
|
||||
{
|
||||
:'attribute_string' => :'attribute_string',
|
||||
:'attribute_number' => :'attribute_number',
|
||||
:'attribute_integer' => :'attribute_integer',
|
||||
:'attribute_boolean' => :'attribute_boolean',
|
||||
:'wrapped_array' => :'wrapped_array',
|
||||
:'name_string' => :'name_string',
|
||||
:'name_number' => :'name_number',
|
||||
:'name_integer' => :'name_integer',
|
||||
:'name_boolean' => :'name_boolean',
|
||||
:'name_array' => :'name_array',
|
||||
:'name_wrapped_array' => :'name_wrapped_array',
|
||||
:'prefix_string' => :'prefix_string',
|
||||
:'prefix_number' => :'prefix_number',
|
||||
:'prefix_integer' => :'prefix_integer',
|
||||
:'prefix_boolean' => :'prefix_boolean',
|
||||
:'prefix_array' => :'prefix_array',
|
||||
:'prefix_wrapped_array' => :'prefix_wrapped_array',
|
||||
:'namespace_string' => :'namespace_string',
|
||||
:'namespace_number' => :'namespace_number',
|
||||
:'namespace_integer' => :'namespace_integer',
|
||||
:'namespace_boolean' => :'namespace_boolean',
|
||||
:'namespace_array' => :'namespace_array',
|
||||
:'namespace_wrapped_array' => :'namespace_wrapped_array',
|
||||
:'prefix_ns_string' => :'prefix_ns_string',
|
||||
:'prefix_ns_number' => :'prefix_ns_number',
|
||||
:'prefix_ns_integer' => :'prefix_ns_integer',
|
||||
:'prefix_ns_boolean' => :'prefix_ns_boolean',
|
||||
:'prefix_ns_array' => :'prefix_ns_array',
|
||||
:'prefix_ns_wrapped_array' => :'prefix_ns_wrapped_array'
|
||||
}
|
||||
end
|
||||
|
||||
# Attribute type mapping.
|
||||
def self.openapi_types
|
||||
{
|
||||
:'attribute_string' => :'String',
|
||||
:'attribute_number' => :'Float',
|
||||
:'attribute_integer' => :'Integer',
|
||||
:'attribute_boolean' => :'Boolean',
|
||||
:'wrapped_array' => :'Array<Integer>',
|
||||
:'name_string' => :'String',
|
||||
:'name_number' => :'Float',
|
||||
:'name_integer' => :'Integer',
|
||||
:'name_boolean' => :'Boolean',
|
||||
:'name_array' => :'Array<Integer>',
|
||||
:'name_wrapped_array' => :'Array<Integer>',
|
||||
:'prefix_string' => :'String',
|
||||
:'prefix_number' => :'Float',
|
||||
:'prefix_integer' => :'Integer',
|
||||
:'prefix_boolean' => :'Boolean',
|
||||
:'prefix_array' => :'Array<Integer>',
|
||||
:'prefix_wrapped_array' => :'Array<Integer>',
|
||||
:'namespace_string' => :'String',
|
||||
:'namespace_number' => :'Float',
|
||||
:'namespace_integer' => :'Integer',
|
||||
:'namespace_boolean' => :'Boolean',
|
||||
:'namespace_array' => :'Array<Integer>',
|
||||
:'namespace_wrapped_array' => :'Array<Integer>',
|
||||
:'prefix_ns_string' => :'String',
|
||||
:'prefix_ns_number' => :'Float',
|
||||
:'prefix_ns_integer' => :'Integer',
|
||||
:'prefix_ns_boolean' => :'Boolean',
|
||||
:'prefix_ns_array' => :'Array<Integer>',
|
||||
:'prefix_ns_wrapped_array' => :'Array<Integer>'
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
if (!attributes.is_a?(Hash))
|
||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::XmlItem` initialize method"
|
||||
end
|
||||
|
||||
# check to see if the attribute exists and convert string to symbol for hash key
|
||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
||||
if (!self.class.attribute_map.key?(k.to_sym))
|
||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::XmlItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
||||
end
|
||||
h[k.to_sym] = v
|
||||
}
|
||||
|
||||
if attributes.key?(:'attribute_string')
|
||||
self.attribute_string = attributes[:'attribute_string']
|
||||
end
|
||||
|
||||
if attributes.key?(:'attribute_number')
|
||||
self.attribute_number = attributes[:'attribute_number']
|
||||
end
|
||||
|
||||
if attributes.key?(:'attribute_integer')
|
||||
self.attribute_integer = attributes[:'attribute_integer']
|
||||
end
|
||||
|
||||
if attributes.key?(:'attribute_boolean')
|
||||
self.attribute_boolean = attributes[:'attribute_boolean']
|
||||
end
|
||||
|
||||
if attributes.key?(:'wrapped_array')
|
||||
if (value = attributes[:'wrapped_array']).is_a?(Array)
|
||||
self.wrapped_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'name_string')
|
||||
self.name_string = attributes[:'name_string']
|
||||
end
|
||||
|
||||
if attributes.key?(:'name_number')
|
||||
self.name_number = attributes[:'name_number']
|
||||
end
|
||||
|
||||
if attributes.key?(:'name_integer')
|
||||
self.name_integer = attributes[:'name_integer']
|
||||
end
|
||||
|
||||
if attributes.key?(:'name_boolean')
|
||||
self.name_boolean = attributes[:'name_boolean']
|
||||
end
|
||||
|
||||
if attributes.key?(:'name_array')
|
||||
if (value = attributes[:'name_array']).is_a?(Array)
|
||||
self.name_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'name_wrapped_array')
|
||||
if (value = attributes[:'name_wrapped_array']).is_a?(Array)
|
||||
self.name_wrapped_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_string')
|
||||
self.prefix_string = attributes[:'prefix_string']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_number')
|
||||
self.prefix_number = attributes[:'prefix_number']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_integer')
|
||||
self.prefix_integer = attributes[:'prefix_integer']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_boolean')
|
||||
self.prefix_boolean = attributes[:'prefix_boolean']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_array')
|
||||
if (value = attributes[:'prefix_array']).is_a?(Array)
|
||||
self.prefix_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_wrapped_array')
|
||||
if (value = attributes[:'prefix_wrapped_array']).is_a?(Array)
|
||||
self.prefix_wrapped_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'namespace_string')
|
||||
self.namespace_string = attributes[:'namespace_string']
|
||||
end
|
||||
|
||||
if attributes.key?(:'namespace_number')
|
||||
self.namespace_number = attributes[:'namespace_number']
|
||||
end
|
||||
|
||||
if attributes.key?(:'namespace_integer')
|
||||
self.namespace_integer = attributes[:'namespace_integer']
|
||||
end
|
||||
|
||||
if attributes.key?(:'namespace_boolean')
|
||||
self.namespace_boolean = attributes[:'namespace_boolean']
|
||||
end
|
||||
|
||||
if attributes.key?(:'namespace_array')
|
||||
if (value = attributes[:'namespace_array']).is_a?(Array)
|
||||
self.namespace_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'namespace_wrapped_array')
|
||||
if (value = attributes[:'namespace_wrapped_array']).is_a?(Array)
|
||||
self.namespace_wrapped_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_ns_string')
|
||||
self.prefix_ns_string = attributes[:'prefix_ns_string']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_ns_number')
|
||||
self.prefix_ns_number = attributes[:'prefix_ns_number']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_ns_integer')
|
||||
self.prefix_ns_integer = attributes[:'prefix_ns_integer']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_ns_boolean')
|
||||
self.prefix_ns_boolean = attributes[:'prefix_ns_boolean']
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_ns_array')
|
||||
if (value = attributes[:'prefix_ns_array']).is_a?(Array)
|
||||
self.prefix_ns_array = value
|
||||
end
|
||||
end
|
||||
|
||||
if attributes.key?(:'prefix_ns_wrapped_array')
|
||||
if (value = attributes[:'prefix_ns_wrapped_array']).is_a?(Array)
|
||||
self.prefix_ns_wrapped_array = 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
|
||||
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?
|
||||
true
|
||||
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 &&
|
||||
attribute_string == o.attribute_string &&
|
||||
attribute_number == o.attribute_number &&
|
||||
attribute_integer == o.attribute_integer &&
|
||||
attribute_boolean == o.attribute_boolean &&
|
||||
wrapped_array == o.wrapped_array &&
|
||||
name_string == o.name_string &&
|
||||
name_number == o.name_number &&
|
||||
name_integer == o.name_integer &&
|
||||
name_boolean == o.name_boolean &&
|
||||
name_array == o.name_array &&
|
||||
name_wrapped_array == o.name_wrapped_array &&
|
||||
prefix_string == o.prefix_string &&
|
||||
prefix_number == o.prefix_number &&
|
||||
prefix_integer == o.prefix_integer &&
|
||||
prefix_boolean == o.prefix_boolean &&
|
||||
prefix_array == o.prefix_array &&
|
||||
prefix_wrapped_array == o.prefix_wrapped_array &&
|
||||
namespace_string == o.namespace_string &&
|
||||
namespace_number == o.namespace_number &&
|
||||
namespace_integer == o.namespace_integer &&
|
||||
namespace_boolean == o.namespace_boolean &&
|
||||
namespace_array == o.namespace_array &&
|
||||
namespace_wrapped_array == o.namespace_wrapped_array &&
|
||||
prefix_ns_string == o.prefix_ns_string &&
|
||||
prefix_ns_number == o.prefix_ns_number &&
|
||||
prefix_ns_integer == o.prefix_ns_integer &&
|
||||
prefix_ns_boolean == o.prefix_ns_boolean &&
|
||||
prefix_ns_array == o.prefix_ns_array &&
|
||||
prefix_ns_wrapped_array == o.prefix_ns_wrapped_array
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Integer] Hash code
|
||||
def hash
|
||||
[attribute_string, attribute_number, attribute_integer, attribute_boolean, wrapped_array, name_string, name_number, name_integer, name_boolean, name_array, name_wrapped_array, prefix_string, prefix_number, prefix_integer, prefix_boolean, prefix_array, prefix_wrapped_array, namespace_string, namespace_number, namespace_integer, namespace_boolean, namespace_array, namespace_wrapped_array, prefix_ns_string, prefix_ns_number, prefix_ns_integer, prefix_ns_boolean, prefix_ns_array, prefix_ns_wrapped_array].hash
|
||||
end
|
||||
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def self.build_from_hash(attributes)
|
||||
new.build_from_hash(attributes)
|
||||
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.openapi_types.each_pair do |key, type|
|
||||
if type =~ /\AArray<(.*)>/i
|
||||
# check to ensure the input is an array given that 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
|
||||
Petstore.const_get(type).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
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.3-SNAPSHOT
|
||||
OpenAPI Generator version: 4.1.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user