-
Notifications
You must be signed in to change notification settings - Fork 86
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
updated API Blueprint with stripecard #386
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below are some questions and some suggested changes.
Did you try previewing the generated API Blueprint (at localhost:8081
? I'm guessing it didn't render correctly due to syntax errors.
@@ -1533,7 +1533,6 @@ This resource identifies a relationship between a User and a Skill. For example, | |||
+ Attributes (Record Not Found Response) | |||
|
|||
# Group Users | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like accidental removal of this line.
@@ -1690,6 +1689,50 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
|
|||
+ Attributes (Unprocessable Entity Response) | |||
|
|||
#StripeCard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have a space between #
and StripeCard
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it looks like this breaks the alpha ordering convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to prefix with Group
.
@@ -1690,6 +1689,50 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
|
|||
+ Attributes (Unprocessable Entity Response) | |||
|
|||
#StripeCard | |||
|
|||
This resource identifies the relationship between a StripeCustomer and a StripeCard. A StripeCustomer has many StripeCards and StripeCard belongs to a StripeCustomer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't call this a relationship. This on its own is a resource.
|
||
This resource identifies the relationship between a StripeCustomer and a StripeCard. A StripeCustomer has many StripeCards and StripeCard belongs to a StripeCustomer. | ||
|
||
## StripeCards [/stripe_cards] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be dasherized.
+ Parameters | ||
|
||
+ id (number) - Id of StripeCard. | ||
+stripe_customer_id(number) - ID of StripeCustomer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the stripe_customer_id
to make a request to this endpoint.
|
||
+ Response 404 (application/vnd.api+json; charset=utf-8) | ||
|
||
+ Attributes (Record Not Found Response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add in the 401
and 403
response since we know that this is authenticated and authorized.
##StripeCards (object) | ||
+ data(StripeCards Resource) | ||
+ include JSON API Version | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the StripeCard Resource
defined?
+ include JSON API Version | ||
|
||
##StripeCards (object) | ||
+ data(StripeCards Resource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need a StripeCard Response
and a StripeCards Response
. Look at Categories
as an example here.
|
||
+ Response 200 (application/vnd.api+json; charset=utf-8) | ||
|
||
+ Attributes (StripeCards Response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is StripeCards Response
defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these changes should be implemented inside of this PR.
Other comments, though, are simply suggestions for refactorings that could be placed in future issue(s).
|
||
## Stripe Cards [/stripe-cards] | ||
|
||
### List all Stripe Cards [GET] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would change Cards
to cards
here.
|
||
## Stripe Card [/stripe-cards/{id}] | ||
|
||
### Retrieve a Stripe Card [GET] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also would change to lowercase card
.
|
||
+ Parameters | ||
|
||
+ id (number) - Id of a Stripe card. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we're inconsistent in other endpoints about whether or not we have an id
parameter on GET
requests for the show
actions. I'm not sure if we should open another issue for this, but we might want to consider it to make everything consistent across our entire documentation.
|
||
+ Response 403 (application/vnd.api+json; charset=utf-8) | ||
|
||
+ Attributes (Forbidden Response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to consider opening an issue about the security implications of returning a 401
or 403
vs just a 404
to say that the object doesn't exist, so people don't sneak around trying to find extra information about cards in our API somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an issue for this: #392
I wasn't sure how to reference this comment specifically.
+ `pass` | ||
+ `fail` | ||
+ `unavailable` | ||
+ `unchecked` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there's no default value here. Not sure we should specify, but I guess if we don't the assumption should be that there is no default.
+ `unavailable` | ||
+ `unchecked` | ||
+ exp_month: `12` (number) | ||
+ exp_year: `2017` (number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an integer
in #377 inside the database schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't think this value needs backticks around it if it's just an integer. Not sure, but we should check some of the other examples.
+ attributes(Stripe Card Attributes) | ||
+ relationships(Stripe Card Relationships) | ||
+ `project-categories` | ||
+ data(array[Project Category Resource Identifier]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely missed this project-categories
inside of here.
|
||
## Stripe Customer Resource Identifier (object) | ||
+ id: `1` (string, required) | ||
+ type: `stripe-customer` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's some inconsistency across our responses here. id
and type
should both be required.
Given some of the inconsistencies we're identifying here that stem from this blueprint not being significantly refactored after the changeover from Rails, I think we should open a parent journey issue that contains all of these suggestions for refactoring/fixes. Then we can break off into individual issues where needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added issue for this: #393
743147d
to
6cdf336
Compare
Ignore coveralls here. I don't know why it's saying test coverage went down. Nonsense. |
I haven't checked if this renders. Does this still render correctly for you? Good work! 🎉 |
Before you can merge, you'll need to rebase and squash your commits into one. Your reworded commit message should probably read something like:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed something I'd missed here previously.
+ exp_year: 2017 (number) | ||
+ id_from_stripe: `card_18Emd52eZvKYlo2C1s9DYdv8` (required, string) | ||
+ last4: `4242` (string) | ||
+ name: `John Doe` (string) - Cardholder name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is missing inserted-at
and updated-at
timestamps, which actually all objects in our database will have.
It was rendering earlier when i tried to push it, but won't anymore - I think it might be because of the stripe auth stuff that was added when we rebased? |
@@ -2293,6 +2293,8 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
+ id_from_stripe: `card_18Emd52eZvKYlo2C1s9DYdv8` (required, string) | |||
+ last4: `4242` (string) | |||
+ name: `John Doe` (string) - Cardholder name | |||
+ `inserted-at`: `2014-07-07T18:01:26.000Z` (string) | |||
+ `updated-at`: `2014-07-07T18:01:26.000Z` (string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch the alpha ordering here.
@@ -1961,7 +2021,6 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
## Preview Resource Identifier (object) | |||
+ id: `1` (string, required) | |||
+ type: `preview` (string, required) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like accidental deletion here
@@ -2209,6 +2268,59 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
+ data(Stripe Auth Resource) | |||
+ include JSON API Version | |||
|
|||
## StripeCard (object) | |||
+ data(StripeCard Resource) | |||
+ include JSON API Version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is why rendering is failing. Probably should be Stripe Card
and not StripeCard
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, no. This shouldn't even exist. Not sure what this is doing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still why it's failing. Trying to hit a StripeCard Resource
that doesn't exist.
+ `unchecked` | ||
+ exp_month: 12 (number) | ||
+ exp_year: 2017 (number) | ||
+ id_from_stripe: `card_18Emd52eZvKYlo2C1s9DYdv8` (required, string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think these attributes should be dasherized, and surrounded by ` marks.
|
||
This resource identifies a card created on the [Stripe API](https://stripe.com/docs/api#cards). | ||
|
||
A Stripe card belongs to a Stripe customer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we changed this now in our system to say that it belongs to a user. Belonging to a customer (for us) is some unnecessary complexity.
Squash and rebase. |
23848c7
to
ab53c82
Compare
@@ -2511,6 +2571,59 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
+ data(array[Stripe Plan Resource], required) | |||
+ include JSON API Version | |||
|
|||
## Stripe Card (object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to put these above Stripe plans.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it not showing up in alpha order from the most recent commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It didn't show up for me randomly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, a couple notes here.
@@ -2714,6 +2714,8 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
+ data(array[User Role Resource Identifier]) | |||
+ `user-skills` (object) | |||
+ data(array[User Skill Resource Identifier]) | |||
+ `stripe-cards` (object) | |||
+ data(array[Stripe Card Resource Identifier]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch alpha order here.
@@ -2624,6 +2597,33 @@ This endpoint allows you to check whether a username is valid (by running a vali | |||
+ id: `1` (string, required) | |||
+ type: `stripe-customer` | |||
|
|||
## Stripe Plan Attributes (object) | |||
+ amount: 999 (number) - Describes the amount of a plan in cents. | |||
+ created: `2016-07-08T03:03:51.967Z` (string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write that this is the created
time from Stripe. Did we do this in #383?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From 383:
+ *
created- A timestamp, indicating when the plan was created by Stripe
I'll add the comment into this also.
Didn't mean to approve that one. It should have been requested changes. |
And that one comment should not be showing as outdated, so make sure you expand that. |
@amyschools looks great, go ahead and squash again! |
cf91a38
to
c4204c0
Compare
Closes #385
Added endpoint and data structures for StripeCard.