Skip to content

Instantly share code, notes, and snippets.

@dbarrionuevo
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbarrionuevo/79c9350532d08f6449bc to your computer and use it in GitHub Desktop.
Save dbarrionuevo/79c9350532d08f6449bc to your computer and use it in GitHub Desktop.
Apipie.configure do |config|
reload_controllers = Rails.env.development?
end
class API::V1::PressController < API::V1::BaseController
# All Doc code here
include PressDoc
def index
respond_with Press.all
end
#... NO DOC CODE HERE
end
module PressDoc
extend ActiveSupport::Concern
api :GET, '/press', "List Press"
example_json FactoryGirl.build_list(:press, 2).map{
|a| a.attributes.except("created_at", "updated_at").merge("id" => 1 + rand(1000))
}
def index; end # Define an empty action, to let apipie know where to associate the documentation
api :GET, '/press/:id', "Show a Press"
param :id, Integer, required: true
example_json FactoryGirl.build(:press).attributes.merge(
"id" => 1, "created_at" => Time.current, "updated_at" => Time.current
)
def show; end
# etc..
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment