Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Customization possible? #121

Closed
bkimble opened this issue May 7, 2013 · 2 comments
Closed

Additional Customization possible? #121

bkimble opened this issue May 7, 2013 · 2 comments

Comments

@bkimble
Copy link

bkimble commented May 7, 2013

I'm still continuing to look at all of the functionality of apipie, but I think it will be the doc library that we wind up using. I am wondering if you have any suggestions for the following, though.

  1. Is it possible to configure the controller that apipie uses, and have it extend the base one, so you can add your own custom code to the mix?
  2. if not, s it possible to pass your own filters to the existing controller/
  3. If either of these are not� possible, is it possible to add authentication to the apipie doc directory? Basic http auth mostly. We don't want our doc exposed to the world.
  4. Is it possible to alter the templates without unpacking the gem and altering them in the code base? Perhaps an option to point to the views that it uses. I like the default views, with the exception of the 'examples' part. I like that block to be at the bottom of every page as it is usually the longest.
  5. How do you suggest tracking "what changed with this API call from previous versions" ? I was going to put the changes in the descrption, but do you think it makes more sense to add a method called "changes" to ApiPie, that way an entire changelog could be generated from 1 version to the other?

If none of this is possible and you think they are good features, let me know how you think it should be designed and implemented, and I will try to get to it myself. Thanks again!

@iNecas
Copy link
Member

iNecas commented May 10, 2013

Hi,

For extedning the controller, you should be able to do something like this somewhere in initializers of your app

module MyMixin

  def self.included(base)
     base.before_filter(:authenticate)
  end

  def authenticate
      # your custom code goes here
   end
end

Apipie::ApipiesController.send(:include, MyMixin)

To override some views, copy them (just those ones you want to alter) to your app app/views/apipy/apipies dir, when rendering, a view from this one should take precedence over the original one.

The 5. point is a good suggestion. Maybe diffing the json output for different versions is a good start to see what changed. It would be nice if Apipie was able to preproces that. We will need it at some point as well.

Did that answer your guestions?

@bkimble
Copy link
Author

bkimble commented May 10, 2013

Yep this is perfect! I'll look in to writing a patch for a 'changes' directive to see what you think about it. It would benefit us greatly as we won't have to maintain an external document saying what has changed in between REST api versions :)

@bkimble bkimble closed this as completed May 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants