Skip to content

Instantly share code, notes, and snippets.

@JustSilverman
Created June 24, 2016 22:24
Show Gist options
  • Save JustSilverman/d9704f9fe8c5c78394b801e71a6f8a66 to your computer and use it in GitHub Desktop.
Save JustSilverman/d9704f9fe8c5c78394b801e71a6f8a66 to your computer and use it in GitHub Desktop.
def create_pets_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: PetsApi.create_pets ..."
end
# resource path
local_var_path = "/pets".sub('{format}','json')
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
local_header_accept = ['application/json']
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
# HTTP header 'Content-Type'
local_header_content_type = ['application/json']
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
# form parameters
form_params = {}
form_params["isDog"] = opts[:'is_dog'] if opts[:'is_dog']
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: PetsApi#create_pets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"license": {
"name": "MIT"
}
},
"host": "petstore.swagger.io",
"basePath": "/v1",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/pets": {
"post": {
"summary": "Create a pet",
"operationId": "createPets",
"tags": [
"pets"
],
"parameters": [
{
"name": "isDog",
"in": "formData",
"required": false,
"type": "boolean"
}
],
"responses": {
"201": {
"description": "Null response"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment