forked from loafle/openapi-generator-original
Added with-http-info API methods to Ruby client
to allow accessing response status code and headers, and removed the methods of recording last response info from ApiClient.
This commit is contained in:
parent
d1361ab529
commit
66112d9eb5
@ -17,6 +17,17 @@ module {{moduleName}}
|
|||||||
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
|
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
|
||||||
{{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}]
|
{{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}]
|
||||||
def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
||||||
|
{{#returnType}}status_code, headers, data = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts)
|
||||||
|
{{#returnType}}return data{{/returnType}}{{^returnType}}return nil{{/returnType}}
|
||||||
|
end
|
||||||
|
|
||||||
|
# {{summary}}
|
||||||
|
# {{notes}}
|
||||||
|
{{#allParams}}{{#required}} # @param {{paramName}} {{description}}
|
||||||
|
{{/required}}{{/allParams}} # @param [Hash] opts the optional parameters
|
||||||
|
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}
|
||||||
|
{{/required}}{{/allParams}} # @return [Array<Fixnum, Hash, {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}>] response status code, response headers and {{#returnType}}{{{returnType}}} data{{/returnType}}{{^returnType}}nil{{/returnType}}
|
||||||
|
def {{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: {{classname}}#{{operationId}} ..."
|
Configuration.logger.debug "Calling API: {{classname}}#{{operationId}} ..."
|
||||||
end
|
end
|
||||||
@ -63,26 +74,17 @@ module {{moduleName}}
|
|||||||
{{/bodyParam}}
|
{{/bodyParam}}
|
||||||
|
|
||||||
auth_names = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
|
auth_names = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
|
||||||
{{#returnType}}result = @api_client.call_api(:{{httpMethod}}, path,
|
status_code, headers, data = @api_client.call_api(:{{httpMethod}}, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names,
|
:auth_names => auth_names{{#returnType}},
|
||||||
:return_type => '{{{returnType}}}')
|
:return_type => '{{{returnType}}}'{{/returnType}})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: {{classname}}#{{operationId}}. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: {{classname}}#{{operationId}}\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result{{/returnType}}{{^returnType}}@api_client.call_api(:{{httpMethod}}, path,
|
return status_code, headers, data
|
||||||
:header_params => header_params,
|
|
||||||
:query_params => query_params,
|
|
||||||
:form_params => form_params,
|
|
||||||
:body => post_body,
|
|
||||||
:auth_names => auth_names)
|
|
||||||
if Configuration.debugging
|
|
||||||
Configuration.logger.debug "API called: {{classname}}#{{operationId}}"
|
|
||||||
end
|
|
||||||
return nil{{/returnType}}
|
|
||||||
end
|
end
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
end
|
end
|
||||||
|
@ -15,9 +15,6 @@ module {{moduleName}}
|
|||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
attr_accessor :default_headers
|
attr_accessor :default_headers
|
||||||
|
|
||||||
# Stores the HTTP response from the last API call using this API client.
|
|
||||||
attr_accessor :last_response
|
|
||||||
|
|
||||||
def initialize(host = nil)
|
def initialize(host = nil)
|
||||||
@host = host || Configuration.base_url
|
@host = host || Configuration.base_url
|
||||||
@format = 'json'
|
@format = 'json'
|
||||||
@ -28,13 +25,12 @@ module {{moduleName}}
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Call an API with given options and an array of 3 elements:
|
||||||
|
# response status code, response headers and the data deserialized from response body (could be nil).
|
||||||
def call_api(http_method, path, opts = {})
|
def call_api(http_method, path, opts = {})
|
||||||
request = build_request(http_method, path, opts)
|
request = build_request(http_method, path, opts)
|
||||||
response = request.run
|
response = request.run
|
||||||
|
|
||||||
# record as last response
|
|
||||||
@last_response = response
|
|
||||||
|
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
Configuration.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
||||||
end
|
end
|
||||||
@ -47,10 +43,11 @@ module {{moduleName}}
|
|||||||
end
|
end
|
||||||
|
|
||||||
if opts[:return_type]
|
if opts[:return_type]
|
||||||
deserialize(response, opts[:return_type])
|
data = deserialize(response, opts[:return_type])
|
||||||
else
|
else
|
||||||
nil
|
data = nil
|
||||||
end
|
end
|
||||||
|
return response.code, response.headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_request(http_method, path, opts = {})
|
def build_request(http_method, path, opts = {})
|
||||||
|
@ -14,6 +14,16 @@ module Petstore
|
|||||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def update_pet(opts = {})
|
def update_pet(opts = {})
|
||||||
|
update_pet_with_http_info(opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update an existing pet
|
||||||
|
#
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def update_pet_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#update_pet ..."
|
Configuration.logger.debug "Calling API: PetApi#update_pet ..."
|
||||||
end
|
end
|
||||||
@ -43,16 +53,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['petstore_auth']
|
auth_names = ['petstore_auth']
|
||||||
@api_client.call_api(:PUT, path,
|
status_code, headers, data = @api_client.call_api(:PUT, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#update_pet"
|
Configuration.logger.debug "API called: PetApi#update_pet\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add a new pet to the store
|
# Add a new pet to the store
|
||||||
@ -61,6 +71,16 @@ module Petstore
|
|||||||
# @option opts [Pet] :body Pet object that needs to be added to the store
|
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def add_pet(opts = {})
|
def add_pet(opts = {})
|
||||||
|
add_pet_with_http_info(opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add a new pet to the store
|
||||||
|
#
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [Pet] :body Pet object that needs to be added to the store
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def add_pet_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#add_pet ..."
|
Configuration.logger.debug "Calling API: PetApi#add_pet ..."
|
||||||
end
|
end
|
||||||
@ -90,16 +110,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['petstore_auth']
|
auth_names = ['petstore_auth']
|
||||||
@api_client.call_api(:POST, path,
|
status_code, headers, data = @api_client.call_api(:POST, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#add_pet"
|
Configuration.logger.debug "API called: PetApi#add_pet\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finds Pets by status
|
# Finds Pets by status
|
||||||
@ -108,6 +128,16 @@ module Petstore
|
|||||||
# @option opts [Array<String>] :status Status values that need to be considered for filter
|
# @option opts [Array<String>] :status Status values that need to be considered for filter
|
||||||
# @return [Array<Pet>]
|
# @return [Array<Pet>]
|
||||||
def find_pets_by_status(opts = {})
|
def find_pets_by_status(opts = {})
|
||||||
|
status_code, headers, data = find_pets_by_status_with_http_info(opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finds Pets by status
|
||||||
|
# Multiple status values can be provided with comma seperated strings
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [Array<String>] :status Status values that need to be considered for filter
|
||||||
|
# @return [Array<Fixnum, Hash, Array<Pet>>] response status code, response headers and Array<Pet> data
|
||||||
|
def find_pets_by_status_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#find_pets_by_status ..."
|
Configuration.logger.debug "Calling API: PetApi#find_pets_by_status ..."
|
||||||
end
|
end
|
||||||
@ -138,7 +168,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['petstore_auth']
|
auth_names = ['petstore_auth']
|
||||||
result = @api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -146,9 +176,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'Array<Pet>')
|
:return_type => 'Array<Pet>')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#find_pets_by_status. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: PetApi#find_pets_by_status\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finds Pets by tags
|
# Finds Pets by tags
|
||||||
@ -157,6 +187,16 @@ module Petstore
|
|||||||
# @option opts [Array<String>] :tags Tags to filter by
|
# @option opts [Array<String>] :tags Tags to filter by
|
||||||
# @return [Array<Pet>]
|
# @return [Array<Pet>]
|
||||||
def find_pets_by_tags(opts = {})
|
def find_pets_by_tags(opts = {})
|
||||||
|
status_code, headers, data = find_pets_by_tags_with_http_info(opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finds Pets by tags
|
||||||
|
# Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [Array<String>] :tags Tags to filter by
|
||||||
|
# @return [Array<Fixnum, Hash, Array<Pet>>] response status code, response headers and Array<Pet> data
|
||||||
|
def find_pets_by_tags_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#find_pets_by_tags ..."
|
Configuration.logger.debug "Calling API: PetApi#find_pets_by_tags ..."
|
||||||
end
|
end
|
||||||
@ -187,7 +227,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['petstore_auth']
|
auth_names = ['petstore_auth']
|
||||||
result = @api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -195,9 +235,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'Array<Pet>')
|
:return_type => 'Array<Pet>')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#find_pets_by_tags. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: PetApi#find_pets_by_tags\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find pet by ID
|
# Find pet by ID
|
||||||
@ -206,6 +246,16 @@ module Petstore
|
|||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [Pet]
|
# @return [Pet]
|
||||||
def get_pet_by_id(pet_id, opts = {})
|
def get_pet_by_id(pet_id, opts = {})
|
||||||
|
status_code, headers, data = get_pet_by_id_with_http_info(pet_id, opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Find pet by ID
|
||||||
|
# Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
|
# @param pet_id ID of pet that needs to be fetched
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @return [Array<Fixnum, Hash, Pet>] response status code, response headers and Pet data
|
||||||
|
def get_pet_by_id_with_http_info(pet_id, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#get_pet_by_id ..."
|
Configuration.logger.debug "Calling API: PetApi#get_pet_by_id ..."
|
||||||
end
|
end
|
||||||
@ -238,7 +288,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['api_key']
|
auth_names = ['api_key']
|
||||||
result = @api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -246,9 +296,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'Pet')
|
:return_type => 'Pet')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#get_pet_by_id. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: PetApi#get_pet_by_id\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updates a pet in the store with form data
|
# Updates a pet in the store with form data
|
||||||
@ -259,6 +309,18 @@ module Petstore
|
|||||||
# @option opts [String] :status Updated status of the pet
|
# @option opts [String] :status Updated status of the pet
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def update_pet_with_form(pet_id, opts = {})
|
def update_pet_with_form(pet_id, opts = {})
|
||||||
|
update_pet_with_form_with_http_info(pet_id, opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates a pet in the store with form data
|
||||||
|
#
|
||||||
|
# @param pet_id 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<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def update_pet_with_form_with_http_info(pet_id, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#update_pet_with_form ..."
|
Configuration.logger.debug "Calling API: PetApi#update_pet_with_form ..."
|
||||||
end
|
end
|
||||||
@ -293,16 +355,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['petstore_auth']
|
auth_names = ['petstore_auth']
|
||||||
@api_client.call_api(:POST, path,
|
status_code, headers, data = @api_client.call_api(:POST, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#update_pet_with_form"
|
Configuration.logger.debug "API called: PetApi#update_pet_with_form\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Deletes a pet
|
# Deletes a pet
|
||||||
@ -312,6 +374,17 @@ module Petstore
|
|||||||
# @option opts [String] :api_key
|
# @option opts [String] :api_key
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def delete_pet(pet_id, opts = {})
|
def delete_pet(pet_id, opts = {})
|
||||||
|
delete_pet_with_http_info(pet_id, opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deletes a pet
|
||||||
|
#
|
||||||
|
# @param pet_id Pet id to delete
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [String] :api_key
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def delete_pet_with_http_info(pet_id, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#delete_pet ..."
|
Configuration.logger.debug "Calling API: PetApi#delete_pet ..."
|
||||||
end
|
end
|
||||||
@ -345,16 +418,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['petstore_auth']
|
auth_names = ['petstore_auth']
|
||||||
@api_client.call_api(:DELETE, path,
|
status_code, headers, data = @api_client.call_api(:DELETE, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#delete_pet"
|
Configuration.logger.debug "API called: PetApi#delete_pet\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# uploads an image
|
# uploads an image
|
||||||
@ -365,6 +438,18 @@ module Petstore
|
|||||||
# @option opts [File] :file file to upload
|
# @option opts [File] :file file to upload
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def upload_file(pet_id, opts = {})
|
def upload_file(pet_id, opts = {})
|
||||||
|
upload_file_with_http_info(pet_id, opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# uploads an image
|
||||||
|
#
|
||||||
|
# @param pet_id 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<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def upload_file_with_http_info(pet_id, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: PetApi#upload_file ..."
|
Configuration.logger.debug "Calling API: PetApi#upload_file ..."
|
||||||
end
|
end
|
||||||
@ -399,16 +484,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['petstore_auth']
|
auth_names = ['petstore_auth']
|
||||||
@api_client.call_api(:POST, path,
|
status_code, headers, data = @api_client.call_api(:POST, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: PetApi#upload_file"
|
Configuration.logger.debug "API called: PetApi#upload_file\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -13,6 +13,15 @@ module Petstore
|
|||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [Hash<String, Integer>]
|
# @return [Hash<String, Integer>]
|
||||||
def get_inventory(opts = {})
|
def get_inventory(opts = {})
|
||||||
|
status_code, headers, data = get_inventory_with_http_info(opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns pet inventories by status
|
||||||
|
# Returns a map of status codes to quantities
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @return [Array<Fixnum, Hash, Hash<String, Integer>>] response status code, response headers and Hash<String, Integer> data
|
||||||
|
def get_inventory_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: StoreApi#get_inventory ..."
|
Configuration.logger.debug "Calling API: StoreApi#get_inventory ..."
|
||||||
end
|
end
|
||||||
@ -42,7 +51,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = ['api_key']
|
auth_names = ['api_key']
|
||||||
result = @api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -50,9 +59,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'Hash<String, Integer>')
|
:return_type => 'Hash<String, Integer>')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: StoreApi#get_inventory. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: StoreApi#get_inventory\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Place an order for a pet
|
# Place an order for a pet
|
||||||
@ -61,6 +70,16 @@ module Petstore
|
|||||||
# @option opts [Order] :body order placed for purchasing the pet
|
# @option opts [Order] :body order placed for purchasing the pet
|
||||||
# @return [Order]
|
# @return [Order]
|
||||||
def place_order(opts = {})
|
def place_order(opts = {})
|
||||||
|
status_code, headers, data = place_order_with_http_info(opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Place an order for a pet
|
||||||
|
#
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [Order] :body order placed for purchasing the pet
|
||||||
|
# @return [Array<Fixnum, Hash, Order>] response status code, response headers and Order data
|
||||||
|
def place_order_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: StoreApi#place_order ..."
|
Configuration.logger.debug "Calling API: StoreApi#place_order ..."
|
||||||
end
|
end
|
||||||
@ -90,7 +109,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
result = @api_client.call_api(:POST, path,
|
status_code, headers, data = @api_client.call_api(:POST, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -98,9 +117,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'Order')
|
:return_type => 'Order')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: StoreApi#place_order. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: StoreApi#place_order\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find purchase order by ID
|
# Find purchase order by ID
|
||||||
@ -109,6 +128,16 @@ module Petstore
|
|||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [Order]
|
# @return [Order]
|
||||||
def get_order_by_id(order_id, opts = {})
|
def get_order_by_id(order_id, opts = {})
|
||||||
|
status_code, headers, data = get_order_by_id_with_http_info(order_id, opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Find purchase order by ID
|
||||||
|
# For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
# @param order_id ID of pet that needs to be fetched
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @return [Array<Fixnum, Hash, Order>] response status code, response headers and Order data
|
||||||
|
def get_order_by_id_with_http_info(order_id, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: StoreApi#get_order_by_id ..."
|
Configuration.logger.debug "Calling API: StoreApi#get_order_by_id ..."
|
||||||
end
|
end
|
||||||
@ -141,7 +170,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
result = @api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -149,9 +178,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'Order')
|
:return_type => 'Order')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: StoreApi#get_order_by_id. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: StoreApi#get_order_by_id\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Delete purchase order by ID
|
# Delete purchase order by ID
|
||||||
@ -160,6 +189,16 @@ module Petstore
|
|||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def delete_order(order_id, opts = {})
|
def delete_order(order_id, opts = {})
|
||||||
|
delete_order_with_http_info(order_id, opts)
|
||||||
|
return nil
|
||||||
|
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 [Hash] opts the optional parameters
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def delete_order_with_http_info(order_id, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: StoreApi#delete_order ..."
|
Configuration.logger.debug "Calling API: StoreApi#delete_order ..."
|
||||||
end
|
end
|
||||||
@ -192,16 +231,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
@api_client.call_api(:DELETE, path,
|
status_code, headers, data = @api_client.call_api(:DELETE, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: StoreApi#delete_order"
|
Configuration.logger.debug "API called: StoreApi#delete_order\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -14,6 +14,16 @@ module Petstore
|
|||||||
# @option opts [User] :body Created user object
|
# @option opts [User] :body Created user object
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def create_user(opts = {})
|
def create_user(opts = {})
|
||||||
|
create_user_with_http_info(opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create user
|
||||||
|
# This can only be done by the logged in user.
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [User] :body Created user object
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def create_user_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#create_user ..."
|
Configuration.logger.debug "Calling API: UserApi#create_user ..."
|
||||||
end
|
end
|
||||||
@ -43,16 +53,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
@api_client.call_api(:POST, path,
|
status_code, headers, data = @api_client.call_api(:POST, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#create_user"
|
Configuration.logger.debug "API called: UserApi#create_user\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
@ -61,6 +71,16 @@ module Petstore
|
|||||||
# @option opts [Array<User>] :body List of user object
|
# @option opts [Array<User>] :body List of user object
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def create_users_with_array_input(opts = {})
|
def create_users_with_array_input(opts = {})
|
||||||
|
create_users_with_array_input_with_http_info(opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates list of users with given input array
|
||||||
|
#
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [Array<User>] :body List of user object
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def create_users_with_array_input_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#create_users_with_array_input ..."
|
Configuration.logger.debug "Calling API: UserApi#create_users_with_array_input ..."
|
||||||
end
|
end
|
||||||
@ -90,16 +110,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
@api_client.call_api(:POST, path,
|
status_code, headers, data = @api_client.call_api(:POST, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#create_users_with_array_input"
|
Configuration.logger.debug "API called: UserApi#create_users_with_array_input\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
@ -108,6 +128,16 @@ module Petstore
|
|||||||
# @option opts [Array<User>] :body List of user object
|
# @option opts [Array<User>] :body List of user object
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def create_users_with_list_input(opts = {})
|
def create_users_with_list_input(opts = {})
|
||||||
|
create_users_with_list_input_with_http_info(opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates list of users with given input array
|
||||||
|
#
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [Array<User>] :body List of user object
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def create_users_with_list_input_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#create_users_with_list_input ..."
|
Configuration.logger.debug "Calling API: UserApi#create_users_with_list_input ..."
|
||||||
end
|
end
|
||||||
@ -137,16 +167,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
@api_client.call_api(:POST, path,
|
status_code, headers, data = @api_client.call_api(:POST, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#create_users_with_list_input"
|
Configuration.logger.debug "API called: UserApi#create_users_with_list_input\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Logs user into the system
|
# Logs user into the system
|
||||||
@ -156,6 +186,17 @@ module Petstore
|
|||||||
# @option opts [String] :password The password for login in clear text
|
# @option opts [String] :password The password for login in clear text
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def login_user(opts = {})
|
def login_user(opts = {})
|
||||||
|
status_code, headers, data = login_user_with_http_info(opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Logs user into the system
|
||||||
|
#
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [String] :username The user name for login
|
||||||
|
# @option opts [String] :password The password for login in clear text
|
||||||
|
# @return [Array<Fixnum, Hash, String>] response status code, response headers and String data
|
||||||
|
def login_user_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#login_user ..."
|
Configuration.logger.debug "Calling API: UserApi#login_user ..."
|
||||||
end
|
end
|
||||||
@ -187,7 +228,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
result = @api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -195,9 +236,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'String')
|
:return_type => 'String')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#login_user. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: UserApi#login_user\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Logs out current logged in user session
|
# Logs out current logged in user session
|
||||||
@ -205,6 +246,15 @@ module Petstore
|
|||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def logout_user(opts = {})
|
def logout_user(opts = {})
|
||||||
|
logout_user_with_http_info(opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Logs out current logged in user session
|
||||||
|
#
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def logout_user_with_http_info(opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#logout_user ..."
|
Configuration.logger.debug "Calling API: UserApi#logout_user ..."
|
||||||
end
|
end
|
||||||
@ -234,16 +284,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
@api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#logout_user"
|
Configuration.logger.debug "API called: UserApi#logout_user\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get user by user name
|
# Get user by user name
|
||||||
@ -252,6 +302,16 @@ module Petstore
|
|||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [User]
|
# @return [User]
|
||||||
def get_user_by_name(username, opts = {})
|
def get_user_by_name(username, opts = {})
|
||||||
|
status_code, headers, data = get_user_by_name_with_http_info(username, opts)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get user by user name
|
||||||
|
#
|
||||||
|
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @return [Array<Fixnum, Hash, User>] response status code, response headers and User data
|
||||||
|
def get_user_by_name_with_http_info(username, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#get_user_by_name ..."
|
Configuration.logger.debug "Calling API: UserApi#get_user_by_name ..."
|
||||||
end
|
end
|
||||||
@ -284,7 +344,7 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
result = @api_client.call_api(:GET, path,
|
status_code, headers, data = @api_client.call_api(:GET, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
@ -292,9 +352,9 @@ module Petstore
|
|||||||
:auth_names => auth_names,
|
:auth_names => auth_names,
|
||||||
:return_type => 'User')
|
:return_type => 'User')
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#get_user_by_name. Result: #{result.inspect}"
|
Configuration.logger.debug "API called: UserApi#get_user_by_name\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return result
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updated user
|
# Updated user
|
||||||
@ -304,6 +364,17 @@ module Petstore
|
|||||||
# @option opts [User] :body Updated user object
|
# @option opts [User] :body Updated user object
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def update_user(username, opts = {})
|
def update_user(username, opts = {})
|
||||||
|
update_user_with_http_info(username, opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updated user
|
||||||
|
# This can only be done by the logged in user.
|
||||||
|
# @param username name that need to be deleted
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @option opts [User] :body Updated user object
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def update_user_with_http_info(username, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#update_user ..."
|
Configuration.logger.debug "Calling API: UserApi#update_user ..."
|
||||||
end
|
end
|
||||||
@ -336,16 +407,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
@api_client.call_api(:PUT, path,
|
status_code, headers, data = @api_client.call_api(:PUT, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#update_user"
|
Configuration.logger.debug "API called: UserApi#update_user\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
# Delete user
|
# Delete user
|
||||||
@ -354,6 +425,16 @@ module Petstore
|
|||||||
# @param [Hash] opts the optional parameters
|
# @param [Hash] opts the optional parameters
|
||||||
# @return [nil]
|
# @return [nil]
|
||||||
def delete_user(username, opts = {})
|
def delete_user(username, opts = {})
|
||||||
|
delete_user_with_http_info(username, opts)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# Delete user
|
||||||
|
# This can only be done by the logged in user.
|
||||||
|
# @param username The name that needs to be deleted
|
||||||
|
# @param [Hash] opts the optional parameters
|
||||||
|
# @return [Array<Fixnum, Hash, nil>] response status code, response headers and nil
|
||||||
|
def delete_user_with_http_info(username, opts = {})
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "Calling API: UserApi#delete_user ..."
|
Configuration.logger.debug "Calling API: UserApi#delete_user ..."
|
||||||
end
|
end
|
||||||
@ -386,16 +467,16 @@ module Petstore
|
|||||||
|
|
||||||
|
|
||||||
auth_names = []
|
auth_names = []
|
||||||
@api_client.call_api(:DELETE, path,
|
status_code, headers, data = @api_client.call_api(:DELETE, path,
|
||||||
:header_params => header_params,
|
:header_params => header_params,
|
||||||
:query_params => query_params,
|
:query_params => query_params,
|
||||||
:form_params => form_params,
|
:form_params => form_params,
|
||||||
:body => post_body,
|
:body => post_body,
|
||||||
:auth_names => auth_names)
|
:auth_names => auth_names)
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "API called: UserApi#delete_user"
|
Configuration.logger.debug "API called: UserApi#delete_user\nStatus code: #{status_code}\nHeaders: #{headers}\nData: #{data.inspect}"
|
||||||
end
|
end
|
||||||
return nil
|
return status_code, headers, data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -15,9 +15,6 @@ module Petstore
|
|||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
attr_accessor :default_headers
|
attr_accessor :default_headers
|
||||||
|
|
||||||
# Stores the HTTP response from the last API call using this API client.
|
|
||||||
attr_accessor :last_response
|
|
||||||
|
|
||||||
def initialize(host = nil)
|
def initialize(host = nil)
|
||||||
@host = host || Configuration.base_url
|
@host = host || Configuration.base_url
|
||||||
@format = 'json'
|
@format = 'json'
|
||||||
@ -28,13 +25,12 @@ module Petstore
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Call an API with given options and an array of 3 elements:
|
||||||
|
# response status code, response headers and the data deserialized from response body (could be nil).
|
||||||
def call_api(http_method, path, opts = {})
|
def call_api(http_method, path, opts = {})
|
||||||
request = build_request(http_method, path, opts)
|
request = build_request(http_method, path, opts)
|
||||||
response = request.run
|
response = request.run
|
||||||
|
|
||||||
# record as last response
|
|
||||||
@last_response = response
|
|
||||||
|
|
||||||
if Configuration.debugging
|
if Configuration.debugging
|
||||||
Configuration.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
Configuration.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
|
||||||
end
|
end
|
||||||
@ -47,10 +43,11 @@ module Petstore
|
|||||||
end
|
end
|
||||||
|
|
||||||
if opts[:return_type]
|
if opts[:return_type]
|
||||||
deserialize(response, opts[:return_type])
|
data = deserialize(response, opts[:return_type])
|
||||||
else
|
else
|
||||||
nil
|
data = nil
|
||||||
end
|
end
|
||||||
|
return response.code, response.headers, data
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_request(http_method, path, opts = {})
|
def build_request(http_method, path, opts = {})
|
||||||
|
@ -50,6 +50,17 @@ describe "Pet" do
|
|||||||
pet.category.name.should == "category test"
|
pet.category.name.should == "category test"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should fetch a pet object with http info" do
|
||||||
|
status_code, headers, pet = @pet_api.get_pet_by_id_with_http_info(10002)
|
||||||
|
status_code.should == 200
|
||||||
|
headers['Content-Type'].should == 'application/json'
|
||||||
|
pet.should be_a(Petstore::Pet)
|
||||||
|
pet.id.should == 10002
|
||||||
|
pet.name.should == "RUBY UNIT TESTING"
|
||||||
|
pet.tags[0].name.should == "tag test"
|
||||||
|
pet.category.name.should == "category test"
|
||||||
|
end
|
||||||
|
|
||||||
it "should not find a pet that does not exist" do
|
it "should not find a pet that does not exist" do
|
||||||
begin
|
begin
|
||||||
@pet_api.get_pet_by_id(-10002)
|
@pet_api.get_pet_by_id(-10002)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user