Skip to content

Allow callables for hidden setting #214

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

Merged
merged 1 commit into from
Feb 12, 2015

Conversation

zbelzer
Copy link
Contributor

@zbelzer zbelzer commented Feb 11, 2015

I would like to expose a different set of API features per client, so having the documentation conditionally hidden is very useful to me.

Not sure if there's a more compact way to say the same thing.

Also, RubyCop is complaining because I added three lines. Is this configured limitation or am I just so lucky that we were at the exact boundary before?

@dblock
Copy link
Member

dblock commented Feb 11, 2015

For rubocop run rubocop --auto-gen-config.

@dblock
Copy link
Member

dblock commented Feb 11, 2015

Squash your commits please?

@zbelzer zbelzer force-pushed the allow_lambdas_for_hidden branch 2 times, most recently from 1736cf3 to 45c21db Compare February 12, 2015 16:20
@zbelzer
Copy link
Contributor Author

zbelzer commented Feb 12, 2015

Squashed. Rubocop updated and it looks like travis is happy.

@dblock
Copy link
Member

dblock commented Feb 12, 2015

We should probably also document this in README, what do you think?

@zbelzer zbelzer force-pushed the allow_lambdas_for_hidden branch from 45c21db to 6f67a29 Compare February 12, 2015 17:59
@zbelzer
Copy link
Contributor Author

zbelzer commented Feb 12, 2015

Docs added.

dblock added a commit that referenced this pull request Feb 12, 2015
@dblock dblock merged commit 46ac11e into ruby-grape:master Feb 12, 2015
@dblock
Copy link
Member

dblock commented Feb 12, 2015

Merged, thank you.

@zbelzer zbelzer deleted the allow_lambdas_for_hidden branch February 12, 2015 21:34
@swistaczek
Copy link
Contributor

👍

@synth
Copy link

synth commented Feb 27, 2016

Is there way to show/hide endpoints based on oauth scope of current token used when rendering endpoints? Eg I have an OAuth2 scope called "trusted" and I would only like to show "trusted" endpoints when a user has entered a token that has that scope.

@zbelzer
Copy link
Contributor Author

zbelzer commented Feb 29, 2016

I would imagine you just need to pass contextual information to call in each location. Not sure where whatever information you are using is kept, but you can figure out if it's available by putting in a breakpoint before route.route_hidden.respond_to?(:call) ? route.route_hidden.call : route.route_hidden

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

Successfully merging this pull request may close these issues.

4 participants