Skip to content

Instantly share code, notes, and snippets.

@zmalltalker
Created November 14, 2016 14:10
Show Gist options
  • Save zmalltalker/c463f66759b1c0fd4997e623479ce529 to your computer and use it in GitHub Desktop.
Save zmalltalker/c463f66759b1c0fd4997e623479ce529 to your computer and use it in GitHub Desktop.
class FooController < ApplicationController
create_endpoint = swagger_method :create do |create|
create.summary "List all the Foos"
create.header :auth, :"X-AUTH-TOKEN", :required
create.param :new_foo, {name: String, address: {zip: String, city: String}}
end
def index
query = create_endpoint.parse(request)
auth_header = query.header[:auth]
body = query.param[:new_foo]
if body.valid?
name = body.name
city = body.address.city
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment