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

add api v1 actors gate endpoint #181

Merged
merged 1 commit into from
Oct 29, 2016
Merged

add api v1 actors gate endpoint #181

merged 1 commit into from
Oct 29, 2016

Conversation

AlexWheeler
Copy link
Collaborator

@AlexWheeler AlexWheeler commented Oct 28, 2016

completes #169

  • POST / DELETE to enable disable with 'flipper_id' parameter
  • adds specs
  • adds Fliper::Api::Actor shim just like UI

Returns error if flipper_id parameter is missing or nil. Flipper allows enabling an actor with a nil flipper_id, and I thought about allowing this and only rendering error on missing flipper_id parameter, but the more I think about it I don't think its ideal for a user to do this. A flipper id should ideally be unique. It opens the door for accidentally enabling a feature for anything with a nil flipper_id and users wanting to do this are better off using the group gate right? Let me know your thoughts

Figured its easier to review small PRs so will update invalid error responses to 422, or can do it in this PR as a separate commit if you'd like

@jnunemaker
Copy link
Collaborator

I don't think its ideal for a user to do this

Agreed. We should probably plug that in flipper as well if it does actually allow that. It was not intentional.

Figured its easier to review small PRs so will update invalid error responses to 422, or can do it in this PR as a separate commit if you'd like

Sounds good to me. I'll look this over now quick.

Copy link
Collaborator

@jnunemaker jnunemaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Merge away! Left one question, but minor. I don't care either way just a suggestion.

@@ -24,6 +24,7 @@ def as_json
feature_not_found: Error.new(1, "Feature not found.", "", 404),
group_not_registered: Error.new(2, "Group not registered.", "", 404),
percentage_invalid: Error.new(3, "Percentage must be a positive number less than or equal to 100.", "", 400),
flipper_id_invalid: Error.new(4, "Required parameter flipper_id cannot be nil.", "", 400),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about "Required parameter flipper_id is missing."? I'm not sure that we need to mention nil.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I've gone back and forth on this. I was thinking that saying its missing sounds like the key is missing, but definitely see how nil doesn't really translate to JSON. I like your suggestion as it being missing could also be interpreted as the key or value is missing. Will update thanks!

* POST / DELETE to enable disable with 'flipper_id' parameter
* adds specs
@AlexWheeler AlexWheeler merged commit f7809de into master Oct 29, 2016
@AlexWheeler AlexWheeler deleted the api-v1-actors-gate branch October 29, 2016 14:11
@jnunemaker jnunemaker added api and removed api labels Dec 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants